Re: [PATCH v2 09/11] s390: mm: Convert to GENERIC_IOREMAP

From: Baoquan He
Date: Wed Aug 31 2022 - 05:00:17 EST


On 08/22/22 at 05:08pm, Niklas Schnelle wrote:
> On Sun, 2022-08-21 at 00:05 -0700, Christoph Hellwig wrote:
> > > +void __iomem *
> > > +arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val)
> > > {
> > > if (!static_branch_unlikely(&have_mio))
> > > + return (void __iomem *) *paddr;
> > > + return NULL;
> >
> > This logic isn't new in the patch, but it could really use a comment
> > as it is rather non-obvious.
>
> Yes, makes sense. Basically we fake MMIO addresses because the s390
> architecture doesn't have MMIO as a concept. That is until the PCI MIO
> instructions introduced pseudo-MMIO though only for specific PCI
> load/store instructions. Without those PCI BAR spaces as well as config
> space is accessed with so called function handles. As these are a bad
> fit for Linux' MMIO based APIs we create fake MMIO addresses (called
> address cookies) that encode an index into the zpci_iomap_start[] which
> can be decoded by our implementation of ioread*/iowrite*().
>
> I don't think this is the right place to describe this overall scheme
> in detail but maybe we can leave a a good bread crumb. Maybe something
> like below?
>
> /*
> * When PCI MIO instructions are unavailable the "physical" address encodes
> * a hint for accessing the PCI memory space it represents. Just pass it
> * unchanged such that ioread/iowrite can decode it.
> */

Thanks. Looks good to me, I will add these to above the code.

>