Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp348464rdb; Thu, 5 Oct 2023 07:43:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSrHfmxORWc4sXLJatahgO8aM89ty4t/kK4xXGiBBkqTmMlhKiBqOEf3ihXxoMCefBgDvJ X-Received: by 2002:a05:6358:3418:b0:142:fb25:c7e6 with SMTP id h24-20020a056358341800b00142fb25c7e6mr5417684rwd.13.1696517039436; Thu, 05 Oct 2023 07:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696517039; cv=none; d=google.com; s=arc-20160816; b=DzsspFl/X7mgireS4rHbr3vcaCSrFDGDakjfIxue1kN7xkc7xA+GS7UBd5dHPch+Rn qnvAIgA86RQeRx5+BZqnVFPg7YtihJMNKg9+owJiwTaClpXV8BeLkuN9wVMGzYRiL2Z8 HE+TxWs0w/7L8nYvoyd+tDskUF79bBeumCwz6FWeSOWlUDYaStsoV+PiZD7isL9DwfId ZOQnzy8e7QNioYDeyB8X6q36Hc9tulW3HpLF0qCar7N6UWUdieqYmCvmqKbWT8xFs45w x9rRsG+N2hRZtp9LtnkiueOXgDK0ChVHOiC04r7Zr4IJEXWpLQ5fVYlzm5t0+OdJQuEQ Lh8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ts6fwCrw/TilDmRh7VytWxNn3jjGIo0e+qTqpAkQALc=; fh=F1gpqSS/HYttK+doOKuW4yrAifo5qykyq1MCI9SIQmQ=; b=as4B7YuqJYNwgXjpmO/9YD1cPchuT+J0reUNgQ+OCodL7LgipnndQ3EWGP4O5QfrPu jEBJKDJndQEBnsG54YhE7jcqEJZMXs/bDqvv/5UdEzWlvf0UVGq9kBcOcfdqV2KcLGJw iPr5M5q4Jdz8nrWE38BIJSXOWhRpzyScfWbIhDIyUUmlc59XrXjXp8+ptAi+YxYIc2Oo tbJgOTjBohVPPs+SSTvuPa4YcPT3sOl/NCbYPNLvlTlT2ptqup8yZRY6Z5qJcnzNdDzs v3FaMHZEsWfdFXn9SgXONoQRk+z2aa1zJoZ4Xyl46GNXjDq8qm+5OsAP0FHvqQj+D4M7 Y2PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XmucqGNR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id r37-20020a635165000000b0055e607f1e99si1496108pgl.882.2023.10.05.07.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:43:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XmucqGNR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A598F860AD31; Thu, 5 Oct 2023 07:43:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238302AbjJEOnj (ORCPT + 99 others); Thu, 5 Oct 2023 10:43:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237204AbjJEOip (ORCPT ); Thu, 5 Oct 2023 10:38:45 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 870344E367 for ; Thu, 5 Oct 2023 07:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696514656; x=1728050656; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UutLKR1Vg2FeYITzS3ethN6UgzHw9Sr7YlTqsZDUwd0=; b=XmucqGNRRfm93DC4BT2r5OcHuuRUny0dk0lZC6N4/1ptOwWo7DDNtHyB AFhErLcTN2LUFBiIEJUeKF6Tpzk0bOk5dZg6AyYyskuIFoRHqBAW9EFBe dPRCa9fFcheFYK0hIdFOr2/6X65Gh6HfUWzwyqln1CjLouFrHFJAy5Qzo gZ7FOK/dlgwjAahMcwidpN6kwxXOyDQWdhZ5s1ROAYMWMSbNl14Gz91Ds T3xaKEsf08EmcKIp9Ajh3jQjooRF5lABuqZRaYKbzFnLNfhaweDMHiDpL C7S++Slmi2N+3zcVKcddn2hkUBv6R99l8JE02B1gR3YKB6nTa0Nc96FdF w==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="382357451" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="382357451" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 06:14:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="817564303" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="817564303" Received: from skwasnia-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.251.222.71]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 06:14:16 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 2BD9910A14A; Thu, 5 Oct 2023 16:14:14 +0300 (+03) From: "Kirill A. Shutemov" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org Cc: "Rafael J. Wysocki" , Peter Zijlstra , Adrian Hunter , Kuppuswamy Sathyanarayanan , Elena Reshetova , Jun Nakajima , Rick Edgecombe , Tom Lendacky , kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 03/13] cpu/hotplug, x86/acpi: Disable CPU hotplug for ACPI MADT wakeup Date: Thu, 5 Oct 2023 16:13:52 +0300 Message-ID: <20231005131402.14611-4-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231005131402.14611-1-kirill.shutemov@linux.intel.com> References: <20231005131402.14611-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:43:57 -0700 (PDT) ACPI MADT doesn't allow to offline CPU after it got woke up. Currently hotplug prevented based on the confidential computing attribute which is set for Intel TDX. But TDX is not the only possible user of the wake up method. Mark CPU hotplug as "not supported" on ACPI MADT wakeup enumeration. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/core.c | 1 - arch/x86/kernel/acpi/madt_wakeup.c | 4 ++++ include/linux/cc_platform.h | 10 ---------- kernel/cpu.c | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/arch/x86/coco/core.c b/arch/x86/coco/core.c index eeec9986570e..f07c3bb7deab 100644 --- a/arch/x86/coco/core.c +++ b/arch/x86/coco/core.c @@ -20,7 +20,6 @@ static bool noinstr intel_cc_platform_has(enum cc_attr attr) { switch (attr) { case CC_ATTR_GUEST_UNROLL_STRING_IO: - case CC_ATTR_HOTPLUG_DISABLED: case CC_ATTR_GUEST_MEM_ENCRYPT: case CC_ATTR_MEM_ENCRYPT: return true; diff --git a/arch/x86/kernel/acpi/madt_wakeup.c b/arch/x86/kernel/acpi/madt_wakeup.c index 1b9747bfd5b9..15bdf10b1393 100644 --- a/arch/x86/kernel/acpi/madt_wakeup.c +++ b/arch/x86/kernel/acpi/madt_wakeup.c @@ -1,4 +1,5 @@ #include +#include #include /* Physical address of the Multiprocessor Wakeup Structure mailbox */ @@ -74,6 +75,9 @@ int __init acpi_parse_mp_wake(union acpi_subtable_headers *header, acpi_mp_wake_mailbox_paddr = mp_wake->base_address; + /* Disable CPU onlining/offlining */ + cpu_hotplug_not_supported(); + apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu); return 0; diff --git a/include/linux/cc_platform.h b/include/linux/cc_platform.h index cb0d6cd1c12f..d08dd65b5c43 100644 --- a/include/linux/cc_platform.h +++ b/include/linux/cc_platform.h @@ -80,16 +80,6 @@ enum cc_attr { * using AMD SEV-SNP features. */ CC_ATTR_GUEST_SEV_SNP, - - /** - * @CC_ATTR_HOTPLUG_DISABLED: Hotplug is not supported or disabled. - * - * The platform/OS is running as a guest/virtual machine does not - * support CPU hotplug feature. - * - * Examples include TDX Guest. - */ - CC_ATTR_HOTPLUG_DISABLED, }; #ifdef CONFIG_ARCH_HAS_CC_PLATFORM diff --git a/kernel/cpu.c b/kernel/cpu.c index cf536fe1a88a..9d4279476b40 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1522,7 +1522,7 @@ static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target) * If the platform does not support hotplug, report it explicitly to * differentiate it from a transient offlining failure. */ - if (cc_platform_has(CC_ATTR_HOTPLUG_DISABLED) || !cpu_hotplug_supported) + if (!cpu_hotplug_supported) return -EOPNOTSUPP; if (cpu_hotplug_disabled) return -EBUSY; -- 2.41.0