linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, hch@infradead.org,
	agordeev@linux.ibm.com, christophe.leroy@csgroup.eu,
	schnelle@linux.ibm.com, David.Laight@aculab.com,
	shorne@gmail.com, Arnd Bergmann <arnd@arndb.de>,
	linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 03/11] mm/ioremap: change the return value of io[re|un]map_allowed and rename
Date: Mon, 10 Oct 2022 08:25:22 +0800	[thread overview]
Message-ID: <Y0NmcspddDQICfTi@MiWiFi-R3L-srv> (raw)
In-Reply-To: <10ada8f0-0931-b6a6-e240-fc8b500e578d@huawei.com>

On 10/09/22 at 07:13pm, Kefeng Wang wrote:
> 
> On 2022/10/9 18:31, Baoquan He wrote:
> > Currently, hooks ioremap_allowed() and iounmap_allowed() are used to
> > check if it's qualified to do ioremap, and now this is done on ARM64.
> > However, in oder to convert more architectures to take GENERIC_IOREMAP
> > method, several more things need be done in those two hooks:
> >   1) The io address mapping need be handled specifically on architectures,
> >      e.g arc, ia64, s390;
> >   2) The original physical address passed into ioremap_prot() need be
> >      fixed up, e.g arc;
> >   3) The 'prot' passed into ioremap_prot() need be adjusted, e.g on arc
> >      and xtensa.
> > 
> > To handle these three issues,
> > 
> >   1) Rename ioremap_allowed() and iounmap_allowed() to arch_ioremap()
> >      and arch_iounmap() since the old name can't reflect their
> >      functionality after change;
> >   2) Change the return value of arch_ioremap() so that arch can add
> >      specifical io address mapping handling inside and return the maped
> >      address. Now their returned value means:
> >      ===
> >      arch_ioremap() return a bool,
> pointer?

Right, I forgot fixing it again. Thanks.

> >        - IS_ERR means return an error
> >        - 0 means continue to remap
> >        - a non-zero, non-IS_ERR pointer is returned directly
> >      arch_iounmap() return a bool,
> >        - true means continue to vunmap
> >        - false means skip vunmap and return directly
> ...
> >   /*
> > diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> > index a68f8fbf423b..2ae16906f3be 100644
> > --- a/include/asm-generic/io.h
> > +++ b/include/asm-generic/io.h
> > @@ -1049,25 +1049,26 @@ static inline void iounmap(volatile void __iomem *addr)
> >   /*
> >    * Arch code can implement the following two hooks when using GENERIC_IOREMAP
> > - * ioremap_allowed() return a bool,
> > - *   - true means continue to remap
> > - *   - false means skip remap and return directly
> > - * iounmap_allowed() return a bool,
> > + * arch_ioremap() return a bool,
> ditto...

Will change.

> >   	area = get_vm_area_caller(size, VM_IOREMAP,
> >   			__builtin_return_address(0));
> >   	if (!area)
> > @@ -52,7 +57,7 @@ void iounmap(volatile void __iomem *addr)
> >   {
> >   	void *vaddr = (void *)((unsigned long)addr & PAGE_MASK);
> > -	if (!iounmap_allowed(vaddr))
> > +	if (!arch_iounmap((void __iomem *)addr))
> vaddr?

No, it's intentional. Alexander suggested this, both of you discussed
this in v1, see below thread.

https://lore.kernel.org/all/Yu4mYxpV0GWRTjQp@li-4a3a4a4c-28e5-11b2-a85c-a8d192c6f089.ibm.com/T/#u

> >   		return;
> >   	if (is_vmalloc_addr(vaddr))
> 


  reply	other threads:[~2022-10-10  0:57 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09 10:31 [PATCH v3 00/11] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
2022-10-09 10:31 ` [PATCH v3 01/11] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
2022-10-09 16:39   ` Christophe Leroy
2022-10-10  0:17     ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 02/11] openrisc: mm: remove unneeded early ioremap code Baoquan He
2022-10-09 10:31 ` [PATCH v3 03/11] mm/ioremap: change the return value of io[re|un]map_allowed and rename Baoquan He
2022-10-09 11:13   ` Kefeng Wang
2022-10-10  0:25     ` Baoquan He [this message]
2022-10-10  0:55       ` Kefeng Wang
2022-10-09 10:31 ` [PATCH v3 04/11] mm: ioremap: allow ARCH to have its own ioremap definition Baoquan He
2022-10-09 10:31 ` [PATCH v3 05/11] arc: mm: Convert to GENERIC_IOREMAP Baoquan He
2022-10-12 10:17   ` Christophe Leroy
2022-10-13  9:51     ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 06/11] ia64: " Baoquan He
2022-10-09 10:31 ` [PATCH v3 07/11] openrisc: " Baoquan He
2022-10-09 10:31 ` [PATCH v3 08/11] parisc: " Baoquan He
2022-10-09 10:31 ` [PATCH v3 09/11] s390: " Baoquan He
2022-10-09 13:54   ` kernel test robot
2022-10-10 10:38     ` Baoquan He
2022-10-10 11:53       ` Niklas Schnelle
2022-10-11  3:00         ` Baoquan He
2022-10-11 15:16   ` Niklas Schnelle
2022-10-12  5:52     ` Baoquan He
2022-10-12  7:37       ` Niklas Schnelle
2022-10-12  9:20         ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 10/11] sh: " Baoquan He
2022-10-09 14:16   ` kernel test robot
2022-10-09 10:31 ` [PATCH v3 11/11] xtensa: " Baoquan He
2022-10-09 16:12   ` kernel test robot
2022-10-10  2:47     ` Baoquan He
2022-10-12 10:08 ` [PATCH v3 00/11] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y0NmcspddDQICfTi@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=David.Laight@aculab.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=christophe.leroy@csgroup.eu \
    --cc=hch@infradead.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=schnelle@linux.ibm.com \
    --cc=shorne@gmail.com \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).