On Thu, 30 Nov 2017 13:55:25 +0100 Pierre Morel <pmo...@linux.vnet.ibm.com> wrote:
> Enhance the fault detection, correction of the fault reporting. > > Signed-off-by: Pierre Morel <pmo...@linux.vnet.ibm.com> > Reviewed-by: Yi Min Zhao <zyi...@linux.vnet.ibm.com> > --- > hw/s390x/s390-pci-inst.c | 42 +++++++++++++++++++++++++----------------- > hw/s390x/s390-pci-inst.h | 4 ++++ > 2 files changed, 29 insertions(+), 17 deletions(-) > > @@ -493,9 +497,13 @@ int pcistg_service_call(S390CPU *cpu, uint8_t r1, > uint8_t r2) > break; > } > > - data = env->regs[r1]; > - if (pcias < 6) { > - if ((8 - (offset & 0x7)) < len) { > + switch (pcias) { > + /* A ZPCI PCI card may use any BAR from BAR 0 to BAR 5 */ > + case ZPCI_IO_BAR_MIN ... ZPCI_IO_BAR_MAX: Will make this case ZPCI_IO_BAR_MIN...ZPCI_IO_BAR_MAX: > + /* Check length: > + * A length of 0 is invalid and length should not cross a double word > + */ > + if (!len || (len > (8 - (offset & 0x7)))) { > program_interrupt(env, PGM_OPERAND, 4); > return 0; > }