From e9b4d5447b08fe37633990a984bbccf638de5ed2 Mon Sep 17 00:00:00 2001
From: Joel Stanley <joel@jms.id.au>
Date: Thu, 1 Aug 2019 14:42:01 +0930
Subject: [PATCH] TESTING: mark every second core as guarded

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 hw/ppc/pnv.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index bd4531c82260..e1e057bbe40f 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -123,7 +123,7 @@ static int get_cpus_node(void *fdt)
  * device tree, used in XSCOM to address cores and in interrupt
  * servers.
  */
-static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt)
+static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt, bool bad)
 {
     PowerPCCPU *cpu = pc->threads[0];
     CPUState *cs = CPU(cpu);
@@ -185,7 +185,10 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt)
     _FDT((fdt_setprop_cell(fdt, offset, "timebase-frequency", tbfreq)));
     _FDT((fdt_setprop_cell(fdt, offset, "clock-frequency", cpufreq)));
     _FDT((fdt_setprop_cell(fdt, offset, "ibm,slb-size", cpu->hash64_opts->slb_size)));
-    _FDT((fdt_setprop_string(fdt, offset, "status", "okay")));
+    if (bad)
+        _FDT((fdt_setprop_string(fdt, offset, "status", "bad")));
+    else
+        _FDT((fdt_setprop_string(fdt, offset, "status", "okay")));
     _FDT((fdt_setprop(fdt, offset, "64-bit", NULL, 0)));
 
     if (env->spr_cb[SPR_PURR].oea_read) {
@@ -280,7 +283,7 @@ static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt)
     for (i = 0; i < chip->nr_cores; i++) {
         PnvCore *pnv_core = PNV_CORE(chip->cores + i * typesize);
 
-        pnv_dt_core(chip, pnv_core, fdt);
+        pnv_dt_core(chip, pnv_core, fdt, i % 2);
 
         /* Interrupt Control Presenters (ICP). One per core. */
         pnv_dt_icp(chip, fdt, pnv_core->pir, CPU_CORE(pnv_core)->nr_threads);
@@ -302,7 +305,7 @@ static void pnv_chip_power9_dt_populate(PnvChip *chip, void *fdt)
     for (i = 0; i < chip->nr_cores; i++) {
         PnvCore *pnv_core = PNV_CORE(chip->cores + i * typesize);
 
-        pnv_dt_core(chip, pnv_core, fdt);
+        pnv_dt_core(chip, pnv_core, fdt, i % 2);
     }
 
     if (chip->ram_size) {
-- 
2.20.1

