Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp828610lqs; Fri, 14 Jun 2024 06:59:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkvzpTQgCceOz99SGzUw6F/laL5hPmp/UNHmSLsG7SBSntPQbl69HeCxiC9EDxJaK7NRqWSXM5/+fiQ5tX/Eg6bwH1mzxWcHZbDhKWxA== X-Google-Smtp-Source: AGHT+IF/lXuy9sEZzYGKoxPjVnC1mdBSvKo8mpxabBnjVwYK0aa/mSBnM7mYNyMvw1AWqe0KavCH X-Received: by 2002:a05:6830:1390:b0:6fb:8b05:2c79 with SMTP id 46e09a7af769-6fb9376c248mr3325229a34.16.1718373559145; Fri, 14 Jun 2024 06:59:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718373559; cv=pass; d=google.com; s=arc-20160816; b=pHJ/VE8J4H/TMCX1ukzS7XQ6atzJKCnx8rch/ifozJjqUih2UDfiKtGvczdnP7ClCN ron+3KuND5hZpM9IxwiWHHJshE211Nrfz3LrjodwMBBYoZnA7CCkPdzjK688NerqTD7A TeKT2bvSYf4yuxlOCe1YkfCx8R6c3d0pIgyHRKgo7x0kAZLfMW5RDAE3iucvUpI2bnKN SoaQS72SWRz5y+zhLGdB02mTv9vcrcVGxGGU+yz65zC/MsbhjSSEYRiOhfELYJ7lY1jV V6WLPzN0WTYoqzFEqMsge5/DXvw1mz21g8JYWbOP02+b+dRHNbleLLGd8g9oleif1PPx c+sQ== 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=RJYJdUB3RSut58NVsYLb82SvkVwbO2eNpHPZ8kqn7Dc=; fh=cPmJNda8c601wC/77Nyp+sUEZAven/FLIGVJKzRwPVw=; b=Jo2CIIOOgfumqezSajMXk9YZ7uWnkY1NVfBOJcNcgpcr5fjgkgUIFe+TSKeCbm3u9q DhBFWkzdtFSe+FUk60soK9lYKCmF1wy3e1U3CqU7eqxwrQYYDzxluHffekKGvO/H/fDm Cv+KIRvD/PZi16iE9BhZZtPjcSLmdiK7Q4s1SlH+/sjA9/iSmzF2D10xEfxeSIzebyGY SxS9lU6C8iDXekQH8HoJ6p891nsyDiD3BVEr80QqnycYZqEhOXQ2tlbsmcTc4SlXO7dN oH3AwXB3a4pzQVtMP2+TvD8pCZlnCbU0bC26cgN+tPVVWLP7v3K1h/i0EnqcswPd3tH4 LuAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="H+/RDKFz"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-214707-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214707-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-441ef3ba1aasi36593901cf.134.2024.06.14.06.59.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 06:59:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214707-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="H+/RDKFz"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-214707-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214707-linux.lists.archive=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 DA7101C255E2 for ; Fri, 14 Jun 2024 10:00:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB738195399; Fri, 14 Jun 2024 09:59:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="H+/RDKFz" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 4EB4B192B95; Fri, 14 Jun 2024 09:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718359159; cv=none; b=nbFKEioj5gnLo2bUQmq0AC1RecalcBCYi3XcMBcgusQuqcPtUkk1scoyUQAeLEbSApwbQq7ovRcX9adHBp0UOtVOPU+bs2lgjjesYq441kWB7NnMOJdQnYQytfqHLQ7SdKRoptjMdE81dE9TMmtDT54bzygJq5AoLCk6y+dUbU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718359159; c=relaxed/simple; bh=fyGOMpA0bytiIUBWmRIiG3omrNG4mIyQ9nld5RBIUQA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vD7HDhv6T96m7zbE2eVTspUYsSLc40kxElt+Msk6I3036uOFO0XrC1KeSOHSs2VgKpft1/FXhw+n85u1PzK1kr79wNcr2NgT5A2x6qPseypOkPDAVU3chESH9Dgls2JZ3+TYDGexgHcv6ExJv2cxRo9RFXxGdfeTVLDfnJxLbnE= 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=H+/RDKFz; arc=none smtp.client-ip=192.198.163.16 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=1718359158; x=1749895158; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fyGOMpA0bytiIUBWmRIiG3omrNG4mIyQ9nld5RBIUQA=; b=H+/RDKFzYneTUO8c9zcixW6ujdVFkcb7JrAPd+e1Pd5tgmHN4ZFoCspy 50bbgevKA64SCVBvk3FqxSdzFyN9rEPVz0/+KrluJ7ktVqR0t2TsQiD35 c/oibo+FqT+N3YcHNSbF4FEi6kq1qu1Lrfdga0zl23jnynk7al9Kfiuna dkUKlW2FuORMYufHibxAUzN4hsadsuVnjTw62Nj7c7We/WKgnXN7QukLJ m4e2kA0no6GLPUrn1xaUO4CO8+RsjQTXwVmpYHICqnqAzKy83WSaFE3KA Nti8/muNNHkABuWdoGpN7IDFkDsYortVXJzluwPdBX1o60RKvDehrHqPH g==; X-CSE-ConnectionGUID: KwLucCVdTImU9uRsk+mgAw== X-CSE-MsgGUID: MsYuyQFDQvSpIxzNGghG6w== X-IronPort-AV: E=McAfee;i="6700,10204,11102"; a="12072329" X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="12072329" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2024 02:59:16 -0700 X-CSE-ConnectionGUID: 7ulnDtgYSXqhQN1MrNDKYg== X-CSE-MsgGUID: pgUsI12bTZiAgoY6X5ysbw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,237,1712646000"; d="scan'208";a="44995804" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa004.fm.intel.com with ESMTP; 14 Jun 2024 02:59:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id AB928291D; Fri, 14 Jun 2024 12:59:08 +0300 (EEST) 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" , Ard Biesheuvel , Baoquan He , "H. Peter Anvin" , "Kirill A. Shutemov" , "K. Y. Srinivasan" , Haiyang Zhang , kexec@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-acpi@vger.kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, "Rafael J . Wysocki" , Tao Liu Subject: [PATCHv12 04/19] cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup Date: Fri, 14 Jun 2024 12:58:49 +0300 Message-ID: <20240614095904.1345461-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240614095904.1345461-1-kirill.shutemov@linux.intel.com> References: <20240614095904.1345461-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 Content-Transfer-Encoding: 8bit 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. Any platform that uses ACPI MADT wakeup method cannot offline CPU. Disable CPU offlining on ACPI MADT wakeup enumeration. The change has no visible effects for users: currently, TDX guest is the only platform that uses the ACPI MADT wakeup method. Signed-off-by: Kirill A. Shutemov Acked-by: Rafael J. Wysocki Reviewed-by: Thomas Gleixner Tested-by: Tao Liu --- 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 b31ef2424d19..0f81f70aca82 100644 --- a/arch/x86/coco/core.c +++ b/arch/x86/coco/core.c @@ -29,7 +29,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 60693a145894..caa4b4430634 100644 --- a/include/linux/cc_platform.h +++ b/include/linux/cc_platform.h @@ -81,16 +81,6 @@ enum cc_attr { */ 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, - /** * @CC_ATTR_HOST_SEV_SNP: AMD SNP enabled on the host. * diff --git a/kernel/cpu.c b/kernel/cpu.c index 4c15b478e2bc..a609385c7f99 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1481,8 +1481,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.43.0