s390x changes for 2.3
The following changes since commit 99c9c3cb24e566258a0a141178934f9cb5198842:
Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2014-12-11' into staging (2014-12-11 18:27:02 +0000)
are available in the git repository at:
git://github.com/cohuck/qemu tags/s390x-20141215
for you to fetch changes up to 5a9403c9bc36aaa3431083f152251e775c38b386:
s390x: update MAINTAINERS (2014-12-15 10:43:17 +0100)
----------------------------------------------------------------
390x patches for 2.3.
Highlight is support for PCI devices on s390x. Otherwise, performance improvements (register sync) and small cleanups.
----------------------------------------------------------------
Cornelia Huck (2):
s390x/ccw: fix oddity in machine class init
s390x: update MAINTAINERS
David Hildenbrand (2):
s390x/kvm: sync register support helper function s390x/kvm: avoid syscalls by syncing registers with kvm_run
Frank Blaschka (6):
s390: Add PCI bus support
s390: implement pci instructions
kvm: extend kvm_irqchip_add_msi_route to work on s390 s390/pci: add error event support
s390/pci: implement stpcifc instruction s390/pci: remove unnecessary cpu_synchronize_state
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 | 594 ++++++++++++++++++++++++++ hw/s390x/s390-pci-bus.h | 251 +++++++++++ hw/s390x/s390-pci-inst.c | 835 +++++++++++++++++++++++++++++++++++++ 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, 2332 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 01/11] s390: Add PCI bus support
From: 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.
--- 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 | 554 +++++++++++++++++++++++++++++++++++++ hw/s390x/s390-pci-bus.h | 217 +++++++++++++++ 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 + 11 files changed, 856 insertions(+), 1 deletion(-) create mode 100644 hw/s390x/s390-pci-bus.c create mode 100644 hw/s390x/s390-pci-bus.h
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 ,0 ); +} +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 +554 -0
554 lines not on this page · raw message
hw/s390x/s390-pci-bus.h new file +217 -0
217 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 03/11] 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
@@ -148,6 +148,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;
@@ -260,6 +261,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
@@ -1224,6 +1224,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);
@@ -1249,6 +1253,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
@@ -2707,3 +2707,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
@@ -2388,3 +2388,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 */
@@ -1510,3 +1511,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
[Qemu-devel] [PULL 04/11] s390x/ccw: fix oddity in machine class init
In reply to Cornelia Huckccw_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
@@ -188,7 +188,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 05/11] 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 07/11] 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
@@ -264,18 +264,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;
@@ -379,18 +394,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 09/11] s390/pci: implement stpcifc instruction
In reply to Cornelia HuckFrom: Frank Blaschka <[email protected]>
This patch implements the last remaining s390 pci instruction to query the function information block.
--- hw/s390x/s390-pci-bus.h | 1 + hw/s390x/s390-pci-inst.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++ hw/s390x/s390-pci-inst.h | 1 + target-s390x/kvm.c | 9 +++++-- 4 files changed, 73 insertions(+), 2 deletions(-)
hw/s390x/s390-pci-bus.h +1 -0
@@ -223,6 +223,7 @@ typedef struct S390PCIBusDevice {uint64_t g_iota;uint64_t pba;uint64_t pal; +uint64_t fmb_addr;uint8_t isc;uint16_t noi;uint8_t sum;
hw/s390x/s390-pci-inst.c +64 -0
73 lines not on this page · raw message
hw/s390x/s390-pci-inst.h +1 -0
@@ -283,5 +283,6 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2);int rpcit_service_call (S390CPU *cpu,uint8_t r1,uint8_t r2);int pcistb_service_call (S390CPU *cpu,uint8_t r1,uint8_t r3,uint64_t gaddr);int mpcifc_service_call (S390CPU *cpu,uint8_t r1,uint64_t fiba); +int stpcifc_service_call (S390CPU *cpu,uint8_t r1,uint64_t fiba);#endif
target-s390x/kvm.c +7 -2
@@ -906,8 +906,13 @@ static int kvm_pcistg_service_call(S390CPU *cpu, struct kvm_run *run)static int kvm_stpcifc_service_call (S390CPU *cpu,struct kvm_run *run) { -qemu_log_mask (LOG_UNIMP ,"STPCIFC missing\n" ); -return 0 ; +uint8_t r1 = (run->s390_sieic.ipa &0x00f0 ) >>4 ; +uint64_t fiba; + +cpu_synchronize_state (CPU (cpu)); + fiba =get_base_disp_rxy (cpu, run); + +return stpcifc_service_call (cpu, r1, fiba); }static int kvm_sic_service_call (S390CPU *cpu,struct kvm_run *run)
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 11/11] s390x: update MAINTAINERS
In reply to Cornelia HuckMake sure the new pci support is sorted to the right maintainers.
--- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
@@ -534,6 +534,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]>
@@ -544,6 +545,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
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 02/11] 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 | 711 ++++++++++++++++++++++++++++++++++++++++++++++ hw/s390x/s390-pci-inst.h | 287 +++++++++++++++++++ target-s390x/kvm.c | 148 ++++++++++ 4 files changed, 1147 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 +711 -0
711 lines not on this page · raw message
hw/s390x/s390-pci-inst.h new file +287 -0
287 lines not on this page · raw message
target-s390x/kvm.c +148 -0
197 lines not on this page · raw message
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 06/11] 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
@@ -214,6 +214,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);
@@ -228,7 +233,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 ;
@@ -285,9 +290,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];
@@ -306,7 +310,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 {
@@ -329,7 +333,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]; }
@@ -344,9 +348,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];
@@ -373,7 +375,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 08/11] s390/pci: add error event support
In reply to Cornelia HuckFrom: Frank Blaschka <[email protected]>
This patch adds support to generate s390 pci error events and makes use of it to support iota error handling.
--- hw/s390x/s390-pci-bus.c | 50 ++++++++++++++++++++++++--- hw/s390x/s390-pci-bus.h | 35 ++++++++++++++++++- hw/s390x/s390-pci-inst.c | 86 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 155 insertions(+), 16 deletions(-)
hw/s390x/s390-pci-bus.c +45 -5
@@ -52,6 +52,9 @@ int chsc_sei_nt2_get_event(void *res) eccdf = (PciCcdfErr *)nt2_res->ccdf; eccdf->fid =cpu_to_be32 (sei_cont->fid); eccdf->fh =cpu_to_be32 (sei_cont->fh); + eccdf->e =cpu_to_be32 (sei_cont->e); + eccdf->faddr =cpu_to_be64 (sei_cont->faddr); + eccdf->pec =cpu_to_be16 (sei_cont->pec);break ;case 2 :/* availability event */ accdf = (PciCcdfAvail *)nt2_res->ccdf;
@@ -184,8 +187,8 @@ S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh)return NULL ; } -static void s390_pci_generate_plug_event (uint16_t pec,uint32_t fh, -uint32_t fid) +static void s390_pci_generate_event (uint8_t cc,uint16_t pec,uint32_t fh, +uint32_t fid,uint64_t faddr,uint32_t e) {SeiContainer *sei_cont =g_malloc0 (sizeof (SeiContainer)); S390pciState *s = S390_PCI_HOST_BRIDGE(
@@ -197,13 +200,28 @@ static void s390_pci_generate_plug_event(uint16_t pec, uint32_t fh, sei_cont->fh = fh; sei_cont->fid = fid; - sei_cont->cc =2 ; + sei_cont->cc = cc; sei_cont->pec = pec; + sei_cont->faddr = faddr; + sei_cont->e = e;QTAILQ_INSERT_TAIL (&s->pending_sei, sei_cont, link);css_generate_css_crws (0 ); } +static void s390_pci_generate_plug_event (uint16_t pec,uint32_t fh, +uint32_t fid) +{ +s390_pci_generate_event (2 , pec, fh, fid,0 ,0 ); +} + +static void s390_pci_generate_error_event (uint16_t pec,uint32_t fh, +uint32_t fid,uint64_t faddr, +uint32_t e) +{ +s390_pci_generate_event (1 , pec, fh, fid, faddr, e); +} +static void s390_pci_set_irq (void *opaque,int irq,int level) {/* nothing to do */
@@ -313,10 +331,30 @@ static IOMMUTLBEntry s390_translate_iommu(MemoryRegion *iommu, hwaddr addr,return ret; } +if (!pbdev->g_iota) { + pbdev->error_state = true; + pbdev->lgstg_blocked = true; +s390_pci_generate_error_event (ERR_EVENT_INVALAS , pbdev->fh, pbdev->fid, + addr,0 ); +return ret; + } + +if (addr < pbdev->pba || addr > pbdev->pal) { + pbdev->error_state = true; + pbdev->lgstg_blocked = true; +s390_pci_generate_error_event (ERR_EVENT_OORANGE , pbdev->fh, pbdev->fid, + addr,0 ); +return ret; + } + pte =s390_guest_io_table_walk (s390_pci_get_table_origin (pbdev->g_iota), addr);if (!pte) { + pbdev->error_state = true; + pbdev->lgstg_blocked = true; +s390_pci_generate_error_event (ERR_EVENT_SERR , pbdev->fh, pbdev->fid, + addr,ERR_EVENT_Q_BIT );return ret; }
@@ -353,7 +391,7 @@ static uint8_t set_ind_atomic(uint64_t ind_loc, uint8_t to_be_set) ind_addr =cpu_physical_memory_map (ind_loc, &len,1 );if (!ind_addr) { -error_report ("%s: unable to access indicator" , __func__); +s390_pci_generate_error_event (ERR_EVENT_AIRERR ,0 ,0 ,0 ,0 );return -1 ; } do {
@@ -374,12 +412,14 @@ static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data,uint32_t vec = data &ZPCI_MSI_VEC_MASK ;uint64_t ind_bit;uint32_t sum_bit; +uint32_t e =0 ;DPRINTF ("write_msix data 0x%lx fid %d vec 0x%x\n" , data, fid, vec); pbdev =s390_pci_find_dev_by_fid (fid);if (!pbdev) { -DPRINTF ("msix_notify no dev\n" ); + e |= (vec <<ERR_EVENT_MVN_OFFSET ); +s390_pci_generate_error_event (ERR_EVENT_NOMSI ,0 , fid, addr, e);return ; }
hw/s390x/s390-pci-bus.h +34 -1
@@ -33,6 +33,31 @@#define HP_EVENT_CONFIGURED_TO_STBRES 0x0304#define HP_EVENT_STANDBY_TO_RESERVED 0x0308 +#define ERR_EVENT_INVALAS 0x1 +#define ERR_EVENT_OORANGE 0x2 +#define ERR_EVENT_INVALTF 0x3 +#define ERR_EVENT_TPROTE 0x4 +#define ERR_EVENT_APROTE 0x5 +#define ERR_EVENT_KEYE 0x6 +#define ERR_EVENT_INVALTE 0x7 +#define ERR_EVENT_INVALTL 0x8 +#define ERR_EVENT_TT 0x9 +#define ERR_EVENT_INVALMS 0xa +#define ERR_EVENT_SERR 0xb +#define ERR_EVENT_NOMSI 0x10 +#define ERR_EVENT_INVALBV 0x11 +#define ERR_EVENT_AIBV 0x12 +#define ERR_EVENT_AIRERR 0x13 +#define ERR_EVENT_FMBA 0x2a +#define ERR_EVENT_FMBUP 0x2b +#define ERR_EVENT_FMBPRO 0x2c +#define ERR_EVENT_CCONF 0x30 +#define ERR_EVENT_SERVAC 0x3a +#define ERR_EVENT_PERMERR 0x3b + +#define ERR_EVENT_Q_BIT 0x2 +#define ERR_EVENT_MVN_OFFSET 16 +#define ZPCI_MSI_VEC_BITS 11#define ZPCI_MSI_VEC_MASK 0x7ff
@@ -130,13 +155,15 @@ typedef struct SeiContainer {uint32_t fh;uint8_t cc;uint16_t pec; +uint64_t faddr; +uint32_t e; } SeiContainer; typedef struct PciCcdfErr { uint32_t reserved1; uint32_t fh; uint32_t fid; - uint32_t reserved2; + uint32_t e; uint64_t faddr; uint32_t reserved3; uint16_t reserved4;
@@ -189,10 +216,16 @@ typedef struct S390MsixInfo { typedef struct S390PCIBusDevice { PCIDevice *pdev; bool configured; + bool error_state; + bool lgstg_blocked; uint32_t fh; uint32_t fid; uint64_t g_iota; + uint64_t pba; + uint64_t pal; uint8_t isc; + uint16_t noi; + uint8_t sum; S390MsixInfo msix; AdapterRoutes routes; AddressSpace as;
hw/s390x/s390-pci-inst.c +76 -10
159 lines not on this page · raw message
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 10/11] s390/pci: remove unnecessary cpu_synchronize_state
In reply to Cornelia HuckFrom: Frank Blaschka <[email protected]>
Remove all unnecessary calls to cpu_synchronize_state
--- hw/s390x/s390-pci-inst.c | 6 ------ 1 file changed, 6 deletions(-)
hw/s390x/s390-pci-inst.c +0 -6
@@ -564,8 +564,6 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr)uint8_t pcias;uint8_t len; -cpu_synchronize_state (CPU (cpu)); -if (env->psw.mask &PSW_MASK_PSTATE ) {program_interrupt (env,PGM_PRIVILEGED ,6 );return 0 ;
@@ -711,8 +709,6 @@ int mpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba)S390PCIBusDevice *pbdev;uint64_t cc =ZPCI_PCI_LS_OK ; -cpu_synchronize_state (CPU (cpu)); -if (env->psw.mask &PSW_MASK_PSTATE ) {program_interrupt (env,PGM_PRIVILEGED ,6 );return 0 ;
@@ -786,8 +782,6 @@ int stpcifc_service_call(S390CPU *cpu, uint8_t r1, uint64_t fiba)uint32_t data;uint64_t cc =ZPCI_PCI_LS_OK ; -cpu_synchronize_state (CPU (cpu)); -if (env->psw.mask &PSW_MASK_PSTATE ) {program_interrupt (env,PGM_PRIVILEGED ,6 );return 0 ;
Signature · 1 line
1.7.9.5
Quoted 4 lines · Cornelia Huck
The following changes since commit
99c9c3cb24e566258a0a141178934f9cb5198842:Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2014-12-11' into staging (2014-12-11 18:27:02 +0000)
Quoted 8 lines
are available in the git repository at:
git://github.com/cohuck/qemutags/s390x-20141215for you to fetch changes up to
5a9403c9bc36aaa3431083f152251e775c38b386:s390x: update
MAINTAINERS(2014-12-15 10:43:17 +0100)
Hi; I'm afraid this doesn't build for win32 or MacOSX or 32-bit Linux:
32-bit Linux failures:hw/s390x/s390-pci-bus.c: In function 's390_guest_io_table_walk':hw/s390x/s390-pci-bus.c:283:11: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] hw/s390x/s390-pci-bus.c:291:11: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
Windows failures:
/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c: In function ‘s390_guest_io_table_walk’:/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c:283:
warning: cast from pointer to integer of different size /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c:291:
warning: cast from pointer to integer of different size /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c: In function ‘s390_translate_iommu’:/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c:325:
warning: integer constant is too large for ‘long’ type
(those are just warnings but should be fixed anyway)
/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:15:23:
warning: sys/ioctl.h: No such file or directory /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:16:22:
warning: sys/mman.h: No such file or directory /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:18:23:
warning: linux/kvm.h: No such file or directory /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:19:24:
warning: asm/ptrace.h: No such file or directory
In file included from /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:32:/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.h:25:
error: expected specifier-qualifier-list before ‘__uint16_t’ /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.h:30:
error: expected specifier-qualifier-list before ‘__uint16_t’ /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.h:55:
error: expected specifier-qualifier-list before ‘__uint16_t’ /home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.h:92:
error: expected specifier-qualifier-list before ‘__uint32_t’
...and a lot of other stuff that's probably just cascade from trying to include a bunch of Linux headers.
MacOSX builds also fail for lack of linux/kvm.h.
Incidentally, trying to include kvm.h is really a bad idea unless guarded by CONFIG_KVM, even on Linux. You'll get whatever the system include directory's kvm.h has, which might be older than the one we ship in the QEMU tree and is quite likely for a different architecture.
thanks
-- PMM
Quoted 61 lines · On Mon, 15 Dec 2014 13:10:51 +0000 Peter Maydell <[email protected]>…
Quoted 4 lines · Cornelia Huck
The following changes since commit
99c9c3cb24e566258a0a141178934f9cb5198842:Merge remote-tracking branch 'remotes/mjt/tags/pull-trivial-patches-2014-12-11' into staging (2014-12-11 18:27:02 +0000)
Quoted 8 lines
are available in the git repository at:
git://github.com/cohuck/qemutags/s390x-20141215for you to fetch changes up to
5a9403c9bc36aaa3431083f152251e775c38b386:s390x: update
MAINTAINERS(2014-12-15 10:43:17 +0100)Hi; I'm afraid this doesn't build for win32 or MacOSX or 32-bit Linux:
32-bit Linux failures:
hw/s390x/s390-pci-bus.c: In function 's390_guest_io_table_walk':hw/s390x/s390-pci-bus.c:283:11: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]hw/s390x/s390-pci-bus.c:291:11: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]Windows failures:
/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c: In function ‘s390_guest_io_table_walk’:/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c:283:
warning: cast from pointer to integer of different size/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c:291:
warning: cast from pointer to integer of different size/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c: In function ‘s390_translate_iommu’:/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-bus.c:325:
warning: integer constant is too large for ‘long’ type(those are just warnings but should be fixed anyway)
/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:15:23:
warning:sys/ioctl.h: No such file or directory/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:16:22:
warning:sys/mman.h: No such file or directory/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:18:23:
warning:linux/kvm.h: No such file or directory/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:19:24:
warning:asm/ptrace.h: No such file or directory
In file included from/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.c:32:/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.h:25:
error: expected specifier-qualifier-list before ‘__uint16_t’/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.h:30:
error: expected specifier-qualifier-list before ‘__uint16_t’/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.h:55:
error: expected specifier-qualifier-list before ‘__uint16_t’/home/petmay01/linaro/qemu-for-merges/hw/s390x/s390-pci-inst.h:92:
error: expected specifier-qualifier-list before ‘__uint32_t’...and a lot of other stuff that's probably just cascade from trying to include a bunch of Linux headers.
Quoted 7 lines
MacOSX builds also fail for lack of
linux/kvm.h.Incidentally, trying to include
kvm.his really a bad idea unless guarded byCONFIG_KVM, even on Linux. You'll get whatever the system include directory'skvm.hhas, which might be older than the one we ship in the QEMU tree and is quite likely for a different architecture.
Sorry, my builds did not catch this :(
Frank, could you please take a look at the pci build failures?