@@ -396,6 +396,22 @@ ioapic_fix_smi_unsupported(uint64_t *entry)
}
}
+static inline void
+ioapic_fix_init_sipi_unsupported(uint64_t *entry)
+{
+ uint64_t delmode = *entry & IOAPIC_LVT_DELIV_MODE;
+ if (delmode == IOAPIC_DM_INIT << IOAPIC_LVT_DELIV_MODE_SHIFT ||
+ delmode == IOAPIC_DM_SIPI << IOAPIC_LVT_DELIV_MODE_SHIFT) {
+ /*
+ * ignore a request for delivery mode of lowest SMI
+ */
+ warn_report_once("attempting to set delivery mode to INIT/SIPI"
+ "which is not supported");
+ *entry &= ~IOAPIC_LVT_DELIV_MODE;
+ *entry |= IOAPIC_DM_FIXED << IOAPIC_LVT_DELIV_MODE_SHIFT;
+ }
+}
+
static void
ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,
unsigned int size)
@@ -442,6 +458,9 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,
if (s->smi_unsupported) {
ioapic_fix_smi_unsupported(&s->ioredtbl[index]);
}
+ if (s->init_sipi_unsupported) {
+ ioapic_fix_init_sipi_unsupported(&s->ioredtbl[index]);
+ }
ioapic_fix_edge_remote_irr(&s->ioredtbl[index]);
ioapic_service(s);
}
@@ -185,6 +185,23 @@ static void ioapic_common_set_smi_unsupported(Object *obj, bool value,
s->smi_unsupported = value;
}
+static bool ioapic_common_get_init_sipi_unsupported(Object *obj, Error **errp)
+{
+ IOAPICCommonState *s = IOAPIC_COMMON(obj);
+ return s->init_sipi_unsupported;
+}
+
+static void ioapic_common_set_init_sipi_unsupported(Object *obj, bool value,
+ Error **errp)
+{
+ DeviceState *dev = DEVICE(obj);
+ IOAPICCommonState *s = IOAPIC_COMMON(obj);
+ /* only disabling before realize is allowed */
+ assert(!dev->realized);
+ assert(!s->init_sipi_unsupported);
+ s->init_sipi_unsupported = value;
+}
+
static void ioapic_common_init(Object *obj)
{
object_property_add_bool(obj, "level_trigger_unsupported",
@@ -194,6 +211,10 @@ static void ioapic_common_init(Object *obj)
object_property_add_bool(obj, "smi_unsupported",
ioapic_common_get_smi_unsupported,
ioapic_common_set_smi_unsupported);
+
+ object_property_add_bool(obj, "init_sipi_unsupported",
+ ioapic_common_get_init_sipi_unsupported,
+ ioapic_common_set_init_sipi_unsupported);
}
static void ioapic_common_realize(DeviceState *dev, Error **errp)
@@ -105,6 +105,7 @@ struct IOAPICCommonState {
Notifier machine_done;
bool level_trigger_unsupported;
bool smi_unsupported;
+ bool init_sipi_unsupported;
uint8_t version;
uint64_t irq_count[IOAPIC_NUM_PINS];
int irq_level[IOAPIC_NUM_PINS];