[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 22/41] hw/intc/arm_gicv3: Implement GICv4's new redistributor
From: |
Peter Maydell |
Subject: |
Re: [PATCH 22/41] hw/intc/arm_gicv3: Implement GICv4's new redistributor frame |
Date: |
Fri, 22 Apr 2022 09:39:35 +0100 |
On Sat, 9 Apr 2022 at 19:32, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/8/22 07:15, Peter Maydell wrote:
> > diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c
> > index 7c75dd6f072..9f1fe09a78e 100644
> > --- a/hw/intc/arm_gicv3_redist.c
> > +++ b/hw/intc/arm_gicv3_redist.c
> > @@ -442,8 +442,8 @@ MemTxResult gicv3_redist_read(void *opaque, hwaddr
> > offset, uint64_t *data,
> > * in the memory map); if so then the GIC has multiple MemoryRegions
> > * for the redistributors.
> > */
> > - cpuidx = region->cpuidx + offset / GICV3_REDIST_SIZE;
> > - offset %= GICV3_REDIST_SIZE;
> > + cpuidx = region->cpuidx + offset / gicv3_redist_size(s);
> > + offset %= gicv3_redist_size(s);
> >
> > cs = &s->cpu[cpuidx];
> >
> > @@ -501,8 +501,8 @@ MemTxResult gicv3_redist_write(void *opaque, hwaddr
> > offset, uint64_t data,
> > * in the memory map); if so then the GIC has multiple MemoryRegions
> > * for the redistributors.
> > */
> > - cpuidx = region->cpuidx + offset / GICV3_REDIST_SIZE;
> > - offset %= GICV3_REDIST_SIZE;
> > + cpuidx = region->cpuidx + offset / gicv3_redist_size(s);
> > + offset %= gicv3_redist_size(s);
>
> In these two cases, it would be better to call the function only once.
The compiler is smart enough to only actually call the function once
(and thus to do the / and % with a single div and imul), so I don't
think that explicitly adding a local variable and doing the call-once
by hand is really worthwhile.
thanks
-- PMM
- [PATCH 28/41] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for all LPIs" logic, (continued)
- [PATCH 28/41] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for all LPIs" logic, Peter Maydell, 2022/04/08
- [PATCH 21/41] hw/intc/arm_gicv3_its: Implement VINVALL, Peter Maydell, 2022/04/08
- [PATCH 19/41] hw/intc/arm_gicv3_its: Implement INV for virtual interrupts, Peter Maydell, 2022/04/08
- [PATCH 20/41] hw/intc/arm_gicv3_its: Implement VMOVI, Peter Maydell, 2022/04/08
- [PATCH 22/41] hw/intc/arm_gicv3: Implement GICv4's new redistributor frame, Peter Maydell, 2022/04/08
- [PATCH 24/41] hw/intc/arm_gicv3_cpuif: Split "update vIRQ/vFIQ" from gicv3_cpuif_virt_update(), Peter Maydell, 2022/04/08
- [PATCH 27/41] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for one LPI" logic, Peter Maydell, 2022/04/08
- [PATCH 29/41] hw/intc/arm_gicv3_redist: Recalculate hppvlpi on VPENDBASER writes, Peter Maydell, 2022/04/08
- [PATCH 31/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_process_vlpi(), Peter Maydell, 2022/04/08
- [PATCH 34/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_mov_vlpi(), Peter Maydell, 2022/04/08