Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20200618' int…
Browse files Browse the repository at this point in the history
…o staging

s390x update:
- update Linux headers to 5.8-rc1 (for vfio-ccw path handling)
- vfio-ccw: add support for path handling
- documentation fix

# gpg: Signature made Thu 18 Jun 2020 16:36:04 BST
# gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
# gpg:                issuer "cohuck@redhat.com"
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [marginal]
# 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>" [marginal]
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [marginal]
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20200618:
  docs/s390x: fix vfio-ap device_del description
  vfio-ccw: Add support for the CRW region and IRQ
  s390x/css: Refactor the css_queue_crw() routine
  vfio-ccw: Refactor ccw irq handler
  vfio-ccw: Add support for the schib region
  vfio-ccw: Refactor cleanup of regions
  Linux headers: update

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Jun 19, 2020
2 parents 292ef18 + 458e056 commit 4d28582
Show file tree
Hide file tree
Showing 32 changed files with 1,075 additions and 78 deletions.
8 changes: 4 additions & 4 deletions docs/system/s390x/vfio-ap.rst
Expand Up @@ -606,10 +606,11 @@ action.

To hot plug a vfio-ap device, use the QEMU ``device_add`` command::

(qemu) device_add vfio-ap,sysfsdev="$path-to-mdev"
(qemu) device_add vfio-ap,sysfsdev="$path-to-mdev",id="$id"

Where the ``$path-to-mdev`` value specifies the absolute path to a mediated
device to which AP resources to be used by the guest have been assigned.
``$id`` is the name value for the optional id parameter.

Note that on Linux guests, the AP devices will be created in the
``/sys/bus/ap/devices`` directory when the AP bus subsequently performs its periodic
Expand All @@ -632,10 +633,9 @@ or a prior hot plug action.

To hot unplug a vfio-ap device, use the QEMU ``device_del`` command::

(qemu) device_del vfio-ap,sysfsdev="$path-to-mdev"
(qemu) device_del "$id"

Where ``$path-to-mdev`` is the same as the path specified when the vfio-ap
device was attached to the virtual machine's ap-bus.
Where ``$id`` is the same id that was specified at device creation.

On a Linux guest, the AP devices will be removed from the ``/sys/bus/ap/devices``
directory on the guest when the AP bus subsequently performs its periodic scan,
Expand Down
57 changes: 40 additions & 17 deletions hw/s390x/css.c
Expand Up @@ -1335,11 +1335,20 @@ static void copy_schib_to_guest(SCHIB *dest, const SCHIB *src)
}
}

int css_do_stsch(SubchDev *sch, SCHIB *schib)
IOInstEnding css_do_stsch(SubchDev *sch, SCHIB *schib)
{
int ret;

/*
* For some subchannels, we may want to update parts of
* the schib (e.g., update path masks from the host device
* for passthrough subchannels).
*/
ret = s390_ccw_store(sch);

/* Use current status. */
copy_schib_to_guest(schib, &sch->curr_status);
return 0;
return ret;
}

static void copy_pmcw_from_guest(PMCW *dest, const PMCW *src)
Expand Down Expand Up @@ -2161,30 +2170,23 @@ void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
}
}

void css_queue_crw(uint8_t rsc, uint8_t erc, int solicited,
int chain, uint16_t rsid)
void css_crw_add_to_queue(CRW crw)
{
CrwContainer *crw_cont;

trace_css_crw(rsc, erc, rsid, chain ? "(chained)" : "");
trace_css_crw((crw.flags & CRW_FLAGS_MASK_RSC) >> 8,
crw.flags & CRW_FLAGS_MASK_ERC,
crw.rsid,
(crw.flags & CRW_FLAGS_MASK_C) ? "(chained)" : "");

/* TODO: Maybe use a static crw pool? */
crw_cont = g_try_new0(CrwContainer, 1);
if (!crw_cont) {
channel_subsys.crws_lost = true;
return;
}
crw_cont->crw.flags = (rsc << 8) | erc;
if (solicited) {
crw_cont->crw.flags |= CRW_FLAGS_MASK_S;
}
if (chain) {
crw_cont->crw.flags |= CRW_FLAGS_MASK_C;
}
crw_cont->crw.rsid = rsid;
if (channel_subsys.crws_lost) {
crw_cont->crw.flags |= CRW_FLAGS_MASK_R;
channel_subsys.crws_lost = false;
}

crw_cont->crw = crw;

QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling);

Expand All @@ -2195,6 +2197,27 @@ void css_queue_crw(uint8_t rsc, uint8_t erc, int solicited,
}
}

void css_queue_crw(uint8_t rsc, uint8_t erc, int solicited,
int chain, uint16_t rsid)
{
CRW crw;

crw.flags = (rsc << 8) | erc;
if (solicited) {
crw.flags |= CRW_FLAGS_MASK_S;
}
if (chain) {
crw.flags |= CRW_FLAGS_MASK_C;
}
crw.rsid = rsid;
if (channel_subsys.crws_lost) {
crw.flags |= CRW_FLAGS_MASK_R;
channel_subsys.crws_lost = false;
}

css_crw_add_to_queue(crw);
}

void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
int hotplugged, int add)
{
Expand Down
21 changes: 21 additions & 0 deletions hw/s390x/s390-ccw.c
Expand Up @@ -51,6 +51,27 @@ int s390_ccw_clear(SubchDev *sch)
return cdc->handle_clear(sch);
}

IOInstEnding s390_ccw_store(SubchDev *sch)
{
S390CCWDeviceClass *cdc = NULL;
int ret = IOINST_CC_EXPECTED;

/*
* This code is called for both virtual and passthrough devices,
* but only applies to to the latter. This ugly check makes that
* distinction for us.
*/
if (object_dynamic_cast(OBJECT(sch->driver_data), TYPE_S390_CCW)) {
cdc = S390_CCW_DEVICE_GET_CLASS(sch->driver_data);
}

if (cdc && cdc->handle_store) {
ret = cdc->handle_store(sch);
}

return ret;
}

static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
char *sysfsdev,
Error **errp)
Expand Down

0 comments on commit 4d28582

Please sign in to comment.