qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: lersek@redhat.com, kraxel@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH 11/12] ich9: add smm_enabled field and arguments
Date: Fri,  5 Jun 2015 16:31:32 +0200	[thread overview]
Message-ID: <1433514693-19414-12-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1433514693-19414-1-git-send-email-pbonzini@redhat.com>

Q35's ACPI device is hard-coding SMM availability to KVM.  Place the
logic where the board is created instead, so that it will be possible
to override it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/acpi/ich9.c         | 5 +++--
 hw/i386/pc_q35.c       | 2 +-
 hw/isa/lpc_ich9.c      | 4 ++--
 include/hw/acpi/ich9.h | 3 ++-
 include/hw/i386/ich9.h | 2 +-
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 25bc023..07dbc44 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -194,7 +194,7 @@ static void pm_reset(void *opaque)
     acpi_pm_tmr_reset(&pm->acpi_regs);
     acpi_gpe_reset(&pm->acpi_regs);
 
-    if (kvm_enabled()) {
+    if (!pm->smm_enabled) {
         /* Mark SMM as already inited to prevent SMM from running. KVM does not
          * support SMM mode. */
         pm->smi_en |= ICH9_PMIO_SMI_EN_APMC_EN;
@@ -211,7 +211,7 @@ static void pm_powerdown_req(Notifier *n, void *opaque)
     acpi_pm1_evt_power_down(&pm->acpi_regs);
 }
 
-void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
+void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, bool smm_enabled,
                   qemu_irq sci_irq)
 {
     memory_region_init(&pm->io, OBJECT(lpc_pci), "ich9-pm", ICH9_PMIO_SIZE);
@@ -233,6 +233,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
                           "acpi-smi", 8);
     memory_region_add_subregion(&pm->io, ICH9_PMIO_SMI_EN, &pm->io_smi);
 
+    pm->smm_enabled = smm_enabled;
     pm->irq = sci_irq;
     qemu_register_reset(pm_reset, pm);
     pm->powerdown_notifier.notify = pm_powerdown_req;
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 66220b3..27c4b19 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -254,7 +254,7 @@ static void pc_q35_init(MachineState *machine)
                          (pc_machine->vmport != ON_OFF_AUTO_ON), 0xff0104);
 
     /* connect pm stuff to lpc */
-    ich9_lpc_pm_init(lpc);
+    ich9_lpc_pm_init(lpc, !kvm_enabled());
 
     /* ahci and SATA device, for q35 1 ahci controller is built-in */
     ahci = pci_create_simple_multifunction(host_bus,
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 247158c..1de013d 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -357,13 +357,13 @@ static void ich9_set_sci(void *opaque, int irq_num, int level)
     }
 }
 
-void ich9_lpc_pm_init(PCIDevice *lpc_pci)
+void ich9_lpc_pm_init(PCIDevice *lpc_pci, bool smm_enabled)
 {
     ICH9LPCState *lpc = ICH9_LPC_DEVICE(lpc_pci);
     qemu_irq *sci_irq;
 
     sci_irq = qemu_allocate_irqs(ich9_set_sci, lpc, 1);
-    ich9_pm_init(lpc_pci, &lpc->pm, sci_irq[0]);
+    ich9_pm_init(lpc_pci, &lpc->pm, smm_enabled, sci_irq[0]);
 
     ich9_lpc_reset(&lpc->d.qdev);
 }
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index 77cc65c..ac24bbe 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -54,10 +54,11 @@ typedef struct ICH9LPCPMRegs {
     uint8_t disable_s3;
     uint8_t disable_s4;
     uint8_t s4_val;
+    uint8_t smm_enabled;
 } ICH9LPCPMRegs;
 
 void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm,
-                  qemu_irq sci_irq);
+                  bool smm_enabled, qemu_irq sci_irq);
 void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base);
 extern const VMStateDescription vmstate_ich9_pm;
 
diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index a2cc15c..b317a48 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -17,7 +17,7 @@
 void ich9_lpc_set_irq(void *opaque, int irq_num, int level);
 int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx);
 PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin);
-void ich9_lpc_pm_init(PCIDevice *pci_lpc);
+void ich9_lpc_pm_init(PCIDevice *pci_lpc, bool smm_enabled);
 I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
 
 #define ICH9_CC_SIZE                            (16 * 1024)     /* 16KB */
-- 
2.4.1

  parent reply	other threads:[~2015-06-05 14:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 14:31 [Qemu-devel] [PATCH 00/12] SMM part 2: KVM and -machine enablement Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 01/12] piix4/ich9: do not raise SMI on ACPI enable/disable commands Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 02/12] target-i386: add support for SMBASE MSR and SMIs Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 03/12] kvm-all: put kvm_mem_flags to more work Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 04/12] kvm-all: remove useless typedef Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 05/12] kvm-all: move internal types to kvm_int.h Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 06/12] kvm-all: make KVM's memory listener more generic Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 07/12] kvm-all: add support for multiple address spaces Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 08/12] kvm-all: kvm_irqchip_create is not expected to fail Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 09/12] target-i386: register a separate KVM address space including SMRAM regions Paolo Bonzini
2015-06-05 14:31 ` [Qemu-devel] [PATCH 10/12] pc_piix: rename kvm_enabled to smm_enabled Paolo Bonzini
2015-06-05 14:31 ` Paolo Bonzini [this message]
2015-06-05 14:31 ` [Qemu-devel] [PATCH 12/12] pc: add SMM property Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2015-06-18 16:23 [Qemu-devel] [PATCH for-2.4 00/12] pc: KVM support for SMRAM Paolo Bonzini
2015-06-18 16:30 ` [Qemu-devel] [PATCH 11/12] ich9: add smm_enabled field and arguments Paolo Bonzini

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=1433514693-19414-12-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kraxel@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 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).