All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v3 00/13] KVM patches (SMM implementation) for 2015-07-06
@ 2015-07-06 17:28 Paolo Bonzini
  2015-07-06 17:28 ` [Qemu-devel] [PULL 13/13] pc: add SMM property Paolo Bonzini
  2015-07-07  8:16 ` [Qemu-devel] [PULL v3 00/13] KVM patches (SMM implementation) for 2015-07-06 Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-07-06 17:28 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit 7edd8e4660beb301d527257f8e04ebec0f841cb0:

  Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2015-07-06 14:03:44 +0100)

are available in the git repository at:


  git://github.com/bonzini/qemu.git tags/for-upstream-smm

for you to fetch changes up to 355023f2010c4df619d88a0dd7012b4b9c74c12c:

  pc: add SMM property (2015-07-06 18:39:59 +0200)

----------------------------------------------------------------
This series implements KVM support for SMM, and lets you enable/disable
it through the "smm" property of x86 machine types.

----------------------------------------------------------------

ARM compile-tested only, with GCC 5.1.

Alexey Kardashevskiy (1):
      linux-headers: Update to 4.2-rc1

Andrew Jones (1):
      kvm-all: put kvm_mem_flags to more work

Paolo Bonzini (11):
      piix4/ich9: do not raise SMI on ACPI enable/disable commands
      target-i386: add support for SMBASE MSR and SMIs
      kvm-all: remove useless typedef
      kvm-all: move internal types to kvm_int.h
      kvm-all: make KVM's memory listener more generic
      kvm-all: add support for multiple address spaces
      kvm-all: kvm_irqchip_create is not expected to fail
      target-i386: register a separate KVM address space including SMRAM regions
      pc_piix: rename kvm_enabled to smm_enabled
      ich9: add smm_enabled field and arguments
      pc: add SMM property

 hw/acpi/ich9.c                                  |   5 +-
 hw/acpi/piix4.c                                 |  13 +-
 hw/i386/pc.c                                    |  51 +++++
 hw/i386/pc_piix.c                               |   7 +-
 hw/i386/pc_q35.c                                |   6 +-
 hw/isa/lpc_ich9.c                               |   9 +-
 include/hw/acpi/ich9.h                          |   3 +-
 include/hw/i386/ich9.h                          |   2 +-
 include/hw/i386/pc.h                            |   5 +-
 include/standard-headers/linux/input.h          |  10 +-
 include/standard-headers/linux/virtio_balloon.h |   1 +
 include/standard-headers/linux/virtio_gpu.h     |   2 +
 include/sysemu/kvm_int.h                        |  39 ++++
 kvm-all.c                                       | 243 ++++++++++++------------
 linux-headers/asm-x86/hyperv.h                  |  11 ++
 linux-headers/linux/kvm.h                       |   2 +-
 linux-headers/linux/vfio.h                      | 102 +++++++++-
 linux-headers/linux/virtio_pci.h                | 192 -------------------
 target-i386/cpu.h                               |   1 +
 target-i386/kvm-stub.c                          |   5 +
 target-i386/kvm.c                               | 151 +++++++++++++--
 target-i386/kvm_i386.h                          |   1 +
 22 files changed, 517 insertions(+), 344 deletions(-)
 create mode 100644 include/sysemu/kvm_int.h
 delete mode 100644 linux-headers/linux/virtio_pci.h
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PULL 13/13] pc: add SMM property
  2015-07-06 17:28 [Qemu-devel] [PULL v3 00/13] KVM patches (SMM implementation) for 2015-07-06 Paolo Bonzini
@ 2015-07-06 17:28 ` Paolo Bonzini
  2015-07-07  8:16 ` [Qemu-devel] [PULL v3 00/13] KVM patches (SMM implementation) for 2015-07-06 Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-07-06 17:28 UTC (permalink / raw)
  To: qemu-devel

The property can take values on, off or auto.  The default is "off"
for KVM and pre-2.4 machines, otherwise "auto" (which makes it
available on TCG or on new-enough kernels).

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/pc.c           | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/pc_piix.c      |  7 ++++++-
 hw/i386/pc_q35.c       |  6 +++++-
 include/hw/i386/pc.h   |  3 +++
 target-i386/kvm-stub.c |  5 +++++
 target-i386/kvm.c      |  5 +++++
 target-i386/kvm_i386.h |  1 +
 7 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index a66416d..7959b44 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1768,6 +1768,48 @@ static void pc_machine_set_vmport(Object *obj, Visitor *v, void *opaque,
     visit_type_OnOffAuto(v, &pcms->vmport, name, errp);
 }
 
+bool pc_machine_is_smm_enabled(PCMachineState *pcms)
+{
+    bool smm_available = false;
+
+    if (pcms->smm == ON_OFF_AUTO_OFF) {
+        return false;
+    }
+
+    if (tcg_enabled() || qtest_enabled()) {
+        smm_available = true;
+    } else if (kvm_enabled()) {
+        smm_available = kvm_has_smm();
+    }
+
+    if (smm_available) {
+        return true;
+    }
+
+    if (pcms->smm == ON_OFF_AUTO_ON) {
+        error_report("System Management Mode not supported by this hypervisor.");
+        exit(1);
+    }
+    return false;
+}
+
+static void pc_machine_get_smm(Object *obj, Visitor *v, void *opaque,
+                              const char *name, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+    OnOffAuto smm = pcms->smm;
+
+    visit_type_OnOffAuto(v, &smm, name, errp);
+}
+
+static void pc_machine_set_smm(Object *obj, Visitor *v, void *opaque,
+                                  const char *name, Error **errp)
+{
+    PCMachineState *pcms = PC_MACHINE(obj);
+
+    visit_type_OnOffAuto(v, &pcms->smm, name, errp);
+}
+
 static bool pc_machine_get_aligned_dimm(Object *obj, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
@@ -1792,6 +1834,15 @@ static void pc_machine_initfn(Object *obj)
                                     "Maximum ram below the 4G boundary (32bit boundary)",
                                     NULL);
 
+    pcms->smm = ON_OFF_AUTO_AUTO;
+    object_property_add(obj, PC_MACHINE_SMM, "OnOffAuto",
+                        pc_machine_get_smm,
+                        pc_machine_set_smm,
+                        NULL, NULL, NULL);
+    object_property_set_description(obj, PC_MACHINE_SMM,
+                                    "Enable SMM (pc & q35)",
+                                    NULL);
+
     pcms->vmport = ON_OFF_AUTO_AUTO;
     object_property_add(obj, PC_MACHINE_VMPORT, "OnOffAuto",
                         pc_machine_get_vmport,
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 8d0313e..56cdcb9 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -287,7 +287,8 @@ static void pc_init1(MachineState *machine)
         /* TODO: Populate SPD eeprom data.  */
         smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
                               gsi[9], smi_irq,
-                              !kvm_enabled(), &piix4_pm);
+                              pc_machine_is_smm_enabled(pc_machine),
+                              &piix4_pm);
         smbus_eeprom_init(smbus, 8, NULL, 0);
 
         object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
@@ -306,7 +307,11 @@ static void pc_init1(MachineState *machine)
 
 static void pc_compat_2_3(MachineState *machine)
 {
+    PCMachineState *pcms = PC_MACHINE(machine);
     savevm_skip_section_footers();
+    if (kvm_enabled()) {
+        pcms->smm = ON_OFF_AUTO_OFF;
+    }
 }
 
 static void pc_compat_2_2(MachineState *machine)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index b0bf2d0..8aa3a67 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -253,7 +253,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, !kvm_enabled());
+    ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pc_machine));
 
     /* ahci and SATA device, for q35 1 ahci controller is built-in */
     ahci = pci_create_simple_multifunction(host_bus,
@@ -290,7 +290,11 @@ static void pc_q35_init(MachineState *machine)
 
 static void pc_compat_2_3(MachineState *machine)
 {
+    PCMachineState *pcms = PC_MACHINE(machine);
     savevm_skip_section_footers();
+    if (kvm_enabled()) {
+        pcms->smm = ON_OFF_AUTO_OFF;
+    }
 }
 
 static void pc_compat_2_2(MachineState *machine)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 10783b2..786a1d5 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -37,6 +37,7 @@ struct PCMachineState {
 
     uint64_t max_ram_below_4g;
     OnOffAuto vmport;
+    OnOffAuto smm;
     bool enforce_aligned_dimm;
 };
 
@@ -44,6 +45,7 @@ struct PCMachineState {
 #define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
 #define PC_MACHINE_VMPORT           "vmport"
+#define PC_MACHINE_SMM              "smm"
 #define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
 
 /**
@@ -155,6 +157,7 @@ void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
 /* pc.c */
 extern int fd_bootchk;
 
+bool pc_machine_is_smm_enabled(PCMachineState *pcms);
 void pc_register_ferr_irq(qemu_irq irq);
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
diff --git a/target-i386/kvm-stub.c b/target-i386/kvm-stub.c
index 2b9e801..6fefd65 100644
--- a/target-i386/kvm-stub.c
+++ b/target-i386/kvm-stub.c
@@ -18,6 +18,11 @@ bool kvm_allows_irq0_override(void)
 }
 
 #ifndef __OPTIMIZE__
+bool kvm_has_smm(void)
+{
+    return 1;
+}
+
 /* This function is only called inside conditionals which we
  * rely on the compiler to optimize out when CONFIG_KVM is not
  * defined.
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 9dccbe1..9038bf7 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -86,6 +86,11 @@ static bool has_msr_xss;
 static bool has_msr_architectural_pmu;
 static uint32_t num_architectural_pmu_counters;
 
+bool kvm_has_smm(void)
+{
+    return kvm_check_extension(kvm_state, KVM_CAP_X86_SMM);
+}
+
 bool kvm_allows_irq0_override(void)
 {
     return !kvm_irqchip_in_kernel() || kvm_has_gsi_routing();
diff --git a/target-i386/kvm_i386.h b/target-i386/kvm_i386.h
index cac30fd..e557e94 100644
--- a/target-i386/kvm_i386.h
+++ b/target-i386/kvm_i386.h
@@ -14,6 +14,7 @@
 #include "sysemu/kvm.h"
 
 bool kvm_allows_irq0_override(void);
+bool kvm_has_smm(void);
 void kvm_arch_reset_vcpu(X86CPU *cs);
 void kvm_arch_do_init_vcpu(X86CPU *cs);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PULL v3 00/13] KVM patches (SMM implementation) for 2015-07-06
  2015-07-06 17:28 [Qemu-devel] [PULL v3 00/13] KVM patches (SMM implementation) for 2015-07-06 Paolo Bonzini
  2015-07-06 17:28 ` [Qemu-devel] [PULL 13/13] pc: add SMM property Paolo Bonzini
@ 2015-07-07  8:16 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2015-07-07  8:16 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 6 July 2015 at 18:28, Paolo Bonzini <pbonzini@redhat.com> wrote:
> The following changes since commit 7edd8e4660beb301d527257f8e04ebec0f841cb0:
>
>   Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2015-07-06 14:03:44 +0100)
>
> are available in the git repository at:
>
>
>   git://github.com/bonzini/qemu.git tags/for-upstream-smm
>
> for you to fetch changes up to 355023f2010c4df619d88a0dd7012b4b9c74c12c:
>
>   pc: add SMM property (2015-07-06 18:39:59 +0200)
>
> ----------------------------------------------------------------
> This series implements KVM support for SMM, and lets you enable/disable
> it through the "smm" property of x86 machine types.
>
> ----------------------------------------------------------------
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-07  8:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-06 17:28 [Qemu-devel] [PULL v3 00/13] KVM patches (SMM implementation) for 2015-07-06 Paolo Bonzini
2015-07-06 17:28 ` [Qemu-devel] [PULL 13/13] pc: add SMM property Paolo Bonzini
2015-07-07  8:16 ` [Qemu-devel] [PULL v3 00/13] KVM patches (SMM implementation) for 2015-07-06 Peter Maydell

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.