On Tue, 13 Oct 2026 at 11:54, Philippe Mathieu-Daudé
<[email protected]> wrote:
>
> On 13/10/26 10:39, Peter Maydell wrote:
> > When the GICv5 CPU interface wants to make a VPE resident, it calls
> > gicv5_set_resident(). Currently that is a do-nothing placeholder;
> > implement the required behaviour of tracking on the IRS side that
> > the VPE is resident on this CPU, and remembering the information
> > about the doorbell interrupt.
> >
> > For each CPU, we keep a note of the current VPE that is resident (if
> > any), so we have an easy way to get to that information given the CPU
> > index in functions like gicv5_set_priority().  Since the only way to
> > make a VPE invalid is to make the entire VM invalid, we only need to
> > set this info in gicv5_set_resident() and then clear it when a VM
> > becomes invalid or the whole VM table is made invalid.
> >
> > Signed-off-by: Peter Maydell <[email protected]>
> > ---
> >   hw/intc/arm_gicv5.c         | 115 +++++++++++++++++++++++++++++++++++-
> >   hw/intc/trace-events        |   2 +
> >   include/hw/intc/arm_gicv5.h |   5 ++
>
> (please enable scripts/git.orderfile to ease mailing list code review)

Done.

> > @@ -1566,6 +1649,8 @@ static void irs_vmt_baser_write(GICv5 *s, GICv5Domain 
> > domain, uint64_t value)
> >               return;
> >           }
> >           irs_clean_vm_cache(cs, &s->vmt_config[domain]);
> > +        /* No VPE is now resident on any CPU */
> > +        memset(s->res_vpe, 0, sizeof(VPE) * cs->num_cpus);
>
> res_vpe is declared as:
>
>    VPE **res_vpe;
>
> so IIUC we should use sizeof(*VPE), or the sizeof(*s->res_vpe)
> used below to keep the same style.

Yes. I found and fixed this bug in the reset code path, which is why
that part is different, but didn't notice I still had the same bug here.
We should use the same thing we do below (it makes it more obvious that
the type is correct than using "VPE*", I think).

> >           cs->irs_vmt_baser[domain] = FIELD_DP64(cs->irs_vmt_baser[domain],
> >                                                  IRS_VMT_BASER, VALID, 
> > valid);
>
>
> > @@ -2884,6 +2985,11 @@ static void gicv5_reset_hold(Object *obj, ResetType 
> > type)
> >               g_hash_table_remove_all(s->vmt_config[i].vm_cache);
> >           }
> >       }
> > +
> > +    if (s->res_vpe) {
> > +        /* No VPE is now resident on any CPU */
> > +        memset(s->res_vpe, 0, sizeof(*s->res_vpe) * cs->num_cpus);
>
> OK.

thanks
-- PMM

Reply via email to