Re: [PATCH v4 07/48] KVM: arm64: gic-v5: Extract host IRS caps from IRS config frame

Sascha Bischoff <[email protected]> Fri, 31 Jul 2026 09:35:35 +0000
Newsgroups dev.linux.lists.sashiko-reviews,dev.linux.lists.kvmarm,org.kernel.vger.kvm
Message-ID <[email protected]>
On Fri, 2026-07-24 at 11:19 +0000, [email protected] wrote:
> > +	idr = irs_readl_relaxed(GICV5_IRS_IDR3);
> > +
> > +	irs_caps.max_vms =
> > BIT(FIELD_GET(GICV5_IRS_IDR3_VM_ID_BITS, idr));
> 
> [Severity: Medium]
> Should this have a + 1 applied to the field value, similar to how
> VPE_ID_BITS
> is handled below? 
> 
> GIC architecture ID bit fields canonically store the number of bits
> minus 1.
> If VM_ID_BITS follows the same pattern, omitting the + 1 will result
> in KVM
> calculating exactly half of the actual maximum number of VMs
> supported by the
> hardware, leading to premature resource exhaustion.

The field does NOT follow that pattern. Some fields have that, and
others do not. This one does not as adding an offset of +1 would break
things.

Thanks,
Sascha