qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 2/2] Make kvm_enabled unavailable to non-target devices
@ 2010-04-01 20:10 Blue Swirl
  0 siblings, 0 replies; 6+ messages in thread
From: Blue Swirl @ 2010-04-01 20:10 UTC (permalink / raw)
  To: qemu-devel

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(-)

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
-- 
1.6.2.4

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

* [Qemu-devel] [PATCH 2/2] Make kvm_enabled unavailable to non-target devices
@ 2010-04-02 15:46 Blue Swirl
  2010-04-02 16:25 ` Anthony Liguori
  0 siblings, 1 reply; 6+ messages in thread
From: Blue Swirl @ 2010-04-02 15:46 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/acpi.c   |   10 +++++-----
 hw/pc.h     |    2 +-
 hw/poison.h |    3 +++
 3 files changed, 9 insertions(+), 6 deletions(-)

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
-- 
1.6.2.4

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

* Re: [Qemu-devel] [PATCH 2/2] Make kvm_enabled unavailable to non-target devices
  2010-04-02 15:46 [Qemu-devel] [PATCH 2/2] Make kvm_enabled unavailable to non-target devices Blue Swirl
@ 2010-04-02 16:25 ` Anthony Liguori
  2010-04-02 16:33   ` Blue Swirl
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony Liguori @ 2010-04-02 16:25 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

On 04/02/2010 10:46 AM, Blue Swirl wrote:
> Signed-off-by: Blue Swirl<blauwirbel@gmail.com>
> ---
>   hw/acpi.c   |   10 +++++-----
>   hw/pc.h     |    2 +-
>   hw/poison.h |    3 +++
>   3 files changed, 9 insertions(+), 6 deletions(-)
>
> 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
>
>    

kvm_enabled() is a macro.  I dont' think this poison pragma is actually 
meaningful.

Regards,

Anthony Liguori

>   #endif
>   #endif
>    

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

* Re: [Qemu-devel] [PATCH 2/2] Make kvm_enabled unavailable to non-target devices
  2010-04-02 16:25 ` Anthony Liguori
@ 2010-04-02 16:33   ` Blue Swirl
  2010-04-02 16:47     ` [Qemu-devel] " Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Blue Swirl @ 2010-04-02 16:33 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

On 4/2/10, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 04/02/2010 10:46 AM, Blue Swirl wrote:
>
> > Signed-off-by: Blue Swirl<blauwirbel@gmail.com>
> > ---
> >  hw/acpi.c   |   10 +++++-----
> >  hw/pc.h     |    2 +-
> >  hw/poison.h |    3 +++
> >  3 files changed, 9 insertions(+), 6 deletions(-)
> >
> > 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
> >
> >
> >
>
>  kvm_enabled() is a macro.  I dont' think this poison pragma is actually
> meaningful.

I'm not familiar with poison pragmas, but actually poisoning only
kvm_allowed didn't work.

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

* [Qemu-devel] Re: [PATCH 2/2] Make kvm_enabled unavailable to non-target devices
  2010-04-02 16:33   ` Blue Swirl
@ 2010-04-02 16:47     ` Paolo Bonzini
  2010-04-02 16:57       ` Anthony Liguori
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2010-04-02 16:47 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel


>>> +#pragma GCC poison kvm_allowed
>>> +#pragma GCC poison kvm_enabled
>>
>>   kvm_enabled() is a macro.  I dont' think this poison pragma is actually
>> meaningful.
>
> I'm not familiar with poison pragmas, but actually poisoning only
> kvm_allowed didn't work.

Indeed, macro expansions are explicitly allowed to use poisoned 
identifiers (and on the contrary macro names count towards poisoning 
errors).

IMO kvm_allowed should be left unpoisoned.

Paolo

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

* [Qemu-devel] Re: [PATCH 2/2] Make kvm_enabled unavailable to non-target devices
  2010-04-02 16:47     ` [Qemu-devel] " Paolo Bonzini
@ 2010-04-02 16:57       ` Anthony Liguori
  0 siblings, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2010-04-02 16:57 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Blue Swirl, qemu-devel

On 04/02/2010 11:47 AM, Paolo Bonzini wrote:
>
>>>> +#pragma GCC poison kvm_allowed
>>>> +#pragma GCC poison kvm_enabled
>>>
>>>   kvm_enabled() is a macro.  I dont' think this poison pragma is 
>>> actually
>>> meaningful.
>>
>> I'm not familiar with poison pragmas, but actually poisoning only
>> kvm_allowed didn't work.
>
> Indeed, macro expansions are explicitly allowed to use poisoned 
> identifiers (and on the contrary macro names count towards poisoning 
> errors).
>
> IMO kvm_allowed should be left unpoisoned.

Interesting, thanks.

Regards,

Anthony Liguori

> Paolo

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

end of thread, other threads:[~2010-04-02 16:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-02 15:46 [Qemu-devel] [PATCH 2/2] Make kvm_enabled unavailable to non-target devices Blue Swirl
2010-04-02 16:25 ` Anthony Liguori
2010-04-02 16:33   ` Blue Swirl
2010-04-02 16:47     ` [Qemu-devel] " Paolo Bonzini
2010-04-02 16:57       ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2010-04-01 20:10 [Qemu-devel] " Blue Swirl

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).