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

Re: [Xen-devel] [RFC PATCH v2 3/8] arm/mem_access: Add defines supporting PTs with varying page sizes



Hi Sergej,

On 06/01/2017 04:18 PM, Sergej Proskurin wrote:
The ARMv8 architecture supports pages with different (4K, 16K, and 64K) sizes.
To enable guest page table walks for various configurations, this commit
extends the defines and helpers of the current implementation.

Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx>
---
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
---
  xen/include/asm-arm/page.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 67 insertions(+)

diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 4b46e8831c..6222b1d4a2 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -500,6 +500,73 @@ static inline int gva_to_ipa(vaddr_t va, paddr_t *paddr, 
unsigned int flags)
#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & PAGE_MASK) +#define LPAE_SHIFT_4K (9)
+#define LPAE_SHIFT_16K          (11)
+#define LPAE_SHIFT_64K          (13)
+
+#define LPAE_ENTRIES_4K         (_AC(1,U) << LPAE_SHIFT_4K)
+#define LPAE_ENTRIES_16K        (_AC(1,U) << LPAE_SHIFT_16K)
+#define LPAE_ENTRIES_64K        (_AC(1,U) << LPAE_SHIFT_64K)

It sounds like to me you can introduce macros to avoid all the redundancies as you did below for GUEST_TABLE_OFFSET.

This macro would take a granularity in parameter and create all the *_gran define associated to it.

But I am not fully convinced they all need to be defined. You only use them once and could easily use LPAE_SHIFT_*K to get what you need in the guest page table walker.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.