Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6830549rdb; Fri, 15 Dec 2023 09:20:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWLdKLCUAC2/BlxqZ00AhouTTfJG1pHhCzNj/QAml9eTBFNaRBitGrG3ePGZ0cTs85AnKP X-Received: by 2002:a05:620a:19a6:b0:77d:98c3:1eda with SMTP id bm38-20020a05620a19a600b0077d98c31edamr15673701qkb.43.1702660856259; Fri, 15 Dec 2023 09:20:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702660856; cv=none; d=google.com; s=arc-20160816; b=0Po+M9Vur3jVwVO1u2ikGxYz1Kh86R+jl0OtRgT2LF7EKXojCGGSA+OWj5HhErKZO3 BqxYguwu3By+cv01BjZS6up9oiC/HLpK0Q1zeQ/Vgv2I4L4fktLkEXz5yurysTWEl0Gk W2IKvmxXf/AfNb6A6UsHzcmE30HYG+/7CqroLXeSp4e3NSXRlRezP3lcKcg/X8xJvx9E Cb/7S+ETo1qOQvku5frCpnMOBh5ETx1yvi8JUDoVnG/skZewdXLN+Ppz4YzqFKApmy6x zhVoIL3lvdqKZ9+tjcP30AUECDYMZUJw75fuyzjxpQD0piv7jHGd/6nh6gqCNZ3DZcrx mcxg== ARC-Message-Signature: i=1; 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:organization:references :in-reply-to:message-id:subject:cc:to:from:date; bh=5slfa5MUqcYKEQcOkkiUO3LdguuWytvcDSz2xNouQHg=; fh=YYMyfi07xPN81oPP7P4R+cOm8nSeByLamxS8CKmBrAk=; b=Fj7owtkqfQMP3SKm5NEs5WJF5usefVf7WTz/4nyqxG4tiyC9mZXRHUTPKhBIkqJn/h oJ5sGgEoiQSLfDELgfhrpcHlZO2IRLkiZFuMMFVIlfGsm3v67kl5WFDA2xMafiAyE+eR iLtr8CoOy+ZUCh6Tr8o2rLvkqGUquspPnkmjzDjqaysSnpCbkmt9hxA+10co7off0w7U OPg0z4Gi0A1WBXjSDullb5cFwjmXm87pGvKLB0Allw79uMqbbqGNGcKCWmZJVv3qjEYC AHd15Sw6TJfZyIk+6cw6TBOPj7cCllhk00SSmGQgSdSLJ3lSLTKR3y6kzfn0tM7qiTCk clMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-1391-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1391-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ay17-20020a05620a179100b007681446a032si19638511qkb.269.2023.12.15.09.20.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 09:20:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1391-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; spf=pass (google.com: domain of linux-kernel+bounces-1391-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1391-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.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 E68431C240F5 for ; Fri, 15 Dec 2023 17:20:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BFF346529; Fri, 15 Dec 2023 17:12:34 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 9357D446DA; Fri, 15 Dec 2023 17:12:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=Huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SsG1y3GNgz6K8qY; Sat, 16 Dec 2023 01:10:30 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 5989E140447; Sat, 16 Dec 2023 01:12:29 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 15 Dec 2023 17:12:28 +0000 Date: Fri, 15 Dec 2023 17:12:27 +0000 From: Jonathan Cameron To: "Russell King (Oracle)" CC: , , , , , , , , , , , , , , Salil Mehta , Jean-Philippe Brucker , , , James Morse , Jose Marinho , Samer El-Haj-Mahmoud Subject: Re: [PATCH RFC v3 20/21] ACPI: Add _OSC bits to advertise OS support for toggling CPU present/enabled Message-ID: <20231215171227.00006550@Huawei.com> In-Reply-To: References: Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) On Wed, 13 Dec 2023 12:50:54 +0000 Russell King (Oracle) wrote: > From: James Morse > > Platform firmware can disabled a CPU, or make it not-present by making > an eject-request notification, then waiting for the os to make it offline OS > and call _EJx. After the firmware updates _STA with the new status. > > Not all operating systems support this. For arm64 making CPUs not-present > has never been supported. For all ACPI architectures, making CPUs disabled > has recently been added. Firmware can't know what the OS has support for. > > Add two new _OSC bits to advertise whether the OS supports the _STA enabled > or present bits being toggled for CPUs. This will be important for arm64 > if systems that support physical CPU hotplug ever appear as arm64 linux > doesn't currently support this, so firmware shouldn't try. > > Advertising this support to firmware is useful for cloud orchestrators > to know whether they can scale a particular VM by adding CPUs. > > Signed-off-by: James Morse > Tested-by: Miguel Luis > Tested-by: Vishnu Pajjuri > Tested-by: Jianyong Wu I'm very much in favor of this _OSC but it hasn't been accepted yet I think... https://bugzilla.tianocore.org/show_bug.cgi?id=4481 Jose? Github suggests you are the proposer on this. btw v4 looks ok but v5 in the tianocore github seems to have lost the actual OSC part. Jonathan > --- > I'm assuming Loongarch machines do not support physical CPU hotplug. > > Changes since RFC v3: > * Drop ia64 changes > * Update James' comment below "---" to remove reference to ia64 > > Outstanding comment: > https://lore.kernel.org/r/20230914175021.000018fd@Huawei.com > --- > arch/x86/Kconfig | 1 + > drivers/acpi/Kconfig | 9 +++++++++ > drivers/acpi/acpi_processor.c | 14 +++++++++++++- > drivers/acpi/bus.c | 16 ++++++++++++++++ > include/linux/acpi.h | 4 ++++ > 5 files changed, 43 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 64fc7c475ab0..33fc4dcd950c 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -60,6 +60,7 @@ config X86 > select ACPI_LEGACY_TABLES_LOOKUP if ACPI > select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI > select ACPI_HOTPLUG_PRESENT_CPU if ACPI_PROCESSOR && HOTPLUG_CPU > + select ACPI_HOTPLUG_IGNORE_OSC if ACPI && HOTPLUG_CPU > select ARCH_32BIT_OFF_T if X86_32 > select ARCH_CLOCKSOURCE_INIT > select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig > index 9c5a43d0aff4..020e7c0ab985 100644 > --- a/drivers/acpi/Kconfig > +++ b/drivers/acpi/Kconfig > @@ -311,6 +311,15 @@ config ACPI_HOTPLUG_PRESENT_CPU > depends on ACPI_PROCESSOR && HOTPLUG_CPU > select ACPI_CONTAINER > > +config ACPI_HOTPLUG_IGNORE_OSC > + bool > + depends on ACPI_HOTPLUG_PRESENT_CPU > + help > + Ignore whether firmware acknowledged support for toggling the CPU > + present bit in _STA. Some architectures predate the _OSC bits, so > + firmware doesn't know to do this. > + > + > config ACPI_PROCESSOR_AGGREGATOR > tristate "Processor Aggregator" > depends on ACPI_PROCESSOR > diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c > index ea12e70dfd39..5bb207a7a1dd 100644 > --- a/drivers/acpi/acpi_processor.c > +++ b/drivers/acpi/acpi_processor.c > @@ -182,6 +182,18 @@ static void __init acpi_pcc_cpufreq_init(void) > static void __init acpi_pcc_cpufreq_init(void) {} > #endif /* CONFIG_X86 */ > > +static bool acpi_processor_hotplug_present_supported(void) > +{ > + if (!IS_ENABLED(CONFIG_ACPI_HOTPLUG_PRESENT_CPU)) > + return false; > + > + /* x86 systems pre-date the _OSC bit */ > + if (IS_ENABLED(CONFIG_ACPI_HOTPLUG_IGNORE_OSC)) > + return true; > + > + return osc_sb_hotplug_present_support_acked; > +} > + > /* Initialization */ > static int acpi_processor_make_present(struct acpi_processor *pr) > { > @@ -189,7 +201,7 @@ static int acpi_processor_make_present(struct acpi_processor *pr) > acpi_status status; > int ret; > > - if (!IS_ENABLED(CONFIG_ACPI_HOTPLUG_PRESENT_CPU)) { > + if (!acpi_processor_hotplug_present_supported()) { > pr_err_once("Changing CPU present bit is not supported\n"); > return -ENODEV; > } > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > index 72e64c0718c9..7122450739d6 100644 > --- a/drivers/acpi/bus.c > +++ b/drivers/acpi/bus.c > @@ -298,6 +298,13 @@ EXPORT_SYMBOL_GPL(osc_sb_native_usb4_support_confirmed); > > bool osc_sb_cppc2_support_acked; > > +/* > + * ACPI 6.? Proposed Operating System Capabilities for modifying CPU > + * present/enable. > + */ > +bool osc_sb_hotplug_enabled_support_acked; > +bool osc_sb_hotplug_present_support_acked; > + > static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48"; > static void acpi_bus_osc_negotiate_platform_control(void) > { > @@ -346,6 +353,11 @@ static void acpi_bus_osc_negotiate_platform_control(void) > > if (!ghes_disable) > capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT; > + > + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_ENABLED_SUPPORT; > + if (IS_ENABLED(CONFIG_ACPI_HOTPLUG_PRESENT_CPU)) > + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_PRESENT_SUPPORT; > + > if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) > return; > > @@ -383,6 +395,10 @@ static void acpi_bus_osc_negotiate_platform_control(void) > capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT; > osc_cpc_flexible_adr_space_confirmed = > capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_CPC_FLEXIBLE_ADR_SPACE; > + osc_sb_hotplug_enabled_support_acked = > + capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_HOTPLUG_ENABLED_SUPPORT; > + osc_sb_hotplug_present_support_acked = > + capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_HOTPLUG_PRESENT_SUPPORT; > } > > kfree(context.ret.pointer); > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index 00be66683505..c572abac803c 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -559,12 +559,16 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); > #define OSC_SB_NATIVE_USB4_SUPPORT 0x00040000 > #define OSC_SB_PRM_SUPPORT 0x00200000 > #define OSC_SB_FFH_OPR_SUPPORT 0x00400000 > +#define OSC_SB_HOTPLUG_ENABLED_SUPPORT 0x00800000 > +#define OSC_SB_HOTPLUG_PRESENT_SUPPORT 0x01000000 > > extern bool osc_sb_apei_support_acked; > extern bool osc_pc_lpi_support_confirmed; > extern bool osc_sb_native_usb4_support_confirmed; > extern bool osc_sb_cppc2_support_acked; > extern bool osc_cpc_flexible_adr_space_confirmed; > +extern bool osc_sb_hotplug_enabled_support_acked; > +extern bool osc_sb_hotplug_present_support_acked; > > /* USB4 Capabilities */ > #define OSC_USB_USB3_TUNNELING 0x00000001