hw/arm/smmuv3: Support 16K translation granule
PATCH 1/1 hw/arm/smmuv3: Support 16K translation granule
The driver can query some bits in SMMUv3 IDR5 to learn which translation granules are supported. Arm recommends that SMMUv3 implementations support at least 4K and 64K granules. But in the vSMMUv3, there seems to be no reason not to support 16K translation granule. In addition, if 16K is not supported, vSVA will failed to be enabled in the future for 16K guest kernel. So it'd better to support it.
--- hw/arm/smmuv3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/arm/smmuv3.c +4 -2
@@ -259,8 +259,9 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); -/* 4K and 64K granule support */ +/* 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 */
@@ -503,7 +504,8 @@ static int decode_cd(SMMUTransCfg *cfg, CD *cd, SMMUEventInfo *event) tg =CD_TG (cd, i); tt->granule_sz =tg2granule (tg, i); -if ((tt->granule_sz !=12 && tt->granule_sz !=16 ) ||CD_ENDI (cd)) { +if ((tt->granule_sz !=12 && tt->granule_sz !=14 && + tt->granule_sz !=16 ) ||CD_ENDI (cd)) { goto bad_cd; }
Signature · 1 line
2.19.1
Hi Kunkun,
Quoted 9 lines · Kunkun Jiang
The driver can query some bits in SMMUv3 IDR5 to learn which translation granules are supported. Arm recommends that SMMUv3 implementations support at least 4K and 64K granules. But in the vSMMUv3, there seems to be no reason not to support 16K translation granule. In addition, if 16K is not supported, vSVA will failed to be enabled in the future for 16K guest kernel. So it'd better to support it.
Signed-off-by Kunkun Jiang <[email protected]>
Looks good to me.
Thanks
Eric
Quoted 30 lines
--- hw/arm/smmuv3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)hw/arm/smmuv3.c +4
-2@@ -259,8 +259,9 @@ static void smmuv3_init_regs(SMMUv3State *s) s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,RIL ,1 ); s->idr[3 ] =FIELD_DP32 (s->idr[3 ],IDR3 ,HAD ,1 ); -/* 4K and 64K granule support */ +/* 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 */ @@ -503,7 +504,8 @@ static int decode_cd(SMMUTransCfg *cfg, CD *cd, SMMUEventInfo *event) tg =CD_TG (cd, i); tt->granule_sz =tg2granule (tg, i); -if ((tt->granule_sz !=12 && tt->granule_sz !=16 ) ||CD_ENDI (cd)) { +if ((tt->granule_sz !=12 && tt->granule_sz !=14 && + tt->granule_sz !=16 ) ||CD_ENDI (cd)) { goto bad_cd; }
Peter Maydell
AppliedQuoted 12 lines · Auger Eric
Hi Kunkun,
Quoted 8 lines · Kunkun Jiang
The driver can query some bits in SMMUv3 IDR5 to learn which translation granules are supported. Arm recommends that SMMUv3 implementations support at least 4K and 64K granules. But in the vSMMUv3, there seems to be no reason not to support 16K translation granule. In addition, if 16K is not supported, vSVA will failed to be enabled in the future for 16K guest kernel. So it'd better to support it.
Quoted 5 lines
Quoted 1 line
Signed-off-by Kunkun Jiang <[email protected]>Looks good to me.
Reviewed-by Eric Auger <[email protected]>Tested-by Eric Auger <[email protected]>
Applied to target-arm.next (for 6.1), thanks.
-- PMM