mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-29 13:01:52 -06:00
s390x/css: Refactor the css_queue_crw() routine
We have a use case (vfio-ccw) where a CRW is already built and ready to use. Rather than teasing out the components just to reassemble it later, let's rework this code so we can queue a fully-qualified CRW directly. Signed-off-by: Eric Farman <farman@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20200505125757.98209-6-farman@linux.ibm.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
This commit is contained in:
parent
690e29b911
commit
f6dde1b012
2 changed files with 30 additions and 15 deletions
|
@ -2170,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,
|
void css_crw_add_to_queue(CRW crw)
|
||||||
int chain, uint16_t rsid)
|
|
||||||
{
|
{
|
||||||
CrwContainer *crw_cont;
|
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? */
|
/* TODO: Maybe use a static crw pool? */
|
||||||
crw_cont = g_try_new0(CrwContainer, 1);
|
crw_cont = g_try_new0(CrwContainer, 1);
|
||||||
if (!crw_cont) {
|
if (!crw_cont) {
|
||||||
channel_subsys.crws_lost = true;
|
channel_subsys.crws_lost = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
crw_cont->crw.flags = (rsc << 8) | erc;
|
|
||||||
if (solicited) {
|
crw_cont->crw = crw;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling);
|
QTAILQ_INSERT_TAIL(&channel_subsys.pending_crws, crw_cont, sibling);
|
||||||
|
|
||||||
|
@ -2204,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,
|
void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
|
||||||
int hotplugged, int add)
|
int hotplugged, int add)
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,6 +205,7 @@ void copy_scsw_to_guest(SCSW *dest, const SCSW *src);
|
||||||
void css_inject_io_interrupt(SubchDev *sch);
|
void css_inject_io_interrupt(SubchDev *sch);
|
||||||
void css_reset(void);
|
void css_reset(void);
|
||||||
void css_reset_sch(SubchDev *sch);
|
void css_reset_sch(SubchDev *sch);
|
||||||
|
void css_crw_add_to_queue(CRW crw);
|
||||||
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);
|
int chain, uint16_t rsid);
|
||||||
void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
|
void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue