All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Isaku Yamahata <isaku.yamahata@intel.com>
Cc: isaku.yamahata@gmail.com, qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [PATCH v3 03/10] i386: add properoty, x-smm-compat-5, to keep compatibility of SMM
Date: Fri, 12 Feb 2021 15:54:00 +0100	[thread overview]
Message-ID: <20210212155400.40cab452@redhat.com> (raw)
In-Reply-To: <7b74891766ad1caccd83c28ecea0d5d4293b3860.1613025709.git.isaku.yamahata@intel.com>

On Wed, 10 Feb 2021 22:46:39 -0800
Isaku Yamahata <isaku.yamahata@intel.com> wrote:

> The following patch will introduce incompatible behavior of SMM.
> Introduce a property to keep the old behavior for compatibility.
> To enable smm compat, use "-machine x-smm-compat-5=on"

just curious, why it has "-5" suffix
also I'd drop x- prefix.
 
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> ---
>  hw/i386/pc_piix.c     | 10 ++++++----
>  hw/i386/pc_q35.c      |  1 +
>  hw/i386/x86.c         | 18 ++++++++++++++++++
>  include/hw/i386/x86.h |  2 ++
>  4 files changed, 27 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 6188c3e97e..87269e170e 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -441,6 +441,7 @@ DEFINE_I440FX_MACHINE(v6_0, "pc-i440fx-6.0", NULL,
>  static void pc_i440fx_5_2_machine_options(MachineClass *m)
>  {
>      pc_i440fx_6_0_machine_options(m);
> +    m->default_machine_opts = "firmware=bios-256k.bin,x-smm-compat-5=on";

did I point to a wrong example :/

smm machinery is part of ich9/piix4 devices, so it would be simpler
by adding 'smm-compat' property to them

diff --git a/hw/core/machine.c b/hw/core/machine.c
index 970046f438..bcb0333ddf 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -36,7 +36,9 @@
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-pci.h"
 
-GlobalProperty hw_compat_5_2[] = {};
+GlobalProperty hw_compat_5_2[] = {

it turns on compat mode on 5.2 and older machines types

+    { "ICH9-LPC", "smm-compat", "on"},
+};
 const size_t hw_compat_5_2_len = G_N_ELEMENTS(hw_compat_5_2);
 
 GlobalProperty hw_compat_5_1[] = {
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index d3145bf014..13003b2ac2 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -774,6 +774,7 @@ static const VMStateDescription vmstate_ich9_lpc = {
 };
 
 static Property ich9_lpc_properties[] = {

default would be used on new and later machine types

+    DEFINE_PROP_BOOL("smm-compat", ICH9LPCState, pm.smm_compat , false),
     DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, true),
     DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features,
                       ICH9_LPC_SMI_F_BROADCAST_BIT, true),

then do the same for piix4 pm device


>      m->alias = NULL;
>      m->is_default = false;
>      compat_props_add(m->compat_props, hw_compat_5_2, hw_compat_5_2_len);
> @@ -664,7 +665,8 @@ static void pc_i440fx_2_2_machine_options(MachineClass *m)
>  
>      pc_i440fx_2_3_machine_options(m);
>      m->hw_version = "2.2.0";
> -    m->default_machine_opts = "firmware=bios-256k.bin,suppress-vmdesc=on";
> +    m->default_machine_opts = "firmware=bios-256k.bin,suppress-vmdesc=on"
> +        ",x-smm-compat-5=on";
>      compat_props_add(m->compat_props, hw_compat_2_2, hw_compat_2_2_len);
>      compat_props_add(m->compat_props, pc_compat_2_2, pc_compat_2_2_len);
>      pcmc->rsdp_in_ram = false;
> @@ -727,7 +729,7 @@ static void pc_i440fx_1_7_machine_options(MachineClass *m)
>  
>      pc_i440fx_2_0_machine_options(m);
>      m->hw_version = "1.7.0";
> -    m->default_machine_opts = NULL;
> +    m->default_machine_opts = "x-smm-compat-5=on";
>      m->option_rom_has_mr = true;
>      compat_props_add(m->compat_props, pc_compat_1_7, pc_compat_1_7_len);
>      pcmc->smbios_defaults = false;
> @@ -999,7 +1001,7 @@ static void xenfv_4_2_machine_options(MachineClass *m)
>      pc_i440fx_4_2_machine_options(m);
>      m->desc = "Xen Fully-virtualized PC";
>      m->max_cpus = HVM_MAX_VCPUS;
> -    m->default_machine_opts = "accel=xen,suppress-vmdesc=on";
> +    m->default_machine_opts = "accel=xen,suppress-vmdesc=on,x-smm-compat-5=on";
>  }
>  
>  DEFINE_PC_MACHINE(xenfv_4_2, "xenfv-4.2", pc_xen_hvm_init,
> @@ -1011,7 +1013,7 @@ static void xenfv_3_1_machine_options(MachineClass *m)
>      m->desc = "Xen Fully-virtualized PC";
>      m->alias = "xenfv";
>      m->max_cpus = HVM_MAX_VCPUS;
> -    m->default_machine_opts = "accel=xen,suppress-vmdesc=on";
> +    m->default_machine_opts = "accel=xen,suppress-vmdesc=on,x-smm-compat-5=on";
>  }
>  
>  DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init,
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index 0a212443aa..14974b7255 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -358,6 +358,7 @@ DEFINE_Q35_MACHINE(v6_0, "pc-q35-6.0", NULL,
>  static void pc_q35_5_2_machine_options(MachineClass *m)
>  {
>      pc_q35_6_0_machine_options(m);
> +    m->default_machine_opts = "firmware=bios-256k.bin,x-smm-compat-5=on";
>      m->alias = NULL;
>      compat_props_add(m->compat_props, hw_compat_5_2, hw_compat_5_2_len);
>      compat_props_add(m->compat_props, pc_compat_5_2, pc_compat_5_2_len);
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index 6329f90ef9..00eb2253d3 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -1174,6 +1174,18 @@ static void x86_machine_set_smm(Object *obj, Visitor *v, const char *name,
>      visit_type_OnOffAuto(v, name, &x86ms->smm, errp);
>  }
>  
> +static bool x86_machine_get_smm_compat_5(Object *obj, Error **errp)
> +{
> +    X86MachineState *x86ms = X86_MACHINE(obj);
> +    return  x86ms->smm_compat_5;
> +}
> +
> +static void x86_machine_set_smm_compat_5(Object *obj, bool value, Error **errp)
> +{
> +    X86MachineState *x86ms = X86_MACHINE(obj);
> +    x86ms->smm_compat_5 = value;
> +}
> +
>  bool x86_machine_is_acpi_enabled(const X86MachineState *x86ms)
>  {
>      if (x86ms->acpi == ON_OFF_AUTO_OFF) {
> @@ -1204,6 +1216,7 @@ static void x86_machine_initfn(Object *obj)
>      X86MachineState *x86ms = X86_MACHINE(obj);
>  
>      x86ms->smm = ON_OFF_AUTO_AUTO;
> +    x86ms->smm_compat_5 = false;
>      x86ms->acpi = ON_OFF_AUTO_AUTO;
>      x86ms->smp_dies = 1;
>      x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
> @@ -1228,6 +1241,11 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)
>      object_class_property_set_description(oc, X86_MACHINE_SMM,
>          "Enable SMM");
>  
> +    object_class_property_add_bool(oc, X86_MACHINE_SMM_COMPAT_5,
> +        x86_machine_get_smm_compat_5, x86_machine_set_smm_compat_5);
> +    object_class_property_set_description(oc, X86_MACHINE_SMM_COMPAT_5,
> +        "Enable SMM compatible behavior");
> +
>      object_class_property_add(oc, X86_MACHINE_ACPI, "OnOffAuto",
>          x86_machine_get_acpi, x86_machine_set_acpi,
>          NULL, NULL);
> diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
> index 56080bd1fb..3dbe19a335 100644
> --- a/include/hw/i386/x86.h
> +++ b/include/hw/i386/x86.h
> @@ -65,6 +65,7 @@ struct X86MachineState {
>      unsigned smp_dies;
>  
>      OnOffAuto smm;
> +    bool smm_compat_5;
>      OnOffAuto acpi;
>  
>      /*
> @@ -75,6 +76,7 @@ struct X86MachineState {
>  };
>  
>  #define X86_MACHINE_SMM              "smm"
> +#define X86_MACHINE_SMM_COMPAT_5     "x-smm-compat-5"
>  #define X86_MACHINE_ACPI             "acpi"
>  
>  #define TYPE_X86_MACHINE   MACHINE_TYPE_NAME("x86")



  reply	other threads:[~2021-02-12 14:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11  6:46 [PATCH v3 00/10] ACPI related fixes to comform the spec better Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 01/10] checkpatch: don't emit warning on newly created acpi data files Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 02/10] qtest: update tests/qtest/bios-tables-test-allowed-diff.h Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 03/10] i386: add properoty, x-smm-compat-5, to keep compatibility of SMM Isaku Yamahata
2021-02-12 14:54   ` Igor Mammedov [this message]
2021-02-11  6:46 ` [PATCH v3 04/10] acpi/core: always set SCI_EN when SMM isn't supported Isaku Yamahata
2021-02-12 15:09   ` Igor Mammedov
2021-02-11  6:46 ` [PATCH v3 05/10] acpi: set fadt.smi_cmd to zero when SMM is not supported Isaku Yamahata
2021-02-12 15:15   ` Igor Mammedov
2021-02-11  6:46 ` [PATCH v3 06/10] acpi: add test case for smm unsupported -machine smm=off Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 07/10] hw/i386: declare ACPI mother board resource for MMCONFIG region Isaku Yamahata
2021-02-12 15:40   ` Igor Mammedov
2021-02-12 20:51     ` Isaku Yamahata
2021-02-15 12:48       ` Igor Mammedov
2021-02-16  9:43         ` Isaku Yamahata
2021-02-16 13:45           ` Michael S. Tsirkin
2021-02-16 18:13             ` Isaku Yamahata
2021-02-16 22:04               ` Igor Mammedov
2021-02-11  6:46 ` [PATCH v3 08/10] i386: acpi: Don't build HPET ACPI entry if HPET is disabled Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 09/10] acpi: add test case for -no-hpet Isaku Yamahata
2021-02-11  6:46 ` [PATCH v3 10/10] qtest/acpi/bios-tables-test: update acpi tables Isaku Yamahata

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=20210212155400.40cab452@redhat.com \
    --to=imammedo@redhat.com \
    --cc=isaku.yamahata@gmail.com \
    --cc=isaku.yamahata@intel.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.