Message ID | 20130128105926.6aa192d2@gondolin |
---|---|
State | New |
Headers | show |
On 01/28/2013 10:59 AM, Cornelia Huck wrote: > On Fri, 25 Jan 2013 20:28:31 +0100 > Alexander Graf<agraf@suse.de> wrote: > >> However, I do agree that this duplicates logic. Cornelia, mind to instead call our map helper in css_do_tpi? > Well, ioinst_handle_tpi() looks like the better place to do this. > > Can you put this into the series, or should I re-send? > > From a8064d80759e30662b0ac41643a29b41e9015a3f Mon Sep 17 00:00:00 2001 > From: Cornelia Huck<cornelia.huck@de.ibm.com> > Date: Mon, 28 Jan 2013 10:42:44 +0100 > Subject: [PATCH] s390: Use s390_cpu_physical_memory_map for tpi. > > Map the I/O interruption code before calling into css. > > Signed-off-by: Cornelia Huck<cornelia.huck@de.ibm.com> Thanks, applied to s390-next. Alex
On 01/28/2013 10:59 AM, Cornelia Huck wrote: > On Fri, 25 Jan 2013 20:28:31 +0100 > Alexander Graf<agraf@suse.de> wrote: > >> However, I do agree that this duplicates logic. Cornelia, mind to instead call our map helper in css_do_tpi? > Well, ioinst_handle_tpi() looks like the better place to do this. > > Can you put this into the series, or should I re-send? It still breaks for 32-bit targets. Could you please replace the set_bit call by normal bit shift operations? Alex <afaerber_> CC s390x-softmmu/hw/s390x/virtio-ccw.o <afaerber_> CC s390x-softmmu/target-s390x/translate.o <afaerber_> CC s390x-softmmu/target-s390x/helper.o <afaerber_> /home/andreas/QEMU/qemu-s390/hw/s390x/virtio-ccw.c: In function 'virtio_ccw_notify': <afaerber_> /home/andreas/QEMU/qemu-s390/hw/s390x/virtio-ccw.c:665:9: warning: passing argument 2 of 'set_bit' from incompatible pointer type [enabled by default] <afaerber_> In file included from /home/andreas/QEMU/qemu-s390/hw/s390x/virtio-ccw.c:22:0: <afaerber_> /home/andreas/QEMU/qemu-s390/include/qemu/bitops.h:117:20: note: expected 'long unsigned int *' but argument is of type 'uint64_t *' * rastal (~samuelig@000130cd.user.oftc.net) has joined #qemu <afaerber_> /home/andreas/QEMU/qemu-s390/hw/s390x/virtio-ccw.c:670:9: warning: passing argument 2 of 'set_bit' from incompatible pointer type [enabled by default] <afaerber_> In file included from /home/andreas/QEMU/qemu-s390/hw/s390x/virtio-ccw.c:22:0: <mjt> whee <afaerber_> /home/andreas/QEMU/qemu-s390/include/qemu/bitops.h:117:20: note: expected 'long unsigned int *' but argument is of type 'uint64_t *' <afaerber_> agraf: ^ if (vector < VIRTIO_PCI_QUEUE_MAX) { indicators = ldq_phys(dev->indicators); set_bit(vector, &indicators); ^^ stq_phys(dev->indicators, indicators); } else { vector = 0; indicators = ldq_phys(dev->indicators2); set_bit(vector, &indicators); stq_phys(dev->indicators2, indicators); }
diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 113ac9a..84efd4a 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -852,7 +852,7 @@ int css_do_stcrw(CRW *crw) return ret; } -int css_do_tpi(uint64_t addr, int lowcore) +int css_do_tpi(IOIntCode *int_code, int lowcore) { /* No pending interrupts for !KVM. */ return 0; diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index ce12fa4..9be4a47 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -413,7 +413,7 @@ int css_do_hsch(SubchDev *sch); int css_do_ssch(SubchDev *sch, ORB *orb); int css_do_tsch(SubchDev *sch, IRB *irb); int css_do_stcrw(CRW *crw); -int css_do_tpi(uint64_t addr, int lowcore); +int css_do_tpi(IOIntCode *int_code, int lowcore); int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid, int rfmt, void *buf); void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo); @@ -471,7 +471,7 @@ static inline int css_do_stcrw(CRW *crw) { return 1; } -static inline int css_do_tpi(uint64_t addr, int lowcore) +static inline int css_do_tpi(IOIntCode *int_code, int lowcore) { return 0; } diff --git a/target-s390x/ioinst.c b/target-s390x/ioinst.c index 4ef2d73..e3531f3 100644 --- a/target-s390x/ioinst.c +++ b/target-s390x/ioinst.c @@ -619,16 +619,25 @@ int ioinst_handle_tpi(CPUS390XState *env, uint32_t ipb) { uint64_t addr; int lowcore; + IOIntCode *int_code; + hwaddr len, orig_len; + int ret; trace_ioinst("tpi"); addr = decode_basedisp_s(env, ipb); lowcore = addr ? 0 : 1; - if (addr < 8192) { - addr += env->psa; - } else if ((env->psa <= addr) && (addr < env->psa + 8192)) { - addr -= env->psa; + len = lowcore ? 8 /* two words */ : 12 /* three words */; + orig_len = len; + int_code = s390_cpu_physical_memory_map(env, addr, &len, 1); + if (!int_code || (len != orig_len)) { + program_interrupt(env, PGM_SPECIFICATION, 2); + ret = -EIO; + goto out; } - return css_do_tpi(addr, lowcore); + ret = css_do_tpi(int_code, lowcore); +out: + s390_cpu_physical_memory_unmap(env, int_code, len, 1); + return ret; } #define SCHM_REG1_RES(_reg) (_reg & 0x000000000ffffffc) diff --git a/target-s390x/ioinst.h b/target-s390x/ioinst.h index a59742c..d5a43f4 100644 --- a/target-s390x/ioinst.h +++ b/target-s390x/ioinst.h @@ -195,6 +195,13 @@ typedef struct CRW { #define CRW_RSC_SUBCH 0x3 #define CRW_RSC_CHP 0x4 +/* I/O interruption code */ +typedef struct IOIntCode { + uint32_t subsys_id; + uint32_t intparm; + uint32_t interrupt_id; +} QEMU_PACKED IOIntCode; + /* schid disintegration */ #define IOINST_SCHID_ONE(_schid) ((_schid & 0x00010000) >> 16) #define IOINST_SCHID_M(_schid) ((_schid & 0x00080000) >> 19)