some accumulated s390x fixes

-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEw9DWbcNiT/aowBjO3s9rk8bwL68FAmBCUygSHGNvaHVja0By
 ZWRoYXQuY29tAAoJEN7Pa5PG8C+v3AUQAJ0lmxoMCbnHQn4wbFRfQW8XH8MVKSFU
 mJ+UTcsKnoA+sgo6FkwxJwKWuhJ2tpeUHENRRSZ73KgnedA2tou4Cc/18oUtl8Oc
 TS3L8Eq6NQA6Xf+uSpOUKM0R+shgYdOO6QnWO8WGVhmpP6adQLHZX0tWomkXJfDS
 fpCt+ivs+iHkENL1+45wohwoXRaznYPIspHMhkL4AxvQfI55RifWjX0K+srpLgNy
 mkbAlhLJX+0AxA75EyhgWddYmu9HcMtFLMBFJcsALYxPtp21MTHd5ha9uDvrWkXS
 Q4jp1QMr+8kJrCUZTWSL25IfYHNoBZjMa+AB04rYC1BG1E6FZA2NKcd0kZtwEU+g
 hwer/HahSJ+TXohYkXsjEkpMYvCButmvzPjHLin9gzGjg8z31EpvqGuz/iZA9IgZ
 qA7tegwqclDLmBZjEge6jF3iCiM1f4292cGhsZ40Vmmkn+O2udSirzUGFxwQmdWn
 YR03lGi2BfC5ND42HBmEuqFna3GjfYBKhvromLFsVInws7uBQRzN4GJtzWMRY5R2
 R5oeVz5NiimV4iqDUjCv/LjZD6fEJPyGTRzS2niVWSEqS/jfjBs3aBgwq9bAw7jo
 Wyv/jPUngbZnMcpl7FU9OyefJFuFgztVWD2+HFwrgrfJFhsmx/jkwNCUEYLL8JQ7
 TwvTQHe547//
 =BhxJ
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210305' into staging

some accumulated s390x fixes

# gpg: Signature made Fri 05 Mar 2021 15:50:00 GMT
# gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
# gpg:                issuer "cohuck@redhat.com"
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown]
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full]
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full]
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>" [unknown]
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [unknown]
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck-gitlab/tags/s390x-20210305:
  target/s390x/kvm: Simplify debug code
  vfio-ccw: Do not read region ret_code after write
  css: SCHIB measurement block origin must be aligned
  virtio-ccw: commands on revision-less devices
  s390x/pci: restore missing Query PCI Function CLP data
  hw/s390x: fix build for virtio-9p-ccw
  target/s390x/arch_dump: Fix warning for the name field in the PT_NOTE section
  s390x/cpu_model: disallow unpack for --only-migratable

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2021-03-05 19:04:46 +00:00
commit 91e92cad67
8 changed files with 48 additions and 17 deletions

View File

@ -40,7 +40,9 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-ccw-net.c'))
virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-ccw-rng.c'))
virtio_ss.add(when: 'CONFIG_VIRTIO_SCSI', if_true: files('virtio-ccw-scsi.c'))
virtio_ss.add(when: 'CONFIG_VIRTIO_SERIAL', if_true: files('virtio-ccw-serial.c'))
virtio_ss.add(when: ['CONFIG_VIRTIO_9P', 'CONFIG_VIRTFS'], if_true: files('virtio-ccw-blk.c'))
if have_virtfs
virtio_ss.add(when: 'CONFIG_VIRTIO_9P', if_true: files('virtio-ccw-9p.c'))
endif
virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-ccw.c'))
virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-ccw.c'))
s390x_ss.add_all(when: 'CONFIG_VIRTIO_CCW', if_true: virtio_ss)

View File

@ -284,10 +284,15 @@ int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
stq_p(&resquery->sdma, pbdev->zpci_fn.sdma);
stq_p(&resquery->edma, pbdev->zpci_fn.edma);
stw_p(&resquery->pchid, pbdev->zpci_fn.pchid);
stw_p(&resquery->vfn, pbdev->zpci_fn.vfn);
resquery->flags = pbdev->zpci_fn.flags;
resquery->pfgid = pbdev->zpci_fn.pfgid;
resquery->pft = pbdev->zpci_fn.pft;
resquery->fmbl = pbdev->zpci_fn.fmbl;
stl_p(&resquery->fid, pbdev->zpci_fn.fid);
stl_p(&resquery->uid, pbdev->zpci_fn.uid);
memcpy(resquery->pfip, pbdev->zpci_fn.pfip, CLP_PFIP_NR_SEGMENTS);
memcpy(resquery->util_str, pbdev->zpci_fn.util_str, CLP_UTIL_STR_LEN);
for (i = 0; i < PCI_BAR_COUNT; i++) {
uint32_t data = pci_get_long(pbdev->pdev->config +

View File

@ -327,13 +327,20 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
ccw.cmd_code);
check_len = !((ccw.flags & CCW_FLAG_SLI) && !(ccw.flags & CCW_FLAG_DC));
if (dev->force_revision_1 && dev->revision < 0 &&
ccw.cmd_code != CCW_CMD_SET_VIRTIO_REV) {
/*
* virtio-1 drivers must start with negotiating to a revision >= 1,
* so post a command reject for all other commands
*/
return -ENOSYS;
if (dev->revision < 0 && ccw.cmd_code != CCW_CMD_SET_VIRTIO_REV) {
if (dev->force_revision_1) {
/*
* virtio-1 drivers must start with negotiating to a revision >= 1,
* so post a command reject for all other commands
*/
return -ENOSYS;
} else {
/*
* If the driver issues any command that is not SET_VIRTIO_REV,
* we'll have to operate the device in legacy mode.
*/
dev->revision = 0;
}
}
/* Look at the command. */

View File

@ -104,9 +104,9 @@ again:
goto again;
}
error_report("vfio-ccw: write I/O region failed with errno=%d", errno);
ret = -errno;
ret = errno ? -errno : -EFAULT;
} else {
ret = region->ret_code;
ret = 0;
}
switch (ret) {
case 0:
@ -192,9 +192,9 @@ again:
goto again;
}
error_report("vfio-ccw: write cmd region failed with errno=%d", errno);
ret = -errno;
ret = errno ? -errno : -EFAULT;
} else {
ret = region->ret_code;
ret = 0;
}
switch (ret) {
case 0:
@ -232,9 +232,9 @@ again:
goto again;
}
error_report("vfio-ccw: write cmd region failed with errno=%d", errno);
ret = -errno;
ret = errno ? -errno : -EFAULT;
} else {
ret = region->ret_code;
ret = 0;
}
switch (ret) {
case 0:

View File

@ -212,11 +212,13 @@ static int s390x_write_elf64_notes(const char *note_name,
int note_size;
int ret = -1;
assert(strlen(note_name) < sizeof(note.name));
for (nf = funcs; nf->note_contents_func; nf++) {
memset(&note, 0, sizeof(note));
note.hdr.n_namesz = cpu_to_be32(strlen(note_name) + 1);
note.hdr.n_descsz = cpu_to_be32(nf->contents_size);
strncpy(note.name, note_name, sizeof(note.name));
g_strlcpy(note.name, note_name, sizeof(note.name));
(*nf->note_contents_func)(&note, cpu, id);
note_size = sizeof(note) - sizeof(note.contents) + nf->contents_size;

View File

@ -26,6 +26,7 @@
#include "qapi/qmp/qdict.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/arch_init.h"
#include "sysemu/sysemu.h"
#include "hw/pci/pci.h"
#endif
#include "qapi/qapi-commands-machine-target.h"
@ -878,6 +879,15 @@ static void check_compatibility(const S390CPUModel *max_model,
return;
}
#ifndef CONFIG_USER_ONLY
if (only_migratable && test_bit(S390_FEAT_UNPACK, model->features)) {
error_setg(errp, "The unpack facility is not compatible with "
"the --only-migratable option. You must remove either "
"the 'unpack' facility or the --only-migratable option");
return;
}
#endif
/* detect the missing features to properly report them */
bitmap_andnot(missing, model->features, max_model->features, S390_FEAT_MAX);
if (bitmap_empty(missing, S390_FEAT_MAX)) {

View File

@ -121,6 +121,12 @@ static int ioinst_schib_valid(SCHIB *schib)
if (be32_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_XMWME) {
return 0;
}
/* for MB format 1 bits 26-31 of word 11 must be 0 */
/* MBA uses words 10 and 11, it means align on 2**6 */
if ((be16_to_cpu(schib->pmcw.chars) & PMCW_CHARS_MASK_MBFC) &&
(be64_to_cpu(schib->mba) & 0x03fUL)) {
return 0;
}
return 1;
}

View File

@ -1785,8 +1785,7 @@ static int handle_intercept(S390CPU *cpu)
int icpt_code = run->s390_sieic.icptcode;
int r = 0;
DPRINTF("intercept: 0x%x (at 0x%lx)\n", icpt_code,
(long)cs->kvm_run->psw_addr);
DPRINTF("intercept: 0x%x (at 0x%lx)\n", icpt_code, (long)run->psw_addr);
switch (icpt_code) {
case ICPT_INSTRUCTION:
case ICPT_PV_INSTR: