[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <534380F6.7090703@gmail.com>
Date: Tue, 08 Apr 2014 12:54:14 +0800
From: Chen Gang <gang.chen.5i5j@...il.com>
To: 管雪涛 <gxt@....edu.cn>
CC: Guan Xuetao <gxt@...c.pku.edu.cn>, akpm@...ux-foundation.org,
liuj97@...il.com, rientjes@...gle.com, dhowells@...hat.com,
mhocko@...e.cz, mgorman@...e.de, linux-kernel@...r.kernel.org
Subject: Re: 回复: [PATCH] arch:unicore32:mm: add devmem_is_allowed() to support STRICT_DEVMEM
On 04/08/2014 11:20 AM, 管雪涛 wrote:
> I'd like to put the code into asm/io.h, and make it static.
>
It sounds OK to me, but I don't know why the other architectures (e.g.
arm, powerpc, x86) put them into ".c".
iomem_is_exclusive() and page_is_ram() are all extern functions, so for
me, devmem_is_allowed() is shot enough to be as inline function.
>> +#ifdef CONFIG_STRICT_DEVMEM
>> +/*
>> + * devmem_is_allowed() checks to see if /dev/mem access to a certain
>> + * address is valid. The argument is a physical page number.
>> + * We mimic x86 here by disallowing access to system RAM as well as
>> + * device-exclusive MMIO regions. This effectively disable read()/write()
>> + * on /dev/mem.
>> + */
>> +static int devmem_is_allowed(unsigned long pfn)
How about "static inline int devmem_is_allowed(unsigned long pfn)"?
>> +{
>> + if (iomem_is_exclusive(pfn << PAGE_SHIFT))
>> + return 0;
>> + if (!page_is_ram(pfn))
>> + return 1;
>> + return 0;
>> +}
>> +#endif /* CONFIG_STRICT_DEVMEM */
>
> Thanks,
>
> Acked-by: Xuetao Guan <gxt@...c.pku.edu.cn>
>
[...]
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists