Skip to contentSkip to conversation

hw/riscv/riscv-iommu: Use standard EN_PRI bit for PRI

PATCH Superseded Jay Chang 2 participants 2 messages Mar 24 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jay Chang

author
#0 lore raw

PATCH 1/1 hw/riscv/riscv-iommu: Use standard EN_PRI bit for PRI

Replace the temporary custom extension bit (TC[32]) with the standard EN_PRI bit defined in RISC-V IOMMU specification.

---
 hw/riscv/riscv-iommu.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
hw/riscv/riscv-iommu.c +2 -5
index 225394ea83..7d5c8cd7f5 100644
@@ -1572,11 +1572,8 @@ static int riscv_iommu_translate(RISCVIOMMUState *s, RISCVIOMMUContext *ctx,
     riscv_iommu_hpm_incr_ctr(s, ctx, RISCV_IOMMU_HPMEVENT_URQ);
 
     iot_cache = g_hash_table_ref(s->iot_cache);
-    /*
-     * TC[32] is reserved for custom extensions, used here to temporarily
-     * enable automatic page-request generation for ATS queries.
-     */
-    enable_pri = (iotlb->perm == IOMMU_NONE) && (ctx->tc & BIT_ULL(32));
+    enable_pri = (iotlb->perm == IOMMU_NONE) &&
+        (ctx->tc & RISCV_IOMMU_DC_TC_EN_PRI);
     enable_pid = (ctx->tc & RISCV_IOMMU_DC_TC_PDTV);
 
     /* Check for ATS request. */
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Jay Chang

Replace the temporary custom extension bit (TC[32]) with the standard EN_PRI bit defined in RISC-V IOMMU specification.

---
  hw/riscv/riscv-iommu.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)
hw/riscv/riscv-iommu.c +0 -0
index 225394ea83..7d5c8cd7f5 100644

hw/riscv/riscv-iommu.c static int riscv_iommu_translate(RISCVIOMMUState *s, RISCVIOMMUContext *ctx, · line 1576

Quoted 10 lines
hw/riscv/riscv-iommu.c +2 -5
@@ -1572,11 +1572,8 @@ static int riscv_iommu_translate(RISCVIOMMUState *s, RISCVIOMMUContext *ctx,
      riscv_iommu_hpm_incr_ctr(s, ctx, RISCV_IOMMU_HPMEVENT_URQ);
 
      iot_cache = g_hash_table_ref(s->iot_cache);
-    /*
-     * TC[32] is reserved for custom extensions, used here to temporarily
-     * enable automatic page-request generation for ATS queries.
-     */
-    enable_pri = (iotlb->perm == IOMMU_NONE) && (ctx->tc & BIT_ULL(32));
+    enable_pri = (iotlb->perm == IOMMU_NONE) &&
+        (ctx->tc & RISCV_IOMMU_DC_TC_EN_PRI);

Better to align with the first word on the right side of '='.  Like:

+ enable_pri = (iotlb->perm == IOMMU_NONE) &&
+ (ctx->tc & RISCV_IOMMU_DC_TC_EN_PRI);

Otherwise,

Thanks,
Nutty

Quoted 3 lines
hw/riscv/riscv-iommu.c +0 -0
      enable_pid = (ctx->tc & RISCV_IOMMU_DC_TC_PDTV);
 
      /* Check for ATS request. */