From patchwork Tue Dec 5 00:45:00 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: 173613 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3133812vqy; Mon, 4 Dec 2023 16:46:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6pgZpATyipWSpxmmWgM3lE4r5NuGEec9tGfptAWtxzcZ8dOSmPZCQa7FS5FL977qoGNym X-Received: by 2002:a05:6808:1a8f:b0:3b8:b063:5d8b with SMTP id bm15-20020a0568081a8f00b003b8b0635d8bmr3804358oib.114.1701737184840; Mon, 04 Dec 2023 16:46:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701737184; cv=none; d=google.com; s=arc-20160816; b=NVcOFviV658eyph0JCMuVwCHQKzeenQulq4SVezjz+z87/NBgqLzs8U0v9zTA5GV53 ZBWhpvWTbMsLijl/5X1G4F+4MOPGBSsSU0BNcqg60D/nuO+0Lnq3413C2WgXVNCIQzU+ 4Q7aGbW9VLReLOkHRdNecYqfkICw4Gau3TMdbVu+DUa+B8/kgkan9Ynq1UVYD0bVOIl5 ql3TiVapOa0nS3o5mx8VpHoxOHxAAv+zkgxQ6w2WjuQrqxLpVmirq4OiYu7IhxxXu8Ni JQIyrQ7zXUnz7c+JYk+iRK+rCElwIrA/YWI5VhJY2YgrKZyB8+bqZcVciyNB9vUWSVEl DsOA== 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 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id w62-20020a636241000000b005c6707eedb1si3754101pgb.679.2023.12.04.16.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 16:46:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; 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 23.128.96.33 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 5E362804C609; Mon, 4 Dec 2023 16:46:17 -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 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:17 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784400770286641946 X-GMAIL-MSGID: 1784400770286641946 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 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 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;