]> Git Repo - qemu.git/commitdiff
ppc/pnv: Introduce a pnv_xive_is_cpu_enabled() helper
authorCédric Le Goater <[email protected]>
Mon, 25 Nov 2019 06:58:06 +0000 (07:58 +0100)
committerDavid Gibson <[email protected]>
Mon, 16 Dec 2019 23:39:47 +0000 (10:39 +1100)
and use this helper to exclude CPUs which are not enabled in the XIVE
controller.

Signed-off-by: Cédric Le Goater <[email protected]>
Message-Id: <20191125065820[email protected]>
Signed-off-by: David Gibson <[email protected]>
hw/intc/pnv_xive.c
include/hw/ppc/pnv.h

index 9798bd9e729fbeb5233e01b8fd3155f0f5297c0a..ec8349ee4a1f19a0ac2430521b551694401bdda6 100644 (file)
@@ -372,6 +372,21 @@ static int pnv_xive_get_eas(XiveRouter *xrtr, uint8_t blk, uint32_t idx,
     return pnv_xive_vst_read(xive, VST_TSEL_IVT, blk, idx, eas);
 }
 
+/*
+ * One bit per thread id. The first register PC_THREAD_EN_REG0 covers
+ * the first cores 0-15 (normal) of the chip or 0-7 (fused). The
+ * second register covers cores 16-23 (normal) or 8-11 (fused).
+ */
+static bool pnv_xive_is_cpu_enabled(PnvXive *xive, PowerPCCPU *cpu)
+{
+    int pir = ppc_cpu_pir(cpu);
+    uint32_t fc = PNV9_PIR2FUSEDCORE(pir);
+    uint64_t reg = fc < 8 ? PC_THREAD_EN_REG0 : PC_THREAD_EN_REG1;
+    uint32_t bit = pir & 0x3f;
+
+    return xive->regs[reg >> 3] & PPC_BIT(bit);
+}
+
 static int pnv_xive_match_nvt(XivePresenter *xptr, uint8_t format,
                               uint8_t nvt_blk, uint32_t nvt_idx,
                               bool cam_ignore, uint8_t priority,
@@ -391,6 +406,10 @@ static int pnv_xive_match_nvt(XivePresenter *xptr, uint8_t format,
             XiveTCTX *tctx;
             int ring;
 
+            if (!pnv_xive_is_cpu_enabled(xive, cpu)) {
+                continue;
+            }
+
             tctx = XIVE_TCTX(pnv_cpu_state(cpu)->intc);
 
             /*
index 03cb429f2131f35c168ecba50ea1602991f2aee2..12b0169a40107dc24263efcf346fcb65511e500b 100644 (file)
@@ -99,6 +99,11 @@ typedef struct Pnv9Chip {
     PnvQuad      *quads;
 } Pnv9Chip;
 
+/*
+ * A SMT8 fused core is a pair of SMT4 cores.
+ */
+#define PNV9_PIR2FUSEDCORE(pir) (((pir) >> 3) & 0xf)
+
 typedef struct PnvChipClass {
     /*< private >*/
     SysBusDeviceClass parent_class;
This page took 0.031766 seconds and 4 git commands to generate.