s390x patches for 2.3
Third time's the charm? I've verified that this builds with mingw32 (and nothing else that worked before broke).
The following changes since commit 64ea8038ffbf703dcd438a108d2d5499c8ff95d9:
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150109.0' into staging (2015-01-10 22:29:09 +0000)
are available in the git repository at:
git://github.com/cohuck/qemu tags/s390x-20150112-v3
for you to fetch changes up to 9e03a0405d56b4af8952b794d0e5dd9206ee7329:
kvm: extend kvm_irqchip_add_msi_route to work on s390 (2015-01-12 10:14:04 +0100)
----------------------------------------------------------------
s390x patches for 2.3.
Highlight is support for PCI devices on s390x. Otherwise, performance improvements (register sync) and small cleanups.
----------------------------------------------------------------
Cornelia Huck (1):
s390x/ccw: fix oddity in machine class init
David Hildenbrand (2):
s390x/kvm: sync register support helper function s390x/kvm: avoid syscalls by syncing registers with kvm_run
Frank Blaschka (3):
s390: Add PCI bus support
s390: implement pci instructions
kvm: extend kvm_irqchip_add_msi_route to work on s390
Thomas Huth (1):
s390x/css: Clean up unnecessary CONFIG_USER_ONLY wrappers
MAINTAINERS | 2 + default-configs/s390x-softmmu.mak | 1 + hw/s390x/Makefile.objs | 1 + hw/s390x/css.c | 5 + hw/s390x/css.h | 1 + hw/s390x/s390-pci-bus.c | 591 +++++++++++++++++++++++++++ hw/s390x/s390-pci-bus.h | 251 ++++++++++++ hw/s390x/s390-pci-inst.c | 811 +++++++++++++++++++++++++++++++++++++ hw/s390x/s390-pci-inst.h | 288 +++++++++++++ hw/s390x/s390-virtio-ccw.c | 9 +- hw/s390x/sclp.c | 10 +- include/hw/s390x/sclp.h | 8 + include/sysemu/kvm.h | 4 + kvm-all.c | 7 + target-arm/kvm.c | 6 + target-i386/kvm.c | 6 + target-mips/kvm.c | 6 + target-ppc/kvm.c | 6 + target-s390x/cpu.h | 81 ---- target-s390x/ioinst.c | 52 +++ target-s390x/ioinst.h | 1 + target-s390x/kvm.c | 273 +++++++++++-- 22 files changed, 2305 insertions(+), 115 deletions(-) create mode 100644 hw/s390x/s390-pci-bus.c create mode 100644 hw/s390x/s390-pci-bus.h create mode 100644 hw/s390x/s390-pci-inst.c create mode 100644 hw/s390x/s390-pci-inst.h
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL v3 1/7] s390x/ccw: fix oddity in machine class init
ccw_machine_class_init() uses ',' instead of ';' while initializing the class' fields. This is almost certainly a copy/paste error and, while legal C, rather on the unusual side. Just use ';' everywhere.
--- hw/s390x/s390-virtio-ccw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/s390-virtio-ccw.c +1 -1
@@ -181,7 +181,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) mc->no_serial =1 ; mc->no_parallel =1 ; mc->no_sdcard =1 ; - mc->use_sclp =1 , + mc->use_sclp =1 ; mc->max_cpus =255 ; nc->nmi_monitor_handler = s390_nmi; }
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL v3 3/7] s390x/kvm: sync register support helper function
In reply to Cornelia HuckFrom: David Hildenbrand <[email protected]>
Let's unify the code to sync registers by moving the checks into a helper function can_sync_regs().
--- target-s390x/kvm.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
target-s390x/kvm.c +12 -10
@@ -202,6 +202,11 @@ void kvm_s390_reset_vcpu(S390CPU *cpu) } } +static int can_sync_regs (CPUState *cs,int regs) +{ +return cap_sync_regs && (cs->kvm_run->kvm_valid_regs & regs) == regs; +} +int kvm_arch_put_registers (CPUState *cs,int level) {S390CPU *cpu =S390_CPU (cs);
@@ -216,7 +221,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) cs->kvm_run->psw_addr = env->psw.addr; cs->kvm_run->psw_mask = env->psw.mask; -if (cap_sync_regs && cs->kvm_run->kvm_valid_regs &KVM_SYNC_GPRS ) { +if (can_sync_regs (cs,KVM_SYNC_GPRS )) {for (i =0 ; i <16 ; i++) { cs->kvm_run->s.regs.gprs[i] = env->regs[i]; cs->kvm_run->kvm_dirty_regs |=KVM_SYNC_GPRS ;
@@ -273,9 +278,8 @@ int kvm_arch_put_registers(CPUState *cs, int level) } } -if (cap_sync_regs && - cs->kvm_run->kvm_valid_regs &KVM_SYNC_ACRS && - cs->kvm_run->kvm_valid_regs &KVM_SYNC_CRS ) { +/* access registers and control registers*/ +if (can_sync_regs (cs,KVM_SYNC_ACRS |KVM_SYNC_CRS )) {for (i =0 ; i <16 ; i++) { cs->kvm_run->s.regs.acrs[i] = env->aregs[i]; cs->kvm_run->s.regs.crs[i] = env->cregs[i];
@@ -294,7 +298,7 @@ int kvm_arch_put_registers(CPUState *cs, int level) }/* Finally the prefix */ -if (cap_sync_regs && cs->kvm_run->kvm_valid_regs &KVM_SYNC_PREFIX ) { +if (can_sync_regs (cs,KVM_SYNC_PREFIX )) { cs->kvm_run->s.regs.prefix = env->psa; cs->kvm_run->kvm_dirty_regs |=KVM_SYNC_PREFIX ; }else {
@@ -317,7 +321,7 @@ int kvm_arch_get_registers(CPUState *cs) env->psw.mask = cs->kvm_run->psw_mask;/* the GPRS */ -if (cap_sync_regs && cs->kvm_run->kvm_valid_regs &KVM_SYNC_GPRS ) { +if (can_sync_regs (cs,KVM_SYNC_GPRS )) {for (i =0 ; i <16 ; i++) { env->regs[i] = cs->kvm_run->s.regs.gprs[i]; }
@@ -332,9 +336,7 @@ int kvm_arch_get_registers(CPUState *cs) }/* The ACRS and CRS */ -if (cap_sync_regs && - cs->kvm_run->kvm_valid_regs &KVM_SYNC_ACRS && - cs->kvm_run->kvm_valid_regs &KVM_SYNC_CRS ) { +if (can_sync_regs (cs,KVM_SYNC_ACRS |KVM_SYNC_CRS )) {for (i =0 ; i <16 ; i++) { env->aregs[i] = cs->kvm_run->s.regs.acrs[i]; env->cregs[i] = cs->kvm_run->s.regs.crs[i];
@@ -361,7 +363,7 @@ int kvm_arch_get_registers(CPUState *cs) env->fpc = fpu.fpc;/* The prefix */ -if (cap_sync_regs && cs->kvm_run->kvm_valid_regs &KVM_SYNC_PREFIX ) { +if (can_sync_regs (cs,KVM_SYNC_PREFIX )) { env->psa = cs->kvm_run->s.regs.prefix; }
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL v3 2/7] s390x/css: Clean up unnecessary CONFIG_USER_ONLY wrappers
In reply to Cornelia HuckFrom: Thomas Huth <[email protected]>
The css functions are only used from ioinst.c and other files that are only built for CONFIG_SOFTMMU. So we do not need the dummy wrappers for the CONFIG_USER_ONLY target in the cpu.h header.
--- target-s390x/cpu.h | 81 ---------------------------------------------------- 1 file changed, 81 deletions(-)
target-s390x/cpu.h +0 -81
@@ -457,87 +457,6 @@ int css_enable_mss(void);int css_do_rsch (SubchDev *sch);int css_do_rchp (uint8_t cssid,uint8_t chpid);bool css_present (uint8_t cssid); -#else -static inline SubchDev *css_find_subch (uint8_t m,uint8_t cssid,uint8_t ssid, -uint16_t schid) -{ -return NULL ; -} -static inline bool css_subch_visible (SubchDev *sch) -{ -return false; -} -static inline void css_conditional_io_interrupt (SubchDev *sch) -{ -} -static inline int css_do_stsch (SubchDev *sch,SCHIB *schib) -{ -return -ENODEV ; -} -static inline bool css_schid_final (uint8_t cssid,uint8_t ssid,uint16_t schid) -{ -return true; -} -static inline int css_do_msch (SubchDev *sch,SCHIB *schib) -{ -return -ENODEV ; -} -static inline int css_do_xsch (SubchDev *sch) -{ -return -ENODEV ; -} -static inline int css_do_csch (SubchDev *sch) -{ -return -ENODEV ; -} -static inline int css_do_hsch (SubchDev *sch) -{ -return -ENODEV ; -} -static inline int css_do_ssch (SubchDev *sch,ORB *orb) -{ -return -ENODEV ; -} -static inline int css_do_tsch (SubchDev *sch,IRB *irb) -{ -return -ENODEV ; -} -static inline int css_do_stcrw (CRW *crw) -{ -return 1 ; -} -static inline int css_do_tpi (IOIntCode *int_code,int lowcore) -{ -return 0 ; -} -static inline int css_collect_chp_desc (int m,uint8_t cssid,uint8_t f_chpid, -int rfmt,uint8_t l_chpid,void *buf) -{ -return 0 ; -} -static inline void css_do_schm (uint8_t mbk,int update,int dct,uint64_t mbo) -{ -} -static inline int css_enable_mss (void ) -{ -return -EINVAL ; -} -static inline int css_enable_mcsse (void ) -{ -return -EINVAL ; -} -static inline int css_do_rsch (SubchDev *sch) -{ -return -ENODEV ; -} -static inline int css_do_rchp (uint8_t cssid,uint8_t chpid) -{ -return -ENODEV ; -} -static inline bool css_present (uint8_t cssid) -{ -return false; -}#endif #define cpu_init (model) (&cpu_s390x_init(model)->env)
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL v3 5/7] s390: Add PCI bus support
In reply to Cornelia HuckFrom: Frank Blaschka <[email protected]>
This patch implements a pci bus for s390x together with infrastructure to generate and handle hotplug events, to configure/unconfigure via sclp instruction, to do iommu translations and provide s390 support for MSI/MSI-X notification processing.
--- MAINTAINERS | 2 + default-configs/s390x-softmmu.mak | 1 + hw/s390x/Makefile.objs | 1 + hw/s390x/css.c | 5 + hw/s390x/css.h | 1 + hw/s390x/s390-pci-bus.c | 591 +++++++++++++++++++++++++++++++++++++ hw/s390x/s390-pci-bus.h | 251 ++++++++++++++++ hw/s390x/s390-virtio-ccw.c | 7 + hw/s390x/sclp.c | 10 +- include/hw/s390x/sclp.h | 8 + target-s390x/ioinst.c | 52 ++++ target-s390x/ioinst.h | 1 + 12 files changed, 929 insertions(+), 1 deletion(-) create mode 100644 hw/s390x/s390-pci-bus.c create mode 100644 hw/s390x/s390-pci-bus.h
MAINTAINERS +2 -0
@@ -538,6 +538,7 @@ S390 Virtio M: Alexander Graf <[email protected]> S: Maintained F: hw/s390x/s390-*.c +X: hw/s390x/*pci*.[hc] S390 Virtio-ccw M: Cornelia Huck <[email protected]>
@@ -548,6 +549,7 @@ F: hw/s390x/s390-virtio-ccw.c F: hw/s390x/css.[hc] F: hw/s390x/sclp*.[hc] F: hw/s390x/ipl*.[hc] +F: hw/s390x/*pci*.[hc] F: include/hw/s390x/ F: pc-bios/s390-ccw/ T: git git://github.com/cohuck/qemu virtio-ccw-upstr
default-configs/s390x-softmmu.mak +1 -0
@@ -1,3 +1,4 @@ +include pci.mak CONFIG_VIRTIO=y CONFIG_SCLPCONSOLE=y CONFIG_S390_FLIC=y
hw/s390x/Makefile.objs +1 -0
@@ -8,3 +8,4 @@ obj-y += ipl.o obj-y += css.o obj-y += s390-virtio-ccw.o obj-y += virtio-ccw.o +obj-y += s390-pci-bus.o
hw/s390x/css.c +5 -0
@@ -1299,6 +1299,11 @@ void css_generate_chp_crws(uint8_t cssid, uint8_t chpid)/* TODO */ } +void css_generate_css_crws (uint8_t cssid) +{ +css_queue_crw (CRW_RSC_CSS ,0 ,0 , cssid); +} +int css_enable_mcsse (void ) {trace_css_enable_facility ("mcsse" );
hw/s390x/css.h +1 -0
@@ -101,6 +101,7 @@ void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid);void css_generate_sch_crws (uint8_t cssid,uint8_t ssid,uint16_t schid,int hotplugged,int add);void css_generate_chp_crws (uint8_t cssid,uint8_t chpid); +void css_generate_css_crws (uint8_t cssid);void css_adapter_interrupt (uint8_t isc);#define CSS_IO_ADAPTER_VIRTIO 1
hw/s390x/s390-pci-bus.c new file +591 -0
591 lines not on this page · raw message
hw/s390x/s390-pci-bus.h new file +251 -0
251 lines not on this page · raw message
hw/s390x/s390-virtio-ccw.c +7 -0
@@ -18,6 +18,7 @@#include "css.h" #include "virtio-ccw.h" #include "qemu/config-file.h" +#include "s390-pci-bus.h" #define TYPE_S390_CCW_MACHINE "s390-ccw-machine"
@@ -91,6 +92,7 @@ static void ccw_init(MachineState *machine)uint8_t *storage_keys;int ret;VirtualCssBus *css_bus; +DeviceState *dev;QemuOpts *opts =qemu_opts_find (qemu_find_opts ("memory" ),NULL );ram_addr_t pad_size =0 ;ram_addr_t maxmem =qemu_opt_get_size (opts,"maxmem" , my_ram_size);
@@ -127,6 +129,11 @@ static void ccw_init(MachineState *machine) machine->initrd_filename, "s390-ccw.img");s390_flic_init (); + dev =qdev_create (NULL ,TYPE_S390_PCI_HOST_BRIDGE ); +object_property_add_child (qdev_get_machine (),TYPE_S390_PCI_HOST_BRIDGE , +OBJECT (dev),NULL ); +qdev_init_nofail (dev); +/* register hypercalls */ virtio_ccw_register_hcalls ();
hw/s390x/sclp.c +9 -1
@@ -20,6 +20,7 @@#include "qemu/config-file.h" #include "hw/s390x/sclp.h" #include "hw/s390x/event-facility.h" +#include "hw/s390x/s390-pci-bus.h" static inline SCLPEventFacility *get_event_facility (void ) {
@@ -62,7 +63,8 @@ static void read_SCP_info(SCCB *sccb) read_info->entries[i].type =0 ; } - read_info->facilities =cpu_to_be64 (SCLP_HAS_CPU_INFO ); + read_info->facilities =cpu_to_be64 (SCLP_HAS_CPU_INFO | +SCLP_HAS_PCI_RECONFIG );/* * The storage increment size is a multiple of 1M and is a power of 2.
@@ -350,6 +352,12 @@ static void sclp_execute(SCCB *sccb, uint32_t code)case SCLP_UNASSIGN_STORAGE :unassign_storage (sccb);break ; +case SCLP_CMDW_CONFIGURE_PCI : +s390_pci_sclp_configure (1 , sccb); +break ; +case SCLP_CMDW_DECONFIGURE_PCI : +s390_pci_sclp_configure (0 , sccb); +break ;default : efc->command_handler (ef, sccb, code);break ;
include/hw/s390x/sclp.h +8 -0
@@ -43,14 +43,22 @@#define SCLP_CMDW_CONFIGURE_CPU 0x00110001#define SCLP_CMDW_DECONFIGURE_CPU 0x00100001 +/* SCLP PCI codes */ +#define SCLP_HAS_PCI_RECONFIG 0x0000000040000000ULL +#define SCLP_CMDW_CONFIGURE_PCI 0x001a0001 +#define SCLP_CMDW_DECONFIGURE_PCI 0x001b0001 +#define SCLP_RECONFIG_PCI_ATPYE 2 +/* SCLP response codes */ #define SCLP_RC_NORMAL_READ_COMPLETION 0x0010#define SCLP_RC_NORMAL_COMPLETION 0x0020#define SCLP_RC_SCCB_BOUNDARY_VIOLATION 0x0100 +#define SCLP_RC_NO_ACTION_REQUIRED 0x0120#define SCLP_RC_INVALID_SCLP_COMMAND 0x01f0#define SCLP_RC_CONTAINED_EQUIPMENT_CHECK 0x0340#define SCLP_RC_INSUFFICIENT_SCCB_LENGTH 0x0300#define SCLP_RC_STANDBY_READ_COMPLETION 0x0410 +#define SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED 0x09f0#define SCLP_RC_INVALID_FUNCTION 0x40f0#define SCLP_RC_NO_EVENT_BUFFERS_STORED 0x60f0#define SCLP_RC_INVALID_SELECTION_MASK 0x70f0
target-s390x/ioinst.c +52 -0
76 lines not on this page · raw message
target-s390x/ioinst.h +1 -0
@@ -204,6 +204,7 @@ typedef struct CRW {#define CRW_RSC_SUBCH 0x3#define CRW_RSC_CHP 0x4 +#define CRW_RSC_CSS 0xb/* I/O interruption code */ typedef struct IOIntCode {
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL v3 4/7] s390x/kvm: avoid syscalls by syncing registers with kvm_run
In reply to Cornelia HuckFrom: David Hildenbrand <[email protected]>
We can avoid loads of syscalls when dropping to user space by storing the values of more registers directly within kvm_run.
Support is added for:
- ARCH0: CPU timer, clock comparator, TOD programmable register, guest breaking-event register, program parameter
- PFAULT: pfault parameters (token, select, compare)
--- target-s390x/kvm.c | 72 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 22 deletions(-)
target-s390x/kvm.c +50 -22
@@ -252,18 +252,33 @@ int kvm_arch_put_registers(CPUState *cs, int level)return 0 ; } -/* -* These ONE_REGS are not protected by a capability. As they are only -* necessary for migration we just trace a possible error, but don't -* return with an error return code. -*/ -kvm_set_one_reg (cs,KVM_REG_S390_CPU_TIMER , &env->cputm); -kvm_set_one_reg (cs,KVM_REG_S390_CLOCK_COMP , &env->ckc); -kvm_set_one_reg (cs,KVM_REG_S390_TODPR , &env->todpr); -kvm_set_one_reg (cs,KVM_REG_S390_GBEA , &env->gbea); -kvm_set_one_reg (cs,KVM_REG_S390_PP , &env->pp); +if (can_sync_regs (cs,KVM_SYNC_ARCH0 )) { + cs->kvm_run->s.regs.cputm = env->cputm; + cs->kvm_run->s.regs.ckc = env->ckc; + cs->kvm_run->s.regs.todpr = env->todpr; + cs->kvm_run->s.regs.gbea = env->gbea; + cs->kvm_run->s.regs.pp = env->pp; + cs->kvm_run->kvm_dirty_regs |=KVM_SYNC_ARCH0 ; + }else { +/* +* These ONE_REGS are not protected by a capability. As they are only +* necessary for migration we just trace a possible error, but don't +* return with an error return code. +*/ +kvm_set_one_reg (cs,KVM_REG_S390_CPU_TIMER , &env->cputm); +kvm_set_one_reg (cs,KVM_REG_S390_CLOCK_COMP , &env->ckc); +kvm_set_one_reg (cs,KVM_REG_S390_TODPR , &env->todpr); +kvm_set_one_reg (cs,KVM_REG_S390_GBEA , &env->gbea); +kvm_set_one_reg (cs,KVM_REG_S390_PP , &env->pp); + } -if (cap_async_pf) { +/* pfault parameters */ +if (can_sync_regs (cs,KVM_SYNC_PFAULT )) { + cs->kvm_run->s.regs.pft = env->pfault_token; + cs->kvm_run->s.regs.pfs = env->pfault_select; + cs->kvm_run->s.regs.pfc = env->pfault_compare; + cs->kvm_run->kvm_dirty_regs |=KVM_SYNC_PFAULT ; + }else if (cap_async_pf) { r =kvm_set_one_reg (cs,KVM_REG_S390_PFTOKEN , &env->pfault_token);if (r <0 ) {return r;
@@ -367,18 +382,31 @@ int kvm_arch_get_registers(CPUState *cs) env->psa = cs->kvm_run->s.regs.prefix; } -/* -* These ONE_REGS are not protected by a capability. As they are only -* necessary for migration we just trace a possible error, but don't -* return with an error return code. -*/ -kvm_get_one_reg (cs,KVM_REG_S390_CPU_TIMER , &env->cputm); -kvm_get_one_reg (cs,KVM_REG_S390_CLOCK_COMP , &env->ckc); -kvm_get_one_reg (cs,KVM_REG_S390_TODPR , &env->todpr); -kvm_get_one_reg (cs,KVM_REG_S390_GBEA , &env->gbea); -kvm_get_one_reg (cs,KVM_REG_S390_PP , &env->pp); +if (can_sync_regs (cs,KVM_SYNC_ARCH0 )) { + env->cputm = cs->kvm_run->s.regs.cputm; + env->ckc = cs->kvm_run->s.regs.ckc; + env->todpr = cs->kvm_run->s.regs.todpr; + env->gbea = cs->kvm_run->s.regs.gbea; + env->pp = cs->kvm_run->s.regs.pp; + }else { +/* +* These ONE_REGS are not protected by a capability. As they are only +* necessary for migration we just trace a possible error, but don't +* return with an error return code. +*/ +kvm_get_one_reg (cs,KVM_REG_S390_CPU_TIMER , &env->cputm); +kvm_get_one_reg (cs,KVM_REG_S390_CLOCK_COMP , &env->ckc); +kvm_get_one_reg (cs,KVM_REG_S390_TODPR , &env->todpr); +kvm_get_one_reg (cs,KVM_REG_S390_GBEA , &env->gbea); +kvm_get_one_reg (cs,KVM_REG_S390_PP , &env->pp); + } -if (cap_async_pf) { +/* pfault parameters */ +if (can_sync_regs (cs,KVM_SYNC_PFAULT )) { + env->pfault_token = cs->kvm_run->s.regs.pft; + env->pfault_select = cs->kvm_run->s.regs.pfs; + env->pfault_compare = cs->kvm_run->s.regs.pfc; + }else if (cap_async_pf) { r =kvm_get_one_reg (cs,KVM_REG_S390_PFTOKEN , &env->pfault_token);if (r <0 ) {return r;
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL v3 6/7] s390: implement pci instructions
In reply to Cornelia HuckFrom: Frank Blaschka <[email protected]>
This patch implements the s390 pci instructions in qemu. It allows to access and drive pci devices attached to the s390 pci bus. Because of platform constrains devices using IO BARs are not supported. Also a device has to support MSI/MSI-X to run on s390.
--- hw/s390x/Makefile.objs | 2 +- hw/s390x/s390-pci-inst.c | 811 ++++++++++++++++++++++++++++++++++++++++++++++ hw/s390x/s390-pci-inst.h | 288 ++++++++++++++++ target-s390x/kvm.c | 153 +++++++++ 4 files changed, 1253 insertions(+), 1 deletion(-) create mode 100644 hw/s390x/s390-pci-inst.c create mode 100644 hw/s390x/s390-pci-inst.h
hw/s390x/Makefile.objs +1 -1
@@ -8,4 +8,4 @@ obj-y += ipl.o obj-y += css.o obj-y += s390-virtio-ccw.o obj-y += virtio-ccw.o -obj-y += s390-pci-bus.o +obj-y += s390-pci-bus.o s390-pci-inst.o
hw/s390x/s390-pci-inst.c new file +811 -0
811 lines not on this page · raw message
hw/s390x/s390-pci-inst.h new file +288 -0
288 lines not on this page · raw message
target-s390x/kvm.c +153 -0
202 lines not on this page · raw message
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL v3 7/7] kvm: extend kvm_irqchip_add_msi_route to work on s390
In reply to Cornelia HuckFrom: Frank Blaschka <[email protected]>
on s390 MSI-X irqs are presented as thin or adapter interrupts for this we have to reorganize the routing entry to contain valid information for the adapter interrupt code on s390. To minimize impact on existing code we introduce an architecture function to fixup the routing entry.
--- include/sysemu/kvm.h | 4 ++++ kvm-all.c | 7 +++++++ target-arm/kvm.c | 6 ++++++ target-i386/kvm.c | 6 ++++++ target-mips/kvm.c | 6 ++++++ target-ppc/kvm.c | 6 ++++++ target-s390x/kvm.c | 26 ++++++++++++++++++++++++++ 7 files changed, 61 insertions(+)
include/sysemu/kvm.h +4 -0
@@ -158,6 +158,7 @@ extern bool kvm_readonly_mem_allowed;struct kvm_run ;struct kvm_lapic_state ; +struct kvm_irq_routing_entry ; typedef struct KVMCapabilityInfo { const char *name;
@@ -270,6 +271,9 @@ int kvm_arch_on_sigbus(int code, void *addr);void kvm_arch_init_irq_routing (KVMState *s); +int kvm_arch_fixup_msi_route (struct kvm_irq_routing_entry *route, +uint64_t address,uint32_t data); +int kvm_set_irq (KVMState *s,int irq,int level);int kvm_irqchip_send_msi (KVMState *s,MSIMessage msg);
kvm-all.c +7 -0
@@ -1225,6 +1225,10 @@ int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg) kroute.u.msi.address_lo = (uint32_t )msg.address; kroute.u.msi.address_hi = msg.address >>32 ; kroute.u.msi.data =le32_to_cpu (msg.data); +if (kvm_arch_fixup_msi_route (&kroute, msg.address, msg.data)) { +kvm_irqchip_release_virq (s, virq); +return -EINVAL ; + }kvm_add_routing_entry (s, &kroute);kvm_irqchip_commit_routes (s);
@@ -1250,6 +1254,9 @@ int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg) kroute.u.msi.address_lo = (uint32_t )msg.address; kroute.u.msi.address_hi = msg.address >>32 ; kroute.u.msi.data =le32_to_cpu (msg.data); +if (kvm_arch_fixup_msi_route (&kroute, msg.address, msg.data)) { +return -EINVAL ; + }return kvm_update_routing_entry (s, &kroute); }
target-arm/kvm.c +6 -0
@@ -548,3 +548,9 @@ int kvm_arch_irqchip_create(KVMState *s)return 0 ; } + +int kvm_arch_fixup_msi_route (struct kvm_irq_routing_entry *route, +uint64_t address,uint32_t data) +{ +return 0 ; +}
target-i386/kvm.c +6 -0
@@ -2733,3 +2733,9 @@ int kvm_device_msix_deassign(KVMState *s, uint32_t dev_id)return kvm_deassign_irq_internal (s, dev_id,KVM_DEV_IRQ_GUEST_MSIX |KVM_DEV_IRQ_HOST_MSIX ); } + +int kvm_arch_fixup_msi_route (struct kvm_irq_routing_entry *route, +uint64_t address,uint32_t data) +{ +return 0 ; +}
target-mips/kvm.c +6 -0
@@ -688,3 +688,9 @@ int kvm_arch_get_registers(CPUState *cs)return ret; } + +int kvm_arch_fixup_msi_route (struct kvm_irq_routing_entry *route, +uint64_t address,uint32_t data) +{ +return 0 ; +}
target-ppc/kvm.c +6 -0
@@ -2402,3 +2402,9 @@ out_close: error_out:return ; } + +int kvm_arch_fixup_msi_route (struct kvm_irq_routing_entry *route, +uint64_t address,uint32_t data) +{ +return 0 ; +}
target-s390x/kvm.c +26 -0
@@ -41,6 +41,7 @@#include "trace.h" #include "qapi-event.h" #include "hw/s390x/s390-pci-inst.h" +#include "hw/s390x/s390-pci-bus.h" /* #define DEBUG_KVM */
@@ -1544,3 +1545,28 @@ int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state)return ret; } + +int kvm_arch_fixup_msi_route (struct kvm_irq_routing_entry *route, +uint64_t address,uint32_t data) +{ +S390PCIBusDevice *pbdev; +uint32_t fid = data >>ZPCI_MSI_VEC_BITS ; +uint32_t vec = data &ZPCI_MSI_VEC_MASK ; + + pbdev =s390_pci_find_dev_by_fid (fid); +if (!pbdev) { +DPRINTF ("add_msi_route no dev\n" ); +return -ENODEV ; + } + + pbdev->routes.adapter.ind_offset = vec; + + route->type =KVM_IRQ_ROUTING_S390_ADAPTER ; + route->flags =0 ; + route->u.adapter.summary_addr = pbdev->routes.adapter.summary_addr; + route->u.adapter.ind_addr = pbdev->routes.adapter.ind_addr; + route->u.adapter.summary_offset = pbdev->routes.adapter.summary_offset; + route->u.adapter.ind_offset = pbdev->routes.adapter.ind_offset; + route->u.adapter.adapter_id = pbdev->routes.adapter.adapter_id; +return 0 ; +}
Signature · 1 line
1.7.9.5
Peter Maydell
AppliedQuoted 16 lines · Cornelia Huck
Third time's the charm? I've verified that this builds with mingw32 (and nothing else that worked before broke).
The following changes since commit
64ea8038ffbf703dcd438a108d2d5499c8ff95d9:Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150109.0' into staging (2015-01-10 22:29:09 +0000)
are available in the git repository at:
git://github.com/cohuck/qemutags/s390x-20150112-v3for you to fetch changes up to
9e03a0405d56b4af8952b794d0e5dd9206ee7329:kvm: extend
kvm_irqchip_add_msi_routeto work on s390 (2015-01-12 10:14:04 +0100)
Quoted 7 lines
----------------------------------------------------------------
s390x patches for 2.3.Highlight is support for PCI devices on s390x. Otherwise, performance improvements (register sync) and small cleanups.
----------------------------------------------------------------
Applied, thanks.
-- PMM