aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Grimm <grimm@linux.ibm.com>2021-09-08 11:57:59 -0500
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2021-10-19 12:14:20 +0530
commit70bf92ae7e4fd9a114d25fa7b1f55151b5835e53 (patch)
treed37017f6a4dc0321d466ebfa33cef6571d73b55a
parentc496563de915cb00c6e99586568743ea890af2f2 (diff)
downloadskiboot-70bf92ae7e4fd9a114d25fa7b1f55151b5835e53.zip
skiboot-70bf92ae7e4fd9a114d25fa7b1f55151b5835e53.tar.gz
skiboot-70bf92ae7e4fd9a114d25fa7b1f55151b5835e53.tar.bz2
AWAN simulator support for P10
This patch enables Skiboot to initialize and Linux to boot to user space on the AWAN core and chip models. We need the distinction between core and chip models because the core models do not have an XSCOM unit, CHIPTOD, nor RNG. The chip model does have them and they work. So, add a device_type property to the awan node to distinguish core from chip. Sample DTS are provided for the core and chip models in external/awan. Just like Mambo, we need to return in slw_init before trying to initialize SLW. Without an XSCOM unit in the device tree for the core model, the SLW code path eventually fails an assert due to lack of chips. This commit defines a QUIRK_AWAN where previously Mambo used QUIRK_MAMBO_CALLOUTS so now Mambo and AWAN core both work. Also, fix up chip quirks so the core model and chip model boot and initialize the appropriate units. Disable sreset and power management in a couple spots because the chip model does not support stop with EC=1 and enter_p9_pm_state spins in the branch-to-self after stop. Provide an external/awan/README.md with a high-level view of booting in the environment. Signed-off-by: Ryan Grimm <grimm@linux.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
-rw-r--r--core/chip.c17
-rw-r--r--core/cpu.c5
-rw-r--r--core/init.c2
-rw-r--r--external/awan/README.md34
-rw-r--r--external/awan/p10_chip_2ex_smt4.dts135
-rw-r--r--external/awan/p10_core_1ex_smt4.dts69
-rw-r--r--hw/slw.c7
-rw-r--r--include/chip.h1
8 files changed, 262 insertions, 8 deletions
diff --git a/core/chip.c b/core/chip.c
index 2d95b2e..6fc5d42 100644
--- a/core/chip.c
+++ b/core/chip.c
@@ -166,11 +166,20 @@ void init_chips(void)
prlog(PR_NOTICE, "CHIP: Detected Simics simulator\n");
}
/* Detect Awan emulator */
- if (dt_find_by_path(dt_root, "/awan")) {
- proc_chip_quirks |= QUIRK_NO_CHIPTOD | QUIRK_NO_F000F
- | QUIRK_NO_PBA | QUIRK_NO_OCC_IRQ | QUIRK_SLOW_SIM;
+ xn = dt_find_by_path(dt_root, "/awan");
+ if (xn) {
+ const char *model_type;
+ proc_chip_quirks |= QUIRK_AWAN | QUIRK_SLOW_SIM | QUIRK_NO_PBA
+ | QUIRK_NO_OCC_IRQ;
tb_hz = 512000;
- prlog(PR_NOTICE, "CHIP: Detected Awan emulator\n");
+
+ model_type = dt_prop_get_def(xn, "device_type", (void *)"core");
+ if (strcmp(model_type, "core") == 0) {
+ proc_chip_quirks |= QUIRK_NO_RNG | QUIRK_NO_CHIPTOD
+ | QUIRK_NO_F000F;
+ }
+ prlog(PR_NOTICE, "CHIP: Detected Awan emulator %s model\n",
+ model_type);
}
/* Detect Qemu */
if (dt_node_is_compatible(dt_root, "qemu,powernv") ||
diff --git a/core/cpu.c b/core/cpu.c
index d11d7f9..6f37358 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -637,6 +637,9 @@ static void cpu_pm_disable(void)
void cpu_set_sreset_enable(bool enabled)
{
+ if (proc_chip_quirks & QUIRK_AWAN)
+ return;
+
if (sreset_enabled == enabled)
return;
@@ -688,7 +691,7 @@ void cpu_set_ipi_enable(bool enabled)
sync();
if (!enabled)
cpu_pm_disable();
- else
+ else if (!chip_quirk(QUIRK_AWAN))
pm_enabled = true;
}
}
diff --git a/core/init.c b/core/init.c
index 235f905..0247a0a 100644
--- a/core/init.c
+++ b/core/init.c
@@ -999,7 +999,7 @@ static void mask_pc_system_xstop(void)
if (proc_gen != proc_gen_p10)
return;
- if (chip_quirk(QUIRK_MAMBO_CALLOUTS))
+ if (chip_quirk(QUIRK_MAMBO_CALLOUTS) || chip_quirk(QUIRK_AWAN))
return;
/*
diff --git a/external/awan/README.md b/external/awan/README.md
new file mode 100644
index 0000000..d625b5a
--- /dev/null
+++ b/external/awan/README.md
@@ -0,0 +1,34 @@
+# Running skiboot and Linux in AWAN
+
+AWAN is a hardware accelerator composed of programmable gate arrays that can
+emulate a POWER logic core. The AWAN environment can be used to run hardware
+procedures or test binaries on the logic, before hardware is available or when
+hardware is scarce.
+
+The AWAN environment is slow compared to Mambo and QEMU. Each timebase tick is
+equivalent to 8 simclocks, and simclock is slow. For example, on the core
+model we get through Skiboot in about 6 million simclock cycles and that takes
+approximately 1 minute wall-clock time to complete.
+
+# Getting started
+
+To run in AWAN, you need a an initial checkpoint, a loader, and a method to
+read memory.
+
+The high-level sequence for running in AWAN is:
+
+1. Load an initial checkpoint provided by the person that built the model
+
+2. Load a stripped vmlinux at 0
+
+3. Load an initramfs at 0x28200000
+
+4. Load skiboot.lid at 0x30000000
+
+5. Load a small piece of start code at 0x100 that tells skiboot where to find
+ the device tree blob
+
+6. Load a compiled device tree blob at 0x1f00000
+
+7. Run "simclock 5000000" and check the console buffer for the Skiboot log
+ by reading memory at 784MB.
diff --git a/external/awan/p10_chip_2ex_smt4.dts b/external/awan/p10_chip_2ex_smt4.dts
new file mode 100644
index 0000000..61d474d
--- /dev/null
+++ b/external/awan/p10_chip_2ex_smt4.dts
@@ -0,0 +1,135 @@
+/dts-v1/;
+
+/ {
+ compatible = "ibm,powernv";
+ model = "BML";
+ #size-cells = <0x2>;
+ #address-cells = <0x2>;
+
+ reserved-names = "ibm,fake-nvram";
+ reserved-ranges = <0x0 0x28100000 0x0 0x100000>;
+
+ chosen {
+ kernel-base-address = <0x00 0x00>;
+ linux,initrd-start = <0x28200000>;
+ linux,initrd-end = <0x28200800>;
+ };
+
+ awan {
+ device_type = "chip";
+ };
+
+ memory@0 {
+ reg = <0x0 0x0 0x0 0x80000000>;
+ ibm,chip-id = <0x0>;
+ device_type = "memory";
+ };
+
+ cpus {
+ #address-cells = <0x01>;
+ #size-cells = <0x00>;
+
+ PowerPC,POWER10@18 {
+ name = "PowerPC,POWER10";
+ device_type = "cpu";
+ status = "okay";
+ ibm,chip-id = <0x00>;
+ ibm,pir = <0x18>;
+ reg = <0x18>;
+ timebase-frequency = <512000000>;
+ clock-frequency = <3250000000>;
+ ibm,segment-page-sizes = <0x0c 0x00 0x3 0xc 0x0 0x10 0x7 0x18 0x38 0x10 0x110 0x2 0x10 0x1 0x18 0x08 0x18 0x100 0x1 0x18 0x00 0x22 0x120 0x1 0x22 0x03>;
+ ibm,processor-segment-sizes = <0x0000001c 0x28 0xffffffff 0xffffffff>;
+ ibm,vmx = <0x2>;
+ i-cache-size = <0x8000>;
+ d-cache-size = <0x8000>;
+ i-cache-line-size = <0x80>;
+ d-cache-line-size = <0x80>;
+ ibm,slb-size = <0x20>;
+ ibm,ppc-interrupt-server#s = <0x18 0x19 0x1a 0x1b>;
+ ibm,pa-features = <0x4000f63f 0xc7c080d0 0x80000000 0x00000000 0x00008000 0x80008000 0x00008000 0x80008000 0x00008000 0x80000000 0x80008000 0x80008000 0x80008000 0x80008000 0x80008000 0x80000000 0x80000000 0x00000000>;
+ ibm,processor-radix-AP-encodings = <0x0000000c 0xa0000010 0x20000015 0x4000001e>;
+ ibm,dfp = <0x2>;
+ };
+
+ PowerPC,POWER10@1c {
+ name = "PowerPC,POWER10";
+ device_type = "cpu";
+ status = "okay";
+ ibm,chip-id = <0x00>;
+ ibm,pir = <0x1c>;
+ reg = <0x1c>;
+ timebase-frequency = <512000000>;
+ clock-frequency = <3250000000>;
+ ibm,segment-page-sizes = <0x0c 0x00 0x3 0xc 0x0 0x10 0x7 0x18 0x38 0x10 0x110 0x2 0x10 0x1 0x18 0x08 0x18 0x100 0x1 0x18 0x00 0x22 0x120 0x1 0x22 0x03>;
+ ibm,processor-segment-sizes = <0x0000001c 0x28 0xffffffff 0xffffffff>;
+ ibm,vmx = <0x2>;
+ i-cache-size = <0x8000>;
+ d-cache-size = <0x8000>;
+ i-cache-line-size = <0x80>;
+ d-cache-line-size = <0x80>;
+ ibm,slb-size = <0x20>;
+ ibm,ppc-interrupt-server#s = <0x1c 0x1d 0x1e 0x1f>;
+ ibm,pa-features = <0x4000f63f 0xc7c080d0 0x80000000 0x00000000 0x00008000 0x80008000 0x00008000 0x80008000 0x00008000 0x80000000 0x80008000 0x80008000 0x80008000 0x80008000 0x80008000 0x80000000 0x80000000 0x00000000>;
+ ibm,processor-radix-AP-encodings = <0x0000000c 0xa0000010 0x20000015 0x4000001e>;
+ ibm,dfp = <0x2>;
+ };
+ };
+
+ xscom@e03fc00000000 {
+ compatible = "ibm,xscom", "ibm,power10-xscom";
+ ibm,chip-id = <0x0>;
+ #size-cells = <1>;
+ #address-cells = <1>;
+ reg = <0xe03fc 0x00000000 0x8 0x0>;
+
+ ibm,primary-topology-index = <0x0>;
+
+ chiptod@40000 {
+ primary;
+ reg = <0x40000 0x34>;
+ compatible = "ibm,power-chiptod", "ibm,power10-chiptod";
+ };
+
+ xive@2010800 {
+ compatible = "ibm,power10-xive-x";
+ reg = < 0x2010800 0x400 >;
+ force-assign-bars;
+ };
+
+ psihb@3011d00 {
+ compatible = "ibm,power10-psihb-x", ibm,psihb-x";
+ #size-cells = < 0x01 >;
+ #address-cells = < 0x02 >;
+ reg = < 0x3011d00 0x100 >;
+ };
+
+ nx@2010000 {
+ reg = <0x2010000 0x4000>;
+ compatible = "ibm,power9-nx";
+ };
+
+ vas@2011400 {
+ reg = <0x2011400 0x300>;
+ compatible = "ibm,power9-vas-x", "ibm,power10-vas-x";
+ ibm,vas-id = < 0x0 >;
+ };
+
+ nmmu@2010c40 {
+ reg = <0x2010c40 0x20>;
+ compatible = "ibm,power9-nest-mmu";
+ };
+
+ nmmu@3010c40 {
+ reg = <0x3010c40 0x20>;
+ compatible = "ibm,power9-nest-mmu";
+ };
+ };
+
+ ibm,opal {
+ power-mgt {
+ ibm,enabled-stop-levels = <0x0>;
+ };
+ };
+
+};
diff --git a/external/awan/p10_core_1ex_smt4.dts b/external/awan/p10_core_1ex_smt4.dts
new file mode 100644
index 0000000..1794ae9
--- /dev/null
+++ b/external/awan/p10_core_1ex_smt4.dts
@@ -0,0 +1,69 @@
+/dts-v1/;
+
+/ {
+ compatible = "ibm,powernv";
+ model = "BML";
+ #size-cells = <0x2>;
+ #address-cells = <0x2>;
+
+ reserved-names = "ibm,fake-nvram";
+ reserved-ranges = <0x0 0x28100000 0x0 0x100000>;
+
+ chosen {
+ kernel-base-address = <0x00 0x00>;
+ linux,initrd-start = <0x28200000>;
+ linux,initrd-end = <0x28200800>;
+ linux,stdout-path = "/chosen/stdout";
+ };
+
+ awan {
+ device_type = "core";
+ };
+
+ memory@0 {
+ reg = <0x0 0x0 0x0 0x80000000>;
+ ibm,chip-id = <0x0>;
+ device_type = "memory";
+ };
+
+ cpus {
+ #address-cells = <0x01>;
+ #size-cells = <0x00>;
+
+ PowerPC,POWER10@0 {
+ name = "PowerPC,POWER10";
+ device_type = "cpu";
+ status = "okay";
+ ibm,chip-id = <0x0>;
+ ibm,pir = <0x0>;
+ reg = <0x0>;
+ timebase-frequency = <512000000>;
+ clock-frequency = <3400000000>;
+ ibm,segment-page-sizes = <0x0c 0x00 0x3 0xc 0x0 0x10 0x7 0x18 0x38 0x10 0x110 0x2 0x10 0x1 0x18 0x08 0x18 0x100 0x1 0x18 0x00 0x22 0x120 0x1 0x22 0x03>;
+ ibm,processor-segment-sizes = <0x0000001c 0x28 0xffffffff 0xffffffff>;
+ ibm,vmx = <0x2>;
+ i-cache-size = <0x8000>;
+ d-cache-size = <0x8000>;
+ i-cache-line-size = <0x80>;
+ d-cache-line-size = <0x80>;
+ ibm,slb-size = <0x20>;
+ ibm,ppc-interrupt-server#s = <0x0 0x1 0x2 0x3>;
+ ibm,pa-features = <0x4000f63f 0xc7c080d0 0x80000000 0x00000000 0x00008000 0x80008000 0x00008000 0x80008000 0x00008000 0x80000000 0x80008000 0x80008000 0x80008000 0x80008000 0x80008000 0x80000000 0x80000000 0x00000000>;
+ ibm,processor-radix-AP-encodings = <0x0000000c 0xa0000010 0x20000015 0x4000001e>;
+ ibm,dfp = <0x2>;
+ };
+ };
+
+ pmem {
+ #address-cells = <0x2>;
+ #size-cells = <0x2>;
+ ranges;
+
+ pmem@80000000 {
+ reg = <0x0 0x80000000 0x0 0x8000000>;
+ ibm,chip-id = <0x00>;
+ compatible = "pmem-region";
+ volatile;
+ };
+ };
+};
diff --git a/hw/slw.c b/hw/slw.c
index 178ee4f..eb67998 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -1372,11 +1372,14 @@ void slw_init(void)
{
struct proc_chip *chip;
- if (proc_chip_quirks & QUIRK_MAMBO_CALLOUTS) {
- wakeup_engine_state = WAKEUP_ENGINE_NOT_PRESENT;
+ wakeup_engine_state = WAKEUP_ENGINE_NOT_PRESENT;
+ if (chip_quirk(QUIRK_AWAN))
+ return;
+ if (chip_quirk(QUIRK_MAMBO_CALLOUTS)) {
add_cpu_idle_state_properties();
return;
}
+
if (proc_gen == proc_gen_p8) {
for_each_chip(chip) {
slw_init_chip_p8(chip);
diff --git a/include/chip.h b/include/chip.h
index bbfc65e..cfa5ce3 100644
--- a/include/chip.h
+++ b/include/chip.h
@@ -186,6 +186,7 @@ enum proc_chip_quirks {
QUIRK_NO_DIRECT_CTL = 0x00000080,
QUIRK_NO_RNG = 0x00000100,
QUIRK_QEMU = 0x00000200,
+ QUIRK_AWAN = 0x00000400,
};
extern enum proc_chip_quirks proc_chip_quirks;