* [Qemu-devel] [PATCH 0/0] MSI/MSIX injection for Xen HVM guests @ 2012-04-05 9:32 ` Wei Liu 0 siblings, 0 replies; 22+ messages in thread From: Wei Liu @ 2012-04-05 9:32 UTC (permalink / raw) To: QEMU-devel Cc: xen-devel, wei.liu2, Stefano Stabellini, Jan Kiszka, liuw, Paolo Bonzini Implement a simple Xen APIC module and use it to deliver MSI/MSIX for Xen HVM guests. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 0/0] MSI/MSIX injection for Xen HVM guests @ 2012-04-05 9:32 ` Wei Liu 0 siblings, 0 replies; 22+ messages in thread From: Wei Liu @ 2012-04-05 9:32 UTC (permalink / raw) To: QEMU-devel Cc: xen-devel, wei.liu2, Stefano Stabellini, Jan Kiszka, liuw, Paolo Bonzini Implement a simple Xen APIC module and use it to deliver MSI/MSIX for Xen HVM guests. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 1/2] Xen: basic HVM MSI injection support. 2012-04-05 9:32 ` Wei Liu @ 2012-04-05 9:34 ` Wei Liu -1 siblings, 0 replies; 22+ messages in thread From: Wei Liu @ 2012-04-05 9:34 UTC (permalink / raw) To: QEMU-devel Cc: xen-devel, wei.liu2, Stefano Stabellini, Jan Kiszka, liuw, Paolo Bonzini Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- hw/xen.h | 1 + xen-all.c | 5 +++++ xen-stub.c | 4 ++++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/hw/xen.h b/hw/xen.h index b46879c..e5926b7 100644 --- a/hw/xen.h +++ b/hw/xen.h @@ -34,6 +34,7 @@ static inline int xen_enabled(void) int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num); void xen_piix3_set_irq(void *opaque, int irq_num, int level); void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len); +void xen_hvm_inject_msi(uint64_t addr, uint32_t data); void xen_cmos_set_s3_resume(void *opaque, int irq, int level); qemu_irq *xen_interrupt_controller_init(void); diff --git a/xen-all.c b/xen-all.c index 3e6de41..abd2b2d 100644 --- a/xen-all.c +++ b/xen-all.c @@ -122,6 +122,11 @@ void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) } } +void xen_hvm_inject_msi(uint64_t addr, uint32_t data) +{ + xc_hvm_inject_msi(xen_xc, xen_domid, addr, data); +} + static void xen_suspend_notifier(Notifier *notifier, void *data) { xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3); diff --git a/xen-stub.c b/xen-stub.c index 9ea02d4..8ff2b79 100644 --- a/xen-stub.c +++ b/xen-stub.c @@ -29,6 +29,10 @@ void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) { } +void xen_hvm_inject_msi(uint64_t addr, uint32_t data) +{ +} + void xen_cmos_set_s3_resume(void *opaque, int irq, int level) { } -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 1/2] Xen: basic HVM MSI injection support. @ 2012-04-05 9:34 ` Wei Liu 0 siblings, 0 replies; 22+ messages in thread From: Wei Liu @ 2012-04-05 9:34 UTC (permalink / raw) To: QEMU-devel Cc: xen-devel, wei.liu2, Stefano Stabellini, Jan Kiszka, liuw, Paolo Bonzini Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- hw/xen.h | 1 + xen-all.c | 5 +++++ xen-stub.c | 4 ++++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/hw/xen.h b/hw/xen.h index b46879c..e5926b7 100644 --- a/hw/xen.h +++ b/hw/xen.h @@ -34,6 +34,7 @@ static inline int xen_enabled(void) int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num); void xen_piix3_set_irq(void *opaque, int irq_num, int level); void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len); +void xen_hvm_inject_msi(uint64_t addr, uint32_t data); void xen_cmos_set_s3_resume(void *opaque, int irq, int level); qemu_irq *xen_interrupt_controller_init(void); diff --git a/xen-all.c b/xen-all.c index 3e6de41..abd2b2d 100644 --- a/xen-all.c +++ b/xen-all.c @@ -122,6 +122,11 @@ void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) } } +void xen_hvm_inject_msi(uint64_t addr, uint32_t data) +{ + xc_hvm_inject_msi(xen_xc, xen_domid, addr, data); +} + static void xen_suspend_notifier(Notifier *notifier, void *data) { xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 3); diff --git a/xen-stub.c b/xen-stub.c index 9ea02d4..8ff2b79 100644 --- a/xen-stub.c +++ b/xen-stub.c @@ -29,6 +29,10 @@ void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len) { } +void xen_hvm_inject_msi(uint64_t addr, uint32_t data) +{ +} + void xen_cmos_set_s3_resume(void *opaque, int irq, int level) { } -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [Qemu-devel] [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-05 9:32 ` Wei Liu @ 2012-04-05 9:35 ` Wei Liu -1 siblings, 0 replies; 22+ messages in thread From: Wei Liu @ 2012-04-05 9:35 UTC (permalink / raw) To: QEMU-devel Cc: xen-devel, wei.liu2, Stefano Stabellini, Jan Kiszka, liuw, Paolo Bonzini Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Makefile.target | 2 +- hw/pc.c | 8 +++++ hw/xen_apic.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletions(-) create mode 100644 hw/xen_apic.c diff --git a/Makefile.target b/Makefile.target index cff15f0..6210bae 100644 --- a/Makefile.target +++ b/Makefile.target @@ -235,7 +235,7 @@ QEMU_CFLAGS += $(VNC_PNG_CFLAGS) obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o obj-$(CONFIG_NO_XEN) += xen-stub.o -obj-i386-$(CONFIG_XEN) += xen_platform.o +obj-i386-$(CONFIG_XEN) += xen_platform.o xen_apic.o # Inter-VM PCI shared memory CONFIG_IVSHMEM = diff --git a/hw/pc.c b/hw/pc.c index 83a1b5b..5585cac 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -42,6 +42,7 @@ #include "sysbus.h" #include "sysemu.h" #include "kvm.h" +#include "xen.h" #include "blockdev.h" #include "ui/qemu-spice.h" #include "memory.h" @@ -891,9 +892,12 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) if (kvm_irqchip_in_kernel()) { dev = qdev_create(NULL, "kvm-apic"); + } else if (xen_enabled()) { + dev = qdev_create(NULL, "xen-apic"); } else { dev = qdev_create(NULL, "apic"); } + qdev_prop_set_uint8(dev, "id", apic_id); qdev_prop_set_ptr(dev, "cpu_env", env); qdev_init_nofail(dev); @@ -912,6 +916,10 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) msi_supported = true; } + if (xen_enabled()) { + msi_supported = true; + } + return dev; } diff --git a/hw/xen_apic.c b/hw/xen_apic.c new file mode 100644 index 0000000..b1060b7 --- /dev/null +++ b/hw/xen_apic.c @@ -0,0 +1,90 @@ +/* + * Xen basic APIC support + * + * Copyright (c) 2012 Citrix + * + * Authors: + * Wei Liu <wei.liu2@citrix.com> + * + * This work is licensed under the terms of the GNU GPL version 2. + * See the COPYING file in the top-level directory. + */ +#include "hw/apic_internal.h" +#include "hw/msi.h" +#include "xen.h" + +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, + unsigned size) +{ + return -1U; +} + +static void xen_apic_mem_write(void *opaque, target_phys_addr_t addr, + uint64_t data, unsigned size) +{ + if (size != sizeof(uint32_t)) { + fprintf(stderr, "Xen: APIC write data size = %d, invalid\n", size); + return; + } + + xen_hvm_inject_msi(addr, data); +} + +static const MemoryRegionOps xen_apic_io_ops = { + .read = xen_apic_mem_read, + .write = xen_apic_mem_write, + .endianness = DEVICE_NATIVE_ENDIAN, +}; + +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); +} + +static void xen_apic_set_base(APICCommonState *s, uint64_t val) +{ +} + +static void xen_apic_set_tpr(APICCommonState *s, uint8_t val) +{ +} + +static uint8_t xen_apic_get_tpr(APICCommonState *s) +{ + return 0; +} + +static void xen_apic_vapic_base_update(APICCommonState *s) +{ +} + +static void xen_apic_external_nmi(APICCommonState *s) +{ +} + +static void xen_apic_class_init(ObjectClass *klass, void *data) +{ + APICCommonClass *k = APIC_COMMON_CLASS(klass); + + k->init = xen_apic_init; + k->set_base = xen_apic_set_base; + k->set_tpr = xen_apic_set_tpr; + k->get_tpr = xen_apic_get_tpr; + k->vapic_base_update = xen_apic_vapic_base_update; + k->external_nmi = xen_apic_external_nmi; +} + +static TypeInfo xen_apic_info = { + .name = "xen-apic", + .parent = TYPE_APIC_COMMON, + .instance_size = sizeof(APICCommonState), + .class_init = xen_apic_class_init, +}; + +static void xen_apic_register_types(void) +{ + type_register_static(&xen_apic_info); +} + +type_init(xen_apic_register_types) -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 2/2] Xen: Add xen-apic support and hook it up. @ 2012-04-05 9:35 ` Wei Liu 0 siblings, 0 replies; 22+ messages in thread From: Wei Liu @ 2012-04-05 9:35 UTC (permalink / raw) To: QEMU-devel Cc: xen-devel, wei.liu2, Stefano Stabellini, Jan Kiszka, liuw, Paolo Bonzini Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Makefile.target | 2 +- hw/pc.c | 8 +++++ hw/xen_apic.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletions(-) create mode 100644 hw/xen_apic.c diff --git a/Makefile.target b/Makefile.target index cff15f0..6210bae 100644 --- a/Makefile.target +++ b/Makefile.target @@ -235,7 +235,7 @@ QEMU_CFLAGS += $(VNC_PNG_CFLAGS) obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o obj-$(CONFIG_NO_XEN) += xen-stub.o -obj-i386-$(CONFIG_XEN) += xen_platform.o +obj-i386-$(CONFIG_XEN) += xen_platform.o xen_apic.o # Inter-VM PCI shared memory CONFIG_IVSHMEM = diff --git a/hw/pc.c b/hw/pc.c index 83a1b5b..5585cac 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -42,6 +42,7 @@ #include "sysbus.h" #include "sysemu.h" #include "kvm.h" +#include "xen.h" #include "blockdev.h" #include "ui/qemu-spice.h" #include "memory.h" @@ -891,9 +892,12 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) if (kvm_irqchip_in_kernel()) { dev = qdev_create(NULL, "kvm-apic"); + } else if (xen_enabled()) { + dev = qdev_create(NULL, "xen-apic"); } else { dev = qdev_create(NULL, "apic"); } + qdev_prop_set_uint8(dev, "id", apic_id); qdev_prop_set_ptr(dev, "cpu_env", env); qdev_init_nofail(dev); @@ -912,6 +916,10 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) msi_supported = true; } + if (xen_enabled()) { + msi_supported = true; + } + return dev; } diff --git a/hw/xen_apic.c b/hw/xen_apic.c new file mode 100644 index 0000000..b1060b7 --- /dev/null +++ b/hw/xen_apic.c @@ -0,0 +1,90 @@ +/* + * Xen basic APIC support + * + * Copyright (c) 2012 Citrix + * + * Authors: + * Wei Liu <wei.liu2@citrix.com> + * + * This work is licensed under the terms of the GNU GPL version 2. + * See the COPYING file in the top-level directory. + */ +#include "hw/apic_internal.h" +#include "hw/msi.h" +#include "xen.h" + +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, + unsigned size) +{ + return -1U; +} + +static void xen_apic_mem_write(void *opaque, target_phys_addr_t addr, + uint64_t data, unsigned size) +{ + if (size != sizeof(uint32_t)) { + fprintf(stderr, "Xen: APIC write data size = %d, invalid\n", size); + return; + } + + xen_hvm_inject_msi(addr, data); +} + +static const MemoryRegionOps xen_apic_io_ops = { + .read = xen_apic_mem_read, + .write = xen_apic_mem_write, + .endianness = DEVICE_NATIVE_ENDIAN, +}; + +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); +} + +static void xen_apic_set_base(APICCommonState *s, uint64_t val) +{ +} + +static void xen_apic_set_tpr(APICCommonState *s, uint8_t val) +{ +} + +static uint8_t xen_apic_get_tpr(APICCommonState *s) +{ + return 0; +} + +static void xen_apic_vapic_base_update(APICCommonState *s) +{ +} + +static void xen_apic_external_nmi(APICCommonState *s) +{ +} + +static void xen_apic_class_init(ObjectClass *klass, void *data) +{ + APICCommonClass *k = APIC_COMMON_CLASS(klass); + + k->init = xen_apic_init; + k->set_base = xen_apic_set_base; + k->set_tpr = xen_apic_set_tpr; + k->get_tpr = xen_apic_get_tpr; + k->vapic_base_update = xen_apic_vapic_base_update; + k->external_nmi = xen_apic_external_nmi; +} + +static TypeInfo xen_apic_info = { + .name = "xen-apic", + .parent = TYPE_APIC_COMMON, + .instance_size = sizeof(APICCommonState), + .class_init = xen_apic_class_init, +}; + +static void xen_apic_register_types(void) +{ + type_register_static(&xen_apic_info); +} + +type_init(xen_apic_register_types) -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-05 9:35 ` Wei Liu (?) @ 2012-04-11 16:02 ` Stefano Stabellini 2012-04-11 16:01 ` Jan Kiszka -1 siblings, 1 reply; 22+ messages in thread From: Stefano Stabellini @ 2012-04-11 16:02 UTC (permalink / raw) To: Wei Liu (Intern) Cc: xen-devel, Stefano Stabellini, Jan Kiszka, liuw, QEMU-devel, Anthony Liguori, Paolo Bonzini Jan, Anthony, any opinions on this patch? If it is OK for you, I am going to include it in the next Xen pull request. On Thu, 5 Apr 2012, Wei Liu (Intern) wrote: > > Signed-off-by: Wei Liu <wei.liu2@citrix.com> > --- > Makefile.target | 2 +- > hw/pc.c | 8 +++++ > hw/xen_apic.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 99 insertions(+), 1 deletions(-) > create mode 100644 hw/xen_apic.c > > diff --git a/Makefile.target b/Makefile.target > index cff15f0..6210bae 100644 > --- a/Makefile.target > +++ b/Makefile.target > @@ -235,7 +235,7 @@ QEMU_CFLAGS += $(VNC_PNG_CFLAGS) > obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o > obj-$(CONFIG_NO_XEN) += xen-stub.o > > -obj-i386-$(CONFIG_XEN) += xen_platform.o > +obj-i386-$(CONFIG_XEN) += xen_platform.o xen_apic.o > > # Inter-VM PCI shared memory > CONFIG_IVSHMEM = > diff --git a/hw/pc.c b/hw/pc.c > index 83a1b5b..5585cac 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -42,6 +42,7 @@ > #include "sysbus.h" > #include "sysemu.h" > #include "kvm.h" > +#include "xen.h" > #include "blockdev.h" > #include "ui/qemu-spice.h" > #include "memory.h" > @@ -891,9 +892,12 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) > > if (kvm_irqchip_in_kernel()) { > dev = qdev_create(NULL, "kvm-apic"); > + } else if (xen_enabled()) { > + dev = qdev_create(NULL, "xen-apic"); > } else { > dev = qdev_create(NULL, "apic"); > } > + > qdev_prop_set_uint8(dev, "id", apic_id); > qdev_prop_set_ptr(dev, "cpu_env", env); > qdev_init_nofail(dev); > @@ -912,6 +916,10 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) > msi_supported = true; > } > > + if (xen_enabled()) { > + msi_supported = true; > + } > + > return dev; > } > > diff --git a/hw/xen_apic.c b/hw/xen_apic.c > new file mode 100644 > index 0000000..b1060b7 > --- /dev/null > +++ b/hw/xen_apic.c > @@ -0,0 +1,90 @@ > +/* > + * Xen basic APIC support > + * > + * Copyright (c) 2012 Citrix > + * > + * Authors: > + * Wei Liu <wei.liu2@citrix.com> > + * > + * This work is licensed under the terms of the GNU GPL version 2. > + * See the COPYING file in the top-level directory. > + */ > +#include "hw/apic_internal.h" > +#include "hw/msi.h" > +#include "xen.h" > + > +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, > + unsigned size) > +{ > + return -1U; > +} > + > +static void xen_apic_mem_write(void *opaque, target_phys_addr_t addr, > + uint64_t data, unsigned size) > +{ > + if (size != sizeof(uint32_t)) { > + fprintf(stderr, "Xen: APIC write data size = %d, invalid\n", size); > + return; > + } > + > + xen_hvm_inject_msi(addr, data); > +} > + > +static const MemoryRegionOps xen_apic_io_ops = { > + .read = xen_apic_mem_read, > + .write = xen_apic_mem_write, > + .endianness = DEVICE_NATIVE_ENDIAN, > +}; > + > +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); > +} > + > +static void xen_apic_set_base(APICCommonState *s, uint64_t val) > +{ > +} > + > +static void xen_apic_set_tpr(APICCommonState *s, uint8_t val) > +{ > +} > + > +static uint8_t xen_apic_get_tpr(APICCommonState *s) > +{ > + return 0; > +} > + > +static void xen_apic_vapic_base_update(APICCommonState *s) > +{ > +} > + > +static void xen_apic_external_nmi(APICCommonState *s) > +{ > +} > + > +static void xen_apic_class_init(ObjectClass *klass, void *data) > +{ > + APICCommonClass *k = APIC_COMMON_CLASS(klass); > + > + k->init = xen_apic_init; > + k->set_base = xen_apic_set_base; > + k->set_tpr = xen_apic_set_tpr; > + k->get_tpr = xen_apic_get_tpr; > + k->vapic_base_update = xen_apic_vapic_base_update; > + k->external_nmi = xen_apic_external_nmi; > +} > + > +static TypeInfo xen_apic_info = { > + .name = "xen-apic", > + .parent = TYPE_APIC_COMMON, > + .instance_size = sizeof(APICCommonState), > + .class_init = xen_apic_class_init, > +}; > + > +static void xen_apic_register_types(void) > +{ > + type_register_static(&xen_apic_info); > +} > + > +type_init(xen_apic_register_types) > -- > 1.7.2.5 > > > > > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-11 16:02 ` Stefano Stabellini @ 2012-04-11 16:01 ` Jan Kiszka 0 siblings, 0 replies; 22+ messages in thread From: Jan Kiszka @ 2012-04-11 16:01 UTC (permalink / raw) To: Stefano Stabellini Cc: xen-devel, Wei Liu (Intern), liuw, QEMU-devel, Anthony Liguori, Paolo Bonzini On 2012-04-11 18:02, Stefano Stabellini wrote: > Jan, Anthony, any opinions on this patch? > If it is OK for you, I am going to include it in the next Xen pull request. > Looks good to me. Jan > > On Thu, 5 Apr 2012, Wei Liu (Intern) wrote: >> >> Signed-off-by: Wei Liu <wei.liu2@citrix.com> >> --- >> Makefile.target | 2 +- >> hw/pc.c | 8 +++++ >> hw/xen_apic.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 99 insertions(+), 1 deletions(-) >> create mode 100644 hw/xen_apic.c >> >> diff --git a/Makefile.target b/Makefile.target >> index cff15f0..6210bae 100644 >> --- a/Makefile.target >> +++ b/Makefile.target >> @@ -235,7 +235,7 @@ QEMU_CFLAGS += $(VNC_PNG_CFLAGS) >> obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o >> obj-$(CONFIG_NO_XEN) += xen-stub.o >> >> -obj-i386-$(CONFIG_XEN) += xen_platform.o >> +obj-i386-$(CONFIG_XEN) += xen_platform.o xen_apic.o >> >> # Inter-VM PCI shared memory >> CONFIG_IVSHMEM = >> diff --git a/hw/pc.c b/hw/pc.c >> index 83a1b5b..5585cac 100644 >> --- a/hw/pc.c >> +++ b/hw/pc.c >> @@ -42,6 +42,7 @@ >> #include "sysbus.h" >> #include "sysemu.h" >> #include "kvm.h" >> +#include "xen.h" >> #include "blockdev.h" >> #include "ui/qemu-spice.h" >> #include "memory.h" >> @@ -891,9 +892,12 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) >> >> if (kvm_irqchip_in_kernel()) { >> dev = qdev_create(NULL, "kvm-apic"); >> + } else if (xen_enabled()) { >> + dev = qdev_create(NULL, "xen-apic"); >> } else { >> dev = qdev_create(NULL, "apic"); >> } >> + >> qdev_prop_set_uint8(dev, "id", apic_id); >> qdev_prop_set_ptr(dev, "cpu_env", env); >> qdev_init_nofail(dev); >> @@ -912,6 +916,10 @@ static DeviceState *apic_init(void *env, uint8_t apic_id) >> msi_supported = true; >> } >> >> + if (xen_enabled()) { >> + msi_supported = true; >> + } >> + >> return dev; >> } >> >> diff --git a/hw/xen_apic.c b/hw/xen_apic.c >> new file mode 100644 >> index 0000000..b1060b7 >> --- /dev/null >> +++ b/hw/xen_apic.c >> @@ -0,0 +1,90 @@ >> +/* >> + * Xen basic APIC support >> + * >> + * Copyright (c) 2012 Citrix >> + * >> + * Authors: >> + * Wei Liu <wei.liu2@citrix.com> >> + * >> + * This work is licensed under the terms of the GNU GPL version 2. >> + * See the COPYING file in the top-level directory. >> + */ >> +#include "hw/apic_internal.h" >> +#include "hw/msi.h" >> +#include "xen.h" >> + >> +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, >> + unsigned size) >> +{ >> + return -1U; >> +} >> + >> +static void xen_apic_mem_write(void *opaque, target_phys_addr_t addr, >> + uint64_t data, unsigned size) >> +{ >> + if (size != sizeof(uint32_t)) { >> + fprintf(stderr, "Xen: APIC write data size = %d, invalid\n", size); >> + return; >> + } >> + >> + xen_hvm_inject_msi(addr, data); >> +} >> + >> +static const MemoryRegionOps xen_apic_io_ops = { >> + .read = xen_apic_mem_read, >> + .write = xen_apic_mem_write, >> + .endianness = DEVICE_NATIVE_ENDIAN, >> +}; >> + >> +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); >> +} >> + >> +static void xen_apic_set_base(APICCommonState *s, uint64_t val) >> +{ >> +} >> + >> +static void xen_apic_set_tpr(APICCommonState *s, uint8_t val) >> +{ >> +} >> + >> +static uint8_t xen_apic_get_tpr(APICCommonState *s) >> +{ >> + return 0; >> +} >> + >> +static void xen_apic_vapic_base_update(APICCommonState *s) >> +{ >> +} >> + >> +static void xen_apic_external_nmi(APICCommonState *s) >> +{ >> +} >> + >> +static void xen_apic_class_init(ObjectClass *klass, void *data) >> +{ >> + APICCommonClass *k = APIC_COMMON_CLASS(klass); >> + >> + k->init = xen_apic_init; >> + k->set_base = xen_apic_set_base; >> + k->set_tpr = xen_apic_set_tpr; >> + k->get_tpr = xen_apic_get_tpr; >> + k->vapic_base_update = xen_apic_vapic_base_update; >> + k->external_nmi = xen_apic_external_nmi; >> +} >> + >> +static TypeInfo xen_apic_info = { >> + .name = "xen-apic", >> + .parent = TYPE_APIC_COMMON, >> + .instance_size = sizeof(APICCommonState), >> + .class_init = xen_apic_class_init, >> +}; >> + >> +static void xen_apic_register_types(void) >> +{ >> + type_register_static(&xen_apic_info); >> +} >> + >> +type_init(xen_apic_register_types) >> -- >> 1.7.2.5 >> >> >> >> >> -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-05 9:35 ` Wei Liu (?) (?) @ 2012-04-11 16:07 ` Peter Maydell 2012-04-11 16:13 ` Jan Kiszka 2012-04-11 16:17 ` Stefano Stabellini -1 siblings, 2 replies; 22+ messages in thread From: Peter Maydell @ 2012-04-11 16:07 UTC (permalink / raw) To: Wei Liu Cc: xen-devel, liuw, Jan Kiszka, Stefano Stabellini, QEMU-devel, Paolo Bonzini On 5 April 2012 10:35, Wei Liu <wei.liu2@citrix.com> wrote: > > --- /dev/null > +++ b/hw/xen_apic.c > @@ -0,0 +1,90 @@ > +/* > + * Xen basic APIC support > + * > + * Copyright (c) 2012 Citrix > + * > + * Authors: > + * Wei Liu <wei.liu2@citrix.com> > + * > + * This work is licensed under the terms of the GNU GPL version 2. > + * See the COPYING file in the top-level directory. > + */ Really 2-only, not 2-or-later ? > +#include "hw/apic_internal.h" > +#include "hw/msi.h" > +#include "xen.h" > + > +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, > + unsigned size) > +{ > + return -1U; > +} This seems a rather confusing way to write 'return 0xffffffff;' -- PMM ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-11 16:07 ` Peter Maydell @ 2012-04-11 16:13 ` Jan Kiszka 2012-04-11 16:23 ` Peter Maydell 2012-04-11 16:17 ` Stefano Stabellini 1 sibling, 1 reply; 22+ messages in thread From: Jan Kiszka @ 2012-04-11 16:13 UTC (permalink / raw) To: Peter Maydell Cc: xen-devel, Wei Liu, liuw, Stefano Stabellini, QEMU-devel, Paolo Bonzini On 2012-04-11 18:07, Peter Maydell wrote: >> +#include "hw/apic_internal.h" >> +#include "hw/msi.h" >> +#include "xen.h" >> + >> +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, >> + unsigned size) >> +{ >> + return -1U; >> +} > > This seems a rather confusing way to write 'return 0xffffffff;' You mean 0xffffffffffffffff? :) Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-11 16:13 ` Jan Kiszka @ 2012-04-11 16:23 ` Peter Maydell 0 siblings, 0 replies; 22+ messages in thread From: Peter Maydell @ 2012-04-11 16:23 UTC (permalink / raw) To: Jan Kiszka Cc: xen-devel, Wei Liu, liuw, Stefano Stabellini, QEMU-devel, Paolo Bonzini On 11 April 2012 17:13, Jan Kiszka <jan.kiszka@siemens.com> wrote: > On 2012-04-11 18:07, Peter Maydell wrote: >>> +#include "hw/apic_internal.h" >>> +#include "hw/msi.h" >>> +#include "xen.h" >>> + >>> +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, >>> + unsigned size) >>> +{ >>> + return -1U; >>> +} >> >> This seems a rather confusing way to write 'return 0xffffffff;' > > You mean 0xffffffffffffffff? :) No, that's why it's confusing :-) 1U is the integer constant 1 with a type of 'unsigned int' (cf C99 section 6.4.4.1). It then has the unary negation operator applied to it, giving (for the usual 32 bit integer case) 0xffffffff. This is then cast from 'unsigned int' to 'uint64_t' giving 0xffffffff as a 64 bit unsigned value. (I had to write a test program to (a) confirm what it was going to return and (b) that it would be the same thing on both 32 and 64 bit systems...) I have no opinion on what the return value actually ought to be. -- PMM ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-11 16:07 ` Peter Maydell 2012-04-11 16:13 ` Jan Kiszka @ 2012-04-11 16:17 ` Stefano Stabellini 2012-04-11 16:19 ` Stefano Stabellini ` (2 more replies) 1 sibling, 3 replies; 22+ messages in thread From: Stefano Stabellini @ 2012-04-11 16:17 UTC (permalink / raw) To: Peter Maydell Cc: xen-devel, Wei Liu (Intern), liuw, Jan Kiszka, Stefano Stabellini, QEMU-devel, Paolo Bonzini [-- Attachment #1: Type: text/plain, Size: 1028 bytes --] On Wed, 11 Apr 2012, Peter Maydell wrote: > On 5 April 2012 10:35, Wei Liu <wei.liu2@citrix.com> wrote: > > > > --- /dev/null > > +++ b/hw/xen_apic.c > > @@ -0,0 +1,90 @@ > > +/* > > + * Xen basic APIC support > > + * > > + * Copyright (c) 2012 Citrix > > + * > > + * Authors: > > + * Wei Liu <wei.liu2@citrix.com> > > + * > > + * This work is licensed under the terms of the GNU GPL version 2. > > + * See the COPYING file in the top-level directory. > > + */ > > Really 2-only, not 2-or-later ? I am not a great fun of the 2-or-later clause and it doesn't look like a requirement from the QEMU project POV. However if it is, I'll change it to 2-or-later. > > +#include "hw/apic_internal.h" > > +#include "hw/msi.h" > > +#include "xen.h" > > + > > +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, > > + unsigned size) > > +{ > > + return -1U; > > +} > > This seems a rather confusing way to write 'return 0xffffffff;' Yep, I'll change it. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-11 16:17 ` Stefano Stabellini @ 2012-04-11 16:19 ` Stefano Stabellini 2012-04-11 17:02 ` Eric Blake 2012-04-11 21:37 ` Paolo Bonzini 2 siblings, 0 replies; 22+ messages in thread From: Stefano Stabellini @ 2012-04-11 16:19 UTC (permalink / raw) To: Stefano Stabellini Cc: Peter Maydell, xen-devel, Wei Liu (Intern), liuw, Jan Kiszka, QEMU-devel, Paolo Bonzini [-- Attachment #1: Type: text/plain, Size: 1198 bytes --] On Wed, 11 Apr 2012, Stefano Stabellini wrote: > On Wed, 11 Apr 2012, Peter Maydell wrote: > > On 5 April 2012 10:35, Wei Liu <wei.liu2@citrix.com> wrote: > > > > > > --- /dev/null > > > +++ b/hw/xen_apic.c > > > @@ -0,0 +1,90 @@ > > > +/* > > > + * Xen basic APIC support > > > + * > > > + * Copyright (c) 2012 Citrix > > > + * > > > + * Authors: > > > + * Wei Liu <wei.liu2@citrix.com> > > > + * > > > + * This work is licensed under the terms of the GNU GPL version 2. > > > + * See the COPYING file in the top-level directory. > > > + */ > > > > Really 2-only, not 2-or-later ? > > I am not a great fun of the 2-or-later clause and it doesn't look like a > requirement from the QEMU project POV. However if it is, I'll change it > to 2-or-later. > > > > > +#include "hw/apic_internal.h" > > > +#include "hw/msi.h" > > > +#include "xen.h" > > > + > > > +static uint64_t xen_apic_mem_read(void *opaque, target_phys_addr_t addr, > > > + unsigned size) > > > +{ > > > + return -1U; > > > +} > > > > This seems a rather confusing way to write 'return 0xffffffff;' > > Yep, I'll change it. Actually it is a uint64 so it is a lot of f's ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-11 16:17 ` Stefano Stabellini 2012-04-11 16:19 ` Stefano Stabellini @ 2012-04-11 17:02 ` Eric Blake 2012-04-12 3:23 ` [Qemu-devel] " Wei Liu 2012-04-11 21:37 ` Paolo Bonzini 2 siblings, 1 reply; 22+ messages in thread From: Eric Blake @ 2012-04-11 17:02 UTC (permalink / raw) To: Stefano Stabellini Cc: Peter Maydell, xen-devel, Wei Liu (Intern), liuw, Jan Kiszka, QEMU-devel, Paolo Bonzini [-- Attachment #1: Type: text/plain, Size: 1082 bytes --] On 04/11/2012 10:17 AM, Stefano Stabellini wrote: > On Wed, 11 Apr 2012, Peter Maydell wrote: >> On 5 April 2012 10:35, Wei Liu <wei.liu2@citrix.com> wrote: >>> >>> --- /dev/null >>> +++ b/hw/xen_apic.c >>> @@ -0,0 +1,90 @@ >>> +/* >>> + * Xen basic APIC support >>> + * >>> + * Copyright (c) 2012 Citrix >>> + * >>> + * Authors: >>> + * Wei Liu <wei.liu2@citrix.com> >>> + * >>> + * This work is licensed under the terms of the GNU GPL version 2. >>> + * See the COPYING file in the top-level directory. >>> + */ >> >> Really 2-only, not 2-or-later ? > > I am not a great fun of the 2-or-later clause and it doesn't look like a > requirement from the QEMU project POV. However if it is, I'll change it > to 2-or-later. Conversely, I am not a great fan of the 2-only clause, as it prevents reuse of qemu code in other projects. There's a reason that qemu is now favoring 2-or-later for new submissions. http://wiki.qemu.org/Relicensing -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 620 bytes --] ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-11 17:02 ` Eric Blake @ 2012-04-12 3:23 ` Wei Liu 0 siblings, 0 replies; 22+ messages in thread From: Wei Liu @ 2012-04-12 3:23 UTC (permalink / raw) To: Eric Blake Cc: Peter Maydell, xen-devel, Wei Liu (Intern), Stefano Stabellini, Jan Kiszka, QEMU-devel, Paolo Bonzini On Thu, Apr 12, 2012 at 1:02 AM, Eric Blake <eblake@redhat.com> wrote: > On 04/11/2012 10:17 AM, Stefano Stabellini wrote: >> On Wed, 11 Apr 2012, Peter Maydell wrote: >>> On 5 April 2012 10:35, Wei Liu <wei.liu2@citrix.com> wrote: >>>> >>>> --- /dev/null >>>> +++ b/hw/xen_apic.c >>>> @@ -0,0 +1,90 @@ >>>> +/* >>>> + * Xen basic APIC support >>>> + * >>>> + * Copyright (c) 2012 Citrix >>>> + * >>>> + * Authors: >>>> + * Wei Liu <wei.liu2@citrix.com> >>>> + * >>>> + * This work is licensed under the terms of the GNU GPL version 2. >>>> + * See the COPYING file in the top-level directory. >>>> + */ >>> >>> Really 2-only, not 2-or-later ? >> >> I am not a great fun of the 2-or-later clause and it doesn't look like a >> requirement from the QEMU project POV. However if it is, I'll change it >> to 2-or-later. > > Conversely, I am not a great fan of the 2-only clause, as it prevents > reuse of qemu code in other projects. There's a reason that qemu is now > favoring 2-or-later for new submissions. > > http://wiki.qemu.org/Relicensing > I don't mind changing the licensing to 2-or-later for greater benefit. Stefano, please do whatever you need to. Wei. > -- > Eric Blake eblake@redhat.com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 2/2] Xen: Add xen-apic support and hook it up. 2012-04-11 16:17 ` Stefano Stabellini 2012-04-11 16:19 ` Stefano Stabellini 2012-04-11 17:02 ` Eric Blake @ 2012-04-11 21:37 ` Paolo Bonzini 2 siblings, 0 replies; 22+ messages in thread From: Paolo Bonzini @ 2012-04-11 21:37 UTC (permalink / raw) To: qemu-devel; +Cc: xen-devel Il 11/04/2012 18:17, Stefano Stabellini ha scritto: >> > Really 2-only, not 2-or-later ? > I am not a great fun of the 2-or-later clause and it doesn't look like a > requirement from the QEMU project POV. However if it is, I'll change it > to 2-or-later. OT fun fact: did you know that MPL comes with an or-later clause that (unlike the GPL) you cannot reject? So much for "weak" copyleft. Paolo ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 0/0] MSI/MSIX injection for Xen HVM guests 2012-04-05 9:32 ` Wei Liu @ 2012-04-05 10:14 ` Paolo Bonzini -1 siblings, 0 replies; 22+ messages in thread From: Paolo Bonzini @ 2012-04-05 10:14 UTC (permalink / raw) To: Wei Liu; +Cc: Jan Kiszka, xen-devel, QEMU-devel, Stefano Stabellini, liuw Il 05/04/2012 11:32, Wei Liu ha scritto: > Implement a simple Xen APIC module and use it to deliver MSI/MSIX for > Xen HVM guests. Only skimmed the patch but yeah, this is what I had in mind. Thanks! Paolo ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/0] MSI/MSIX injection for Xen HVM guests @ 2012-04-05 10:14 ` Paolo Bonzini 0 siblings, 0 replies; 22+ messages in thread From: Paolo Bonzini @ 2012-04-05 10:14 UTC (permalink / raw) To: Wei Liu; +Cc: Jan Kiszka, xen-devel, QEMU-devel, Stefano Stabellini, liuw Il 05/04/2012 11:32, Wei Liu ha scritto: > Implement a simple Xen APIC module and use it to deliver MSI/MSIX for > Xen HVM guests. Only skimmed the patch but yeah, this is what I had in mind. Thanks! Paolo ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 0/0] MSI/MSIX injection for Xen HVM guests 2012-04-05 10:14 ` Paolo Bonzini @ 2012-04-05 10:43 ` Stefano Stabellini -1 siblings, 0 replies; 22+ messages in thread From: Stefano Stabellini @ 2012-04-05 10:43 UTC (permalink / raw) To: Paolo Bonzini Cc: xen-devel, Wei Liu (Intern), Stefano Stabellini, Jan Kiszka, liuw, QEMU-devel On Thu, 5 Apr 2012, Paolo Bonzini wrote: > Il 05/04/2012 11:32, Wei Liu ha scritto: > > Implement a simple Xen APIC module and use it to deliver MSI/MSIX for > > Xen HVM guests. > > Only skimmed the patch but yeah, this is what I had in mind. Thanks! It looks good to me too. Paolo, can I add your acked-by? ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/0] MSI/MSIX injection for Xen HVM guests @ 2012-04-05 10:43 ` Stefano Stabellini 0 siblings, 0 replies; 22+ messages in thread From: Stefano Stabellini @ 2012-04-05 10:43 UTC (permalink / raw) To: Paolo Bonzini Cc: xen-devel, Wei Liu (Intern), Stefano Stabellini, Jan Kiszka, liuw, QEMU-devel On Thu, 5 Apr 2012, Paolo Bonzini wrote: > Il 05/04/2012 11:32, Wei Liu ha scritto: > > Implement a simple Xen APIC module and use it to deliver MSI/MSIX for > > Xen HVM guests. > > Only skimmed the patch but yeah, this is what I had in mind. Thanks! It looks good to me too. Paolo, can I add your acked-by? ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [Qemu-devel] [PATCH 0/0] MSI/MSIX injection for Xen HVM guests 2012-04-05 10:43 ` Stefano Stabellini @ 2012-04-05 10:50 ` Paolo Bonzini -1 siblings, 0 replies; 22+ messages in thread From: Paolo Bonzini @ 2012-04-05 10:50 UTC (permalink / raw) To: Stefano Stabellini Cc: Jan Kiszka, xen-devel, Wei Liu (Intern), QEMU-devel, liuw Il 05/04/2012 12:43, Stefano Stabellini ha scritto: >>> > > Implement a simple Xen APIC module and use it to deliver MSI/MSIX for >>> > > Xen HVM guests. >> > >> > Only skimmed the patch but yeah, this is what I had in mind. Thanks! > It looks good to me too. > Paolo, can I add your acked-by? Acked-by, yes. Reviewed-by, no. :) Paolo ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 0/0] MSI/MSIX injection for Xen HVM guests @ 2012-04-05 10:50 ` Paolo Bonzini 0 siblings, 0 replies; 22+ messages in thread From: Paolo Bonzini @ 2012-04-05 10:50 UTC (permalink / raw) To: Stefano Stabellini Cc: Jan Kiszka, xen-devel, Wei Liu (Intern), QEMU-devel, liuw Il 05/04/2012 12:43, Stefano Stabellini ha scritto: >>> > > Implement a simple Xen APIC module and use it to deliver MSI/MSIX for >>> > > Xen HVM guests. >> > >> > Only skimmed the patch but yeah, this is what I had in mind. Thanks! > It looks good to me too. > Paolo, can I add your acked-by? Acked-by, yes. Reviewed-by, no. :) Paolo ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2012-04-12 3:23 UTC | newest] Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-04-05 9:32 [Qemu-devel] [PATCH 0/0] MSI/MSIX injection for Xen HVM guests Wei Liu 2012-04-05 9:32 ` Wei Liu 2012-04-05 9:34 ` [Qemu-devel] [PATCH 1/2] Xen: basic HVM MSI injection support Wei Liu 2012-04-05 9:34 ` Wei Liu 2012-04-05 9:35 ` [Qemu-devel] [PATCH 2/2] Xen: Add xen-apic support and hook it up Wei Liu 2012-04-05 9:35 ` Wei Liu 2012-04-11 16:02 ` Stefano Stabellini 2012-04-11 16:01 ` Jan Kiszka 2012-04-11 16:07 ` Peter Maydell 2012-04-11 16:13 ` Jan Kiszka 2012-04-11 16:23 ` Peter Maydell 2012-04-11 16:17 ` Stefano Stabellini 2012-04-11 16:19 ` Stefano Stabellini 2012-04-11 17:02 ` Eric Blake 2012-04-12 3:23 ` [Qemu-devel] " Wei Liu 2012-04-11 21:37 ` Paolo Bonzini 2012-04-05 10:14 ` [Qemu-devel] [PATCH 0/0] MSI/MSIX injection for Xen HVM guests Paolo Bonzini 2012-04-05 10:14 ` Paolo Bonzini 2012-04-05 10:43 ` [Qemu-devel] " Stefano Stabellini 2012-04-05 10:43 ` Stefano Stabellini 2012-04-05 10:50 ` [Qemu-devel] " Paolo Bonzini 2012-04-05 10:50 ` Paolo Bonzini
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.