summaryrefslogtreecommitdiff
path: root/sys/dev/xen
diff options
context:
space:
mode:
authorRoger Pau Monné <royger@FreeBSD.org>2022-11-29 15:21:51 +0000
committerRoger Pau Monné <royger@FreeBSD.org>2022-11-29 15:36:34 +0000
commitbc9a5b049797fb7484dc1448f5d806955499f1f0 (patch)
tree3cbdae5c799600eb21f409ff7dcb401340dd9eab /sys/dev/xen
parentbad602850e56d9e3b4900c0063a40dd29ea448fe (diff)
Diffstat (limited to 'sys/dev/xen')
-rw-r--r--sys/dev/xen/cpu/xen_acpi_cpu.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/dev/xen/cpu/xen_acpi_cpu.c b/sys/dev/xen/cpu/xen_acpi_cpu.c
index 724634b9fa5f..e95da324bda0 100644
--- a/sys/dev/xen/cpu/xen_acpi_cpu.c
+++ b/sys/dev/xen/cpu/xen_acpi_cpu.c
@@ -506,6 +506,31 @@ xen_acpi_cpu_probe(device_t dev)
return (BUS_PROBE_SPECIFIC);
}
+static bool
+is_processor_online(unsigned int acpi_id)
+{
+ unsigned int i, maxid;
+ struct xen_platform_op op = {
+ .cmd = XENPF_get_cpuinfo,
+ };
+ int ret = HYPERVISOR_platform_op(&op);
+
+ if (ret)
+ return (false);
+
+ maxid = op.u.pcpu_info.max_present;
+ for (i = 0; i <= maxid; i++) {
+ op.u.pcpu_info.xen_cpuid = i;
+ ret = HYPERVISOR_platform_op(&op);
+ if (ret)
+ continue;
+ if (op.u.pcpu_info.acpi_id == acpi_id)
+ return (op.u.pcpu_info.flags & XEN_PCPU_FLAGS_ONLINE);
+ }
+
+ return (false);
+}
+
static int
xen_acpi_cpu_attach(device_t dev)
{
@@ -544,6 +569,10 @@ xen_acpi_cpu_attach(device_t dev)
}
}
+ if (!is_processor_online(sc->cpu_acpi_id))
+ /* Processor is not online, attach the driver and ignore it. */
+ return (0);
+
/*
* Install the notify handler now: even if we fail to parse or upload
* the states it shouldn't prevent us from attempting to parse further