spapr/xive: Add source status helpers
and use them to set and test the ASSERTED bit of LSI sources. Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20211004212141.432954-1-clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
afc9fcde55
commit
621f70d210
@ -185,7 +185,7 @@ static void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
|
|||||||
xive_source_irq_is_lsi(xsrc, i) ? "LSI" : "MSI",
|
xive_source_irq_is_lsi(xsrc, i) ? "LSI" : "MSI",
|
||||||
pq & XIVE_ESB_VAL_P ? 'P' : '-',
|
pq & XIVE_ESB_VAL_P ? 'P' : '-',
|
||||||
pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
|
pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
|
||||||
xsrc->status[i] & XIVE_STATUS_ASSERTED ? 'A' : ' ',
|
xive_source_is_asserted(xsrc, i) ? 'A' : ' ',
|
||||||
xive_eas_is_masked(eas) ? "M" : " ",
|
xive_eas_is_masked(eas) ? "M" : " ",
|
||||||
(int) xive_get_field64(EAS_END_DATA, eas->w));
|
(int) xive_get_field64(EAS_END_DATA, eas->w));
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ int kvmppc_xive_source_reset_one(XiveSource *xsrc, int srcno, Error **errp)
|
|||||||
|
|
||||||
if (xive_source_irq_is_lsi(xsrc, srcno)) {
|
if (xive_source_irq_is_lsi(xsrc, srcno)) {
|
||||||
state |= KVM_XIVE_LEVEL_SENSITIVE;
|
state |= KVM_XIVE_LEVEL_SENSITIVE;
|
||||||
if (xsrc->status[srcno] & XIVE_STATUS_ASSERTED) {
|
if (xive_source_is_asserted(xsrc, srcno)) {
|
||||||
state |= KVM_XIVE_LEVEL_ASSERTED;
|
state |= KVM_XIVE_LEVEL_ASSERTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,7 +321,7 @@ uint64_t kvmppc_xive_esb_rw(XiveSource *xsrc, int srcno, uint32_t offset,
|
|||||||
if (xive_source_irq_is_lsi(xsrc, srcno) &&
|
if (xive_source_irq_is_lsi(xsrc, srcno) &&
|
||||||
offset == XIVE_ESB_LOAD_EOI) {
|
offset == XIVE_ESB_LOAD_EOI) {
|
||||||
xive_esb_read(xsrc, srcno, XIVE_ESB_SET_PQ_00);
|
xive_esb_read(xsrc, srcno, XIVE_ESB_SET_PQ_00);
|
||||||
if (xsrc->status[srcno] & XIVE_STATUS_ASSERTED) {
|
if (xive_source_is_asserted(xsrc, srcno)) {
|
||||||
kvmppc_xive_esb_trigger(xsrc, srcno);
|
kvmppc_xive_esb_trigger(xsrc, srcno);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -359,11 +359,7 @@ void kvmppc_xive_source_set_irq(void *opaque, int srcno, int val)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (val) {
|
xive_source_set_asserted(xsrc, srcno, val);
|
||||||
xsrc->status[srcno] |= XIVE_STATUS_ASSERTED;
|
|
||||||
} else {
|
|
||||||
xsrc->status[srcno] &= ~XIVE_STATUS_ASSERTED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kvmppc_xive_esb_trigger(xsrc, srcno);
|
kvmppc_xive_esb_trigger(xsrc, srcno);
|
||||||
|
@ -875,7 +875,7 @@ static bool xive_source_lsi_trigger(XiveSource *xsrc, uint32_t srcno)
|
|||||||
{
|
{
|
||||||
uint8_t old_pq = xive_source_esb_get(xsrc, srcno);
|
uint8_t old_pq = xive_source_esb_get(xsrc, srcno);
|
||||||
|
|
||||||
xsrc->status[srcno] |= XIVE_STATUS_ASSERTED;
|
xive_source_set_asserted(xsrc, srcno, true);
|
||||||
|
|
||||||
switch (old_pq) {
|
switch (old_pq) {
|
||||||
case XIVE_ESB_RESET:
|
case XIVE_ESB_RESET:
|
||||||
@ -923,7 +923,7 @@ static bool xive_source_esb_eoi(XiveSource *xsrc, uint32_t srcno)
|
|||||||
* notification
|
* notification
|
||||||
*/
|
*/
|
||||||
if (xive_source_irq_is_lsi(xsrc, srcno) &&
|
if (xive_source_irq_is_lsi(xsrc, srcno) &&
|
||||||
xsrc->status[srcno] & XIVE_STATUS_ASSERTED) {
|
xive_source_is_asserted(xsrc, srcno)) {
|
||||||
ret = xive_source_lsi_trigger(xsrc, srcno);
|
ret = xive_source_lsi_trigger(xsrc, srcno);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1104,7 +1104,7 @@ void xive_source_set_irq(void *opaque, int srcno, int val)
|
|||||||
if (val) {
|
if (val) {
|
||||||
notify = xive_source_lsi_trigger(xsrc, srcno);
|
notify = xive_source_lsi_trigger(xsrc, srcno);
|
||||||
} else {
|
} else {
|
||||||
xsrc->status[srcno] &= ~XIVE_STATUS_ASSERTED;
|
xive_source_set_asserted(xsrc, srcno, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (val) {
|
if (val) {
|
||||||
@ -1133,7 +1133,7 @@ void xive_source_pic_print_info(XiveSource *xsrc, uint32_t offset, Monitor *mon)
|
|||||||
xive_source_irq_is_lsi(xsrc, i) ? "LSI" : "MSI",
|
xive_source_irq_is_lsi(xsrc, i) ? "LSI" : "MSI",
|
||||||
pq & XIVE_ESB_VAL_P ? 'P' : '-',
|
pq & XIVE_ESB_VAL_P ? 'P' : '-',
|
||||||
pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
|
pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
|
||||||
xsrc->status[i] & XIVE_STATUS_ASSERTED ? 'A' : ' ');
|
xive_source_is_asserted(xsrc, i) ? 'A' : ' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +286,30 @@ uint8_t xive_esb_set(uint8_t *pq, uint8_t value);
|
|||||||
uint8_t xive_source_esb_get(XiveSource *xsrc, uint32_t srcno);
|
uint8_t xive_source_esb_get(XiveSource *xsrc, uint32_t srcno);
|
||||||
uint8_t xive_source_esb_set(XiveSource *xsrc, uint32_t srcno, uint8_t pq);
|
uint8_t xive_source_esb_set(XiveSource *xsrc, uint32_t srcno, uint8_t pq);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Source status helpers
|
||||||
|
*/
|
||||||
|
static inline void xive_source_set_status(XiveSource *xsrc, uint32_t srcno,
|
||||||
|
uint8_t status, bool enable)
|
||||||
|
{
|
||||||
|
if (enable) {
|
||||||
|
xsrc->status[srcno] |= status;
|
||||||
|
} else {
|
||||||
|
xsrc->status[srcno] &= ~status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void xive_source_set_asserted(XiveSource *xsrc, uint32_t srcno,
|
||||||
|
bool enable)
|
||||||
|
{
|
||||||
|
xive_source_set_status(xsrc, srcno, XIVE_STATUS_ASSERTED, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool xive_source_is_asserted(XiveSource *xsrc, uint32_t srcno)
|
||||||
|
{
|
||||||
|
return xsrc->status[srcno] & XIVE_STATUS_ASSERTED;
|
||||||
|
}
|
||||||
|
|
||||||
void xive_source_pic_print_info(XiveSource *xsrc, uint32_t offset,
|
void xive_source_pic_print_info(XiveSource *xsrc, uint32_t offset,
|
||||||
Monitor *mon);
|
Monitor *mon);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user