[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a381b32861b106afb209628e094260caf5fe9f7b.camel@linux.ibm.com>
Date: Mon, 22 Aug 2022 17:08:10 +0200
From: Niklas Schnelle <schnelle@...ux.ibm.com>
To: Christoph Hellwig <hch@...radead.org>, Baoquan He <bhe@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
akpm@...ux-foundation.org, agordeev@...ux.ibm.com,
wangkefeng.wang@...wei.com, linux-arm-kernel@...ts.infradead.org,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>, linux-s390@...r.kernel.org
Subject: Re: [PATCH v2 09/11] s390: mm: Convert to GENERIC_IOREMAP
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.
*/
Powered by blists - more mailing lists