From patchwork Fri Dec 22 23:51:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 182808 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1394097dyi; Fri, 22 Dec 2023 15:53:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwzlsP3dfJArzddbsxcBJPlqVP/9RzqdtvMGwZVuhEIe5HDt+VGpPTewXofSIJ99PRbo2g X-Received: by 2002:a05:6214:27eb:b0:67f:2e6f:65ed with SMTP id jt11-20020a05621427eb00b0067f2e6f65edmr2832655qvb.39.1703289183908; Fri, 22 Dec 2023 15:53:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703289183; cv=none; d=google.com; s=arc-20160816; b=ecd9PgZhSw4Qpwj7pK2LklReICbD6E/VTQrdKt5cq3Ob8jr1M83ZPo+ntVWphrNW81 Mfsn4E0QJwIG1HUWTuLXxs4PknTqfDRVb0P5hfOajT4lulJmAUDCjX3mRFbnn7UIenkn GsqlCZCJ1rQr7mEUMRDNF14EYnVKJW+WiN4yONyidKvNG/QaGhNUzoRauBZcNBSRiTXo 874Uvt1dv+KPx6xtyxUTXFKeHE6gmf+0U44J4Oxw3n5JZZFt/1Mpb4+C6vRONw4KVjeA OQg+ClKdmS9DO8lj8nIoKdNjTFlaiqCzaQg+W5nJ5XOgS6GP9CDm+2w20XO7JJEvCO2v N3mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pyZW5KJD4F/wGTW2sSpjXW3Ih+6AlZJ5uX+Sso1EwXI=; fh=OvJRnOqsMTm9XoNmEwebcqh9Ud7yh1CTeKAP84ols98=; b=fx1Eq5L1R40hb6KzL/bFPjSK9RrPyXs9fs6cIWtVgvazXgBiUVSZhbtbl3WsY7Y975 zyOIOa8Qr2gTOLDEyvjFZh27DGJ3JRuVgJofuHhW94PjPELxUxwSKI1P40pEjKBTq4Dw Y7YCCspFxXmAOZKTPd3+83hZGrwxVgPJtIbYlm3kj161T+0iPo0bMqzS7XBG2QiIOy5U OmTpG/hFR3sTEMs703vWRo3xgYZ9J9v7IGvKzo8VYrYg1CQ3jOu3+6LA2YH4Crj4JRSU wbK5NbIwaQQXA0H4dWpzfYq5ITmJmqMS8oxY/GdmHrqHJD4nc0QXoUs+0bOomOTtvfTb wayQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Xbo/8kjW"; spf=pass (google.com: domain of linux-kernel+bounces-10128-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10128-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w17-20020a0ca811000000b0067f610329bfsi5166167qva.489.2023.12.22.15.53.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 15:53:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10128-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Xbo/8kjW"; spf=pass (google.com: domain of linux-kernel+bounces-10128-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10128-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8C2901C22848 for ; Fri, 22 Dec 2023 23:53:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4442F38DE5; Fri, 22 Dec 2023 23:52:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Xbo/8kjW" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97C3F35EEC for ; Fri, 22 Dec 2023 23:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703289141; x=1734825141; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VJQoaMr9pR2fhfjF3fTtKOF3w92bT2zKgTwlCgP2JIM=; b=Xbo/8kjWDGmWccLyZ5KMJpCZgQJnYIJASOGBCWWwcC3wJKMWXxSu/A4c XcqVukOspmXrlRb7gfwbjXbpGKrhDxTY42+8UR21sKSjggS6ssXLBKCvT sskVkdRWuGkGOR8rGPAmIQoZJILQmrmkQToSmIoVjwzjr0/4OZQ/+yNre wLWg0+HwROuO2GmsK+amHPJ0NtSF1Hc00CrG1OtxsghhiQdd6bB9Dq4le K/8+8rax2gJfCNTj+RG9YCpK5MHbgnHHZF2gGyjhQT16/Ffo+NSiG4gAV lZI6xxpVO8g1LENDJjg7z30OXHnYtwn4yRZP1HTwO0Oo/YUC697KyMOdo A==; X-IronPort-AV: E=McAfee;i="6600,9927,10932"; a="3414328" X-IronPort-AV: E=Sophos;i="6.04,297,1695711600"; d="scan'208";a="3414328" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 15:52:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10932"; a="726961474" X-IronPort-AV: E=Sophos;i="6.04,297,1695711600"; d="scan'208";a="726961474" Received: from jeroenke-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.249.35.180]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 15:52:14 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 0353E10A472; Sat, 23 Dec 2023 02:52:12 +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: [PATCHv5 04/16] cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup Date: Sat, 23 Dec 2023 02:51:56 +0300 Message-ID: <20231222235209.32143-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231222235209.32143-1-kirill.shutemov@linux.intel.com> References: <20231222235209.32143-1-kirill.shutemov@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786028159649052039 X-GMAIL-MSGID: 1786028159649052039 ACPI MADT doesn't allow to offline CPU after it got woke up. Currently CPU hotplug is 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 Reviewed-by: Thomas Gleixner --- 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 cf79ea6f3007..d222be8d7a07 100644 --- a/arch/x86/kernel/acpi/madt_wakeup.c +++ b/arch/x86/kernel/acpi/madt_wakeup.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include +#include #include #include #include @@ -76,6 +77,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 a2e17f085079..a81475d2a5c0 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;