On Tue, 13 Oct 2026 at 09:40, Peter Maydell <[email protected]> wrote:
>
> The ICH_CONTEXTR_EL2 register is how the hypervisor tells the GICv5
> to make a VCPU for a VM resident on a CPU, so that the IRS will
> forward virtual interrupts for that VCPU to this CPU. We implement
> this similarly to the GICv5 stream protocol, which uses a
> SetResident command to tell the IRS to make the VCPU resident.
> This will always fail until we have implemented the IRS's
> end of virtualization support.
>
> Signed-off-by: Peter Maydell <[email protected]>
> ---
> + /*
> + * Changing V definitely causes us to make a new VPE resident, or
> + * remove the old one.
> + *
> + * Changing VPE or VM while V=1 is CONSTRAINED UNPREDICTABLE
> + * (R_VFKHN): we choose to make the new VPE resident so that we
> + * can trust that the information we have in the register matches
> + * what the IRS thinks the resident VPE is.
> + *
> + * For writes that don't trigger a change of resident VPE, we only
> + * need to update our copy of the register, and recalculate
> + * interrupts if IIRICHPPIDIS changed.
> + *
> + * If we do change the resident VPE, the interrupt recalculation
> + * will happen when the IRS calls gicv5_forward_interrupt().
> + */
> + if (!(valid_changed || (valid && vm_vpe_changed))) {
> + if ((oldval & value) & R_ICH_CONTEXTR_EL2_IRICHPPIDIS_MASK) {
This is supposed to be the usual "did a bit change?" check,
which should be "oldval ^ value", not "&"...
-- PMM