Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3081004rdb; Mon, 4 Dec 2023 16:46:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvraOrJGWsyMpznsEdAMv4dOUfgKXnarZxxRoVw3ummRhwytepwF5qChROGN0JfR6ehBJ7 X-Received: by 2002:a05:6e02:20ca:b0:35d:61b8:faad with SMTP id 10-20020a056e0220ca00b0035d61b8faadmr7258417ilq.27.1701737203646; Mon, 04 Dec 2023 16:46:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701737203; cv=none; d=google.com; s=arc-20160816; b=V69g/bx2CE+Gp85m/rjS22kPKOHxYoVk48OGAzuikOQzy5LPnEZrwZ84W1+OzfotD9 jJb7+Jm3pTknhNVfNap1xgaNH+BChV3hpSzpQ/R378ogs3PgsGMwRzfOXbT/GmHN0oMS L6WKOrNJEbfKhZjNKnV3U75LsXXSjLYvEo8cqHquTRk5xoMltCzPl4KjKUGcTy6qwrWo xm/TpbB6lXtbA/mEwRePhK+YBsz8ZhxpU8RsK4lPei+On1X3msdqZDUs8iKarKZajW51 WJrPh003r2e5KbMYw/U6IaVQxBsfjTDgL3RCqinFsFrhYOPpuBsJH1kmNZiNhgAtuulV aGxw== 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=4LYU1JkhQsEB4ZLh0pJmrlKyXnc7vOu8FrgjgKYcm7s=; fh=OvJRnOqsMTm9XoNmEwebcqh9Ud7yh1CTeKAP84ols98=; b=yvEiTqXJYi89YLD7CW6/l6d0z5EhIb2A1uR4QgJb9inrcFiwmQAmpbssq1f8YQ+HZB pTHhSoSKNvPp2unnD6gbTOi2HO8TJe1yDouZF4L2TS5v9ic1MabCvMmD7bPvV8z1MV+9 Kn0reCK41weilKU5uaKdht6Qx7qpJqBSVGoZuTN/n938c0FWjdB0odL+dktL5mZOBRia wGjx6DDsxzUZR+Dkdru6TJkAMpsYA3mjxaFdDn6e9ZS0HmsOlaCtDZm0ZyYN1Z9MeW0Q sehCAavxG1wA09kKUsnEXuzS7DCnsYPD0lA0rfvXXX1T28Io+cN926bKP65ScZhyn1ov F4Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IyrNUkql; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d15-20020a65620f000000b005b8eaeabf49si8898161pgv.178.2023.12.04.16.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 16:46:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IyrNUkql; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id E7C18808460C; Mon, 4 Dec 2023 16:46:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343694AbjLEApc (ORCPT + 99 others); Mon, 4 Dec 2023 19:45:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbjLEApZ (ORCPT ); Mon, 4 Dec 2023 19:45:25 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B11EA4 for ; Mon, 4 Dec 2023 16:45:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701737131; x=1733273131; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x3xuiVtppGTtNOfAwJhMe/qF1cFiWNEHa9BAkXdB+As=; b=IyrNUkqlu5Gft91KP+D4oiZqC8X0y4U0zIUAjtMaHSiXiPGGYKX8mkCl a6tQh1vh4tbkYJyR69WPBrN2IU8ThqYjogeFrqOLGNeAmEwXTCV6KEN3B 5EQNWSe4DBLoMpWKzDq/9d+J0pPodTKMlpCCSj3t1QIkhZwc0RhmsGrsa bpJMCNr04W8R/vJhTCDV3rFjG/nP8cOeuwPrVqZmTwlu3CyshbWYbuWVb WqAeeURDMiky00LTSALExCGtfOwVm3zy8kQ7SDvRylRMsiK8/Cl2nqbKJ R8P8j0fnMkQJ5q5Mq5v9D1YwMJ2EWfauSn+0YPOEwQzIHeVjR/G+wfuIv A==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="392688625" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="392688625" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 16:45:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="888704375" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="888704375" Received: from abijaz-mobl2.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.61.240]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 16:45:22 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 5335A10A444; Tue, 5 Dec 2023 03:45:20 +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 , "Kalra, Ashish" , Sean Christopherson , "Huang, Kai" , Baoquan He , kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv4 04/14] cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup Date: Tue, 5 Dec 2023 03:45:00 +0300 Message-ID: <20231205004510.27164-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231205004510.27164-1-kirill.shutemov@linux.intel.com> References: <20231205004510.27164-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 04 Dec 2023 16:46:32 -0800 (PST) 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. Disable CPU offlining on ACPI MADT wakeup enumeration. Signed-off-by: Kirill A. Shutemov --- arch/x86/coco/core.c | 1 - arch/x86/kernel/acpi/madt_wakeup.c | 3 +++ include/linux/cc_platform.h | 10 ---------- kernel/cpu.c | 3 +-- 4 files changed, 4 insertions(+), 13 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 38ffd4524e44..f7e33cea1be5 100644 --- a/arch/x86/kernel/acpi/madt_wakeup.c +++ b/arch/x86/kernel/acpi/madt_wakeup.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -75,6 +76,8 @@ int __init acpi_parse_mp_wake(union acpi_subtable_headers *header, acpi_mp_wake_mailbox_paddr = mp_wake->base_address; + cpu_hotplug_disable_offlining(); + 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 af8034ccda8e..a9e1628cebbb 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1532,8 +1532,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_offline_disabled) + if (cpu_hotplug_offline_disabled) return -EOPNOTSUPP; if (cpu_hotplug_disabled) return -EBUSY; -- 2.41.0