Skip to content

Commit 4d28582

Browse files
committed
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20200618' into 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 "[email protected]" # gpg: Good signature from "Cornelia Huck <[email protected]>" [marginal] # gpg: aka "Cornelia Huck <[email protected]>" [full] # gpg: aka "Cornelia Huck <[email protected]>" [full] # gpg: aka "Cornelia Huck <[email protected]>" [marginal] # gpg: aka "Cornelia Huck <[email protected]>" [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 <[email protected]>
2 parents 292ef18 + 458e056 commit 4d28582

File tree

32 files changed

+1075
-78
lines changed

32 files changed

+1075
-78
lines changed

docs/system/s390x/vfio-ap.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,11 @@ action.
606606

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

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

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

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

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

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

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

640640
On a Linux guest, the AP devices will be removed from the ``/sys/bus/ap/devices``
641641
directory on the guest when the AP bus subsequently performs its periodic scan,

hw/s390x/css.c

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,11 +1335,20 @@ static void copy_schib_to_guest(SCHIB *dest, const SCHIB *src)
13351335
}
13361336
}
13371337

1338-
int css_do_stsch(SubchDev *sch, SCHIB *schib)
1338+
IOInstEnding css_do_stsch(SubchDev *sch, SCHIB *schib)
13391339
{
1340+
int ret;
1341+
1342+
/*
1343+
* For some subchannels, we may want to update parts of
1344+
* the schib (e.g., update path masks from the host device
1345+
* for passthrough subchannels).
1346+
*/
1347+
ret = s390_ccw_store(sch);
1348+
13401349
/* Use current status. */
13411350
copy_schib_to_guest(schib, &sch->curr_status);
1342-
return 0;
1351+
return ret;
13431352
}
13441353

13451354
static void copy_pmcw_from_guest(PMCW *dest, const PMCW *src)
@@ -2161,30 +2170,23 @@ void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
21612170
}
21622171
}
21632172

2164-
void css_queue_crw(uint8_t rsc, uint8_t erc, int solicited,
2165-
int chain, uint16_t rsid)
2173+
void css_crw_add_to_queue(CRW crw)
21662174
{
21672175
CrwContainer *crw_cont;
21682176

2169-
trace_css_crw(rsc, erc, rsid, chain ? "(chained)" : "");
2177+
trace_css_crw((crw.flags & CRW_FLAGS_MASK_RSC) >> 8,
2178+
crw.flags & CRW_FLAGS_MASK_ERC,
2179+
crw.rsid,
2180+
(crw.flags & CRW_FLAGS_MASK_C) ? "(chained)" : "");
2181+
21702182
/* TODO: Maybe use a static crw pool? */
21712183
crw_cont = g_try_new0(CrwContainer, 1);
21722184
if (!crw_cont) {
21732185
channel_subsys.crws_lost = true;
21742186
return;
21752187
}
2176-
crw_cont->crw.flags = (rsc << 8) | erc;
2177-
if (solicited) {
2178-
crw_cont->crw.flags |= CRW_FLAGS_MASK_S;
2179-
}
2180-
if (chain) {
2181-
crw_cont->crw.flags |= CRW_FLAGS_MASK_C;
2182-
}
2183-
crw_cont->crw.rsid = rsid;
2184-
if (channel_subsys.crws_lost) {
2185-
crw_cont->crw.flags |= CRW_FLAGS_MASK_R;
2186-
channel_subsys.crws_lost = false;
2187-
}
2188+
2189+
crw_cont->crw = crw;
21882190

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

@@ -2195,6 +2197,27 @@ void css_queue_crw(uint8_t rsc, uint8_t erc, int solicited,
21952197
}
21962198
}
21972199

2200+
void css_queue_crw(uint8_t rsc, uint8_t erc, int solicited,
2201+
int chain, uint16_t rsid)
2202+
{
2203+
CRW crw;
2204+
2205+
crw.flags = (rsc << 8) | erc;
2206+
if (solicited) {
2207+
crw.flags |= CRW_FLAGS_MASK_S;
2208+
}
2209+
if (chain) {
2210+
crw.flags |= CRW_FLAGS_MASK_C;
2211+
}
2212+
crw.rsid = rsid;
2213+
if (channel_subsys.crws_lost) {
2214+
crw.flags |= CRW_FLAGS_MASK_R;
2215+
channel_subsys.crws_lost = false;
2216+
}
2217+
2218+
css_crw_add_to_queue(crw);
2219+
}
2220+
21982221
void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
21992222
int hotplugged, int add)
22002223
{

hw/s390x/s390-ccw.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,27 @@ int s390_ccw_clear(SubchDev *sch)
5151
return cdc->handle_clear(sch);
5252
}
5353

54+
IOInstEnding s390_ccw_store(SubchDev *sch)
55+
{
56+
S390CCWDeviceClass *cdc = NULL;
57+
int ret = IOINST_CC_EXPECTED;
58+
59+
/*
60+
* This code is called for both virtual and passthrough devices,
61+
* but only applies to to the latter. This ugly check makes that
62+
* distinction for us.
63+
*/
64+
if (object_dynamic_cast(OBJECT(sch->driver_data), TYPE_S390_CCW)) {
65+
cdc = S390_CCW_DEVICE_GET_CLASS(sch->driver_data);
66+
}
67+
68+
if (cdc && cdc->handle_store) {
69+
ret = cdc->handle_store(sch);
70+
}
71+
72+
return ret;
73+
}
74+
5475
static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
5576
char *sysfsdev,
5677
Error **errp)

0 commit comments

Comments
 (0)