Patchwork [2/2] Make kvm_enabled unavailable to non-target devices

login
register
mail settings
Submitter Blue Swirl
Date April 1, 2010, 8:10 p.m.
Message ID <g2of43fc5581004011310x40e47851pdd2e5f636dbe8614@mail.gmail.com>
Download mbox | patch
Permalink /patch/49240/
State New
Headers show

Comments

Blue Swirl - April 1, 2010, 8:10 p.m.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
I'm not sure this patch is worth applying. Anyway, it proves that no
non-target devices use kvm.h.

 hw/acpi.c   |   10 +++++-----
 hw/pc.h     |    2 +-
 hw/poison.h |    3 +++
 3 files changed, 9 insertions(+), 6 deletions(-)

Patch

diff --git a/hw/acpi.c b/hw/acpi.c
index 5c01c2e..7c2b109 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -51,7 +51,7 @@  typedef struct PIIX4PMState {
     qemu_irq irq;
     qemu_irq cmos_s3;
     qemu_irq smi_irq;
-    int kvm_enabled;
+    int kvm_is_enabled;
 } PIIX4PMState;

 #define RSM_STS (1 << 15)
@@ -482,7 +482,7 @@  static void piix4_reset(void *opaque)
     pci_conf[0x5a] = 0;
     pci_conf[0x5b] = 0;

-    if (s->kvm_enabled) {
+    if (s->kvm_is_enabled) {
         /* Mark SMM as already inited (until KVM supports SMM). */
         pci_conf[0x5B] = 0x02;
     }
@@ -502,7 +502,7 @@  static void piix4_powerdown(void *opaque, int irq,
int power_failing)

 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq cmos_s3, qemu_irq smi_irq,
-                       int kvm_enabled)
+                       int kvm_is_enabled)
 {
     PIIX4PMState *s;
     uint8_t *pci_conf;
@@ -529,8 +529,8 @@  i2c_bus *piix4_pm_init(PCIBus *bus, int devfn,
uint32_t smb_io_base,

     register_ioport_write(ACPI_DBG_IO_ADDR, 4, 4, acpi_dbg_writel, s);

-    s->kvm_enabled = kvm_enabled;
-    if (s->kvm_enabled) {
+    s->kvm_is_enabled = kvm_is_enabled;
+    if (s->kvm_is_enabled) {
         /* Mark SMM as already inited to prevent SMM from running.
KVM does not
          * support SMM mode. */
         pci_conf[0x5B] = 0x02;
diff --git a/hw/pc.h b/hw/pc.h
index 5f86b37..08a541d 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -92,7 +92,7 @@  int acpi_table_add(const char *table_desc);

 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq cmos_s3, qemu_irq smi_irq,
-                       int kvm_enabled);
+                       int kvm_is_enabled);
 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
 void piix4_acpi_system_hot_add_init(PCIBus *bus);

diff --git a/hw/poison.h b/hw/poison.h
index d7db7f4..18b9657 100644
--- a/hw/poison.h
+++ b/hw/poison.h
@@ -46,5 +46,8 @@ 
 #pragma GCC poison CPU_INTERRUPT_VIRQ
 #pragma GCC poison CPU_INTERRUPT_NMI

+#pragma GCC poison kvm_allowed
+#pragma GCC poison kvm_enabled
+
 #endif
 #endif