s390 patches
The following changes since commit 7721a3044234c46cd6f5f899e7467dc9351f3c8d:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140609-1' into staging (2014-06-09 17:04:13 +0100)
are available in the git repository at:
git://github.com/cohuck/qemu.git tags/s390x-20140610
for you to fetch changes up to bbd8bb8e3245cf6fc6d12b10b3320ab183adb866:
s390x/kvm: inject via flic (2014-06-10 09:50:27 +0200)
----------------------------------------------------------------
Several patches for s390:
- bugfixes: A fix for a long-standing bug in the css code as well as a fixup for the recent I/O adapter support.
- Exploitation of the userspace cmma enablement/reset interface, if it is present.
- Some debuggability improvements by logging unmanageable conditions.
- virtio-ccw finally gets migration support for its structures.
- Some cleanup as to how floating interrupts are injected.
----------------------------------------------------------------
Cornelia Huck (6):
s390x/css: handle emw correctly for tsch
s390x/kvm: make flic play well with old kernels
s390x: consolidate floating interrupts
s390x/kvm: add alternative injection interface
s390x: cleanup interrupt injection
s390x/kvm: inject via flic
Dominik Dingel (1):
s390x/kvm: enable/reset cmma via vm attributes
Jens Freimann (1):
s390/virtio-ccw: migration support
Thomas Huth (2):
s390x/kvm: Log unmanageable external interruptions s390x/kvm: Log unmanageable program interruptions
hw/intc/s390_flic_kvm.c | 16 ++- hw/s390x/css.c | 150 +++++++++++++++++++++--- hw/s390x/css.h | 2 + hw/s390x/s390-virtio-bus.c | 17 +-- hw/s390x/virtio-ccw.c | 95 +++++++++++++++ target-s390x/cpu.h | 66 ++++------- target-s390x/interrupt.c | 56 +++++++-- target-s390x/kvm.c | 275 ++++++++++++++++++++++++++++++++++++-------- target-s390x/misc_helper.c | 9 +- trace-events | 4 + 10 files changed, 560 insertions(+), 130 deletions(-)
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 02/10] s390x/kvm: make flic play well with old kernels
If we run with an old kernel that does not support KVM_CAP_IRQ_ROUTING, we don't have to do anything in the ->register_io_adapter and ->io_adapter_map callbacks and therefore should return 0 instead of -ENOSYS (just as the non-kvm flic does).
This fixes using adapter interrupts when running under an older kernel, which broke with "s390x: add I/O adapter registration".
--- hw/intc/s390_flic_kvm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/intc/s390_flic_kvm.c +4 -2
@@ -170,7 +170,8 @@ static int kvm_s390_register_io_adapter(S390FLICState *fs, uint32_t id, };if (!kvm_check_extension (kvm_state,KVM_CAP_IRQ_ROUTING )) { -return -ENOSYS ; +/* nothing to do */ +return 0 ; } r =ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr);
@@ -195,7 +196,8 @@ static int kvm_s390_io_adapter_map(S390FLICState *fs, uint32_t id,int r;if (!kvm_check_extension (kvm_state,KVM_CAP_IRQ_ROUTING )) { -return -ENOSYS ; +/* nothing to do */ +return 0 ; } r =ioctl (flic->fd,KVM_SET_DEVICE_ATTR , &attr);
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 01/10] s390x/css: handle emw correctly for tsch
In reply to Cornelia HuckWe should not try to store the emw portion of the irb if extended measurements are not applicable. In particular, we should not surprise the guest by storing a larger irb if it did not enable extended measurements.
--- hw/s390x/css.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
hw/s390x/css.c +20 -4
@@ -779,9 +779,11 @@ out:return ret; } -static void copy_irb_to_guest (IRB *dest,const IRB *src) +static void copy_irb_to_guest (IRB *dest,const IRB *src,PMCW *pmcw) {int i; +uint16_t stctl = src->scsw.ctrl &SCSW_CTRL_MASK_STCTL ; +uint16_t actl = src->scsw.ctrl &SCSW_CTRL_MASK_ACTL ;copy_scsw_to_guest (&dest->scsw, &src->scsw);
@@ -791,8 +793,22 @@ static void copy_irb_to_guest(IRB *dest, const IRB *src)for (i =0 ; i <ARRAY_SIZE (dest->ecw); i++) { dest->ecw[i] =cpu_to_be32 (src->ecw[i]); } -for (i =0 ; i <ARRAY_SIZE (dest->emw); i++) { - dest->emw[i] =cpu_to_be32 (src->emw[i]); +/* extended measurements enabled? */ +if ((src->scsw.flags &SCSW_FLAGS_MASK_ESWF ) || + !(pmcw->flags &PMCW_FLAGS_MASK_TF ) || + !(pmcw->chars &PMCW_CHARS_MASK_XMWME )) { +return ; + } +/* extended measurements pending? */ +if (!(stctl &SCSW_STCTL_STATUS_PEND )) { +return ; + } +if ((stctl &SCSW_STCTL_PRIMARY ) || + (stctl ==SCSW_STCTL_SECONDARY ) || + ((stctl &SCSW_STCTL_INTERMEDIATE ) && (actl &SCSW_ACTL_SUSP ))) { +for (i =0 ; i <ARRAY_SIZE (dest->emw); i++) { + dest->emw[i] =cpu_to_be32 (src->emw[i]); + } } }
@@ -838,7 +854,7 @@ int css_do_tsch(SubchDev *sch, IRB *target_irb) } }/* Store the irb to the guest. */ -copy_irb_to_guest (target_irb, &irb); +copy_irb_to_guest (target_irb, &irb, p);/* Clear conditions on subchannel, if applicable. */ if (stctl &SCSW_STCTL_STATUS_PEND ) {
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 05/10] s390x/kvm: Log unmanageable program interruptions
In reply to Cornelia HuckFrom: Thomas Huth <[email protected]>
The kernel only drops to userspace if an endless program interrupt loop has been detected. Let's print an error message in this case to inform the user about the crash and stop the affected CPU with a panic event, just like it is already done for the external interruption loop detection.
--- target-s390x/kvm.c | 6 ++++++ 1 file changed, 6 insertions(+)
target-s390x/kvm.c +6 -0
@@ -83,6 +83,7 @@#define DIAG_KVM_BREAKPOINT 0x501#define ICPT_INSTRUCTION 0x04 +#define ICPT_PROGRAM 0x08#define ICPT_EXT_INT 0x14#define ICPT_WAITPSW 0x1c#define ICPT_SOFT_INTERCEPT 0x24
@@ -966,6 +967,11 @@ static int handle_intercept(S390CPU *cpu)case ICPT_INSTRUCTION : r =handle_instruction (cpu, run);break ; +case ICPT_PROGRAM : +unmanageable_intercept (cpu,"program interrupt" , + offsetof(LowCore , program_new_psw)); + r =EXCP_HALTED ; +break ;case ICPT_EXT_INT :unmanageable_intercept (cpu,"external interrupt" , offsetof(LowCore , external_new_psw));
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 03/10] s390x/kvm: enable/reset cmma via vm attributes
In reply to Cornelia HuckFrom: Dominik Dingel <[email protected]>
Exploit the new api for userspace-controlled cmma. If supported, enable cmma during kvm initialization and register a reset handler for cmma, which is also called directly from the load IPL code.
The reset functionality is needed to reset the cmma state of the guest pages, e.g. if a system reset is triggered via qemu monitor; otherwise this could result in data corruption.
A guest triggered reboot may now lead to multiple cmma resets; this is OK, however, as this is slowpath anyway and the simplest way to achieve the intended effects.
--- target-s390x/cpu.h | 12 +++++++++ target-s390x/kvm.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ target-s390x/misc_helper.c | 2 ++ trace-events | 4 +++ 4 files changed, 76 insertions(+)
target-s390x/cpu.h +12 -0
@@ -1074,6 +1074,7 @@ void kvm_s390_enable_css_support(S390CPU *cpu);int kvm_s390_assign_subch_ioeventfd (EventNotifier *notifier,uint32_t sch,int vq,bool assign);int kvm_s390_cpu_restart (S390CPU *cpu); +void kvm_s390_clear_cmma_callback (void *opaque);#else static inline void kvm_s390_io_interrupt(S390CPU *cpu, uint16_t subchannel_id,
@@ -1098,8 +1099,19 @@ static inline int kvm_s390_cpu_restart(S390CPU *cpu) {return -ENOSYS ; } +static inline void kvm_s390_clear_cmma_callback (void *opaque) +{ +}#endif +static inline void cmma_reset (S390CPU *cpu) +{ +if (kvm_enabled ()) { +CPUState *cs =CPU (cpu); +kvm_s390_clear_cmma_callback (cs->kvm_state); + } +} +static inline int s390_cpu_restart (S390CPU *cpu) {if (kvm_enabled ()) {
target-s390x/kvm.c +58 -0
74 lines not on this page · raw message
target-s390x/misc_helper.c +2 -0
@@ -136,6 +136,7 @@ static int modified_clear_reset(S390CPU *cpu)pause_all_vcpus ();cpu_synchronize_all_states ();cpu_full_reset_all (); +cmma_reset (cpu);io_subsystem_reset (); scc->load_normal (CPU (cpu));cpu_synchronize_all_post_reset ();
@@ -150,6 +151,7 @@ static int load_normal_reset(S390CPU *cpu)pause_all_vcpus ();cpu_synchronize_all_states ();cpu_reset_all (); +cmma_reset (cpu);io_subsystem_reset (); scc->initial_cpu_reset (CPU (cpu)); scc->load_normal (CPU (cpu));
trace-events +4 -0
@@ -1258,3 +1258,7 @@ xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (ad # hw/pci/pci_host.c pci_cfg_read(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x -> 0x%x" pci_cfg_write(const char *dev, unsigned devid, unsigned fnid, unsigned offs, unsigned val) "%s %02u:%u @0x%x <- 0x%x" + +# target-s390x/kvm.c +kvm_enable_cmma(int rc) "CMMA: enabling with result code %d" +kvm_clear_cmma(int rc) "CMMA: clearing with result code %d"
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 04/10] s390x/kvm: Log unmanageable external interruptions
In reply to Cornelia HuckFrom: Thomas Huth <[email protected]>
Interception code 0x14 only drops to userspace when an unmanageable external interruption interception occured (e.g. if the External New PSW does not disable external interruptions). Instead of bailing out via the default handler, it is better to inform the user with a proper error message that also includes the bad PSW, and to stop the affected CPU with a panic event instead.
--- target-s390x/kvm.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
target-s390x/kvm.c +29 -6
@@ -83,6 +83,7 @@#define DIAG_KVM_BREAKPOINT 0x501#define ICPT_INSTRUCTION 0x04 +#define ICPT_EXT_INT 0x14#define ICPT_WAITPSW 0x1c#define ICPT_SOFT_INTERCEPT 0x24#define ICPT_CPU_STOP 0x28
@@ -930,6 +931,28 @@ static bool is_special_wait_psw(CPUState *cs)return cs->kvm_run->psw_addr ==0xfffUL ; } +static void guest_panicked (void ) +{ +QObject *data; + + data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); +monitor_protocol_event (QEVENT_GUEST_PANICKED , data); +qobject_decref (data); + +vm_stop (RUN_STATE_GUEST_PANICKED ); +} + +static void unmanageable_intercept (S390CPU *cpu,const char *str,int pswoffset) +{ +CPUState *cs =CPU (cpu); + +error_report ("Unmanageable %s! CPU%i new PSW: 0x%016lx:%016lx" , + str, cs->cpu_index,ldq_phys (cs->as, cpu->env.psa + pswoffset), +ldq_phys (cs->as, cpu->env.psa + pswoffset +8 )); +s390_del_running_cpu (cpu); +guest_panicked (); +} +static int handle_intercept (S390CPU *cpu) {CPUState *cs =CPU (cpu);
@@ -943,18 +966,18 @@ static int handle_intercept(S390CPU *cpu)case ICPT_INSTRUCTION : r =handle_instruction (cpu, run);break ; +case ICPT_EXT_INT : +unmanageable_intercept (cpu,"external interrupt" , + offsetof(LowCore , external_new_psw)); + r =EXCP_HALTED ; +break ;case ICPT_WAITPSW :/* disabled wait, since enabled wait is handled in kernel */ if (s390_del_running_cpu (cpu) ==0 ) {if (is_special_wait_psw (cs)) {qemu_system_shutdown_request (); }else { -QObject *data; - - data =qobject_from_jsonf ("{ 'action': %s }" ,"pause" ); -monitor_protocol_event (QEVENT_GUEST_PANICKED , data); -qobject_decref (data); -vm_stop (RUN_STATE_GUEST_PANICKED ); +guest_panicked (); } } r =EXCP_HALTED ;
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 06/10] s390/virtio-ccw: migration support
In reply to Cornelia HuckFrom: Jens Freimann <[email protected]>
This patch adds live migration support for virtio-ccw devices. It's not done with vmstate because virtio itself is not yet ported to vmstate either.
--- hw/s390x/css.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/s390x/css.h | 2 + hw/s390x/virtio-ccw.c | 95 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 208 insertions(+)
hw/s390x/css.c +111 -0
@@ -1293,6 +1293,117 @@ int css_enable_mss(void)return 0 ; } +void subch_device_save (SubchDev *s,QEMUFile *f) +{ +int i; + +qemu_put_byte (f, s->cssid); +qemu_put_byte (f, s->ssid); +qemu_put_be16 (f, s->schid); +qemu_put_be16 (f, s->devno); +qemu_put_byte (f, s->thinint_active); +/* SCHIB */ +/* PMCW */ +qemu_put_be32 (f, s->curr_status.pmcw.intparm); +qemu_put_be16 (f, s->curr_status.pmcw.flags); +qemu_put_be16 (f, s->curr_status.pmcw.devno); +qemu_put_byte (f, s->curr_status.pmcw.lpm); +qemu_put_byte (f, s->curr_status.pmcw.pnom); +qemu_put_byte (f, s->curr_status.pmcw.lpum); +qemu_put_byte (f, s->curr_status.pmcw.pim); +qemu_put_be16 (f, s->curr_status.pmcw.mbi); +qemu_put_byte (f, s->curr_status.pmcw.pom); +qemu_put_byte (f, s->curr_status.pmcw.pam); +qemu_put_buffer (f, s->curr_status.pmcw.chpid,8 ); +qemu_put_be32 (f, s->curr_status.pmcw.chars); +/* SCSW */ +qemu_put_be16 (f, s->curr_status.scsw.flags); +qemu_put_be16 (f, s->curr_status.scsw.ctrl); +qemu_put_be32 (f, s->curr_status.scsw.cpa); +qemu_put_byte (f, s->curr_status.scsw.dstat); +qemu_put_byte (f, s->curr_status.scsw.cstat); +qemu_put_be16 (f, s->curr_status.scsw.count); +qemu_put_be64 (f, s->curr_status.mba); +qemu_put_buffer (f, s->curr_status.mda,4 ); +/* end SCHIB */ +qemu_put_buffer (f, s->sense_data,32 ); +qemu_put_be64 (f, s->channel_prog); +/* last cmd */ +qemu_put_byte (f, s->last_cmd.cmd_code); +qemu_put_byte (f, s->last_cmd.flags); +qemu_put_be16 (f, s->last_cmd.count); +qemu_put_be32 (f, s->last_cmd.cda); +qemu_put_byte (f, s->last_cmd_valid); +qemu_put_byte (f, s->id.reserved); +qemu_put_be16 (f, s->id.cu_type); +qemu_put_byte (f, s->id.cu_model); +qemu_put_be16 (f, s->id.dev_type); +qemu_put_byte (f, s->id.dev_model); +qemu_put_byte (f, s->id.unused); +for (i =0 ; i <ARRAY_SIZE (s->id.ciw); i++) { +qemu_put_byte (f, s->id.ciw[i].type); +qemu_put_byte (f, s->id.ciw[i].command); +qemu_put_be16 (f, s->id.ciw[i].count); + } +return ; +} + +int subch_device_load (SubchDev *s,QEMUFile *f) +{ +int i; + + s->cssid =qemu_get_byte (f); + s->ssid =qemu_get_byte (f); + s->schid =qemu_get_be16 (f); + s->devno =qemu_get_be16 (f); + s->thinint_active =qemu_get_byte (f); +/* SCHIB */ +/* PMCW */ + s->curr_status.pmcw.intparm =qemu_get_be32 (f); + s->curr_status.pmcw.flags =qemu_get_be16 (f); + s->curr_status.pmcw.devno =qemu_get_be16 (f); + s->curr_status.pmcw.lpm =qemu_get_byte (f); + s->curr_status.pmcw.pnom =qemu_get_byte (f); + s->curr_status.pmcw.lpum =qemu_get_byte (f); + s->curr_status.pmcw.pim =qemu_get_byte (f); + s->curr_status.pmcw.mbi =qemu_get_be16 (f); + s->curr_status.pmcw.pom =qemu_get_byte (f); + s->curr_status.pmcw.pam =qemu_get_byte (f); +qemu_get_buffer (f, s->curr_status.pmcw.chpid,8 ); + s->curr_status.pmcw.chars =qemu_get_be32 (f); +/* SCSW */ + s->curr_status.scsw.flags =qemu_get_be16 (f); + s->curr_status.scsw.ctrl =qemu_get_be16 (f); + s->curr_status.scsw.cpa =qemu_get_be32 (f); + s->curr_status.scsw.dstat =qemu_get_byte (f); + s->curr_status.scsw.cstat =qemu_get_byte (f); + s->curr_status.scsw.count =qemu_get_be16 (f); + s->curr_status.mba =qemu_get_be64 (f); +qemu_get_buffer (f, s->curr_status.mda,4 ); +/* end SCHIB */ +qemu_get_buffer (f, s->sense_data,32 ); + s->channel_prog =qemu_get_be64 (f); +/* last cmd */ + s->last_cmd.cmd_code =qemu_get_byte (f); + s->last_cmd.flags =qemu_get_byte (f); + s->last_cmd.count =qemu_get_be16 (f); + s->last_cmd.cda =qemu_get_be32 (f); + s->last_cmd_valid =qemu_get_byte (f); + s->id.reserved =qemu_get_byte (f); + s->id.cu_type =qemu_get_be16 (f); + s->id.cu_model =qemu_get_byte (f); + s->id.dev_type =qemu_get_be16 (f); + s->id.dev_model =qemu_get_byte (f); + s->id.unused =qemu_get_byte (f); +for (i =0 ; i <ARRAY_SIZE (s->id.ciw); i++) { + s->id.ciw[i].type =qemu_get_byte (f); + s->id.ciw[i].command =qemu_get_byte (f); + s->id.ciw[i].count =qemu_get_be16 (f); + } +return 0 ; +} + +static void css_init (void ) { channel_subsys =g_malloc0 (sizeof (*channel_subsys));
hw/s390x/css.h +2 -0
@@ -85,6 +85,8 @@ struct SubchDev {typedef SubchDev *(*css_subch_cb_func )(uint8_t m,uint8_t cssid,uint8_t ssid,uint16_t schid); +void subch_device_save (SubchDev *s,QEMUFile *f); +int subch_device_load (SubchDev *s,QEMUFile *f);int css_create_css_image (uint8_t cssid,bool default_image);bool css_devno_used (uint8_t cssid,uint8_t ssid,uint16_t devno); void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
hw/s390x/virtio-ccw.c +95 -0
107 lines not on this page · raw message
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 07/10] s390x: consolidate floating interrupts
In reply to Cornelia HuckMove the injection code for all floating interrupts to interrupt.c and add a comment.
Also get rid of the #ifdef CONFIG_KVM for the service interrupt.
--- hw/s390x/s390-virtio-bus.c | 11 ----------- target-s390x/cpu.h | 32 +++++++++----------------------- target-s390x/interrupt.c | 44 ++++++++++++++++++++++++++++++++++++++------ target-s390x/kvm.c | 5 +++++ 4 files changed, 52 insertions(+), 40 deletions(-)
hw/s390x/s390-virtio-bus.c +0 -11
@@ -45,8 +45,6 @@ do { } while (0)#endif -#define VIRTIO_EXT_CODE 0x2603 -static void virtio_s390_bus_new (VirtioBusState *bus,size_t bus_size,VirtIOS390Device *dev);
@@ -113,15 +111,6 @@ VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size)return bus; } -static void s390_virtio_irq (S390CPU *cpu,int config_change,uint64_t token) -{ -if (kvm_enabled ()) { -kvm_s390_virtio_irq (cpu, config_change, token); - }else { -cpu_inject_ext (cpu,VIRTIO_EXT_CODE , config_change, token); - } -} -static int s390_virtio_device_init (VirtIOS390Device *dev,VirtIODevice *vdev) {VirtIOS390Bus *bus;
target-s390x/cpu.h +9 -23
@@ -357,6 +357,7 @@ void s390x_tod_timer(void *opaque);void s390x_cpu_timer (void *opaque);int s390_virtio_hypercall (CPUS390XState *env); +void s390_virtio_irq (S390CPU *cpu,int config_change,uint64_t token);#ifdef CONFIG_KVM void kvm_s390_reset_vcpu (S390CPU *cpu);
@@ -364,6 +365,7 @@ void kvm_s390_interrupt(S390CPU *cpu, int type, uint32_t code);void kvm_s390_virtio_irq (S390CPU *cpu,int config_change,uint64_t token);void kvm_s390_interrupt_internal (S390CPU *cpu,int type,uint32_t parm,uint64_t parm64,int vm); +void kvm_s390_service_interrupt (S390CPU *cpu,uint32_t parm);#else static inline void kvm_s390_reset_vcpu (S390CPU *cpu) {
@@ -383,6 +385,9 @@ static inline void kvm_s390_interrupt_internal(S390CPU *cpu, int type, int vm) { } +static inline void kvm_s390_service_interrupt (S390CPU *cpu,uint32_t parm) +{ +}#endif S390CPU *s390_cpu_addr2state (uint16_t cpu_addr);void s390_add_running_cpu (S390CPU *cpu);
@@ -1120,29 +1125,10 @@ static inline int s390_cpu_restart(S390CPU *cpu)return -ENOSYS ; } -static inline void s390_io_interrupt (S390CPU *cpu, -uint16_t subchannel_id, -uint16_t subchannel_nr, -uint32_t io_int_parm, -uint32_t io_int_word) -{ -if (kvm_enabled ()) { -kvm_s390_io_interrupt (cpu, subchannel_id, subchannel_nr, io_int_parm, - io_int_word); - }else { -cpu_inject_io (cpu, subchannel_id, subchannel_nr, io_int_parm, - io_int_word); - } -} - -static inline void s390_crw_mchk (S390CPU *cpu) -{ -if (kvm_enabled ()) { -kvm_s390_crw_mchk (cpu); - }else { -cpu_inject_crw_mchk (cpu); - } -} +void s390_io_interrupt (S390CPU *cpu,uint16_t subchannel_id, +uint16_t subchannel_nr,uint32_t io_int_parm, +uint32_t io_int_word); +void s390_crw_mchk (S390CPU *cpu); static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id, int vq,
target-s390x/interrupt.c +38 -6
66 lines not on this page · raw message
target-s390x/kvm.c +5 -0
@@ -593,6 +593,11 @@ void kvm_s390_interrupt(S390CPU *cpu, int type, uint32_t code)kvm_s390_interrupt_internal (cpu, type, code,0 ,0 ); } +void kvm_s390_service_interrupt (S390CPU *cpu,uint32_t parm) +{ +kvm_s390_interrupt_internal (cpu,KVM_S390_INT_SERVICE , parm,0 ,1 ); +} +static void enter_pgmcheck (S390CPU *cpu,uint16_t code) {kvm_s390_interrupt (cpu,KVM_S390_PROGRAM_INT , code);
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 08/10] s390x/kvm: add alternative injection interface
In reply to Cornelia HuckAdd kvm_s390_{vcpu,floating}_interrupt, which offer the possibility to inject interrupts with larger payloads (when a kvm backend becomes available).
Moreover, kvm_s390_floating_interrupt() does no longer have the bogus requirement for a vcpu.
--- target-s390x/cpu.h | 2 ++ target-s390x/kvm.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+)
target-s390x/cpu.h +2 -0
@@ -366,6 +366,8 @@ void kvm_s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token);void kvm_s390_interrupt_internal (S390CPU *cpu,int type,uint32_t parm,uint64_t parm64,int vm);void kvm_s390_service_interrupt (S390CPU *cpu,uint32_t parm); +void kvm_s390_vcpu_interrupt (S390CPU *cpu,struct kvm_s390_irq *irq); +void kvm_s390_floating_interrupt (struct kvm_s390_irq *irq);#else static inline void kvm_s390_reset_vcpu (S390CPU *cpu) {
target-s390x/kvm.c +86 -0
92 lines not on this page · raw message
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 09/10] s390x: cleanup interrupt injection
In reply to Cornelia HuckRemove the need for a cpu to inject a floating interrupt on kvm.
--- hw/s390x/css.c | 15 ++----- hw/s390x/s390-virtio-bus.c | 6 +-- target-s390x/cpu.h | 41 +++++------------ target-s390x/interrupt.c | 38 +++++++++------- target-s390x/kvm.c | 104 +++++++++++++++++++------------------------- target-s390x/misc_helper.c | 7 ++- 6 files changed, 91 insertions(+), 120 deletions(-)
hw/s390x/css.c +4 -11
@@ -128,13 +128,11 @@ uint16_t css_build_subchannel_id(SubchDev *sch)static void css_inject_io_interrupt (SubchDev *sch) { -S390CPU *cpu =s390_cpu_addr2state (0 );uint8_t isc = (sch->curr_status.pmcw.flags &PMCW_FLAGS_MASK_ISC ) >>11 ;trace_css_io_interrupt (sch->cssid, sch->ssid, sch->schid, sch->curr_status.pmcw.intparm, isc,"" ); -s390_io_interrupt (cpu, -css_build_subchannel_id (sch), +s390_io_interrupt (css_build_subchannel_id (sch), sch->schid, sch->curr_status.pmcw.intparm, isc <<27 );
@@ -147,7 +145,6 @@ void css_conditional_io_interrupt(SubchDev *sch)* with alert status. */ if (!(sch->curr_status.scsw.ctrl &SCSW_STCTL_STATUS_PEND )) { -S390CPU *cpu =s390_cpu_addr2state (0 );uint8_t isc = (sch->curr_status.pmcw.flags &PMCW_FLAGS_MASK_ISC ) >>11 ; trace_css_io_interrupt(sch->cssid, sch->ssid, sch->schid,
@@ -157,8 +154,7 @@ void css_conditional_io_interrupt(SubchDev *sch) sch->curr_status.scsw.ctrl |=SCSW_STCTL_ALERT |SCSW_STCTL_STATUS_PEND ;/* Inject an I/O interrupt. */ -s390_io_interrupt (cpu, -css_build_subchannel_id (sch), +s390_io_interrupt (css_build_subchannel_id (sch), sch->schid, sch->curr_status.pmcw.intparm, isc <<27 );
@@ -167,11 +163,10 @@ void css_conditional_io_interrupt(SubchDev *sch)void css_adapter_interrupt (uint8_t isc) { -S390CPU *cpu =s390_cpu_addr2state (0 );uint32_t io_int_word = (isc <<27 ) |IO_INT_WORD_AI ;trace_css_adapter_interrupt (isc); -s390_io_interrupt (cpu,0 ,0 ,0 , io_int_word); +s390_io_interrupt (0 ,0 ,0 , io_int_word); }static void sch_handle_clear_func (SubchDev *sch)
@@ -1231,11 +1226,9 @@ void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid)QTAILQ_INSERT_TAIL (&channel_subsys->pending_crws, crw_cont, sibling);if (channel_subsys->do_crw_mchk) { -S390CPU *cpu =s390_cpu_addr2state (0 ); - channel_subsys->do_crw_mchk = false;/* Inject crw pending machine check. */ -s390_crw_mchk (cpu); +s390_crw_mchk (); } }
hw/s390x/s390-virtio-bus.c +2 -4
@@ -133,8 +133,7 @@ static int s390_virtio_device_init(VirtIOS390Device *dev, VirtIODevice *vdev)s390_virtio_device_sync (dev);s390_virtio_reset_idx (dev);if (dev->qdev.hotplugged) { -S390CPU *cpu =s390_cpu_addr2state (0 ); -s390_virtio_irq (cpu,VIRTIO_PARAM_DEV_ADD , dev->dev_offs); +s390_virtio_irq (VIRTIO_PARAM_DEV_ADD , dev->dev_offs); }return 0 ;
@@ -478,9 +477,8 @@ static void virtio_s390_notify(DeviceState *d, uint16_t vector) {VirtIOS390Device *dev =to_virtio_s390_device_fast (d);uint64_t token =s390_virtio_device_vq_token (dev, vector); -S390CPU *cpu =s390_cpu_addr2state (0 ); -s390_virtio_irq (cpu,0 , token); +s390_virtio_irq (0 , token); }static unsigned virtio_s390_get_features (DeviceState *d)
target-s390x/cpu.h +12 -29
83 lines not on this page · raw message
target-s390x/interrupt.c +22 -16
@@ -12,50 +12,56 @@/* * All of the following interrupts are floating, i.e. not per-vcpu. -* We just need a dummy cpustate in order to be able to inject. +* We just need a dummy cpustate in order to be able to inject in the +* non-kvm case. */ #if !defined(CONFIG_USER_ONLY )void s390_sclp_extint (uint32_t parm) { -S390CPU *dummy_cpu =s390_cpu_addr2state (0 ); -CPUS390XState *env = &dummy_cpu->env; -if (kvm_enabled ()) { -kvm_s390_service_interrupt (dummy_cpu, parm); +kvm_s390_service_interrupt (parm); }else { +S390CPU *dummy_cpu =s390_cpu_addr2state (0 ); +CPUS390XState *env = &dummy_cpu->env; + env->psw.addr +=4 ;cpu_inject_ext (dummy_cpu,EXT_SERVICE , parm,0 ); } } -void s390_virtio_irq (S390CPU *cpu,int config_change,uint64_t token) +void s390_virtio_irq (int config_change,uint64_t token) {if (kvm_enabled ()) { -kvm_s390_virtio_irq (cpu, config_change, token); +kvm_s390_virtio_irq (config_change, token); }else { -cpu_inject_ext (cpu,EXT_VIRTIO , config_change, token); +S390CPU *dummy_cpu =s390_cpu_addr2state (0 ); + +cpu_inject_ext (dummy_cpu,EXT_VIRTIO , config_change, token); } } -void s390_io_interrupt (S390CPU *cpu,uint16_t subchannel_id, -uint16_t subchannel_nr,uint32_t io_int_parm, -uint32_t io_int_word) +void s390_io_interrupt (uint16_t subchannel_id,uint16_t subchannel_nr, +uint32_t io_int_parm,uint32_t io_int_word) {if (kvm_enabled ()) { -kvm_s390_io_interrupt (cpu, subchannel_id, subchannel_nr, io_int_parm, +kvm_s390_io_interrupt (subchannel_id, subchannel_nr, io_int_parm, io_int_word); }else { -cpu_inject_io (cpu, subchannel_id, subchannel_nr, io_int_parm, +S390CPU *dummy_cpu =s390_cpu_addr2state (0 ); + +cpu_inject_io (dummy_cpu, subchannel_id, subchannel_nr, io_int_parm, io_int_word); } } -void s390_crw_mchk (S390CPU *cpu) +void s390_crw_mchk (void ) {if (kvm_enabled ()) { -kvm_s390_crw_mchk (cpu); +kvm_s390_crw_mchk (); }else { -cpu_inject_crw_mchk (cpu); +S390CPU *dummy_cpu =s390_cpu_addr2state (0 ); + +cpu_inject_crw_mchk (dummy_cpu); } }
target-s390x/kvm.c +45 -59
149 lines not on this page · raw message
target-s390x/misc_helper.c +6 -1
@@ -85,7 +85,12 @@ void program_interrupt(CPUS390XState *env, uint32_t code, int ilen)if (kvm_enabled ()) {#ifdef CONFIG_KVM -kvm_s390_interrupt (cpu,KVM_S390_PROGRAM_INT , code); +struct kvm_s390_irq irq = { + .type =KVM_S390_PROGRAM_INT , + .u.pgm.code = code, + }; + +kvm_s390_vcpu_interrupt (cpu, &irq);#endif }else {CPUState *cs =CPU (cpu);
Signature · 1 line
1.7.9.5
[Qemu-devel] [PULL 10/10] s390x/kvm: inject via flic
In reply to Cornelia HuckTry to inject floating interrupts via the flic if it is available. This allows us to inject the full range of floating interrupts.
--- hw/intc/s390_flic_kvm.c | 10 ++++++++++ target-s390x/cpu.h | 1 + target-s390x/kvm.c | 19 ++++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-)
hw/intc/s390_flic_kvm.c +10 -0
@@ -117,6 +117,16 @@ static int flic_enqueue_irqs(void *buf, uint64_t len,return rc ? -errno :0 ; } +int kvm_s390_inject_flic (struct kvm_s390_irq *irq) +{ +static KVMS390FLICState *flic; + +if (unlikely (!flic)) { + flic =KVM_S390_FLIC (s390_get_flic ()); + } +return flic_enqueue_irqs (irq,sizeof (*irq), flic); +} +/** * __get_all_irqs - store all pending irqs in buffer * @flic: pointer to flic device state
target-s390x/cpu.h +1 -0
@@ -365,6 +365,7 @@ void kvm_s390_virtio_irq(int config_change, uint64_t token);void kvm_s390_service_interrupt (uint32_t parm);void kvm_s390_vcpu_interrupt (S390CPU *cpu,struct kvm_s390_irq *irq);void kvm_s390_floating_interrupt (struct kvm_s390_irq *irq); +int kvm_s390_inject_flic (struct kvm_s390_irq *irq);#else static inline void kvm_s390_reset_vcpu (S390CPU *cpu) {
target-s390x/kvm.c +18 -1
@@ -623,7 +623,7 @@ void kvm_s390_vcpu_interrupt(S390CPU *cpu, struct kvm_s390_irq *irq) } } -void kvm_s390_floating_interrupt (struct kvm_s390_irq *irq) +static void __kvm_s390_floating_interrupt (struct kvm_s390_irq *irq) {struct kvm_s390_interrupt kvmint = {};int r;
@@ -641,6 +641,23 @@ void kvm_s390_floating_interrupt(struct kvm_s390_irq *irq) } } +void kvm_s390_floating_interrupt (struct kvm_s390_irq *irq) +{ +static bool use_flic = true; +int r; + +if (use_flic) { + r =kvm_s390_inject_flic (irq); +if (r == -ENOSYS ) { + use_flic = false; + } +if (!r) { +return ; + } + } +__kvm_s390_floating_interrupt (irq); +} +void kvm_s390_virtio_irq (int config_change,uint64_t token) {struct kvm_s390_irq irq = {
Signature · 1 line
1.7.9.5
Peter Maydell
AppliedQuoted 4 lines · Cornelia Huck
The following changes since commit
7721a3044234c46cd6f5f899e7467dc9351f3c8d:Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140609-1' into staging (2014-06-09 17:04:13 +0100)
Quoted 8 lines
are available in the git repository at:
git://github.com/cohuck/qemu.gittags/s390x-20140610for you to fetch changes up to
bbd8bb8e3245cf6fc6d12b10b3320ab183adb866:s390x/kvm: inject via flic (2014-06-10 09:50:27 +0200)
Applied, thanks.
-- PMM