From patchwork Mon Feb 12 10:44:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 199854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2465950dyd; Mon, 12 Feb 2024 06:35:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdAMht31/ET2A2tOqKpt74Kji4lR4LJQ2TQVC5w5yAEKf+yObNv4da7ciHqr7uMePsTUej X-Received: by 2002:a17:902:e54e:b0:1da:23e3:1de8 with SMTP id n14-20020a170902e54e00b001da23e31de8mr7014592plf.27.1707748530163; Mon, 12 Feb 2024 06:35:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707748530; cv=pass; d=google.com; s=arc-20160816; b=iT9MrP43ZBwMOIJsiXSVPZe1wjFrMywJAfU4UaMJEgWe4uyWKniL77DeSOpvP5FPWr SKuIHg87KwSwKfh6vqHm0myAvaZmrISMMP3WI8MmZYzSReNWjYyoF8UhILNYzkC5JG11 hqfCeXVkc3AwCkeqq8EZntktSCqm0olwfV1jRdygPmPTnnyrXFuyUXAzjnLadp9LE7Pf sMSA72BcSTs9Nei6r0upLmAC0I2rtJ5RGnZwuQlp+VX0v/pRQGZp89hHis/PH61M6v2y RLNv7wRfvyaPFwIxW65LrBRtYjaYhScHuuvfT9oLIr7mBqPlbia1Ds01CpSI6XgaNp9X FA5g== ARC-Message-Signature: i=2; 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=iU1ZlftgLUZTKojE64KaxxDuYt8xfxFymPnSI3m2MEY=; fh=nQnOcCXvsO1b0/cqMPvW6F5Y7xIak/Z+GJ+Zeihnhp8=; b=h521+N0aD472TKEq8HUoxEnZjdoffSIpiPygHW0BzBxfuMYmJ7XqsSMAyAtognHCCb PrVSylGqHiDxAQIRgX04zyC4QgKtGKf/HKlyLM/OrxRbNmUUkXq/W6S+Gg0/gPhhd32C vBcAjkYC38RZazIgStTrs2BPPZipcBbYVvbb+NyUWt+BbZ+8PRntzwe4TbV3yoIaXiGm 8el1MW3F4GTyJLFm204eV1Yv0uu7eS0PVDuUHbEia8TbPBX/rwOfmjQiDr67dyFRPER5 w8jYQgxZXidPbsXp8JsQMAXs01XXs6gxJ9QKPnoabT9KUzU9mO+UOyt85Z2BJpGT1I8U b5pQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WCYdhkOQ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61354-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61354-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXFNXP5vWVqSHzRy5Pg9ZA819yzA48LwCcqgVRndZiFR2RGN/73E/MBX4UxNvYOKy8GlYtUIz5KhqcLbA78pfekKwFxOA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b5-20020a170902650500b001d726df3b29si125469plk.305.2024.02.12.06.35.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 06:35:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61354-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WCYdhkOQ; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-61354-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61354-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 68AFB2858F0 for ; Mon, 12 Feb 2024 10:48:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A16293BB2A; Mon, 12 Feb 2024 10:45:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WCYdhkOQ" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (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 B7F633984A for ; Mon, 12 Feb 2024 10:45:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707734706; cv=none; b=l0MX1Ik6YwIT+ScHjF9AQhb10VpdVQLVEoQRJkcbPbf2BEx6vX6OtuuwzS6kNsqpb2vtsZlAuSd9wcvdXfQC7/MwTn4vh8na6W7hs6DIJJLhh5e6KbS91PTefNa7vtk/zSCH/AxB5po2q5pcCp/NBS3/tW50+sggheFovNJw0/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707734706; c=relaxed/simple; bh=ihRAX/Eyt4LbMVM80nu0CT6hBURKtph1gZYnA+gKNPw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R45KJ88uMAbq2gynnOQmql5z8+dU5wsTSlHpjLevOc2NsVlObiBFxwYPdSa3/QJyPwoYoZjbX28xBXLsHm/I5IR6KH0Go7WiqMbo0EEeNFOHs6TQiTc9JjMc15f+W83/DFxb3+wqjEe3M8LQo46c0yORffTsL0N/Cxt5SKK2py0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.helo=mgamail.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WCYdhkOQ; arc=none smtp.client-ip=192.198.163.17 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.helo=mgamail.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707734704; x=1739270704; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ihRAX/Eyt4LbMVM80nu0CT6hBURKtph1gZYnA+gKNPw=; b=WCYdhkOQISDp65W69B3IfwjyGx+9y1w2jfGMx+pepBoaWmyfLNqS9rgO obxpNrws5Zn2da/rJyRs19+Q27GuBSqDhnJ15F/rWRJGN5ZmlI8HVNt4k NDZQzkul+feRdHRD/IIzf9CeyDJnK8WkANeZH8Ee7vlcZWJkx6/Rod+HI kxMH4h/Y7IVLvPyZfVaupsd965sgsgDWS7gaouflvBIt+KGVJCZFnmTbq aSESAotfsENAYBVYqPpeqvaKv4EUayH5U8PAgnTy7CExuT14tPoNa/P98 J8LNJQTJXIlUW+5nliMeNLNNZUU6sKYTzSr1BNyOVpOUSgbjPCeFOuZRe A==; X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="1585015" X-IronPort-AV: E=Sophos;i="6.05,263,1701158400"; d="scan'208";a="1585015" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 02:44:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="935035577" X-IronPort-AV: E=Sophos;i="6.05,262,1701158400"; d="scan'208";a="935035577" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2024 02:44:54 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id 1C79D532; Mon, 12 Feb 2024 12:44:53 +0200 (EET) 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: [PATCHv7 04/16] cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup Date: Mon, 12 Feb 2024 12:44:36 +0200 Message-ID: <20240212104448.2589568-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212104448.2589568-1-kirill.shutemov@linux.intel.com> References: <20240212104448.2589568-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: 1790704122578064249 X-GMAIL-MSGID: 1790704122578064249 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 7c28a07afe8b..3ffdbb1f7bb4 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;