From patchwork Wed Nov 15 12:00:34 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: 165310 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2486249vqg; Wed, 15 Nov 2023 04:02:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbbYjiKUBsvO4DqEAD4Mai97XNfHji+mXAinULn6h6J4G+7/x5QRXOVS4V6DNU9BsxE/By X-Received: by 2002:a05:6a21:7891:b0:171:c88a:890c with SMTP id bf17-20020a056a21789100b00171c88a890cmr10706207pzc.25.1700049770634; Wed, 15 Nov 2023 04:02:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700049770; cv=none; d=google.com; s=arc-20160816; b=BH6nDbJQyYW6VCT7hrD1bW9EfoCl0oLcwGcK/WZ0tQhAbQIIy27OACvHXD+mxqUmsR /ss5Vfazp0uAkNZT8nXh/kG36tIgw/MI/io8LZ6/6EwaxP/bHn97arVyhpiaEEP5/SS2 uwzcvvylcJaGhIJaOpQKfLlIjILFyebDnB9BOlQqGpTZrbILDEof29e5SSaG5uPdmN0d D6hP5buPeJfO8QCljA4VsNbe6qyPTgk3VjwO/6JJ+LaKqvbTDB8r1iwAHScdK/seBrB7 fOjaBoUjlT1EkRO31fxRbucUAQCPjQ4m4aIcKhOr6tq+V3jYzsvIH9mWmjPhtsUfNhYA AdgA== 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=Z+e9ouI+Yr1Mtlk9MsZtoLZ4FpY8fwTOGLDEDjn1vlVDQwcFZINMvB9TXPVOpfp2Yn egUlvl3ZKIokITbwtcfyU5DSmYByeEt2wRB5JLHncFkklna+wcfkbVwX+EENu7b8B2Rm cpZbvRB/cRZlUoTBxfUbBclIgRj38NbsOy+xv0XJ5BVcHRl/jbd+xa960VT/StQKpNL+ Us82xPpChMGvBO1SWpOf4ky7q/XPSwXnLMCd20IDvwDJnVx7CBFqq/KHqVjCFZ/MzhQT Psak6vGTan37JTxlbLMDeRUcWLYSNlOtZXmttgGLrRvjPrOLStDyPUmKf+K3H1QoiZ4M Mxpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="B/Cc9Fyt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id g18-20020a056a000b9200b006a68a46431bsi10332589pfj.50.2023.11.15.04.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 04:02:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="B/Cc9Fyt"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 7CF1080C3A1D; Wed, 15 Nov 2023 04:02:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343710AbjKOMB2 (ORCPT + 28 others); Wed, 15 Nov 2023 07:01:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343607AbjKOMBX (ORCPT ); Wed, 15 Nov 2023 07:01:23 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 611B9120 for ; Wed, 15 Nov 2023 04:01:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700049680; x=1731585680; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x3xuiVtppGTtNOfAwJhMe/qF1cFiWNEHa9BAkXdB+As=; b=B/Cc9Fytx2ykAXucScNIf4m9S8lKwEqVlOdpZv5bUAE+c3t3qfjrcMKe +HxGYmzTRi/tAVIF6xcaQMdvA9quSI1MjwdyL0mQF5vm6MAaIdVyemjg/ h/9sR6/izGcb/LscpFtj+p9n6msRzbzVf1p6Ie6gGkWKfU/YAIzCoHk1O V2MbRVUKeO2RvKTC2yXBF3hYYsHvA5gQPyLrPDQtPN8r44dq6G9Psh2m/ WQlfqtiXXMh12/vd11jTM7pdLfwmKYuG+AlqOODySGVregJmWs2D3qqxC o7dJujwVMYm1kofXIVC7zEijMbuQiVvqePlChhiCXq8ytA6/8Okkfmgde A==; X-IronPort-AV: E=McAfee;i="6600,9927,10894"; a="12411886" X-IronPort-AV: E=Sophos;i="6.03,304,1694761200"; d="scan'208";a="12411886" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 04:01:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,304,1694761200"; d="scan'208";a="6377673" Received: from mituomis-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.249.44.135]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 04:01:15 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 5A69510A119; Wed, 15 Nov 2023 15:01: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: [PATCHv3 04/14] cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup Date: Wed, 15 Nov 2023 15:00:34 +0300 Message-ID: <20231115120044.8034-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115120044.8034-1-kirill.shutemov@linux.intel.com> References: <20231115120044.8034-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 15 Nov 2023 04:02:23 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782631388286362935 X-GMAIL-MSGID: 1782631388286362935 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 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;