Re: [PATCH v2 02/11] mm: ioremap: fixup the physical address and page prot

From: Baoquan He
Date: Mon Aug 22 2022 - 21:19:22 EST


On 08/22/22 at 06:30am, Christophe Leroy wrote:
>
>
> Le 20/08/2022 à 02:31, Baoquan He a écrit :
> > On some architectures, the physical address need be fixed up before
> > doing mapping, e.g, parisc. And on architectures, e.g arc, the
> > parameter 'prot' passed into ioremap_prot() need be adjusted too.
> >
> > In oder to convert them to take GENERIC_IOREMAP method, we need wrap
> > the address fixing up code and page prot adjusting code into arch_ioremap()
> > and pass the new address and 'prot' out for ioremap_prot() handling.
>
> Is it really the best approach ? Wouldn't it be better to have helpers
> to do that, those helpers being called by the ioremap_prot(), instead of
> doing it inside the arch_ioremap() function ?

This is suggested too by Alexander during his v1 reviewing. I tried, but
feel the current way taken in this patchset is better. Because not all
architecutres need the address fix up, only parisc, and only few need
adjust the 'prot'. Introducing other helpers seems too much, that only
increases the complexity of of ioremap() and the generic GENERIC_IOREMAP
method for people to understand and take.

>
> >
> > This is a preparation patch, no functionality change.
>
> Could this be squashed into previous patch ?

Yep, will do. Thanks.