diff mbox

[v3,4/8] pc: Enable MSI support at APIC level

Message ID bcf64f69177abe584562498af6c0aa64defd6403.1336683774.git.jan.kiszka@siemens.com
State New
Headers show

Commit Message

Jan Kiszka May 10, 2012, 9:02 p.m. UTC
Push msi_supported enabling to the APIC implementations where we can
encapsulate the decision more cleanly, hiding the details from the
generic code.

CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/apic.c     |    2 ++
 hw/pc.c       |    9 ---------
 hw/xen.h      |   10 ----------
 hw/xen_apic.c |    5 +++++
 4 files changed, 7 insertions(+), 19 deletions(-)

Comments

Stefano Stabellini May 11, 2012, 4:24 p.m. UTC | #1
On Thu, 10 May 2012, Jan Kiszka wrote:
> Push msi_supported enabling to the APIC implementations where we can
> encapsulate the decision more cleanly, hiding the details from the
> generic code.
> 
> CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

This patch is missing the KVM part, but assuming that it is done in a
later patch:

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>



>  hw/apic.c     |    2 ++
>  hw/pc.c       |    9 ---------
>  hw/xen.h      |   10 ----------
>  hw/xen_apic.c |    5 +++++
>  4 files changed, 7 insertions(+), 19 deletions(-)
> 
> diff --git a/hw/apic.c b/hw/apic.c
> index 4eeaf88..a337790 100644
> --- a/hw/apic.c
> +++ b/hw/apic.c
> @@ -862,6 +862,8 @@ static void apic_init(APICCommonState *s)
>  
>      s->timer = qemu_new_timer_ns(vm_clock, apic_timer, s);
>      local_apics[s->idx] = s;
> +
> +    msi_supported = true;
>  }
>  
>  static void apic_class_init(ObjectClass *klass, void *data)
> diff --git a/hw/pc.c b/hw/pc.c
> index 4d34a33..6691b18 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -911,15 +911,6 @@ static DeviceState *apic_init(void *env, uint8_t apic_id)
>          apic_mapped = 1;
>      }
>  
> -    /* KVM does not support MSI yet. */
> -    if (!kvm_irqchip_in_kernel()) {
> -        msi_supported = true;
> -    }
> -
> -    if (xen_msi_support()) {
> -        msi_supported = true;
> -    }
> -
>      return dev;
>  }
>  
> diff --git a/hw/xen.h b/hw/xen.h
> index 3ae4cd0..e5926b7 100644
> --- a/hw/xen.h
> +++ b/hw/xen.h
> @@ -57,14 +57,4 @@ void xen_register_framebuffer(struct MemoryRegion *mr);
>  #  define HVM_MAX_VCPUS 32
>  #endif
>  
> -static inline int xen_msi_support(void)
> -{
> -#if defined(CONFIG_XEN_CTRL_INTERFACE_VERSION) \
> -    && CONFIG_XEN_CTRL_INTERFACE_VERSION >= 420
> -    return xen_enabled();
> -#else
> -    return 0;
> -#endif
> -}
> -
>  #endif /* QEMU_HW_XEN_H */
> diff --git a/hw/xen_apic.c b/hw/xen_apic.c
> index 1725ff6..a9e101f 100644
> --- a/hw/xen_apic.c
> +++ b/hw/xen_apic.c
> @@ -40,6 +40,11 @@ static void xen_apic_init(APICCommonState *s)
>  {
>      memory_region_init_io(&s->io_memory, &xen_apic_io_ops, s, "xen-apic-msi",
>                            MSI_SPACE_SIZE);
> +
> +#if defined(CONFIG_XEN_CTRL_INTERFACE_VERSION) \
> +    && CONFIG_XEN_CTRL_INTERFACE_VERSION >= 420
> +    msi_supported = true;
> +#endif
>  }
>  
>  static void xen_apic_set_base(APICCommonState *s, uint64_t val)
> -- 
> 1.7.3.4
>
Jan Kiszka May 11, 2012, 6:33 p.m. UTC | #2
On 2012-05-11 13:24, Stefano Stabellini wrote:
> On Thu, 10 May 2012, Jan Kiszka wrote:
>> Push msi_supported enabling to the APIC implementations where we can
>> encapsulate the decision more cleanly, hiding the details from the
>> generic code.
>>
>> CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This patch is missing the KVM part, but assuming that it is done in a
> later patch:

It is as the KVM APIC is not yet ready for MSI activation at this point.

> 
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 

Thanks,
Jan
diff mbox

Patch

diff --git a/hw/apic.c b/hw/apic.c
index 4eeaf88..a337790 100644
--- a/hw/apic.c
+++ b/hw/apic.c
@@ -862,6 +862,8 @@  static void apic_init(APICCommonState *s)
 
     s->timer = qemu_new_timer_ns(vm_clock, apic_timer, s);
     local_apics[s->idx] = s;
+
+    msi_supported = true;
 }
 
 static void apic_class_init(ObjectClass *klass, void *data)
diff --git a/hw/pc.c b/hw/pc.c
index 4d34a33..6691b18 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -911,15 +911,6 @@  static DeviceState *apic_init(void *env, uint8_t apic_id)
         apic_mapped = 1;
     }
 
-    /* KVM does not support MSI yet. */
-    if (!kvm_irqchip_in_kernel()) {
-        msi_supported = true;
-    }
-
-    if (xen_msi_support()) {
-        msi_supported = true;
-    }
-
     return dev;
 }
 
diff --git a/hw/xen.h b/hw/xen.h
index 3ae4cd0..e5926b7 100644
--- a/hw/xen.h
+++ b/hw/xen.h
@@ -57,14 +57,4 @@  void xen_register_framebuffer(struct MemoryRegion *mr);
 #  define HVM_MAX_VCPUS 32
 #endif
 
-static inline int xen_msi_support(void)
-{
-#if defined(CONFIG_XEN_CTRL_INTERFACE_VERSION) \
-    && CONFIG_XEN_CTRL_INTERFACE_VERSION >= 420
-    return xen_enabled();
-#else
-    return 0;
-#endif
-}
-
 #endif /* QEMU_HW_XEN_H */
diff --git a/hw/xen_apic.c b/hw/xen_apic.c
index 1725ff6..a9e101f 100644
--- a/hw/xen_apic.c
+++ b/hw/xen_apic.c
@@ -40,6 +40,11 @@  static void xen_apic_init(APICCommonState *s)
 {
     memory_region_init_io(&s->io_memory, &xen_apic_io_ops, s, "xen-apic-msi",
                           MSI_SPACE_SIZE);
+
+#if defined(CONFIG_XEN_CTRL_INTERFACE_VERSION) \
+    && CONFIG_XEN_CTRL_INTERFACE_VERSION >= 420
+    msi_supported = true;
+#endif
 }
 
 static void xen_apic_set_base(APICCommonState *s, uint64_t val)