All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ankur Arora <ankur.a.arora@oracle.com>
To: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Cc: lersek@redhat.com, mst@redhat.com
Subject: Re: [PATCH 5/8] x86: acpi: let the firmware handle pending "CPU remove" events in SMM
Date: Sun, 6 Dec 2020 22:20:27 -0800	[thread overview]
Message-ID: <533b92b0-1eae-f24d-b90b-f7f174dbf305@oracle.com> (raw)
In-Reply-To: <20201204170939.1815522-6-imammedo@redhat.com>

On 2020-12-04 9:09 a.m., Igor Mammedov wrote:
> if firmware and QEMU negotiated CPU hotunplug support, generate
> _EJ0 method so that it will mark CPU for removal by firmware and
> pass control to it by triggering SMI.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>   include/hw/acpi/cpu.h |  1 +
>   hw/acpi/cpu.c         | 15 +++++++++++++--
>   hw/i386/acpi-build.c  |  1 +
>   3 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h
> index d71edde456..999caaf510 100644
> --- a/include/hw/acpi/cpu.h
> +++ b/include/hw/acpi/cpu.h
> @@ -51,6 +51,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,
>   typedef struct CPUHotplugFeatures {
>       bool acpi_1_compatible;
>       bool has_legacy_cphp;
> +    bool fw_unplugs_cpu;
>       const char *smi_path;
>   } CPUHotplugFeatures;
>   
> diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c
> index 811218f673..bded2a837f 100644
> --- a/hw/acpi/cpu.c
> +++ b/hw/acpi/cpu.c
> @@ -341,6 +341,7 @@ const VMStateDescription vmstate_cpu_hotplug = {
>   #define CPU_INSERT_EVENT  "CINS"
>   #define CPU_REMOVE_EVENT  "CRMV"
>   #define CPU_EJECT_EVENT   "CEJ0"
> +#define CPU_FW_EJECT_EVENT "CEJF"
>   
>   void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
>                       hwaddr io_base,
> @@ -393,7 +394,10 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
>           aml_append(field, aml_named_field(CPU_REMOVE_EVENT, 1));

   Bit 2: Device remove event, used to distinguish device for which
         no device eject request to OSPM was issued. Firmware must
         ignore this bit.

>           /* initiates device eject, write only */
>           aml_append(field, aml_named_field(CPU_EJECT_EVENT, 1));

   Bit 3: reserved and should be ignored by OSPM

> -        aml_append(field, aml_reserved_field(4));
> +        aml_append(field, aml_reserved_field(1));
> +        /* tell firmware to do device eject, write only */
> +        aml_append(field, aml_named_field(CPU_FW_EJECT_EVENT, 1));
> +        aml_append(field, aml_reserved_field(2));

Shouldn't this be instead:

> -        aml_append(field, aml_reserved_field(4));
> +        /* tell firmware to do device eject, write only */
> +        aml_append(field, aml_named_field(CPU_FW_EJECT_EVENT, 1));
> +        aml_append(field, aml_reserved_field(3));

   Bit 4: if set to 1, OSPM requests firmware to perform device eject.
   Bit 5-7: reserved and should be ignored by OSPM

Otherwise AFAICS CPU_FW_EJECT_EVENT would correspond to bit 5.


Ankur

>           aml_append(field, aml_named_field(CPU_COMMAND, 8));
>           aml_append(cpu_ctrl_dev, field);
>   
> @@ -428,6 +432,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
>           Aml *ins_evt = aml_name("%s.%s", cphp_res_path, CPU_INSERT_EVENT);
>           Aml *rm_evt = aml_name("%s.%s", cphp_res_path, CPU_REMOVE_EVENT);
>           Aml *ej_evt = aml_name("%s.%s", cphp_res_path, CPU_EJECT_EVENT);
> +        Aml *fw_ej_evt = aml_name("%s.%s", cphp_res_path, CPU_FW_EJECT_EVENT);
>   
>           aml_append(cpus_dev, aml_name_decl("_HID", aml_string("ACPI0010")));
>           aml_append(cpus_dev, aml_name_decl("_CID", aml_eisaid("PNP0A05")));
> @@ -470,7 +475,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,
>   
>               aml_append(method, aml_acquire(ctrl_lock, 0xFFFF));
>               aml_append(method, aml_store(idx, cpu_selector));
> -            aml_append(method, aml_store(one, ej_evt));
> +            if (opts.fw_unplugs_cpu) {
> +                aml_append(method, aml_store(one, fw_ej_evt));
> +                aml_append(method, aml_store(aml_int(OVMF_CPUHP_SMI_CMD),
> +                           aml_name("%s", opts.smi_path)));
> +            } else {
> +                aml_append(method, aml_store(one, ej_evt));
> +            }
>               aml_append(method, aml_release(ctrl_lock));
>           }
>           aml_append(cpus_dev, method);
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 9036e5594c..475e76f514 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1586,6 +1586,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
>           CPUHotplugFeatures opts = {
>               .acpi_1_compatible = true, .has_legacy_cphp = true,
>               .smi_path = pm->smi_on_cpuhp ? "\\_SB.PCI0.SMI0.SMIC" : NULL,
> +            .fw_unplugs_cpu = pm->smi_on_cpu_unplug,
>           };
>           build_cpus_aml(dsdt, machine, opts, pm->cpu_hp_io_base,
>                          "\\_SB.PCI0", "\\_GPE._E02");
> 


  reply	other threads:[~2020-12-07  6:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 17:09 [PATCH 0/8] add support for cpu hot-unplug with SMI broadcast enabled Igor Mammedov
2020-12-04 17:09 ` [PATCH 1/8] hw: add compat machines for 6.0 Igor Mammedov
2020-12-04 17:09 ` [PATCH 2/8] acpi: cpuhp: introduce 'firmware performs eject' status/control bits Igor Mammedov
2020-12-07  6:31   ` Ankur Arora
2020-12-07  8:47     ` Ankur Arora
2020-12-07 12:48       ` Igor Mammedov
2020-12-07 19:01         ` Ankur Arora
2020-12-07 12:42     ` Igor Mammedov
2020-12-04 17:09 ` [PATCH 3/8] x86: acpi: introduce AcpiPmInfo::smi_on_cpu_unplug Igor Mammedov
2020-12-04 17:09 ` [PATCH 4/8] tests/acpi: allow expected files change Igor Mammedov
2020-12-04 17:09 ` [PATCH 5/8] x86: acpi: let the firmware handle pending "CPU remove" events in SMM Igor Mammedov
2020-12-07  6:20   ` Ankur Arora [this message]
2020-12-07  6:24     ` Ankur Arora
2020-12-07 12:57     ` Igor Mammedov
2020-12-04 17:09 ` [PATCH 6/8] tests/acpi: update expected files Igor Mammedov
2020-12-04 17:09 ` [PATCH 7/8] x86: ich9: factor out "guest_cpu_hotplug_features" Igor Mammedov
2020-12-04 17:09 ` [PATCH 8/8] x86: ich9: let firmware negotiate 'CPU hot-unplug with SMI' feature Igor Mammedov

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=533b92b0-1eae-f24d-b90b-f7f174dbf305@oracle.com \
    --to=ankur.a.arora@oracle.com \
    --cc=imammedo@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.