On 2022/6/22 19:15, Kai Huang wrote:
@@ -357,6 +358,17 @@ static int acpi_processor_add(struct acpi_device *device,
struct device *dev;
int result = 0;
+ /*
+ * If the confidential computing platform doesn't support ACPI
+ * memory hotplug, the BIOS should never deliver such event to
memory or cpu hotplug?
+ * the kernel. Report ACPI CPU hot-add as a BIOS bug and ignore
+ * the new CPU.
+ */
+ if (cc_platform_has(CC_ATTR_ACPI_CPU_HOTPLUG_DISABLED)) {
+ dev_err(&device->dev, "[BIOS bug]: Platform doesn't support ACPI CPU hotplug. New CPU ignored.\n");
+ return -EINVAL;
+ }
+
pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
if (!pr)
return -ENOMEM;
@@ -434,6 +446,17 @@ static void acpi_processor_remove(struct acpi_device *device)
if (!device || !acpi_driver_data(device))
return;
+ /*
+ * The confidential computing platform is broken if ACPI memory
ditto
+ * hot-removal isn't supported but it happened anyway. Assume
+ * it's not guaranteed that the kernel can continue to work
+ * normally. Just BUG().
+ */
+ if (cc_platform_has(CC_ATTR_ACPI_CPU_HOTPLUG_DISABLED)) {
+ dev_err(&device->dev, "Platform doesn't support ACPI CPU hotplug. BUG().\n");
+ BUG();
+ }