From: Gavin Shan <gshan@redhat.com>
To: Salil Mehta <salil.mehta@huawei.com>,
qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: maz@kernel.org, jean-philippe@linaro.org,
jonathan.cameron@huawei.com, lpieralisi@kernel.org,
peter.maydell@linaro.org, richard.henderson@linaro.org,
imammedo@redhat.com, andrew.jones@linux.dev, david@redhat.com,
philmd@linaro.org, eric.auger@redhat.com, will@kernel.org,
ardb@kernel.org, oliver.upton@linux.dev, pbonzini@redhat.com,
mst@redhat.com, rafael@kernel.org, borntraeger@linux.ibm.com,
alex.bennee@linaro.org, linux@armlinux.org.uk,
darren@os.amperecomputing.com, ilkka@os.amperecomputing.com,
vishnu@os.amperecomputing.com, karl.heubaum@oracle.com,
miguel.luis@oracle.com, salil.mehta@opnsrc.net,
zhukeqian1@huawei.com, wangxiongfeng2@huawei.com,
wangyanan55@huawei.com, jiakernel2@gmail.com,
maobibo@loongson.cn, lixianglai@loongson.cn
Subject: Re: [PATCH RFC V2 35/37] hw/arm: Support hotplug capability check using _OSC method
Date: Fri, 29 Sep 2023 14:23:21 +1000 [thread overview]
Message-ID: <ddbc526e-bba3-6b93-753f-6ba3de183755@redhat.com> (raw)
In-Reply-To: <20230926103654.34424-4-salil.mehta@huawei.com>
Hi Salil,
On 9/26/23 20:36, Salil Mehta wrote:
> Physical CPU hotplug results in (un)setting of ACPI _STA.Present bit. AARCH64
> platforms do not support physical CPU hotplug. Virtual CPU hotplug support being
> implemented toggles ACPI _STA.Enabled Bit to achieve hotplug functionality. This
> is not same as physical CPU hotplug support.
>
> In future, if ARM architecture supports physical CPU hotplug then the current
> design of virtual CPU hotplug can be used unchanged. Hence, there is a need for
> firmware/VMM/Qemu to support evaluation of platform wide capabilitiy related to
> the *type* of CPU hotplug support present on the platform. OSPM might need this
> during boot time to correctly initialize the CPUs and other related components
> in the kernel.
>
> NOTE: This implementation will be improved to add the support of *query* in the
> subsequent versions. This is very minimal support to assist kernel.
>
> ASL for the implemented _OSC method:
>
> Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities
> {
> CreateDWordField (Arg3, Zero, CDW1)
> If ((Arg0 == ToUUID ("0811b06e-4a27-44f9-8d60-3cbbc22e7b48") /* Platform-wide Capabilities */))
> {
> CreateDWordField (Arg3, 0x04, CDW2)
> Local0 = CDW2 /* \_SB_._OSC.CDW2 */
> If ((Arg1 != One))
> {
> CDW1 |= 0x08
> }
>
> Local0 &= 0x00800000
> If ((CDW2 != Local0))
> {
> CDW1 |= 0x10
> }
>
> CDW2 = Local0
> }
> Else
> {
> CDW1 |= 0x04
> }
>
> Return (Arg3)
> }
>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> ---
> hw/arm/virt-acpi-build.c | 52 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 52 insertions(+)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index cbccd2ca2d..377450dd16 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -861,6 +861,55 @@ static void build_fadt_rev6(GArray *table_data, BIOSLinker *linker,
> build_fadt(table_data, linker, &fadt, vms->oem_id, vms->oem_table_id);
> }
>
> +static void build_virt_osc_method(Aml *scope, VirtMachineState *vms)
> +{
> + Aml *if_uuid, *else_uuid, *if_rev, *if_caps_masked, *method;
> + Aml *a_cdw1 = aml_name("CDW1");
> + Aml *a_cdw2 = aml_local(0);
> +
> + method = aml_method("_OSC", 4, AML_NOTSERIALIZED);
> + aml_append(method, aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1"));
> +
> + /* match UUID */
> + if_uuid = aml_if(aml_equal(
> + aml_arg(0), aml_touuid("0811B06E-4A27-44F9-8D60-3CBBC22E7B48")));
> +
> + aml_append(if_uuid, aml_create_dword_field(aml_arg(3), aml_int(4), "CDW2"));
> + aml_append(if_uuid, aml_store(aml_name("CDW2"), a_cdw2));
> +
> + /* check unknown revision in arg(1) */
> + if_rev = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(1))));
> + /* set revision error bits, DWORD1 Bit[3] */
> + aml_append(if_rev, aml_or(a_cdw1, aml_int(0x08), a_cdw1));
> + aml_append(if_uuid, if_rev);
> +
> + /*
> + * check support for vCPU hotplug type(=enabled) platform-wide capability
> + * in DWORD2 as sepcified in the below ACPI Specification ECR,
> + * # https://bugzilla.tianocore.org/show_bug.cgi?id=4481
> + */
> + if (vms->acpi_dev) {
> + aml_append(if_uuid, aml_and(a_cdw2, aml_int(0x800000), a_cdw2));
> + /* check if OSPM specified hotplug capability bits were masked */
> + if_caps_masked = aml_if(aml_lnot(aml_equal(aml_name("CDW2"), a_cdw2)));
> + aml_append(if_caps_masked, aml_or(a_cdw1, aml_int(0x10), a_cdw1));
> + aml_append(if_uuid, if_caps_masked);
> + }
> + aml_append(if_uuid, aml_store(a_cdw2, aml_name("CDW2")));
> +
> + aml_append(method, if_uuid);
> + else_uuid = aml_else();
> +
> + /* set unrecognized UUID error bits, DWORD1 Bit[2] */
> + aml_append(else_uuid, aml_or(a_cdw1, aml_int(4), a_cdw1));
> + aml_append(method, else_uuid);
> +
> + aml_append(method, aml_return(aml_arg(3)));
> + aml_append(scope, method);
> +
> + return;
> +}
> +
The check on vms->acpi_dev seems not enough. We may still need to check
mc->has_hotpluggable_cpus and vms->gic_version etc. Besides, the "return"
at end of the function isn't needed.
> /* DSDT */
> static void
> build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> @@ -894,6 +943,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> } else {
> acpi_dsdt_add_cpus(scope, vms);
> }
> +
> + build_virt_osc_method(scope, vms);
> +
> acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
> (irqmap[VIRT_UART] + ARM_SPI_BASE));
> if (vmc->acpi_expose_flash) {
Thanks,
Gavin
next prev parent reply other threads:[~2023-09-29 4:24 UTC|newest]
Thread overview: 146+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 10:03 [PATCH RFC V2 00/37] Support of Virtual CPU Hotplug for ARMv8 Arch Salil Mehta via
2023-09-26 10:04 ` [PATCH RFC V2 01/37] arm/virt, target/arm: Add new ARMCPU {socket, cluster, core, thread}-id property Salil Mehta via
2023-09-26 23:57 ` [PATCH RFC V2 01/37] arm/virt,target/arm: Add new ARMCPU {socket,cluster,core,thread}-id property Gavin Shan
2023-10-02 9:53 ` Salil Mehta via
2023-10-02 9:53 ` Salil Mehta
2023-10-03 5:05 ` Gavin Shan
2023-09-26 10:04 ` [PATCH RFC V2 02/37] cpus-common: Add common CPU utility for possible vCPUs Salil Mehta via
2023-09-27 3:54 ` Gavin Shan
2023-10-02 10:21 ` Salil Mehta via
2023-10-02 10:21 ` Salil Mehta
2023-10-03 5:34 ` Gavin Shan
2023-09-26 10:04 ` [PATCH RFC V2 03/37] hw/arm/virt: Move setting of common CPU properties in a function Salil Mehta via
2023-09-27 5:16 ` Gavin Shan
2023-10-02 10:24 ` Salil Mehta via
2023-10-02 10:24 ` Salil Mehta
2023-10-10 6:46 ` Shaoqin Huang
2023-10-10 9:47 ` Salil Mehta via
2023-10-10 9:47 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 04/37] arm/virt, target/arm: Machine init time change common to vCPU {cold|hot}-plug Salil Mehta via
2023-09-27 6:28 ` [PATCH RFC V2 04/37] arm/virt,target/arm: " Gavin Shan
2023-10-02 16:12 ` Salil Mehta via
2023-10-02 16:12 ` Salil Mehta
2024-01-16 15:59 ` Jonathan Cameron via
2023-09-27 6:30 ` Gavin Shan
2023-10-02 10:27 ` Salil Mehta via
2023-10-02 10:27 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 05/37] accel/kvm: Extract common KVM vCPU {creation, parking} code Salil Mehta via
2023-09-27 6:51 ` [PATCH RFC V2 05/37] accel/kvm: Extract common KVM vCPU {creation,parking} code Gavin Shan
2023-10-02 16:20 ` Salil Mehta via
2023-10-02 16:20 ` Salil Mehta
2023-10-03 5:39 ` Gavin Shan
2023-09-26 10:04 ` [PATCH RFC V2 06/37] arm/virt, kvm: Pre-create disabled possible vCPUs @machine init Salil Mehta via
2023-09-27 10:04 ` [PATCH RFC V2 06/37] arm/virt,kvm: " Gavin Shan
2023-10-02 16:39 ` Salil Mehta via
2023-10-02 16:39 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 07/37] arm/virt, gicv3: Changes to pre-size GIC with possible vcpus " Salil Mehta via
2023-09-28 0:14 ` Gavin Shan
2023-10-16 16:15 ` Salil Mehta via
2023-10-16 16:15 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 08/37] arm/virt: Init PMU at host for all possible vcpus Salil Mehta via
2023-09-26 10:04 ` [PATCH RFC V2 09/37] hw/acpi: Move CPU ctrl-dev MMIO region len macro to common header file Salil Mehta via
2023-09-28 0:19 ` Gavin Shan
2023-10-16 16:20 ` Salil Mehta via
2023-10-16 16:20 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 10/37] arm/acpi: Enable ACPI support for vcpu hotplug Salil Mehta via
2023-09-28 0:25 ` Gavin Shan
2023-10-16 21:23 ` Salil Mehta via
2023-10-16 21:23 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 11/37] hw/acpi: Add ACPI CPU hotplug init stub Salil Mehta via
2023-09-28 0:28 ` Gavin Shan
2023-10-16 21:27 ` Salil Mehta via
2023-10-16 21:27 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 12/37] hw/acpi: Use qemu_present_cpu() API in ACPI CPU hotplug init Salil Mehta via
2023-09-28 0:40 ` Gavin Shan
2023-10-16 21:41 ` Salil Mehta via
2023-10-16 21:41 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 13/37] hw/acpi: Init GED framework with cpu hotplug events Salil Mehta via
2023-09-28 0:56 ` Gavin Shan
2023-10-16 21:44 ` Salil Mehta via
2023-10-16 21:44 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 14/37] arm/virt: Add cpu hotplug events to GED during creation Salil Mehta via
2023-09-28 1:03 ` Gavin Shan
2023-10-16 21:46 ` Salil Mehta via
2023-10-16 21:46 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 15/37] arm/virt: Create GED dev before *disabled* CPU Objs are destroyed Salil Mehta via
2023-09-28 1:08 ` Gavin Shan
2023-10-16 21:54 ` Salil Mehta via
2023-10-16 21:54 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 16/37] hw/acpi: Update CPUs AML with cpu-(ctrl)dev change Salil Mehta via
2023-09-28 1:26 ` Gavin Shan
2023-10-16 21:57 ` Salil Mehta via
2023-10-16 21:57 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 17/37] arm/virt/acpi: Build CPUs AML with CPU Hotplug support Salil Mehta via
2023-09-28 1:36 ` Gavin Shan
2023-10-16 22:05 ` Salil Mehta via
2023-10-16 22:05 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 18/37] arm/virt: Make ARM vCPU *present* status ACPI *persistent* Salil Mehta via
2023-09-28 23:18 ` Gavin Shan
2023-10-16 22:33 ` Salil Mehta via
2023-10-16 22:33 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 19/37] hw/acpi: ACPI/AML Changes to reflect the correct _STA.{PRES, ENA} Bits to Guest Salil Mehta via
2023-09-28 23:33 ` [PATCH RFC V2 19/37] hw/acpi: ACPI/AML Changes to reflect the correct _STA.{PRES,ENA} " Gavin Shan
2023-10-16 22:59 ` Salil Mehta via
2023-10-16 22:59 ` Salil Mehta
2024-01-17 21:46 ` [PATCH RFC V2 19/37] hw/acpi: ACPI/AML Changes to reflect the correct _STA.{PRES, ENA} " Jonathan Cameron via
2023-09-26 10:04 ` [PATCH RFC V2 20/37] hw/acpi: Update GED _EVT method AML with cpu scan Salil Mehta via
2023-09-28 23:35 ` Gavin Shan
2023-10-16 23:01 ` Salil Mehta via
2023-10-16 23:01 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 21/37] hw/arm: MADT Tbl change to size the guest with possible vCPUs Salil Mehta via
2023-09-28 23:43 ` Gavin Shan
2023-10-16 23:15 ` Salil Mehta via
2023-10-16 23:15 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 22/37] hw/acpi: Make _MAT method optional Salil Mehta via
2023-09-28 23:50 ` Gavin Shan
2023-10-16 23:17 ` Salil Mehta via
2023-10-16 23:17 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 23/37] arm/virt: Release objects for *disabled* possible vCPUs after init Salil Mehta via
2023-09-28 23:57 ` Gavin Shan
2023-10-16 23:28 ` Salil Mehta via
2023-10-16 23:28 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 24/37] hw/acpi: Update ACPI GED framework to support vCPU Hotplug Salil Mehta via
2023-09-26 11:02 ` Michael S. Tsirkin
2023-09-26 11:37 ` Salil Mehta via
2023-09-26 12:00 ` Michael S. Tsirkin
2023-09-26 12:27 ` Salil Mehta via
2023-09-26 13:02 ` lixianglai
2023-09-26 10:04 ` [PATCH RFC V2 25/37] arm/virt: Add/update basic hot-(un)plug framework Salil Mehta via
2023-09-29 0:20 ` Gavin Shan
2023-10-16 23:40 ` Salil Mehta via
2023-10-16 23:40 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 26/37] arm/virt: Changes to (un)wire GICC<->vCPU IRQs during hot-(un)plug Salil Mehta via
2023-09-26 10:04 ` [PATCH RFC V2 27/37] hw/arm, gicv3: Changes to update GIC with vCPU hot-plug notification Salil Mehta via
2023-09-26 10:04 ` [PATCH RFC V2 28/37] hw/intc/arm-gicv3*: Changes required to (re)init the vCPU register info Salil Mehta via
2023-09-26 10:04 ` [PATCH RFC V2 29/37] arm/virt: Update the guest(via GED) about CPU hot-(un)plug events Salil Mehta via
2023-09-29 0:30 ` Gavin Shan
2023-10-16 23:48 ` Salil Mehta via
2023-10-16 23:48 ` Salil Mehta
2023-09-26 10:04 ` [PATCH RFC V2 30/37] hw/arm: Changes required for reset and to support next boot Salil Mehta via
2023-09-26 10:04 ` [PATCH RFC V2 31/37] physmem, gdbstub: Common helping funcs/changes to *unrealize* vCPU Salil Mehta via
2023-10-03 6:33 ` [PATCH RFC V2 31/37] physmem,gdbstub: " Philippe Mathieu-Daudé
2023-10-03 10:22 ` Salil Mehta via
2023-10-03 10:22 ` Salil Mehta
2023-10-04 9:17 ` Salil Mehta via
2023-10-04 9:17 ` Salil Mehta
2023-09-26 10:36 ` [PATCH RFC V2 32/37] target/arm: Add support of *unrealize* ARMCPU during vCPU Hot-unplug Salil Mehta via
2023-09-26 10:36 ` [PATCH RFC V2 33/37] target/arm/kvm: Write CPU state back to KVM on reset Salil Mehta via
2023-09-26 10:36 ` [PATCH RFC V2 34/37] target/arm/kvm, tcg: Register/Handle SMCCC hypercall exits to VMM/Qemu Salil Mehta via
2023-09-29 4:15 ` [PATCH RFC V2 34/37] target/arm/kvm,tcg: " Gavin Shan
2023-10-17 0:03 ` Salil Mehta via
2023-10-17 0:03 ` Salil Mehta
2023-09-26 10:36 ` [PATCH RFC V2 35/37] hw/arm: Support hotplug capability check using _OSC method Salil Mehta via
2023-09-29 4:23 ` Gavin Shan [this message]
2023-10-17 0:13 ` Salil Mehta via
2023-10-17 0:13 ` Salil Mehta
2023-09-26 10:36 ` [PATCH RFC V2 36/37] tcg/mttcg: enable threads to unregister in tcg_ctxs[] Salil Mehta via
2023-09-26 10:36 ` [PATCH RFC V2 37/37] hw/arm/virt: Expose cold-booted CPUs as MADT GICC Enabled Salil Mehta via
2023-10-11 10:23 ` [PATCH RFC V2 00/37] Support of Virtual CPU Hotplug for ARMv8 Arch Vishnu Pajjuri
2023-10-11 10:32 ` Salil Mehta via
2023-10-11 10:32 ` Salil Mehta
2023-10-11 11:08 ` Vishnu Pajjuri
2023-10-11 20:15 ` Salil Mehta
2023-10-12 17:02 ` Miguel Luis
2023-10-12 17:54 ` Salil Mehta via
2023-10-12 17:54 ` Salil Mehta
2023-10-13 10:43 ` Miguel Luis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ddbc526e-bba3-6b93-753f-6ba3de183755@redhat.com \
--to=gshan@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=andrew.jones@linux.dev \
--cc=ardb@kernel.org \
--cc=borntraeger@linux.ibm.com \
--cc=darren@os.amperecomputing.com \
--cc=david@redhat.com \
--cc=eric.auger@redhat.com \
--cc=ilkka@os.amperecomputing.com \
--cc=imammedo@redhat.com \
--cc=jean-philippe@linaro.org \
--cc=jiakernel2@gmail.com \
--cc=jonathan.cameron@huawei.com \
--cc=karl.heubaum@oracle.com \
--cc=linux@armlinux.org.uk \
--cc=lixianglai@loongson.cn \
--cc=lpieralisi@kernel.org \
--cc=maobibo@loongson.cn \
--cc=maz@kernel.org \
--cc=miguel.luis@oracle.com \
--cc=mst@redhat.com \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rafael@kernel.org \
--cc=richard.henderson@linaro.org \
--cc=salil.mehta@huawei.com \
--cc=salil.mehta@opnsrc.net \
--cc=vishnu@os.amperecomputing.com \
--cc=wangxiongfeng2@huawei.com \
--cc=wangyanan55@huawei.com \
--cc=will@kernel.org \
--cc=zhukeqian1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).