[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 30/41] hw/intc/arm_gicv3_redist: Factor out "update bit in pe
From: |
Richard Henderson |
Subject: |
Re: [PATCH 30/41] hw/intc/arm_gicv3_redist: Factor out "update bit in pending table" code |
Date: |
Sat, 9 Apr 2022 13:21:19 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 |
On 4/8/22 07:15, Peter Maydell wrote:
+ if (extract32(pend, irq % 8, 1) == level) {
Here you assume level in {0,1}...
+ pend = deposit32(pend, irq % 8, 1, level ? 1 : 0);
... and here you force it into {0,1}.
Better to have the compiler do that with bool level.
You might consider
uint8_t bit = 1 << (irq % 8);
read();
if (!(pend & bit) ^ level) {
no change
}
pend ^= bit;
write();
as a follow up; extract + deposit seems unnecessary.
Anyway, with the bool thing fixed,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
- [PATCH 36/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_inv_vlpi(), (continued)
- [PATCH 36/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_inv_vlpi(), Peter Maydell, 2022/04/08
- [PATCH 37/41] hw/intc/arm_gicv3: Update ID and feature registers for GICv4, Peter Maydell, 2022/04/08
- [PATCH 25/41] hw/intc/arm_gicv3_cpuif: Support vLPIs, Peter Maydell, 2022/04/08
- [PATCH 26/41] hw/intc/arm_gicv3_cpuif: Don't recalculate maintenance irq unnecessarily, Peter Maydell, 2022/04/08
- [PATCH 30/41] hw/intc/arm_gicv3_redist: Factor out "update bit in pending table" code, Peter Maydell, 2022/04/08
- Re: [PATCH 30/41] hw/intc/arm_gicv3_redist: Factor out "update bit in pending table" code,
Richard Henderson <=
- [PATCH 33/41] hw/intc/arm_gicv3_redist: Use set_pending_table_bit() in mov handling, Peter Maydell, 2022/04/08
- [PATCH 39/41] hw/arm/virt: Use VIRT_GIC_VERSION_* enum values in create_gic(), Peter Maydell, 2022/04/08
- [PATCH 32/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_vlpi_pending(), Peter Maydell, 2022/04/08
- [PATCH 40/41] hw/arm/virt: Abstract out calculation of redistributor region capacity, Peter Maydell, 2022/04/08
- Re: [PATCH 00/41] arm: Implement GICv4, Peter Maydell, 2022/04/08