[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/8] spapr/xive: Enforce the load-after-store ordering
From: |
Cédric Le Goater |
Subject: |
[PATCH 5/8] spapr/xive: Enforce the load-after-store ordering |
Date: |
Wed, 19 Aug 2020 15:08:40 +0200 |
The XIVE_ESB_SET_PQ_10 load operation is used to disable temporarily
an interrupt source. If StoreEOI is active, a source could be left
enabled if the load and store operations come out of order.
QEMU makes use of this offset to quiesce the sources before a
migration. Enforce the load-after-store ordering always when doing so
without querying the characteristics of the sources on the host. The
performance penalty will be very small for QEMU.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
include/hw/ppc/xive.h | 8 ++++++++
hw/intc/spapr_xive_kvm.c | 12 ++++++++++++
2 files changed, 20 insertions(+)
diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index 2c42ae92d287..c061230ea802 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -279,6 +279,14 @@ static inline hwaddr xive_source_esb_mgmt(XiveSource
*xsrc, int srcno)
#define XIVE_ESB_SET_PQ_10 0xe00 /* Load */
#define XIVE_ESB_SET_PQ_11 0xf00 /* Load */
+/*
+ * Load-after-store ordering
+ *
+ * Adding this offset to the load address will enforce
+ * load-after-store ordering. This is required to use with StoreEOI.
+ */
+#define XIVE_ESB_LD_ST_MO 0x40 /* Load-after-store ordering */
+
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);
diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
index 90f4509e6959..3eea4cb1c49f 100644
--- a/hw/intc/spapr_xive_kvm.c
+++ b/hw/intc/spapr_xive_kvm.c
@@ -317,6 +317,18 @@ static uint64_t xive_esb_rw(XiveSource *xsrc, int srcno,
uint32_t offset,
static uint8_t xive_esb_read(XiveSource *xsrc, int srcno, uint32_t offset)
{
+ /*
+ * The XIVE_ESB_SET_PQ_10 load operation is used to disable
+ * temporarily an interrupt source. If StoreEOI is active, a
+ * source could be left enabled if the load and store operations
+ * come out of order.
+ *
+ * Enforce the load-after-store ordering always.
+ */
+ if (offset == XIVE_ESB_SET_PQ_10) {
+ offset |= XIVE_ESB_LD_ST_MO;
+ }
+
return xive_esb_rw(xsrc, srcno, offset, 0, 0) & 0x3;
}
--
2.25.4
- [PATCH 1/8] spapr/xive: Add a 'hv-prio' property to represent the KVM escalation priority, (continued)
- [PATCH 1/8] spapr/xive: Add a 'hv-prio' property to represent the KVM escalation priority, Cédric Le Goater, 2020/08/19
- [PATCH 2/8] linux-headers: Update for KVM_DEV_XIVE_GRP_SOURCE_INFO, Cédric Le Goater, 2020/08/19
- [PATCH 3/8] spapr/xive: Query the characteristics of a source in KVM, Cédric Le Goater, 2020/08/19
- [PATCH 4/8] spapr/xive: Activate StoreEOI for POWER10 only, Cédric Le Goater, 2020/08/19
- [PATCH 6/8] spapr/xive: Activate StoreEOI by default, Cédric Le Goater, 2020/08/19
- [PATCH 5/8] spapr/xive: Enforce the load-after-store ordering,
Cédric Le Goater <=
- [PATCH 7/8] spapr/xive: Use the xics flag to check for XIVE-only IRQ backends, Cédric Le Goater, 2020/08/19
- [PATCH 8/8] spapr/xive: Introduce a XIVE StoreEOI IRQ backend, Cédric Le Goater, 2020/08/19