[PATCH v2 06/20] ARM: LPAE: Introduce the 3-level page table format definitions

Catalin Marinas catalin.marinas at arm.com
Tue Nov 16 04:57:57 EST 2010


On 15 November 2010 18:34, Russell King - ARM Linux
<linux at arm.linux.org.uk> wrote:
> On Fri, Nov 12, 2010 at 06:00:26PM +0000, Catalin Marinas wrote:
>> +#define PMD_TYPE_MASK                (_AT(pmd_t, 3) << 0)
>> +#define PMD_TYPE_FAULT               (_AT(pmd_t, 0) << 0)
>> +#define PMD_TYPE_TABLE               (_AT(pmd_t, 3) << 0)
>> +#define PMD_TYPE_SECT                (_AT(pmd_t, 1) << 0)
>> +#define PMD_BIT4             (_AT(pmd_t, 0))
>> +#define PMD_DOMAIN(x)                (_AT(pmd_t, 0))
>
> It is really not correct to have these constants type'd as pmd_t.
> The idea behind pmd_t et.al. is to detect when normal arithmetic or
> logical operations are performed on page table entries when the
> accessors instead should be used.

OK, I can add pmdval_t (and pgdval_t) and use it for these definitions.

>> diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
>> index 6630620..a62f093 100644
>> --- a/arch/arm/mm/mm.h
>> +++ b/arch/arm/mm/mm.h
>> @@ -16,10 +16,10 @@ static inline pmd_t *pmd_off_k(unsigned long virt)
>>  }
>>
>>  struct mem_type {
>> -     unsigned int prot_pte;
>> -     unsigned int prot_l1;
>> -     unsigned int prot_sect;
>> -     unsigned int domain;
>> +     pgprot_t prot_pte;
>> +     pgprot_t prot_l1;
>> +     pgprot_t prot_sect;
>> +     pgprot_t domain;
>
> Again, this is wrong.  There's an accessor for pgprot_t typed data.  This
> causes code to violate it.

OK, I'll define pgprotval_t and accessors.

-- 
Catalin



More information about the linux-arm-kernel mailing list