aboutsummaryrefslogtreecommitdiff
path: root/external
AgeCommit message (Collapse)AuthorFilesLines
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-10-21external/pci-scripts: Add PHB error parsing scriptOliver O'Halloran2-0/+686
A very hacky, but very useful script that parses the PowerNV EEH register dump from the kernel log, and the verbose EEH dump from the opal message log and renders it into something mostly readable. Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-10-15opal-prd: handle devtmpfs mounted with noexecGeorgy Yakovlev1-2/+34
On systems using recent versions of systemd /dev (devtmpfs) is mounted with noexec option. Such mount prevents mapping HBRT image code region as RWX from /dev. This commit, as suggested in github PR linked below, attempts to work around the situation by copying HBRT image to anon mmaped memory region and sets mprotect rwx on it, allowing opal-prd to sucessfully execute the code region. Having memory region set as RWX is not ideal for security, but fixing that is a separate and hard to solve problem. Original code also mmaped region as RWX, so this PR does not make things worse at least. Closes: https://github.com/open-power/skiboot/issues/258 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> [oliver: whitespace fix, add a comment, reflow commit message] Signed-off-by: Oliver O'Halloran <oohall@gmail.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-30opal-prd: Have a worker process handle page offliningOliver O'Halloran1-19/+64
The memory_error() hservice interface expects the memory_error() call to just accept the offline request and return without actually offlining the memory. Currently we will attempt to offline the marked pages before returning to HBRT which can result in an excessively long time spent in the memory_error() hservice call which blocks HBRT from processing other errors. Fix this by adding a worker process which performs the page offlining via the sysfs memory error interfaces. Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> 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-08-28external/ffspart: define $(sbindir) for MakefileDan Horák1-0/+3
Right now the $(sbindir) variable isn't defined, so the binary gets installed directly into $(DESTDIR). Signed-off-by: Dan Horák <dan@danny.cz> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-06-17test: Add an external-check targetOliver O'Halloran1-1/+3
To go along with core-check and friends. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-06-11external/ffspart: Use read() rather than mmap()Oliver O'Halloran1-8/+34
The various ffspart test cases use /dev/zero as an input which doesn't behave like a normal file. The stat.st_size field for char devs is generally zero so the subsequent attempt to mmap() the file fails because we requested a zero size mapping. Previously we didn't notice this, but it sort of worked since the partitions in the test script that used /dev/zero as an input were also had those partitions marked as ECC. This resulted in the partition contents being re-generated (using a buffer libflash allocates) and the source data pointer being ignored since we said it was zero length. Fix all this by dropping mmap() entirely and inhale the input file into a buffer we malloc() instead. This works for any file, including /dev/urandom, which can't be mmap()ed. Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-06-03opal-gard: sync up the chip unit data list with upstream hostboot.Mahesh Salgaonkar1-1/+9
opal-gard on POWER9P system fails to identify few chip targets while displaying gard records. This patch fixes that. Before: # opal-gard list ID | Error | Type | Path ------------------------------------------------------------------------------- 00000001 | 90004af4 | Predictive | /Sys0/Node0/Proc0/MC0/MI0/UNKNOWN0/UNKNOWN0 =============================================================================== After this patch: # ./opal-gard list ID | Error | Type | Path --------------------------------------------------------------------------- 00000001 | 90004af4 | Predictive | /Sys0/Node0/Proc0/MC0/MI0/MCC0/OMI0 =========================================================================== Signed-off-by: Mahesh Salgaonkar <mahesh@linux.ibm.com> Reviewed-by: Dan Horák <dan@danny.cz> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-03-13Re-license contributions from Dan HorákOliver O'Halloran2-2/+2
Cc: Dan Horák <dan@danny.cz> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-03-12Re-license IBM written files as Apache 2.0 OR GPLv2+Stewart Smith75-75/+75
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-02-12opal-gard: Add support for new PVR POWER9P.Mahesh Salgaonkar1-0/+1
Enable a new PVR for gard tool to work on another p9 variant. Makes op-test as well happy. Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> [oliver: s/Axone/axone/] 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-05hdata: Fix reserved node label searchVasant Hegde1-4/+9
Soon hostboot/HDAT will provide consistent reserved node name. It will just provide node name without starting string "ibm,". Commit 50d508c3 made sure that all device tree nodes starts with "ibm,". But we use hostboot/HDAT provided name for `ibm,prd-label` property. So we have to fix couple of our `ibm,prd-label` property based search/comparision to accommodate this change. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> 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-10-22gard: Add support to run gard tests on FSP platformVasant Hegde2-6/+11
gard tool is not supported on FSP based system. But we can still run gard tests on FSP based system. Acked-by: Stewart Smith <stewart@flamingspork.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-10-14blocklevel: smart_write: Fix unaligned writes to ECC partitionsAndrew Jeffery3-0/+39
Currently trying to clear a gard record results in errors: $ ./opal-gard -pef part create /sys0/node0/proc1 $ ./opal-gard -pef part list ID | Error | Type | Path --------------------------------------------------------- 00000001 | 00000000 | Manual | /Sys0/Node0/Proc1 ========================================================= $ ./opal-gard -pef part clear 00000001 Clearing gard record 0x00000001...done ECC: uncorrectable error: ffffff00ffffffff ff libflash ecc invalid $ A little wrapper around hexdump(1) helps show where the error lies by grouping output in blocks of nine such that the last byte is the ECC byte: $ declare -f ecchd ecchd () { hexdump -e '"%08_ax""\t"' -e '9/1 "%02x ""\t""|"' -e '9/1 "%_p""|\n"' "$@" } A clean GARD partition displays as: $ ecchd part 0002c000 ff ff ff ff ff ff ff ff 00 |.........| * 00030ffb ff ff ff ff ff |.....| $ Dumping the corrupt partition shows: $ ecchd part 0002c000 ff ff ff ff ff ff ff ff 00 |.........| * 0002c024 ff ff ff ff ff ff ff ff ff |.........| 0002c02d ff ff ff 00 ff ff ff ff ff |.........| * 0002c051 ff ff ff 00 ff ff ff ff 00 |.........| 0002c05a ff ff ff ff ff ff ff ff 00 |.........| * 00030ffb ff ff ff ff ff |.....| $ blocklevel_smart_write() turned out to not be quite as smart as it thought it was in that any unaligned write to ECC protected partitions aligned the calculated ECC values to the start of the write buffer and not relative to the start of the partition. Fixes: 29d1e6f78109 ("libflash/blocklevel: add a smart write function which wraps up eraseing and writing") Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-10-14gard: Fix data corruption when clearing single recordsAndrew Jeffery4-1/+31
Attempting to clear a specific gard record leads to corruption of the target record rather than the expected removal: $ ./opal-gard -f romulus.pnor list No GARD entries to display $ ./opal-gard -f romulus.pnor create /sys0/node0/proc1 $ ./opal-gard -f romulus.pnor list ID | Error | Type | Path --------------------------------------------------------- 00000001 | 00000000 | Manual | /Sys0/Node0/Proc1 ========================================================= $ ./opal-gard -f romulus.pnor clear 00000001 Clearing gard record 0x00000001...done $ ./opal-gard -f romulus.pnor list ID | Error | Type | Path --------------------------------------------------------- 00000001 | 00000000 | Unknown | /Sys0/Node0/Proc1 ========================================================= The GUARD partition needs to be compacted when clearing records as the end of the list is a sentinel represented by the erased-flash state. The compaction strategy is to read the trailing records and write them to the offset of the record to be removed, followed by writing the sentinel record at the offset of what was previously the last valid record. The corruption occurs due to incorrect calculation of the offset at which the trailing records will be written. Cc: Skiboot Stable <skiboot-stable@lists.ozlabs.org> Fixes: 5616c42d900a ("libflash/blocklevel: Make read/write be ECC agnostic for callers") Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-09-06external/common: Use file operation used on x86 for ARCH_UNKNOWNFrédéric Bonnard4-8/+2
On arches where only file operation make sense such as x86 and others, use the same code. Signed-off-by: Frédéric Bonnard <frediz@debian.org> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-09-06devicetree: Remove lpc interrupt propertiesReza Arbab1-15/+1
After commit 7b12d5489fcf ("hw/lpc: Configure SerIRQ interrupts on P9P"), we abort on p9p Simics: [ 1486.000029845,3] Duplicate property "interrupt-map" in node /lpcm-opb@6030000000000/lpc@f0000000 [ 1487.000158147,0] Aborting! CPU 0000 Backtrace: S: 0000000031c13940 R: 0000000030013d18 .backtrace+0x5c S: 0000000031c139f0 R: 000000003001dbf8 ._abort+0x60 S: 0000000031c13a80 R: 000000003002d448 .new_property+0x94 S: 0000000031c13b20 R: 000000003002d5e8 .dt_add_property+0xd0 S: 0000000031c13bc0 R: 000000003004202c .lpc_create_int_map+0xa4 S: 0000000031c13da0 R: 0000000030043748 .lpc_finalize_interrupts+0x94 S: 0000000031c13e30 R: 0000000030015d18 .main_cpu_entry+0x620 S: 0000000031c13f00 R: 0000000030002740 boot_entry+0x1b8 Since skiboot creates these interrupt properties now, and always has on older p9 systems, remove them from the input device tree. Signed-off-by: Reza Arbab <arbab@linux.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-07-26SPDX-ify all skiboot codeStewart Smith82-505/+235
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-07-26gard: fix installation ruleDan Horák1-2/+2
Use $(EXE) for the binary name instead of hard-coding. This completes the "gard: Use consistent name" change from commit 41109e5073bd ("gard: Use consistent name") Fixes: 41109e5073bd ("gard: Use consistent name") Signed-off-by: Dan Horák <dan@danny.cz> [oliver: prefix in title, fixes tag] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-07-23Updating shared constants for HBRTDan Crowell1-2/+69
Updated a few sets of constants for HBRT operation based on the most recent Hostboot implementation. - added all of the PIB return codes in for scom - added return cords for firmware_request and wakeup - added capability for 'clear all wakeups' Signed-off-by: Dan Crowell <dcrowell@us.ibm.com>
2019-07-19xscom-utils: refer only objects not sources for getscomDan Horák1-1/+1
The rule for getscom binary should depend on object files only, not sources. Signed-off-by: Dan Horák <dan@danny.cz> Signed-off-by: Than Ngo <than@redhat.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Stewart Smith <stewart@linux.ibm.com> [oliver: added xscom-utils prefix to subject] 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-06-04Remove POWER7 and POWER7+ supportStewart Smith2-12/+1
It's been a good long while since either OPAL POWER7 user touched a machine, and even longer since they'd have been okay using an old version rather than tracking master. There's also been no testing of OPAL on POWER7 systems for an awfully long time, so it's pretty safe to assume that it's very much bitrotted. It also saves a whole 14kb of xz compressed payload space. Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Enthusiasticly-Acked-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-06-03opal-prd: Fix prd message size issueVasant Hegde1-4/+23
If prd messages size is insufficient then read_prd_msg() call fails with below error. And caller is not reallocating sufficient buffer. Also its hard to guess the size. sample log: ----------- Mar 28 03:31:43 zz24p1 opal-prd: FW: error reading from firmware: alloc 32 rc -1: Invalid argument Mar 28 03:31:43 zz24p1 opal-prd: FW: error reading from firmware: alloc 32 rc -1: Invalid argument Mar 28 03:31:43 zz24p1 opal-prd: FW: error reading from firmware: alloc 32 rc -1: Invalid argument .... Lets use `opal-msg-size` device tree property to allocate memory for prd message. Cc: Skiboot Stable <skiboot-stable@lists.ozlabs.org> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20external/trace: Add follow option to dump_traceJordan Niethe1-7/+49
When monitoring traces, an option like the tail command's '-f' (follow) is very useful. This option continues to append to the output as more data arrives. Add an '-f' option to allow dump_trace to operate similarly. Tail also provides a '-s' (sleep time) option that accompanies '-f'. This controls how often new input will be polled. Add a '-s' option that will make dump_trace sleep for N milliseconds before checking for new input. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20external/trace: Add support for dumping multiple buffersJordan Niethe3-44/+135
dump_trace only can dump one trace buffer at a time. It would be handy to be able to dump multiple buffers and to see the entries from these buffers displayed in correct timestamp order. Each trace buffer is already sorted by timestamp so use a heap to implement an efficient k-way merge. Use the CCAN heap to implement this sort. However the CCAN heap does not have a 'heap_replace' operation. We need to 'heap_pop' then 'heap_push' to replace the root which means rebalancing twice instead of once. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20external/trace: mmap trace buffers in dump_traceJordan Niethe2-32/+25
The current lseek/read approach used in dump_trace does not correctly handle certain aspects of the buffers. It does not use the start and end position that is part of the buffer so it will not begin from the correct location. It does not move back to the beginning of the trace buffer file as the buffer wraps around. It also does not handle the overflow case of the writer overwriting when the reader is up to. Mmap the trace buffer file so that the existing reading functions in extra/trace.c can be used. These functions already handle the cases of wrapping and overflow. This reduces code duplication and uses functions that are already unit tested. However this requires a kernel where the trace buffer sysfs nodes are able to be mmaped (see https://patchwork.ozlabs.org/patch/1056786/) Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20external/trace: Introduce structure for reading tracesJordan Niethe2-23/+48
Currently the trace_get and trace_empty functions operate on a tracebuf struct. This requires being able to write to that struct. If dump_trace were able to use these functions it would be convenient as it would reduce code duplication and these functions are already unit tested. However, a tracebuf accessed via mmaping will not be able to be written. The tracebuf struct fields that need to be written are only to be used by a reader. The fields are never used by a writer. Add a new structure for readers, trace_reader, which contains these fields and remove them from the tracebuf struct. Change trace_get and trace_empty to use the trace_reader struct and update the unit tests accordingly. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20core/trace: Change mask/and to modulo for buffer offsetJordan Niethe1-2/+2
We would like the be able to mmap the trace buffers so that the dump_trace tool is able to make use of the existing functions for reading traces in external/trace. Mmaping is done by pages which means that buffers should be aligned to page size. This is not as simple as setting the buffer length to a page aligned value as the buffers each have a header and leave space for an extra entry at the end. These must be taken into account so the entire buffer will be page aligned. The current method of calculating buffer offsets is to use a mask and bitwise 'and'. This limits the potential sizes of the buffer to powers of two. The initial justification for using the mask was that the buffers had different sizes so the offset needed to based on information the buffers carried with them, otherwise they could overflow. Being limited to powers of two will make it impossible to page align the entire buffer. Change to using modulo for calculating the buffer offset to make a much larger range of buffer sizes possible. Instead of the mask, make each buffer carry around the length of the buffer to be used for calculating the offset to avoid overflows. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20external/trace: Use correct width integer byte swappingJordan Niethe1-1/+1
The trace_repeat struct uses be16 for storing the number of repeats. Currently be32_to_cpu conversion is used to display this member. This produces an incorrect value. Use be16_to_cpu instead. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20external/trace: Fix endianness detection in MakefileJordan Niethe1-1/+1
The Makefile for the dump_trace tool does not correctly determine endianness on Power. Instead Big Endian is always used on Power. Fix so Little Endian will be detected. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20opal-gard: Account for ECC size when clearing partitionOliver O'Halloran1-1/+2
When 'opal-gard clear all' is run, it works by erasing the GUARD then using blockevel_smart_write() to write nothing to the partition. This second write call is needed because we rely on libflash to set the ECC bits appropriately when the partition contained ECCed data. The API for this is a little odd with the caller specifying how much actual data to write, and libflash writing size + size/8 bytes since there is one additional ECC byte for every eight bytes of data. We currently do not account for the extra space consumed by the ECC data in reset_partition() which is used to handle the 'clear all' command. Which results in the paritition following the GUARD partition being partially overwritten when the command is used. This patch fixes the problem by reducing the length we would normally write by the number of ECC bytes required. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Tested-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-05-20gard: Use consistent nameVasant Hegde13-16/+16
During compilation we generates binary file as "gard" and during installation we install it as "opal-gard". This seems to be creating some confusion. Some people are thinking these are two different tools. Hence lets use common name for gard tool ("opal-gard"). Cc: Oliver O'Halloran <oohall@gmail.com> Cc: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.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-05-13devicetree: Don't set path to dtc in makefileJoel Stanley1-1/+1
By setting the path we fail to build under buildroot which has it's own set of host tools in PATH, but not at /usr/bin. Keep the variable so it can be set if need be but default to whatever 'dtc' is in the users path. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Oliver O'Halloran <oohall@gmail.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-17opal-prd: Fix memory leak in is-fsp-system checkVasant Hegde1-1/+6
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2019-04-17opal-prd: Check malloc return valueVasant Hegde1-0/+4
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>