hw/arm/smmuv3: Advertise SMMUv3.1-XNX
cover hw/arm/smmuv3: Advertise SMMUv3.1-XNX
The SMMUv3.1-XNX feature is mandatory for an SMMUv3.1 if S2P is supported, so we should theoretically have implemented it as part of the recent S2P work. Fortunately, for us the implementation is a no-op.
This feature is about interpretation of the stage 2 page table descriptor XN bits, which control execute permissions.
For QEMU, the permission bits passed to an IOMMU (via MemTxAttrs and IOMMUAccessFlags) only indicate read and write; we do not distinguish data reads from instruction reads outside the CPU proper. In the SMMU architecture's terms, our interconnect between the client device and the SMMU doesn't have the ability to convey the INST attribute, and we therefore use the default value of "data" for this attribute.
We also do not support the bits in the Stream Table Entry that can override the on-the-bus transaction attribute permissions (we do not set SMMU_IDR1.ATTR_PERMS_OVR=1).
These two things together mean that for our implementation, it never has to deal with transactions with the INST attribute, and so it can correctly ignore the XN bits entirely. So we already implement FEAT_XNX's "XN field is now 2 bits, not 1" behaviour to the extent that we need to.
Patches 1 and 2 in this series do a little bit of tidy up on the ID register bit code. Patch 3 is the one-liner to advertise SMMUv3.1-XNX in the ID register.
thanks
-- PMM
Peter Maydell (3):
hw/arm/smmuv3: Update ID register bit field definitions hw/arm/smmuv3: Sort ID register setting into field order hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
hw/arm/smmuv3-internal.h | 38 ++++++++++++++++++++++++++++++++++++++ hw/arm/smmuv3.c | 5 +++-- 2 files changed, 41 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 hw/arm/smmuv3: Update ID register bit field definitions
Update the SMMUv3 ID register bit field definitions to the set in the most recent specification (IHI0700 F.a).
--- hw/arm/smmuv3-internal.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
hw/arm/smmuv3-internal.h +38 -0
@@ -38,33 +38,71 @@ REG32(IDR0, 0x0) FIELD(IDR0, S1P, 1 , 1) FIELD(IDR0, TTF, 2 , 2) FIELD(IDR0, COHACC, 4 , 1) + FIELD(IDR0, BTM, 5 , 1) + FIELD(IDR0, HTTU, 6 , 2) + FIELD(IDR0, DORMHINT, 8 , 1) + FIELD(IDR0, HYP, 9 , 1) + FIELD(IDR0, ATS, 10, 1) + FIELD(IDR0, NS1ATS, 11, 1) FIELD(IDR0, ASID16, 12, 1) + FIELD(IDR0, MSI, 13, 1) + FIELD(IDR0, SEV, 14, 1) + FIELD(IDR0, ATOS, 15, 1) + FIELD(IDR0, PRI, 16, 1) + FIELD(IDR0, VMW, 17, 1) FIELD(IDR0, VMID16, 18, 1) + FIELD(IDR0, CD2L, 19, 1) + FIELD(IDR0, VATOS, 20, 1) FIELD(IDR0, TTENDIAN, 21, 2) + FIELD(IDR0, ATSRECERR, 23, 1) FIELD(IDR0, STALL_MODEL, 24, 2) FIELD(IDR0, TERM_MODEL, 26, 1) FIELD(IDR0, STLEVEL, 27, 2) + FIELD(IDR0, RME_IMPL, 30, 1) REG32(IDR1, 0x4) FIELD(IDR1, SIDSIZE, 0 , 6) + FIELD(IDR1, SSIDSIZE, 6 , 5) + FIELD(IDR1, PRIQS, 11, 5) FIELD(IDR1, EVENTQS, 16, 5) FIELD(IDR1, CMDQS, 21, 5) + FIELD(IDR1, ATTR_PERMS_OVR, 26, 1) + FIELD(IDR1, ATTR_TYPES_OVR, 27, 1) + FIELD(IDR1, REL, 28, 1) + FIELD(IDR1, QUEUES_PRESET, 29, 1) + FIELD(IDR1, TABLES_PRESET, 30, 1) + FIELD(IDR1, ECMDQ, 31, 1)#define SMMU_IDR1_SIDSIZE 16#define SMMU_CMDQS 19#define SMMU_EVENTQS 19 REG32(IDR2, 0x8) + FIELD(IDR2, BA_VATOS, 0, 10) + REG32(IDR3, 0xc)FIELD (IDR3 ,HAD ,2 ,1 ); +FIELD (IDR3 ,PBHA ,3 ,1 ); +FIELD (IDR3 ,XNX ,4 ,1 ); +FIELD (IDR3 ,PPS ,5 ,1 ); +FIELD (IDR3 ,MPAM ,7 ,1 ); +FIELD (IDR3 ,FWB ,8 ,1 ); +FIELD (IDR3 ,STT ,9 ,1 );FIELD (IDR3 ,RIL ,10 ,1 );FIELD (IDR3 ,BBML ,11 ,2 ); +FIELD (IDR3 ,E0PD ,13 ,1 ); +FIELD (IDR3 ,PTWNNC ,14 ,1 ); +FIELD (IDR3 ,DPT ,15 ,1 ); + REG32(IDR4, 0x10) + REG32(IDR5, 0x14)FIELD (IDR5 ,OAS ,0 ,3 );FIELD (IDR5 ,GRAN4K ,4 ,1 );FIELD (IDR5 ,GRAN16K ,5 ,1 );FIELD (IDR5 ,GRAN64K ,6 ,1 ); +FIELD (IDR5 ,VAX ,10 ,2 ); +FIELD (IDR5 ,STALL_MAX ,16 ,16 );#define SMMU_IDR5_OAS 4
Signature · 1 line
2.34.1
Re: [PATCH 1/3] hw/arm/smmuv3: Update ID register bit field definitions
Hi Peter,
Quoted 74 lines · Peter Maydell
Update the SMMUv3 ID register bit field definitions to the set in the most recent specification (IHI0700 F.a).
Signed-off-by Peter Maydell <[email protected]>--- hw/arm/smmuv3-internal.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)hw/arm/smmuv3-internal.h +36
-0@@ -38,33 +38,71 @@ REG32(IDR0, 0x0) FIELD(IDR0, S1P, 1 , 1) FIELD(IDR0, TTF, 2 , 2) FIELD(IDR0, COHACC, 4 , 1) + FIELD(IDR0, BTM, 5 , 1) + FIELD(IDR0, HTTU, 6 , 2) + FIELD(IDR0, DORMHINT, 8 , 1) + FIELD(IDR0, HYP, 9 , 1) + FIELD(IDR0, ATS, 10, 1) + FIELD(IDR0, NS1ATS, 11, 1) FIELD(IDR0, ASID16, 12, 1) + FIELD(IDR0, MSI, 13, 1) + FIELD(IDR0, SEV, 14, 1) + FIELD(IDR0, ATOS, 15, 1) + FIELD(IDR0, PRI, 16, 1) + FIELD(IDR0, VMW, 17, 1) FIELD(IDR0, VMID16, 18, 1) + FIELD(IDR0, CD2L, 19, 1) + FIELD(IDR0, VATOS, 20, 1) FIELD(IDR0, TTENDIAN, 21, 2) + FIELD(IDR0, ATSRECERR, 23, 1) FIELD(IDR0, STALL_MODEL, 24, 2) FIELD(IDR0, TERM_MODEL, 26, 1) FIELD(IDR0, STLEVEL, 27, 2) + FIELD(IDR0, RME_IMPL, 30, 1) REG32(IDR1, 0x4) FIELD(IDR1, SIDSIZE, 0 , 6) + FIELD(IDR1, SSIDSIZE, 6 , 5) + FIELD(IDR1, PRIQS, 11, 5) FIELD(IDR1, EVENTQS, 16, 5) FIELD(IDR1, CMDQS, 21, 5) + FIELD(IDR1, ATTR_PERMS_OVR, 26, 1) + FIELD(IDR1, ATTR_TYPES_OVR, 27, 1) + FIELD(IDR1, REL, 28, 1) + FIELD(IDR1, QUEUES_PRESET, 29, 1) + FIELD(IDR1, TABLES_PRESET, 30, 1) + FIELD(IDR1, ECMDQ, 31, 1)#define SMMU_IDR1_SIDSIZE 16#define SMMU_CMDQS 19#define SMMU_EVENTQS 19 REG32(IDR2, 0x8) + FIELD(IDR2, BA_VATOS, 0, 10) + REG32(IDR3, 0xc)FIELD (IDR3 ,HAD ,2 ,1 ); +FIELD (IDR3 ,PBHA ,3 ,1 ); +FIELD (IDR3 ,XNX ,4 ,1 ); +FIELD (IDR3 ,PPS ,5 ,1 ); +FIELD (IDR3 ,MPAM ,7 ,1 ); +FIELD (IDR3 ,FWB ,8 ,1 ); +FIELD (IDR3 ,STT ,9 ,1 );FIELD (IDR3 ,RIL ,10 ,1 );FIELD (IDR3 ,BBML ,11 ,2 ); +FIELD (IDR3 ,E0PD ,13 ,1 ); +FIELD (IDR3 ,PTWNNC ,14 ,1 ); +FIELD (IDR3 ,DPT ,15 ,1 ); +REG32 (IDR4 ,0x10 ) +
hw/arm/smmuv3-internal.h REG32(IDR0, 0x0) · line 108
Quoted 10 lines
hw/arm/smmuv3-internal.h +2
-0REG32(IDR5, 0x14)FIELD (IDR5 ,OAS ,0 ,3 );FIELD (IDR5 ,GRAN4K ,4 ,1 );FIELD (IDR5 ,GRAN16K ,5 ,1 );FIELD (IDR5 ,GRAN64K ,6 ,1 ); +FIELD (IDR5 ,VAX ,10 ,2 ); +FIELD (IDR5 ,STALL_MAX ,16 ,16 );#define SMMU_IDR5_OAS 4
Eric
PATCH 2/3 hw/arm/smmuv3: Sort ID register setting into field order
In reply to Peter MaydellIn smmuv3_init_regs() when we set the various bits in the ID registers, we do this almost in order of the fields in the registers, but not quite. Move the initialization of SMMU_IDR3.RIL and SMMU_IDR5.OAS into their correct places.
--- hw/arm/smmuv3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/smmuv3.c +2 -2
@@ -278,15 +278,15 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,EVENTQS ,SMMU_EVENTQS ); s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,CMDQS ,SMMU_CMDQS ); - s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); + s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,BBML ,2 ); + s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,OAS ,SMMU_IDR5_OAS );/* 44 bits */ /* 4K, 16K and 64K granule support */ s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,GRAN4K ,1 ); s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,GRAN16K ,1 ); s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,GRAN64K ,1 ); - s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,OAS ,SMMU_IDR5_OAS );/* 44 bits */ s->cmdq.base =deposit64 (s->cmdq.base,0 ,5 ,SMMU_CMDQS ); s->cmdq.prod =0 ;
Signature · 1 line
2.34.1
Re: [PATCH 2/3] hw/arm/smmuv3: Sort ID register setting into field order
Quoted 22 lines · Peter Maydell
In
smmuv3_init_regs()when we set the various bits in the ID registers, we do this almost in order of the fields in the registers, but not quite. Move the initialization of SMMU_IDR3.RIL and SMMU_IDR5.OAS into their correct places.Signed-off-by Peter Maydell <[email protected]>--- hw/arm/smmuv3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/arm/smmuv3.c +1
-1@@ -278,15 +278,15 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,EVENTQS ,SMMU_EVENTQS ); s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,CMDQS ,SMMU_CMDQS ); - s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); + s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,BBML ,2 );
hw/arm/smmuv3.c static void smmuv3_init_regs(SMMUv3State *s) · line 292
Quoted 10 lines
hw/arm/smmuv3.c +1
-1+ s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,OAS ,SMMU_IDR5_OAS );/* 44 bits */ /* 4K, 16K and 64K granule support */ s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,GRAN4K ,1 ); s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,GRAN16K ,1 ); s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,GRAN64K ,1 ); - s->idr[5 ] =FIELD_DP32 (s->idr[5 ],IDR5 ,OAS ,SMMU_IDR5_OAS );/* 44 bits */ s->cmdq.base =deposit64 (s->cmdq.base,0 ,5 ,SMMU_CMDQS ); s->cmdq.prod =0 ;
Eric
PATCH 3/3 hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
In reply to Peter MaydellThe SMMUv3.1-XNX feature is mandatory for an SMMUv3.1 if S2P is supported, so we should theoretically have implemented it as part of the recent S2P work. Fortunately, for us the implementation is a no-op.
This feature is about interpretation of the stage 2 page table descriptor XN bits, which control execute permissions.
For QEMU, the permission bits passed to an IOMMU (via MemTxAttrs and IOMMUAccessFlags) only indicate read and write; we do not distinguish data reads from instruction reads outside the CPU proper. In the SMMU architecture's terms, our interconnect between the client device and the SMMU doesn't have the ability to convey the INST attribute, and we therefore use the default value of "data" for this attribute.
We also do not support the bits in the Stream Table Entry that can override the on-the-bus transaction attribute permissions (we do not set SMMU_IDR1.ATTR_PERMS_OVR=1).
These two things together mean that for our implementation, it never has to deal with transactions with the INST attribute, and so it can correctly ignore the XN bits entirely. So we already implement FEAT_XNX's "XN field is now 2 bits, not 1" behaviour to the extent that we need to.
Advertise the presence of the feature in SMMU_IDR3.XNX.
--- hw/arm/smmuv3.c | 1 + 1 file changed, 1 insertion(+)
hw/arm/smmuv3.c +1 -0
@@ -279,6 +279,7 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,CMDQS ,SMMU_CMDQS ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); + s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,XNX ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,BBML ,2 );
Signature · 1 line
2.34.1
Re: [PATCH 3/3] hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
Hi Peter,
Quoted 37 lines · Peter Maydell
The SMMUv3.1-XNX feature is mandatory for an SMMUv3.1 if S2P is supported, so we should theoretically have implemented it as part of the recent S2P work. Fortunately, for us the implementation is a no-op.
This feature is about interpretation of the stage 2 page table descriptor XN bits, which control execute permissions.
For QEMU, the permission bits passed to an IOMMU (via MemTxAttrs and IOMMUAccessFlags) only indicate read and write; we do not distinguish data reads from instruction reads outside the CPU proper. In the SMMU architecture's terms, our interconnect between the client device and the SMMU doesn't have the ability to convey the INST attribute, and we therefore use the default value of "data" for this attribute.
We also do not support the bits in the Stream Table Entry that can override the on-the-bus transaction attribute permissions (we do not set SMMU_IDR1.ATTR_PERMS_OVR=1).
These two things together mean that for our implementation, it never has to deal with transactions with the INST attribute, and so it can correctly ignore the XN bits entirely. So we already implement FEAT_XNX's "XN field is now 2 bits, not 1" behaviour to the extent that we need to.
Advertise the presence of the feature in SMMU_IDR3.XNX.
Signed-off-by Peter Maydell <[email protected]>--- hw/arm/smmuv3.c | 1 + 1 file changed, 1 insertion(+)hw/arm/smmuv3.c +0
-0
hw/arm/smmuv3.c static void smmuv3_init_regs(SMMUv3State *s) · line 282
Quoted 4 lines
hw/arm/smmuv3.c +1
-0@@ -279,6 +279,7 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,CMDQS ,SMMU_CMDQS ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); + s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,XNX ,1 );
May be this can be guarded when S2P is present? according the UM "In SMMUv3.1 and later, support for this feature is mandatory when stage 2 is supported, that is when SMMU_IDR0.S2P == 1." So I am not sure what it would mean for XNX and S1P only.
Quoted 5 lines
hw/arm/smmuv3.c +0
-0s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,BBML ,2 );Signature · 1 line
2.34.1
Thanks,
Mostafa
Re: [PATCH 3/3] hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
Quoted 43 lines · Mostafa Saleh
Hi Peter,
Quoted 39 lines · Peter Maydell
The SMMUv3.1-XNX feature is mandatory for an SMMUv3.1 if S2P is supported, so we should theoretically have implemented it as part of the recent S2P work. Fortunately, for us the implementation is a no-op.
This feature is about interpretation of the stage 2 page table descriptor XN bits, which control execute permissions.
For QEMU, the permission bits passed to an IOMMU (via MemTxAttrs and IOMMUAccessFlags) only indicate read and write; we do not distinguish data reads from instruction reads outside the CPU proper. In the SMMU architecture's terms, our interconnect between the client device and the SMMU doesn't have the ability to convey the INST attribute, and we therefore use the default value of "data" for this attribute.
We also do not support the bits in the Stream Table Entry that can override the on-the-bus transaction attribute permissions (we do not set SMMU_IDR1.ATTR_PERMS_OVR=1).
These two things together mean that for our implementation, it never has to deal with transactions with the INST attribute, and so it can correctly ignore the XN bits entirely. So we already implement FEAT_XNX's "XN field is now 2 bits, not 1" behaviour to the extent that we need to.
Advertise the presence of the feature in SMMU_IDR3.XNX.
Signed-off-by Peter Maydell <[email protected]>--- hw/arm/smmuv3.c | 1 + 1 file changed, 1 insertion(+)hw/arm/smmuv3.c +0
-0@@ -279,6 +279,7 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,CMDQS ,SMMU_CMDQS );
Quoted 6 lines
hw/arm/smmuv3.c static void smmuv3_init_regs(SMMUv3State *s) · line 282
Quoted 2 lines
hw/arm/smmuv3.c +1
-0s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); + s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,XNX ,1 );May be this can be guarded when S2P is present? according the UM "In SMMUv3.1 and later, support for this feature is mandatory when stage 2 is supported, that is when SMMU_IDR0.S2P == 1." So I am not sure what it would mean for XNX and S1P only.
Mmm, I don't suppose it would confuse any guest code, but it's probably safest to put in the if():
if (FIELD_EX32(s->idr[0], IDR0, S2P) {
/* XNX is a stage-2-specific feature */
s->idr[3] = FIELD_DP32(s->idr[3], IDR3, XNX, 1);
}thanks
-- PMM
Re: [PATCH 3/3] hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
Hi Peter,
Quoted 51 lines · Peter Maydell
Quoted 43 lines · Mostafa Saleh
Hi Peter,
Quoted 39 lines · Peter Maydell
The SMMUv3.1-XNX feature is mandatory for an SMMUv3.1 if S2P is supported, so we should theoretically have implemented it as part of the recent S2P work. Fortunately, for us the implementation is a no-op.
This feature is about interpretation of the stage 2 page table descriptor XN bits, which control execute permissions.
For QEMU, the permission bits passed to an IOMMU (via MemTxAttrs and IOMMUAccessFlags) only indicate read and write; we do not distinguish data reads from instruction reads outside the CPU proper. In the SMMU architecture's terms, our interconnect between the client device and the SMMU doesn't have the ability to convey the INST attribute, and we therefore use the default value of "data" for this attribute.
We also do not support the bits in the Stream Table Entry that can override the on-the-bus transaction attribute permissions (we do not set SMMU_IDR1.ATTR_PERMS_OVR=1).
These two things together mean that for our implementation, it never has to deal with transactions with the INST attribute, and so it can correctly ignore the XN bits entirely. So we already implement FEAT_XNX's "XN field is now 2 bits, not 1" behaviour to the extent that we need to.
Advertise the presence of the feature in SMMU_IDR3.XNX.
Signed-off-by Peter Maydell <[email protected]>--- hw/arm/smmuv3.c | 1 + 1 file changed, 1 insertion(+)hw/arm/smmuv3.c +0
-0@@ -279,6 +279,7 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,CMDQS ,SMMU_CMDQS );Quoted 6 lines
hw/arm/smmuv3.c static void smmuv3_init_regs(SMMUv3State *s) · line 282
Quoted 2 lines
hw/arm/smmuv3.c +1
-0s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); + s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,XNX ,1 );May be this can be guarded when S2P is present? according the UM "In SMMUv3.1 and later, support for this feature is mandatory when stage 2 is supported, that is when SMMU_IDR0.S2P == 1." So I am not sure what it would mean for XNX and S1P only.
Quoted 7 lines
Mmm, I don't suppose it would confuse any guest code, but it's probably safest to put in the
if():if (FIELD_EX32(s->idr[0], IDR0, S2P) { /* XNX is a stage-2-specific feature */ s->idr[3] = FIELD_DP32(s->idr[3], IDR3, XNX, 1); }
I agree that shouldn't confuse guests. I don't have a strong opinion, both are OK for me.
Quoted 2 lines
thanks
-- PMM
Thanks
Mostafa
Re: [PATCH 3/3] hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
In reply to Peter MaydellHi Peter,
Quoted 15 lines · Peter Maydell
The SMMUv3.1-XNX feature is mandatory for an SMMUv3.1 if S2P is supported, so we should theoretically have implemented it as part of the recent S2P work. Fortunately, for us the implementation is a no-op.
This feature is about interpretation of the stage 2 page table descriptor XN bits, which control execute permissions.
For QEMU, the permission bits passed to an IOMMU (via MemTxAttrs and IOMMUAccessFlags) only indicate read and write; we do not distinguish data reads from instruction reads outside the CPU proper. In the SMMU architecture's terms, our interconnect between the client device and the SMMU doesn't have the ability to convey the INST attribute, and we therefore use the default value of "data" for this attribute.
Quoted 3 lines
We also do not support the bits in the Stream Table Entry that can override the on-the-bus transaction attribute permissions (we do not set SMMU_IDR1.ATTR_PERMS_OVR=1).
you may precise it is called INSTCFG
Quoted 19 lines
These two things together mean that for our implementation, it never has to deal with transactions with the INST attribute, and so it can correctly ignore the XN bits entirely. So we already implement FEAT_XNX's "XN field is now 2 bits, not 1" behaviour to the extent that we need to.
Advertise the presence of the feature in SMMU_IDR3.XNX.
Signed-off-by Peter Maydell <[email protected]>--- hw/arm/smmuv3.c | 1 + 1 file changed, 1 insertion(+)hw/arm/smmuv3.c +0
-0
hw/arm/smmuv3.c static void smmuv3_init_regs(SMMUv3State *s) · line 285
Quoted 7 lines
hw/arm/smmuv3.c +1
-0@@ -279,6 +279,7 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[1 ] =FIELD_DP32 (s->idr[1 ],IDR1 ,CMDQS ,SMMU_CMDQS ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); + s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,XNX ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,BBML ,2 );
With Mostafa's suggestion
Thanks
Eric
Quoted 4 lines · Peter Maydell
Peter Maydell (3):
hw/arm/smmuv3: Update ID register bit field definitions hw/arm/smmuv3: Sort ID register setting into field order hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
r~
Hi Peter,
Quoted 4 lines · Peter Maydell
The SMMUv3.1-XNX feature is mandatory for an SMMUv3.1 if S2P is supported, so we should theoretically have implemented it as part of the recent S2P work. Fortunately, for us the implementation is a no-op.
Oh, I missed that, thanks for spotting it.
Quoted 27 lines
This feature is about interpretation of the stage 2 page table descriptor XN bits, which control execute permissions.
For QEMU, the permission bits passed to an IOMMU (via MemTxAttrs and IOMMUAccessFlags) only indicate read and write; we do not distinguish data reads from instruction reads outside the CPU proper. In the SMMU architecture's terms, our interconnect between the client device and the SMMU doesn't have the ability to convey the INST attribute, and we therefore use the default value of "data" for this attribute.
We also do not support the bits in the Stream Table Entry that can override the on-the-bus transaction attribute permissions (we do not set SMMU_IDR1.ATTR_PERMS_OVR=1).
These two things together mean that for our implementation, it never has to deal with transactions with the INST attribute, and so it can correctly ignore the XN bits entirely. So we already implement FEAT_XNX's "XN field is now 2 bits, not 1" behaviour to the extent that we need to.
Patches 1 and 2 in this series do a little bit of tidy up on the ID register bit code. Patch 3 is the one-liner to advertise SMMUv3.1-XNX in the ID register.
thanks
-- PMM
Quoted 11 lines
Peter Maydell (3):
hw/arm/smmuv3: Update ID register bit field definitions hw/arm/smmuv3: Sort ID register setting into field order hw/arm/smmuv3: Advertise SMMUv3.1-XNX featurehw/arm/smmuv3-internal.h | 38 ++++++++++++++++++++++++++++++++++++++ hw/arm/smmuv3.c | 5 +++-- 2 files changed, 41 insertions(+), 2 deletions(-)Signature · 1 line
2.34.1
I left a comment/question on the last patch, otherwise
Thanks,
Mostafa