mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
arm,smmu: match start level of page table walk with P2M
Don't hardcode the lookup start level of the page table walk to 1
and instead match the one used in P2M. This should fix scenarios
involving SMMU where the start level is different than 1.
In order for the SMMU driver to also compile on arm32 move the
P2M_ROOT_LEVEL in the p2m header file (while at it, for
consistency also P2M_ROOT_ORDER) and use the macro in the smmu
driver.
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 9ae1197582)
This commit is contained in:
1 parent
d131310e60
commit
29b48aa27d
3 files changed
+14
-8
No files matched your search
+2
-7
@@ -17,17 +17,12 @@
|
||||
#define INVALID_VMID 0 /* VMID 0 is reserved */
|
||||
|
||||
#ifdef CONFIG_ARM_64
|
||||
static unsigned int __read_mostly p2m_root_order;
|
||||
static unsigned int __read_mostly p2m_root_level;
|
||||
#define P2M_ROOT_ORDER p2m_root_order
|
||||
#define P2M_ROOT_LEVEL p2m_root_level
|
||||
unsigned int __read_mostly p2m_root_order;
|
||||
unsigned int __read_mostly p2m_root_level;
|
||||
static unsigned int __read_mostly max_vmid = MAX_VMID_8_BIT;
|
||||
/* VMID is by default 8 bit width on AArch64 */
|
||||
#define MAX_VMID max_vmid
|
||||
#else
|
||||
/* First level P2M is always 2 consecutive pages */
|
||||
#define P2M_ROOT_LEVEL 1
|
||||
#define P2M_ROOT_ORDER 1
|
||||
/* VMID is always 8 bit width on AArch32 */
|
||||
#define MAX_VMID MAX_VMID_8_BIT
|
||||
#endif
|
||||
|
||||
@@ -1152,7 +1152,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain)
|
||||
(TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT);
|
||||
|
||||
if (!stage1)
|
||||
reg |= (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT);
|
||||
reg |= (2 - P2M_ROOT_LEVEL) << TTBCR_SL0_SHIFT;
|
||||
|
||||
writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR);
|
||||
|
||||
|
||||
@@ -13,6 +13,17 @@
|
||||
/* Holds the bit size of IPAs in p2m tables. */
|
||||
extern unsigned int p2m_ipa_bits;
|
||||
|
||||
#ifdef CONFIG_ARM_64
|
||||
extern unsigned int p2m_root_order;
|
||||
extern unsigned int p2m_root_level;
|
||||
#define P2M_ROOT_ORDER p2m_root_order
|
||||
#define P2M_ROOT_LEVEL p2m_root_level
|
||||
#else
|
||||
/* First level P2M is always 2 consecutive pages */
|
||||
#define P2M_ROOT_ORDER 1
|
||||
#define P2M_ROOT_LEVEL 1
|
||||
#endif
|
||||
|
||||
struct domain;
|
||||
|
||||
extern void memory_type_changed(struct domain *);
|
||||
|
||||