[Xen-devel,v2,13/24] xen/arm: page: Remove unused attributes DEV_NONSHARED and DEV_CACHED

Message ID 20170912100330.2168-14-julien.grall@arm.com
State Accepted
Commit 219ac334d09eb78e2b34ba7143d161aa62a2e10c
Headers show
Series
  • xen/arm: Memory subsystem clean-up
Related show

Commit Message

Julien Grall Sept. 12, 2017, 10:03 a.m.
They were imported from non-LPAE Linux, but Xen is LPAE only. It is time
to do some clean-up in the memory attribute and keep only what make
sense for Xen. Follow-up patch will do more clean-up.

Also, update the comment saying our attribute matches Linux.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>

---
    Changes in v2:
        - Add Andre's reviewed-by
---
 xen/include/asm-arm/page.h | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Stefano Stabellini Sept. 19, 2017, 11:32 p.m. | #1
On Tue, 12 Sep 2017, Julien Grall wrote:
> They were imported from non-LPAE Linux, but Xen is LPAE only. It is time
> to do some clean-up in the memory attribute and keep only what make
> sense for Xen. Follow-up patch will do more clean-up.
> 
> Also, update the comment saying our attribute matches Linux.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
> 
> ---
>     Changes in v2:
>         - Add Andre's reviewed-by
> ---
>  xen/include/asm-arm/page.h | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
> index b8d641bfaf..d7939bb944 100644
> --- a/xen/include/asm-arm/page.h
> +++ b/xen/include/asm-arm/page.h
> @@ -21,9 +21,9 @@
>  #define LPAE_SH_OUTER         0x2
>  #define LPAE_SH_INNER         0x3
>  
> -/* LPAE Memory region attributes, to match Linux's (non-LPAE) choices.
> - * Indexed by the AttrIndex bits of a LPAE entry;
> - * the 8-bit fields are packed little-endian into MAIR0 and MAIR1
> +/*
> + * LPAE Memory region attributes. Indexed by the AttrIndex bits of a
> + * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1.
>   *
>   *                 ai    encoding
>   *   UNCACHED      000   0000 0000  -- Strongly Ordered
> @@ -35,9 +35,7 @@
>   *   reserved      110
>   *   WRITEALLOC    111   1111 1111  -- Write-back write-allocate
>   *
> - *   DEV_NONSHARED 100   (== DEV_SHARED)
>   *   DEV_WC        001   (== BUFFERABLE)
> - *   DEV_CACHED    011   (== WRITEBACK)
>   */
>  #define MAIR0VAL 0xeeaa4400
>  #define MAIR1VAL 0xff000004

I am OK with removing unused memory attributes, but please update
MAIR0VAL and MAIR1VAL accordingly.  They still have their old values
here.


> @@ -57,9 +55,7 @@
>  #define WRITEBACK     0x3
>  #define DEV_SHARED    0x4
>  #define WRITEALLOC    0x7
> -#define DEV_NONSHARED DEV_SHARED
>  #define DEV_WC        BUFFERABLE
> -#define DEV_CACHED    WRITEBACK
>  
>  #define PAGE_HYPERVISOR         (WRITEALLOC)
>  #define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED)
> -- 
> 2.11.0
>
Julien Grall Sept. 20, 2017, 5:55 p.m. | #2
Hi,

On 20/09/17 00:32, Stefano Stabellini wrote:
> On Tue, 12 Sep 2017, Julien Grall wrote:
>> They were imported from non-LPAE Linux, but Xen is LPAE only. It is time
>> to do some clean-up in the memory attribute and keep only what make
>> sense for Xen. Follow-up patch will do more clean-up.
>>
>> Also, update the comment saying our attribute matches Linux.
>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
>>
>> ---
>>      Changes in v2:
>>          - Add Andre's reviewed-by
>> ---
>>   xen/include/asm-arm/page.h | 10 +++-------
>>   1 file changed, 3 insertions(+), 7 deletions(-)
>>
>> diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
>> index b8d641bfaf..d7939bb944 100644
>> --- a/xen/include/asm-arm/page.h
>> +++ b/xen/include/asm-arm/page.h
>> @@ -21,9 +21,9 @@
>>   #define LPAE_SH_OUTER         0x2
>>   #define LPAE_SH_INNER         0x3
>>   
>> -/* LPAE Memory region attributes, to match Linux's (non-LPAE) choices.
>> - * Indexed by the AttrIndex bits of a LPAE entry;
>> - * the 8-bit fields are packed little-endian into MAIR0 and MAIR1
>> +/*
>> + * LPAE Memory region attributes. Indexed by the AttrIndex bits of a
>> + * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1.
>>    *
>>    *                 ai    encoding
>>    *   UNCACHED      000   0000 0000  -- Strongly Ordered
>> @@ -35,9 +35,7 @@
>>    *   reserved      110
>>    *   WRITEALLOC    111   1111 1111  -- Write-back write-allocate
>>    *
>> - *   DEV_NONSHARED 100   (== DEV_SHARED)
>>    *   DEV_WC        001   (== BUFFERABLE)
>> - *   DEV_CACHED    011   (== WRITEBACK)
>>    */
>>   #define MAIR0VAL 0xeeaa4400
>>   #define MAIR1VAL 0xff000004
> 
> I am OK with removing unused memory attributes, but please update
> MAIR0VAL and MAIR1VAL accordingly.  They still have their old values
> here.

As you may have seen below in the patch. They were just aliased to other 
attributes:

#define DEV_NONSHARED DEV_SHARED
#define DEV_CACHED    WRITEBACK

I removed them because they are unused and just wrongly named.

So there are no need to update MAIR0VAL and MAIR1VAL.

Cheers,

Patch

diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index b8d641bfaf..d7939bb944 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -21,9 +21,9 @@ 
 #define LPAE_SH_OUTER         0x2
 #define LPAE_SH_INNER         0x3
 
-/* LPAE Memory region attributes, to match Linux's (non-LPAE) choices.
- * Indexed by the AttrIndex bits of a LPAE entry;
- * the 8-bit fields are packed little-endian into MAIR0 and MAIR1
+/*
+ * LPAE Memory region attributes. Indexed by the AttrIndex bits of a
+ * LPAE entry; the 8-bit fields are packed little-endian into MAIR0 and MAIR1.
  *
  *                 ai    encoding
  *   UNCACHED      000   0000 0000  -- Strongly Ordered
@@ -35,9 +35,7 @@ 
  *   reserved      110
  *   WRITEALLOC    111   1111 1111  -- Write-back write-allocate
  *
- *   DEV_NONSHARED 100   (== DEV_SHARED)
  *   DEV_WC        001   (== BUFFERABLE)
- *   DEV_CACHED    011   (== WRITEBACK)
  */
 #define MAIR0VAL 0xeeaa4400
 #define MAIR1VAL 0xff000004
@@ -57,9 +55,7 @@ 
 #define WRITEBACK     0x3
 #define DEV_SHARED    0x4
 #define WRITEALLOC    0x7
-#define DEV_NONSHARED DEV_SHARED
 #define DEV_WC        BUFFERABLE
-#define DEV_CACHED    WRITEBACK
 
 #define PAGE_HYPERVISOR         (WRITEALLOC)
 #define PAGE_HYPERVISOR_NOCACHE (DEV_SHARED)