|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] x86/vlapic: accept a logical destination of all ones as a broadcast
On 17.11.2026 03:05, Stefano Stabellini wrote:
> In logical destination mode, a destination of all ones is a broadcast
> accepted by every local APIC: 0xff in xAPIC mode, in both the flat and
> the cluster model (AMD APM vol. 2, 16.6.1), and 0xffffffff in x2APIC
> mode (AMD APM vol. 2 Rev 3.39, 16.14).
While revision number plus section number properly disambiguate things,
this still isn't very practical: Readers may not have that revision to
hand. Therefore we (much) prefer section titles; amending them by rev+
secno is okay.
> vlapic_match_logical_addr() treated these as ordinary logical
> destinations, so a broadcast reached only the vLAPICs whose logical ID
> happened to match it. In particular, a vLAPIC whose logical ID is 0
> received no logical broadcast at all.
>
> Match the broadcast in each model. A destination format register naming
> neither model still matches nothing.
Along the lines of what you say here, why not a simpler change in the
sole caller of vlapic_match_logical_addr(), with this as a result (sans
comment for now):
case APIC_DEST_NOSHORT:
if ( dest == _VLAPIC_ID(target, 0xffffffffU) )
return true;
if ( dest_mode )
return vlapic_match_logical_addr(target, dest);
return dest == VLAPIC_ID(target);
? Otherwise I'd be inclined to ask for simplification of ...
> --- a/xen/arch/x86/hvm/vlapic.c
> +++ b/xen/arch/x86/hvm/vlapic.c
> @@ -209,9 +209,16 @@ static bool vlapic_match_logical_addr(const struct
> vlapic *vlapic, uint32_t mda)
> bool result = false;
> uint32_t logical_id = vlapic_get_reg(vlapic, APIC_LDR);
>
> + /*
> + * A destination of all ones is a broadcast in logical destination mode
> + * too, accepted by every local APIC: 0xffffffff in x2APIC mode (AMD APM
> + * vol. 2 Rev 3.39, 16.14), and 0xff in both the flat and the cluster
> + * model in xAPIC mode (AMD APM vol. 2, 16.6.1).
> + */
> if ( vlapic_x2apic_mode(vlapic) )
> - return ((logical_id >> 16) == (mda >> 16)) &&
> - (uint16_t)(logical_id & mda);
> + return (mda == 0xffffffffU) ||
> + (((logical_id >> 16) == (mda >> 16)) &&
... this and ...
> + (uint16_t)(logical_id & mda));
>
> logical_id = GET_xAPIC_LOGICAL_ID(logical_id);
> mda = (uint8_t)mda;
> @@ -219,11 +226,13 @@ static bool vlapic_match_logical_addr(const struct
> vlapic *vlapic, uint32_t mda)
> switch ( vlapic_get_reg(vlapic, APIC_DFR) )
> {
> case APIC_DFR_FLAT:
> - if ( logical_id & mda )
> + if ( (mda == 0xff) || (logical_id & mda) )
> result = true;
> break;
> case APIC_DFR_CLUSTER:
> - if ( ((logical_id >> 4) == (mda >> 0x4)) && (logical_id & mda & 0xf)
> )
> + if ( (mda == 0xff) ||
> + (((logical_id >> 4) == (mda >> 0x4)) &&
... this while touching this code anyway.
Jan
> + (logical_id & mda & 0xf)) )
> result = true;
> break;
> default:
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |