Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1091874rdb; Fri, 20 Oct 2023 08:13:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFxb8jcWP1Q7dka0fQK1r7PItYgKmCWui/o1gIps1p9W48S2G4gJjLRnA8VuOjegRbvgf2 X-Received: by 2002:a17:902:f94b:b0:1c9:e830:160d with SMTP id kx11-20020a170902f94b00b001c9e830160dmr2423962plb.22.1697814783050; Fri, 20 Oct 2023 08:13:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697814783; cv=none; d=google.com; s=arc-20160816; b=bIjOnXhZiwQjQBf4nam9e6AFevR1zUcklFpk41jOSjDmV2CXtoBkEeqN4bFfbFDex7 1NRPr3hNmYl7U0lHgWz4/E/AKTstAuadyBEYVFMD/j4ejIIzPO+lkTX4GldbkJHhcI3Q vACyk3HIhivH4ZHgi//583Ip2vesuUixZRne+qD97R2+cuAPwQ8k3oJMid1wtfbVuyz3 jta9UyaC7W5fxZO4ZXIWaPWeMi9czSx1DEFoNvluTcH+cXCYdETACDIMpfl5G8u546q2 TcGAzqy1NY57zlRAgLl5NOtS8tHx4KQSdlb66WxbTNhITyEq1IP6BZ684j3NzwELd/M2 9SBg== 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=OEFwtSMMZqgW+ya44M/ybqIRLd+kkibFxvYC3u0YIVg=; fh=OvJRnOqsMTm9XoNmEwebcqh9Ud7yh1CTeKAP84ols98=; b=ynE9sw4wdEihNk7NrO5o++CHCNXAosgVh81EV0SKWPWys5bybmg5/3nOr20AnWDgzP 4ga7Cewusb4lg9BmBqXzJ9vog80VjSkc5wf8SKLQzIAAZ0Ue6JCUURzza0Al1EYmnggd maymPSUJaJbgpNFGsQC6qwX7W3rV21qAVK71BKp7CSC7m08+DGylPia5kZVVwvdLfA4X cqACpbGA4rqyb5AUYV006deNxsNbRXvZf+3mNw4UUUEosAsLUCfrfBXCYZRj8YEYzo49 l3yfHcdh0q9WuRDWxqY1ChrMc7yo2gx7DCeqtzLBSSqgXDStx4+Q9sPXLuWZo7ruM0du XNNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OA67ho2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id jo23-20020a170903055700b001ca8f6b3b8fsi1840510plb.266.2023.10.20.08.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 08:13:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OA67ho2f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 12F2582F4E0A; Fri, 20 Oct 2023 08:13:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377529AbjJTPM7 (ORCPT + 99 others); Fri, 20 Oct 2023 11:12:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377631AbjJTPM5 (ORCPT ); Fri, 20 Oct 2023 11:12:57 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 137A2D60 for ; Fri, 20 Oct 2023 08:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697814776; x=1729350776; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3y5HBaCbruvZDuSXbdYk2vE0ssqVScSk0E4lneENlsY=; b=OA67ho2f3XyDZjWR/DXxT8D7+WSHYel4yamtCsd/uEBz3xudt4C2kN9g GYayaIQ0icpYcvQDijIFH9UscSqiYMQl8CZQm3O7cY3K2HK0kcaG4ZUPM UdAXuzLXP8/aFiHBzHDSASOEy1hUnwEWyLcUFkIe+EC/avPzfjsz3nla/ TkANF+qN8Ub6+J7l/ZdCl5xCA7kYDuSvALB3wCynoSR0ixkiW622171pJ 6Q6fqCi2gbKO1QdznIJiN9EALuP4hoDf0VBMXnQsBvbXveYTR+3eKUuUn jnbog+MF/DIoMUqSqoa00g23PwJwXyS6DJKJ1wuBAEqaHJtBdD+1sTams g==; X-IronPort-AV: E=McAfee;i="6600,9927,10869"; a="376893594" X-IronPort-AV: E=Sophos;i="6.03,239,1694761200"; d="scan'208";a="376893594" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 08:12:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10869"; a="761080243" X-IronPort-AV: E=Sophos;i="6.03,239,1694761200"; d="scan'208";a="761080243" Received: from dgutows1-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.249.39.237]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2023 08:12:49 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id 0648110A295; Fri, 20 Oct 2023 18:12:45 +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: [PATCHv2 03/13] cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup Date: Fri, 20 Oct 2023 18:12:32 +0300 Message-ID: <20231020151242.1814-4-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020151242.1814-1-kirill.shutemov@linux.intel.com> References: <20231020151242.1814-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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 (snail.vger.email [0.0.0.0]); Fri, 20 Oct 2023 08:13:02 -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. 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 58cdfc0b6c0a..4bc1d5106afd 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 faebee0050a2..51c258f289ac 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1517,8 +1517,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