|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] x86/vlapic: accept a logical destination of all ones as a broadcast
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).
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.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
---
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
CC: Teddy Astie <teddy.astie@xxxxxxxxxx>
xen/arch/x86/hvm/vlapic.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 6698779e22..ed745a810c 100644
--- 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)) &&
+ (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)) &&
+ (logical_id & mda & 0xf)) )
result = true;
break;
default:
--
2.47.3
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |