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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Le 23/08/2022 à 03:19, Baoquan He a écrit :
> 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.

I can't understand. Why is it difficult to do something like:

#ifndef ioremap_adjust_prot
static inline unsigned long ioremap_adjust_prot(unsigned long flags)
{
	return flags;
}
#endif

Then for arc you do

static inline unsigned long ioremap_adjust_prot(unsigned long flags)
{
	return pgprot_val(pgprot_noncached(__pgprot(flags)));
}
#define ioremap_adjust_prot ioremap_adjust_prot


By the way, could be a good opportunity to change ioremap_prot() flags 
type from unsigned long to pgprot_t

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux