[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/9] ppc/xive: Introduce helpers for the NVT id
From: |
Cédric Le Goater |
Subject: |
[PATCH 4/9] ppc/xive: Introduce helpers for the NVT id |
Date: |
Mon, 7 Oct 2019 10:40:57 +0200 |
The NVT space is 19 bits wide, giving a maximum of 512K per chip. When
a vPCU is dispatched on a HW thread, the NVT identifier is pushed in
the CAM line (QW1W2). This identifier is used in the presenter
subengine to fetch a NVT structure which might contain pending
interrupts that need a resend.
Signed-off-by: Cédric Le Goater <address@hidden>
---
include/hw/ppc/xive.h | 5 -----
include/hw/ppc/xive_regs.h | 21 +++++++++++++++++++++
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index fd3319bd3202..c1d274f39f9f 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -416,11 +416,6 @@ uint64_t xive_tctx_tm_read(XiveTCTX *tctx, hwaddr offset,
unsigned size);
void xive_tctx_pic_print_info(XiveTCTX *tctx, Monitor *mon);
Object *xive_tctx_create(Object *cpu, XiveRouter *xrtr, Error **errp);
-static inline uint32_t xive_nvt_cam_line(uint8_t nvt_blk, uint32_t nvt_idx)
-{
- return (nvt_blk << 19) | nvt_idx;
-}
-
/*
* KVM XIVE device helpers
*/
diff --git a/include/hw/ppc/xive_regs.h b/include/hw/ppc/xive_regs.h
index 530f232b04f8..1a5622f8ded8 100644
--- a/include/hw/ppc/xive_regs.h
+++ b/include/hw/ppc/xive_regs.h
@@ -272,4 +272,25 @@ typedef struct XiveNVT {
#define xive_nvt_is_valid(nvt) (be32_to_cpu((nvt)->w0) & NVT_W0_VALID)
+/*
+ * The VP number space in a block is defined by the END_W6_NVT_INDEX
+ * field of the XIVE END
+ */
+#define XIVE_NVT_SHIFT 19
+
+static inline uint32_t xive_nvt_cam_line(uint8_t nvt_blk, uint32_t nvt_idx)
+{
+ return (nvt_blk << XIVE_NVT_SHIFT) | nvt_idx;
+}
+
+static inline uint32_t xive_nvt_idx(uint32_t cam_line)
+{
+ return cam_line & ((1 << XIVE_NVT_SHIFT) - 1);
+}
+
+static inline uint32_t xive_nvt_blk(uint32_t cam_line)
+{
+ return (cam_line >> XIVE_NVT_SHIFT) & 0xf;
+}
+
#endif /* PPC_XIVE_REGS_H */
--
2.21.0
- [PATCH 0/9] ppc/pnv: XIVE cleanup and fixes, Cédric Le Goater, 2019/10/07
- [PATCH 3/9] ppc/xive: Record the IPB in the associated NVT, Cédric Le Goater, 2019/10/07
- [PATCH 4/9] ppc/xive: Introduce helpers for the NVT id,
Cédric Le Goater <=
- [PATCH 2/9] ppc/pnv: Use address_space_stq_be() when triggering an interrupt from PSI, Cédric Le Goater, 2019/10/07
- [PATCH 7/9] ppc/pnv: Quiesce some XIVE errors, Cédric Le Goater, 2019/10/07
- [PATCH 9/9] ppc/xive: Check V bit in TM_PULL_POOL_CTX, Cédric Le Goater, 2019/10/07
- [PATCH 1/9] ppc/pnv: Improve trigger data definition, Cédric Le Goater, 2019/10/07
- [PATCH 6/9] ppc/pnv: Dump the XIVE NVT table, Cédric Le Goater, 2019/10/07
- [PATCH 5/9] ppc/pnv: Remove pnv_xive_vst_size() routine, Cédric Le Goater, 2019/10/07
- [PATCH 8/9] ppc/xive: Introduce OS CAM line helpers, Cédric Le Goater, 2019/10/07
- Re: [PATCH 0/9] ppc/pnv: XIVE cleanup and fixes, Cédric Le Goater, 2019/10/21