Skip to contentSkip to conversation

hw/intc/riscv_aplic: Remove redundant "hart_idx" masking

PATCH Applied Huang Borong 3 participants 3 messages Jan 15, 2025 – Jan 29, 2025 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/intc/riscv_aplic: Remove redundant "hart_idx" masking

Remove the redundant masking of "hart_idx", as the same operation is performed later during address calculation.

This change impacts the "hart_idx" value in the final qemu_log_mask() call. The original "hart_idx" parameter should be used for logging to ensure accuracy, rather than the masked value.

---
 hw/intc/riscv_aplic.c | 1 -
 1 file changed, 1 deletion(-)
hw/intc/riscv_aplic.c +0 -1
index 4866649115..0974c6a5db 100644
@@ -421,7 +421,6 @@ static void riscv_aplic_msi_send(RISCVAPLICState *aplic,
             APLIC_xMSICFGADDRH_HHXW_MASK;
 
     group_idx = hart_idx >> lhxw;
-    hart_idx &= APLIC_xMSICFGADDR_PPN_LHX_MASK(lhxw);
 
     addr = msicfgaddr;
     addr |= ((uint64_t)(msicfgaddrH & APLIC_xMSICFGADDRH_BAPPN_MASK)) << 32;
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Huang Borong

Remove the redundant masking of "hart_idx", as the same operation is performed later during address calculation.

This change impacts the "hart_idx" value in the final qemu_log_mask() call. The original "hart_idx" parameter should be used for logging to ensure accuracy, rather than the masked value.

---

Please add a changelog here when sending new versions. In this case, it could just be

v2: Improved commit message and added text about qemu_log_mask
to the commit message

Also CC reviewers of previous versions even if they weren't CC'ed on the version they reviewed.

Quoted 19 lines
 hw/intc/riscv_aplic.c | 1 -
 1 file changed, 1 deletion(-)
hw/intc/riscv_aplic.c +0 -1
index 4866649115..0974c6a5db 100644
@@ -421,7 +421,6 @@ static void riscv_aplic_msi_send(RISCVAPLICState *aplic,
             APLIC_xMSICFGADDRH_HHXW_MASK;
 
     group_idx = hart_idx >> lhxw;
-    hart_idx &= APLIC_xMSICFGADDR_PPN_LHX_MASK(lhxw);
 
     addr = msicfgaddr;
     addr |= ((uint64_t)(msicfgaddrH & APLIC_xMSICFGADDRH_BAPPN_MASK)) << 32;
Signature · 1 line
2.34.1
#2 lore raw
In reply to Huang Borong
Quoted 10 lines · Huang Borong

Remove the redundant masking of "hart_idx", as the same operation is performed later during address calculation.

This change impacts the "hart_idx" value in the final qemu_log_mask() call. The original "hart_idx" parameter should be used for logging to ensure accuracy, rather than the masked value.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 20 lines
---
 hw/intc/riscv_aplic.c | 1 -
 1 file changed, 1 deletion(-)
hw/intc/riscv_aplic.c +0 -2
index 4866649115..0974c6a5db 100644
@@ -421,7 +421,6 @@ static void riscv_aplic_msi_send(RISCVAPLICState *aplic,
             APLIC_xMSICFGADDRH_HHXW_MASK;
 
     group_idx = hart_idx >> lhxw;
-    hart_idx &= APLIC_xMSICFGADDR_PPN_LHX_MASK(lhxw);
 
     addr = msicfgaddr;
     addr |= ((uint64_t)(msicfgaddrH & APLIC_xMSICFGADDRH_BAPPN_MASK)) << 32;
--

2.34.1