aboutsummaryrefslogtreecommitdiff
path: root/external/mambo
AgeCommit message (Collapse)AuthorFilesLines
2022-09-20external/mambo: add a poor man's ftrace commandNicholas Piggin1-0/+26
Add an ftrace command that steps instructions and prints the symbol whenever it changes. This can be helpful for low level debugging. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
2022-08-23mambo: print useful error when mysim mmap failsRyan Grimm1-2/+2
My user id didn't have access to disk.img and the code printed the error message: ERROR: pmem: 'mysim mmap' command needs newer mambo mysim mmap has been in Mambo for a while so this patch prints out the error message from catch. Now we get the useful: ERROR: pmem: 'mysim mmap' Error opening file disk.img for mapping Signed-off-by: Ryan Grimm <grimm@linux.ibm.com> Reviewed-by: Dan Horák <dan@danny.cz> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
2022-08-03mambo: Fix backtrace when trace mixes endian codeRyan Grimm1-0/+7
In the case of LE kernel and BE skiboot, the bt functions triggers an illegal address when the kernel has a stack pointer in skiboot. For example, in copy_and_flush: pc: 0x000000000000C25C +0x000000000000C25C lr: 0x000000000000C240 +0x000000000000C240 stack:0x0000000031C13D20 0x8428023000000000 +0x8428023000000000 Illegal Address 0x001EC13100000007 The bad address is from mem_display_64 and is fixed up by inverting the LE bit: systemsim % mem_display_64 [ expr 0x0000000031C13D20 ] 1 0x103EC13100000000 systemsim % mem_display_64 [ expr 0x0000000031C13D20 ] 0 0x0000000031C13E10 This patch tests the pointer by catching the illegal access and inverting the LE bit. Now the stack trace looks good: pc: 0x000000000000C254 +0x000000000000C254 lr: 0x000000000000C240 +0x000000000000C240 stack:0x0000000031C13D20 0x0000000030022884 .load_and_boot_kernel+0xc6c stack:0x0000000031C13E10 0x0000000030023344 .main_cpu_entry+0x8bc Opal calls also look good too now: pc: 0x0000000030028588 .cpu_idle_delay+0xb8 lr: 0x000000003002856C .cpu_idle_delay+0x9c stack:0x0000000031C13A10 0x0000000030028514 .cpu_idle_delay+0x44 stack:0x0000000031C13AB0 0x000000003002D6C0 .time_wait_nopoll+0x34 stack:0x0000000031C13B20 0x000000003002D77C .time_wait+0xa8 stack:0x0000000031C13BA0 0x000000003002821C .cpu_wait_job+0x3c stack:0x0000000031C13C40 0x0000000030029554 .opal_reinit_cpus+0x3c0 stack:0x0000000031C13D10 0x00000000300038AC opal_entry+0x14c stack:0x000000000071FDA0 0xC0000000000537B0 opal_call+0x40 stack:0x000000000071FE60 0xC00000000005450C opal_reinit_cpus+0x20 stack:0x000000000071FED0 0xC00000000065FDAC opal_configure_cores+0x48 stack:0x000000000071FF00 0xC000000000656554 early_setup+0x134 Signed-off-by: Ryan Grimm <grimm@linux.ibm.com> Reviewed-by: Dan Horák <dan@danny.cz> Acked-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
2022-02-04external/mambo: Handle greater than 16 CPUsMichael Neuling1-1/+4
In OF mambo pads zeros in the CPU node names. So if you have more than 16 CPUs, the first core will be at /cpus/PowerPC@00. Currently we always look for /cpus/PowerPC@0. Fix by zero padding based on the max CPU count. This also converts to hex since that's what's actually needed. This fix should handle any topology. I've tested upto 128 threads (16 cores * 8 threads) but past that the mambo I have starts throwing internal errors. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Cédric Le Goater <clg@kaod.org>
2021-11-10hdata: add mmu-pid-bits and mmu-lpid-bits for POWER10 CPUsNicholas Piggin1-0/+5
This adds ibm,mmu-pid-bits and a new ibm,mmu-lpid-bits to POWER10 CPUs. POWER9 Linux has some workarounds for processors bugs that means it's probably safer to not add the entries there. Linux already hard codes these values correctly on these processors, but this allows more flexibility to change things. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
2021-10-02external/mambo: Add POWER10 small-core modeNicholas Piggin1-4/+21
If the SMT configuration is not 8, set small-core mode in SIM_CTRL1 and PVR registers. Also allow only 1, 2, 4, or 8 threads, and only allow 1 and 2 threads if there is only one processor configured. This helps avoid strange crashes due to thread/core enumeration problems with unexpected threads per core. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
2021-10-02external/mambo: Updates POWER9 SIM_CTRL1 to remove hardware atomic RCNicholas Piggin1-1/+4
Update SIM_CTRL1 bits to set ARC0/1, which disables atomic RC updates in hardware which matches implementation. Comment some remaining quirks with the P9 configuration. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
2021-10-02external/mambo: Updates for POWER10 configuration for DD2.0Nicholas Piggin1-3/+15
Update PVR and mambo f000f bits: - Set POWER10 to DD2.0 Update SIM_CTRL and SIM_CTRL1 bits: - Set the LPAR-per-core mode bit. This is required for SMT KVM to work. - Set ARC0/ARC1 bits which enable atomic RC update interrupts (not hardware updates), which matches implementation. - Enable DEXCR, HAIL, ROP, BHRB disable, block BHRB writes in PR=0, and RFC02628 on POWER10. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
2021-09-09external/mambo: Print more info when the kernel is too bigMichael Ellerman1-2/+4
Make it a bit easier to boot large kernels by printing more info when the kernel is too big, so the user has some idea how much they need to adjust PAYLOAD_ADDR by. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
2021-08-06external/mambo: skiboot.tcl add POWER10 configNicholas Piggin1-7/+27
Co-authored-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Co-authored-by: Madhavan Srinivasan <maddy@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Co-authored-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> [Folded Maddy's IMC changes and Ravi's DAWR changes - Vasant] Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
2020-11-27external/mambo: 4 byte align chained CPIOsMichael Neuling1-1/+2
Linux requires chained CPIOs to be 4 byte aligned otherwise they are ignored. This aligns them. Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Dan Horák <dan@danny.cz> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
2020-09-30external/mambo: Disable MEMORY_OVERFLOWMichael Ellerman1-0/+1
Mambo has a strange feature called MEMORY_OVERFLOW, enabled by default, which causes some accesses to non-existent memory addresses to transparently "create" memory. This can be confusing when debugging, eg: systemsim % mysim cpu 0 display spr pc 0xC0000000000246B8 systemsim % mysim memory display 0xC0000000000246B8 8 0x0000000000000000 Appears to show that the memory at pc (NIP) is currently zeroes. The astute observer will note that "mysim memory display" takes physical addresses, not effective addresses. So unless this machine has > 12XB of RAM, this access should have failed as there is no memory at that address. Turning MEMORY_OVERFLOW off gives us a much more sensible result: systemsim % mysim memory display 0xC0000000000246B8 8 Illegal Address 0xC0000000000246B8 It doesn't appear to have any effect on accesses done from Linux, with the setting enabled or disabled we still get a machine check for bad accesses in real mode: 0:mon> p $__mmu_off return value is 0x9000000030001003 0:mon> d c008000000000000 c008000000000000 [15447.242793] Disabling lock debugging due to kernel taint [15447.242824] MCE: CPU0: machine check (Severe) Host Real address Load/Store (foreign) [Not recovered] [15447.242868] MCE: CPU0: NIP: [c000000000103090] mread+0x90/0x190 [15447.242897] MCE: CPU0: Initiator CPU [15447.242918] MCE: CPU0: Hardware error [15447.242939] opal: Hardware platform error: Unrecoverable Machine Check exception [15447.242978] CPU: 0 PID: 18 Comm: kopald Tainted: G M 5.7.0-gcc-8.2.0-13354-gd475a86526b5-dirty #127 [15447.243022] NIP: c000000000103090 LR: c000000000103034 CTR: c0000000000c2050 [15447.243059] REGS: c0000000fffbfd70 TRAP: 0200 Tainted: G M (5.7.0-gcc-8.2.0-13354-gd475a86526b5-dirty) [15447.243101] MSR: 9000000000201003 <SF,HV,ME,RI,LE> CR: 28002224 XER: 20040000 [15447.243150] CFAR: c000000000029660 DAR: c008000000000000 DSISR: 00000008 IRQMASK: 3 [15447.243150] GPR00: 0000000028002224 c0000000f05074c0 c000000001775e00 0000000000000000 [15447.243150] GPR04: c0000000f0507768 0000000000000010 0000000000000010 c0000000f0507768 [15447.243150] GPR08: 0007ffff0faf8899 0000000000000000 c0000000f0507767 9000000030001003 [15447.243150] GPR12: 0000000031c10000 c000000001970000 c0000000f0507738 0000000000000000 [15447.243150] GPR16: 000000000000002e 0000000000000010 000000000000002e 0000000000000010 [15447.243150] GPR20: c000000000e563d0 c000000000ffcf88 c000000000fddf30 c008000000000000 [15447.243150] GPR24: c0000000f0507767 c000000000ffc678 0000000000000040 c0000000f0507878 [15447.243150] GPR28: c0000000f0507768 c0000000f0507768 0000000000000010 0000000000000000 [15447.243485] NIP [c000000000103090] mread+0x90/0x190 [15447.243514] LR [c000000000103034] mread+0x34/0x190 [15447.243538] Call Trace: [15447.243559] [c0000000f05074c0] [c0000000f0507510] 0xc0000000f0507510 (unreliable) [15447.243602] [c0000000f0507510] [c000000000107b48] xmon_core+0xd18/0x3a10 [15447.243640] [c0000000f0507850] [c00000000010a870] xmon+0x30/0x80 [15447.243677] [c0000000f05079f0] [c0000000001050d4] sysrq_handle_xmon+0xc4/0xd0 [15447.243720] [c0000000f0507a20] [c000000000882954] __handle_sysrq+0xd4/0x220 [15447.243758] [c0000000f0507ac0] [c00000000089db68] __hvc_poll+0x268/0x4b0 [15447.243796] [c0000000f0507b60] [c00000000089e824] hvc_handle_interrupt+0x24/0x70 [15447.243838] [c0000000f0507b80] [c0000000001c2474] __handle_irq_event_percpu+0xb4/0x350 [15447.243880] [c0000000f0507c50] [c0000000001c2754] handle_irq_event_percpu+0x44/0xc0 [15447.243923] [c0000000f0507c90] [c0000000001c2844] handle_irq_event+0x74/0xc0 [15447.243965] [c0000000f0507cc0] [c0000000001c9770] handle_level_irq+0xe0/0x1c0 [15447.244006] [c0000000f0507cf0] [c0000000001c0a44] generic_handle_irq+0x54/0x80 [15447.244046] [c0000000f0507d10] [c0000000000ca050] opal_handle_events+0x130/0x150 [15447.244088] [c0000000f0507d60] [c0000000000c1e7c] kopald+0x9c/0x140 [15447.244124] [c0000000f0507db0] [c00000000016ea9c] kthread+0x19c/0x1b0 [15447.244161] [c0000000f0507e20] [c00000000000d1a8] ret_from_kernel_thread+0x5c/0x74 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-09-29external/mambo Update SIM_CTRL1Anton Blanchard1-1/+1
The configuration of SIM_CTRL1 doesn't match POWER9 in a number of ways, including missing vslv, vsrv, addex and xsmax*/xsmin*/xscmp* instructions. Signed-off-by: Anton Blanchard <anton@ozlabs.org> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-08-28external/mambo: Do not enable TM on P9 in ibm, pa-featuresJordan Niethe1-1/+1
Bytes 22-23 Bit 0 in ibm,pa-features indicate TM support. None of the pa_features_p9*[] in hdata/cpu-common.c set this bit so do not set it in the ibm,pa-features made for mambo either. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-03-12Re-license IBM written files as Apache 2.0 OR GPLv2+Stewart Smith5-5/+5
SPDX makes it a simpler diff. I have audited the commit history of each file to ensure that they are exclusively authored by IBM and thus we have the right to relicense. The motivation behind this is twofold: 1) We want to enable experiments with coreboot, which is GPLv2 licensed 2) An upcoming firmware component wants to incorporate code from skiboot and code from the Linux kernel, which is GPLv2 licensed. I have gone through the IBM internal way of gaining approval for this. The following files are not exclusively authored by IBM, so are *not* included in this update (I will be seeking approval from contributors): core/direct-controls.c core/flash.c core/pcie-slot.c external/common/arch_flash_unknown.c external/common/rules.mk external/gard/Makefile external/gard/rules.mk external/opal-prd/Makefile external/pflash/Makefile external/xscom-utils/Makefile hdata/vpd.c hw/dts.c hw/ipmi/ipmi-watchdog.c hw/phb4.c include/cpu.h include/phb4.h include/platform.h libflash/libffs.c libstb/mbedtls/sha512.c libstb/mbedtls/sha512.h platforms/astbmc/barreleye.c platforms/astbmc/garrison.c platforms/astbmc/mihawk.c platforms/astbmc/nicole.c platforms/astbmc/p8dnu.c platforms/astbmc/p8dtu.c platforms/astbmc/p9dsu.c platforms/astbmc/vesnin.c platforms/rhesus/ec/config.h platforms/rhesus/ec/gpio.h platforms/rhesus/gpio.c platforms/rhesus/rhesus.c platforms/astbmc/talos.c platforms/astbmc/romulus.c Signed-off-by: Stewart Smith <stewart@linux.ibm.com> [oliver: fixed up the drift] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-03-11external/mambo: rename env var PMEM_MODES to PMEM_MODEacsawdey1-2/+2
This patch just renames the env var to be non-plural to match PMEM_DISK. A related patch going in to mambo will make the actual mode used in mambo be called "private" instead of "cow" to reflect the fact that you're getting a private copy of the image file and that any data written to it will be lost when mambo exits. Unlike the old bogusdisk driver, there is no separate .cow file where the writes go. Signed-off-by: Aaron Sawdey <acsawdey@linux.ibm.com> Acked-by: Michael Neuling <mikey@neuling.org> [oliver: fixed whitespace damage on the patch] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-02-24external/mambo: support mambo COW mode for PMEM diskAaron Sawdey1-1/+12
I've added support in mambo's "memory mmap" command to have a "cow" mode which just uses MAP_PRIVATE instead of MAP_SHARED on the file so that writes to the memory region are not sent back to the file. This allows multiple mambo instances to share the same filesystem image. This is implemented by having a PMEM_MODES environment variable. If this is set, it is expected to contain a comma separated list of modes (rw or cow) for the list of files in PMEM_DISK. If there are fewer modes than files, the remaining files default to "rw". Signed-off-by: Aaron Sawdey <acsawdey@linux.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-01-29skiboot.tcl: Add chip-id to pmem device tree nodeAlistair Popple1-0/+1
Skiboot expects a chip-id to be associated with the pmem device tree node. Without one the following assertion is hit during boot: 1305405: (1305405): [ 0.001300406,3] *********************************************** 1316412: (1316412): [ 0.001306446,3] < assert failed at core/device.c:968 > 1319544: (1319544): [ 0.001316645,3] . 1322726: (1322726): [ 0.001319777,3] . 1325958: (1325958): [ 0.001322959,3] . 1329490: (1329490): [ 0.001326191,3] OO__) 1332972: (1332972): [ 0.001329723,3] <"__/ 1336404: (1336404): [ 0.001333205,3] ^ ^ 1612307: (1612307): [ 0.001581877,3] Fatal TRAP at 00000000300297f4 .dt_get_chip_id+0x28 MSR 9000000000021002 1618779: (1618779): [ 0.001612557,3] CFAR : 00000000300ce7b4 MSR : 9000000030001000 1625236: (1625236): [ 0.001619014,3] SRR0 : 00000000300297f4 SRR1 : 9000000000021002 1631693: (1631693): [ 0.001625471,3] HSRR0: 0000000030012624 HSRR1: 9000000030001000 1637745: (1637745): [ 0.001631928,3] DSISR: 00000000 DAR : 0000000000000000 1644023: (1644023): [ 0.001637980,3] LR : 00000000300297dc CTR : 0000000000000000 1649684: (1649684): [ 0.001644258,3] CR : 20000202 XER : 00040000 1656705: (1656705): [ 0.001649921,3] GPR00: 00000000300297dc GPR16: 0000000000000000 1663740: (1663740): [ 0.001656946,3] GPR01: 0000000031c13940 GPR17: 0000000000000000 1670775: (1670775): [ 0.001663981,3] GPR02: 0000000030127400 GPR18: 0000000000000000 1677810: (1677810): [ 0.001671016,3] GPR03: 00000000ffffffff GPR19: 0000000000000000 1684845: (1684845): [ 0.001678051,3] GPR04: 00000000300d0376 GPR20: 0000000000000000 1691796: (1691796): [ 0.001685086,3] GPR05: 000000000000000c GPR21: 0000000000000000 1698831: (1698831): [ 0.001692037,3] GPR06: 0000000031c10060 GPR22: 0000000000000000 1705960: (1705960): [ 0.001699072,3] GPR07: 0000000030500010 GPR23: 00000000300eca0c 1713089: (1713089): [ 0.001706201,3] GPR08: 0000000030502b48 GPR24: 00000000300cf2c8 1720124: (1720124): [ 0.001713330,3] GPR09: 0000000000000000 GPR25: 00000000300ce8d7 1727182: (1727182): [ 0.001720365,3] GPR10: 0000000000000063 GPR26: 00000000300ce8fb 1734228: (1734228): [ 0.001727423,3] GPR11: 0000000000000003 GPR27: 00000000300d0398 1741358: (1741358): [ 0.001734469,3] GPR12: 0000000040000402 GPR28: 00000000300ce91d 1748488: (1748488): [ 0.001741599,3] GPR13: 0000000031c10000 GPR29: 00000000300d048f 1755618: (1755618): [ 0.001748729,3] GPR14: 00000000300026fc GPR30: 0000000030502cb8 1762748: (1762748): [ 0.001755859,3] GPR15: 0000000030000000 GPR31: 0000000030502cb8 2414283: (2414283): CPU 0000 Backtrace: 2414283: (2414283): S: 0000000031c13c40 R: 00000000300297dc .dt_get_chip_id+0x10 2414283: (2414283): S: 0000000031c13cb0 R: 000000003002ab68 .add_chip_dev_associativity+0x14 2414283: (2414283): S: 0000000031c13d50 R: 0000000030017c00 .mem_region_init+0x144 2414283: (2414283): S: 0000000031c13e30 R: 00000000300153d0 .main_cpu_entry+0x4d4 2414283: (2414283): S: 0000000031c13f00 R: 000000003000275c boot_entry+0x1bc Signed-off-by: Alistair Popple <alistair@popple.id.au> Tested-by: Praveen K Pandey <praveen@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-11-27mambo: enable use of real Container Verification CodeStewart Smith3-1/+67
Make skiboot.tcl able to load and use a CVC blob from a real system. This code comes from the src/securerom/ code in Hostboot. we now use this in the sreset_world and hello_world test cases when we do a secure boot run of them Signed-off-by: Stewart Smith <stewart@linux.ibm.com> [oliver: folded cvc.bin into this patch, misc fixes] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-11-04mambo: Add more tweakable security flagsMichael Ellerman1-3/+26
This allows us to test various combinations of the Linux spectre/meltdown mitigations. The default values of the existing settings remain the same. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-07-26SPDX-ify all skiboot codeStewart Smith5-16/+16
Use Software Package Data Exchange (SPDX) to indicate license for each file that is unique to skiboot. At the same time, ensure the (C) who and years are correct. See https://spdx.org/ Signed-off-by: Stewart Smith <stewart@linux.ibm.com> [oliver: Added a few missing files] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-06-27external/mambo: Bump default POWER9 to Nimbus DD2.3Nicholas Piggin1-2/+2
Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-06-13external/mambo: fix tcl startup code for mambo bogus net (repost)Aaron Sawdey1-4/+6
Repost of the same thing with Signed-off-by, and Acked-by from Michael Neuling. This fixes a couple issues with external/mambo/skiboot.tcl so I can use the mambo bogus net. * newer distros (ubuntu 18.04) allow tap device to have a user specified name instead of just tapN so we need to pass in a name not a number. * need some kind of default for net_mac, and need the mconfig for it to be set from an env var. Thanks, Aaron Acked-by: Michael Neuling <mikey at neuling.org> Signed-off-by: Aaron Sawdey <sawdey at linux.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20skiboot.tcl: Add option to wait for GDB server connectionAlistair Popple1-0/+4
Add an environment variable which makes Mambo wait for a connection from gdb prior to starting simulation. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-15mambo: Integrate addr2line into backtrace commandMichael Neuling1-3/+6
Gives nice output like this: systemsim % bt pc: 0xC0000000002BF3D4 _savegpr0_28+0x0 lr: 0xC00000000004E0F4 opal_call+0x10 stack:0x000000000041FAE0 0xC00000000004F054 opal_check_token+0x20 stack:0x000000000041FB50 0xC0000000000500CC __opal_flush_console+0x88 stack:0x000000000041FBD0 0xC000000000050BF8 opal_flush_console+0x24 stack:0x000000000041FC00 0xC0000000001F9510 udbg_opal_putc+0x88 stack:0x000000000041FC40 0xC000000000020E78 udbg_write+0x7c stack:0x000000000041FC80 0xC0000000000B1C44 console_unlock+0x47c stack:0x000000000041FD80 0xC0000000000B2424 register_console+0x320 stack:0x000000000041FE10 0xC0000000003A5328 register_early_udbg_console+0x98 stack:0x000000000041FE80 0xC0000000003A4F14 setup_arch+0x68 stack:0x000000000041FEF0 0xC0000000003A0880 start_kernel+0x74 stack:0x000000000041FF90 0xC00000000000AC60 start_here_common+0x1c Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-15mambo: Add addr2func for symbol resolutionMichael Neuling2-2/+62
If you supply a VMLINUX_MAP/SKIBOOT_MAP/USER_MAP addr2func can guess at your symbol name. ie systemsim % p pc 0xC0000000002A68F8 systemsim % addr2func [p pc] fdt_offset_ptr+0x78 Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-15external/mambo: Add an option to exit Mambo when the system is shutdownAlistair Popple2-0/+9
Automatically exiting can be convenient for scripting. Will also exit due to a HW crash (eg. unhandled exception). Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [stewart: handle case where SKIBOOT_AUTORUN is not set] Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-04-17external/mambo: also invoke readline for the non-autorun caseNicholas Piggin1-0/+2
Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-04-09README: Reflect openpower_mambo_defconfig name changeReza Arbab1-1/+1
The name of this op-build config has changed. Use the new name. Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-03-28external/mambo: Mambo hack to add trace-imc nodes in the device-treeAnju T Sudhakar1-0/+21
Update skiboot.tcl device tree to include trace-imc node to help test the code path in mambo. Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-03-28external/mambo: Error out if kernel is too largeRussell Currey1-0/+4
If you're trying to boot a gigantic kernel in mambo (which you can reproduce by building a kernel with CONFIG_MODULES=n) you'll get misleading errors like: WARNING: 0: (0): [0:0]: Invalid/unsupported instr 0x00000000[INVALID] WARNING: 0: (0): PC(EA): 0x0000000030000010 PC(RA):0x0000000030000010 MSR: 0x9000000000000000 LR: 0x0000000000000000 WARNING: 0: (0): numInstructions = 0 WARNING: 1: (1): [0:0]: Invalid/unsupported instr 0x00000000[INVALID] WARNING: 1: (1): PC(EA): 0x0000000000000E40 PC(RA):0x0000000000000E40 MSR: 0x9000000000000000 LR: 0x0000000000000000 WARNING: 1: (1): numInstructions = 1 WARNING: 1: (1): Interrupt to 0x0000000000000E40 from 0x0000000000000E40 INFO: 1: (2): ** Execution stopped: Continuous Interrupt, Instruction caused exception, ** So add an error to skiboot.tcl to warn the user before this happens. Making PAYLOAD_ADDR further back is one way to do this but if there's a less gross way to generally work around this very niche problem, I can suggest that instead. Signed-off-by: Russell Currey <ruscur@russell.cc> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-03-28external/mambo: Populate kernel-base-address in the DTRussell Currey1-1/+4
skiboot.tcl defines PAYLOAD_ADDR as 0x20000000, which is the default in skiboot. This is also the default in skiboot unless kernel-base-address is set in the device tree. If you change PAYLOAD_ADDR to something else for mambo, skiboot won't see it because it doesn't set that DT property, so fix it so that it does. Signed-off-by: Russell Currey <ruscur@russell.cc> Acked-by: Michael Neuling <mikey@neuling.org> [stewart: fix up mambo hacks for STB] Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-02-12external/mambo: allow CPU targeting for most debug utilsNicholas Piggin1-97/+229
Debug util functions target CPU 0:0:0 by default Some can be overidden explicitly per invocation, and others can't at all. Even for those that can be overidden, it is a pain to type them out when you're debugging a particular thread. Provide a new 'target' function that allows the default CPU target to be changed. Wire that up that default to all other utils. Provide a new 'S' step command which only steps the target CPU. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-10-23external/mambo: Check for qtrace_utils.tcl before sourcing itMadhavan Srinivasan1-1/+3
Commit cb835dbdf875 ('external/mambo: conditionally source qtrace script') added qtrace_utils.tcl sourcing in skiboot.tcl without a check to see whether it exists in the current directory. This broke running mambo from another directory using skiboot.tcl. Patch adds a check. Fixes: cb835dbdf875 ('external/mambo: conditionally source qtrace script') Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-09-20mambo: Merge PMEM_DISK and PMEM_VOLATILE codeMichael Neuling1-46/+31
PMEM_VOLATILE and PMEM_DISK can't be used together and are basically copies of the same code. This merges the two and allows them used together. Same API is kept. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-08-15don't fail fatally if qtrace can't be loadedStewart Smith1-1/+3
Helps with p9 public mambo on fedora at least Fixes: cb835dbdf8758b1fb0cae0ef2f93b324d1c4c96e Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-08-13external/mambo: conditionally source qtrace scriptNicholas Piggin2-7/+10
This automatically gives qtrace commads if the simulator provides the capability. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-06-27pmem: volatile bindings for the poorly enabledBalbir singh1-0/+26
PMEM_DISK bindings were added, but they rely on a rather recent mmap feature. This patch steals from those bindings to add volatile bindings. I've used these bindings with PMEM_VOLATILE to launch an instance with the publicly available systemsim-p9. The bindings are volatile and one should not expect any data to be saved/retrieved. Signed-off-by: Balbir singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-24external/mambo: Add support for readline if it existsBalbir Singh1-1/+14
Add support for tclreadline package if it is present. This patch loads the package and uses it when the simulation stops for any reason. Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-09mambo: Enable XER CA32 and OV32 bits on P9Anton Blanchard1-1/+1
POWER9 adds 32 bit carry and overflow bits to the XER, but we need to set the relevant CTRL1 bit to enable them. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-05-02external/mambo: simplify implementation of diBalbir singh1-9/+3
We've got a great disassembly function built-in, reuse that to implement di (as in xmon). Improves 1bcd6d84: (external/mambo: Add di command to decode instructions) Signed-off-by: Balbir singh <bsingharora@gmail.com> Acked-By: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-29mambo: Add persistent memory disk supportMichael Neuling1-0/+29
This adds support to for mapping disks images using persistent memory. Disks can be added by setting this ENV variable: PMEM_DISK="/mydisks/disk1.img,/mydisks/disk2.img" These will show up in Linux as /dev/pmem0 and /dev/pmem1. This uses a new feature in mambo "mysim memory mmap .." which is only available since mambo commit 0131f0fc08 (from 24/4/2018). This also needs the of_pmem.c driver in Linux which is only available since v4.17. It works with powernv_defconfig + CONFIG_OF_PMEM. ie --- a/arch/powerpc/configs/powernv_defconfig +++ b/arch/powerpc/configs/powernv_defconfig @@ -238,6 +238,8 @@ CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_GENERIC=y CONFIG_VIRTIO_PCI=m CONFIG_VIRTIO_BALLOON=m +CONFIG_LIBNVDIMM=y +# CONFIG_ND_BLK is not set CONFIG_EXT2_FS=y CONFIG_EXT2_FS_XATTR=y CONFIG_EXT2_FS_POSIX_ACL=y Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-24external/mambo: Add di command to decode instructionsMichael Neuling1-0/+11
By default you get 16 instructions but you can specify the number you want. ie systemsim % di 0x100 4 0x0000000000000100: Enc:0xA64BB17D : mtspr HSPRG1,r13 0x0000000000000104: Enc:0xA64AB07D : mfspr r13,HSPRG0 0x0000000000000108: Enc:0xF0092DF9 : std r9,0x9F0(r13) 0x000000000000010C: Enc:0xA6E2207D : mfspr r9,PPR Using di since it's what xmon uses. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-19mambo/mambo_utils.tcl: Inject an MCE at a specified addressBalbir Singh1-1/+15
Currently we don't support injecting an MCE on a specific address. This is useful for testing functionality like memcpy_mcsafe() (see https://patchwork.ozlabs.org/cover/893339/) The core of the functionality is a routine called inject_mce_ue_on_addr, which takes an addr argument and injects an MCE (load/store with UE) when the specified address is accessed by code. This functionality can easily be enhanced to cover instruction UE's as well. A sample use case to create an MCE on stack access would be set addr [mysim display gpr 1] inject_mce_ue_on_addr $addr This would cause an mce on any r1 or r1 based access Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-04-19external/mambo: improve helper for machine checksNicholas Piggin1-9/+53
Improve workarounds for stop injection, because mambo often will trigger on 0x104/204 when injecting sreset/mces. This also adds a workaround to skip injecting on reservations to avoid infinite loops when doing inject_mce_step. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Acked-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2018-02-28mambo: Add fw-feature flags for security related settingsMichael Ellerman1-1/+22
Newer firmwares report some feature flags related to security settings via HDAT. On real hardware skiboot translates these into device tree properties. For testing purposes just create the properties manually in the tcl. These values don't exactly match any actual chip revision, but the code should not rely on any exact set of values anyway. We just define the most interesting flags, that if toggled to "disable" will change Linux behaviour. You can see the actual values in the hostboot source in src/usr/hdat/hdatiplparms.H. Also add an environment variable for easily toggling the top-level "security on" setting. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-20Mambo: run hello_world and sreset_world tests with Secure and Trusted BootStewart Smith1-1/+1
We *disable* the secure boot part, but we keep the verified boot part as we don't currently have container verification code for Mambo. We can run a small part of the code currently though. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-30mambo: Add support for NUMAMichael Ellerman1-0/+25
Currently the mambo scripts can do multiple chips, but only the first ever has memory. This patch adds support for having memory on each chip, with each appearing as a separate NUMA node. Each node gets MEM_SIZE worth of memory. It's opt-in, via export MAMBO_NUMA=1. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-29mambo: split qtrace macros out into qtrace_utils.tclStewart Smith2-11/+10
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-11-28external/mambo: Switch qtrace command to use pluginsNicholas Piggin1-26/+7
The plugin seems to be the preferred way to do this now, it works better, and the qtracer emitter seems to generate invalid traces in new mambo versions. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>