summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
...
* plat/qemu: Add LPC based RTC supportBenjamin Herrenschmidt2015-07-031-17/+0
| | | | | | | | This adds a driver for standard CMOS RTC chips and use it from the QEMU platform. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* plat/qemu: Add simple qemu platformBenjamin Herrenschmidt2015-07-031-1/+1
| | | | | | | | | | | | | This adds support for running under qemu "powernv" platform, which is currently available via the qemu repository at: https://github.com/ozbenh/qemu branch "powernv" qemu can't yet create DT entries for ISA devices so we hard wire the UART and RTC devices in the device-tree like we do with other platforms. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/ipmi: Provide the dequeue message interfaceNeelesh Gupta2015-07-031-0/+13
| | | | | | | | | | Add a wrapper for the client to be able to invoke the backend dequeue message function. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Cc: Alistair Popple <alistair@popple.id.au> Acked-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* flash: Add ecc.h full pathVasant Hegde2015-07-021-1/+1
| | | | | | | | ...to make it consistent with rest of the includes from libflash. Suggested-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add mem_dump_free() call to mem_region unit testStewart Smith2015-07-021-0/+2
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Use memcpy for NVRAM free partition name, is part of stdStewart Smith2015-06-241-1/+2
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* add test for nvram free space partition nameStewart Smith2015-06-241-6/+3
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Expand nvram-format unit test to cover all error pathsStewart Smith2015-06-242-3/+94
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Move NVRAM format/check code out into separate file to unit testStewart Smith2015-06-245-133/+190
| | | | | | | We (slightly) change the internal API so that we operate on parameters rather than globals, this means it's easier to unit test too. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* pci_configure_mps(): Check empty pointer before dereferencingKamalesh Babulal2015-06-241-4/+5
| | | | | | | | | | Re-arrange the code in pci_configure_mps() to avoid dereferencing of in-valid pointer. Fixes Coverity defect#97851. Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu_remove_node() : Fix potential null dereferenceKamalesh Babulal2015-06-241-0/+2
| | | | | | | | | | Fix potential NULL dereference of pointer returned from dt_find_property() in cpu_remove_node(). Fixes coverity defect#97849. Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add unit test for core/time-utilsStewart Smith2015-06-242-0/+61
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* libffs: init with ecc protection at blocklevel levelCyril Bur2015-06-231-2/+2
| | | | | | | | | | | | Passing a flag on libffs init will register all regions of the flash with ecc (as per the libffs partition information) as being ecc protected (or not). This saves the consumer needing to know or care about the presence of ecc. Reviewed-By: Alistair Popple <alistair@popple.id.au> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* libflash/ecc: Simplify and cleanup ecc code.Cyril Bur2015-06-231-5/+5
| | | | | | | | | | | | | | | | The ecc 'memcpy' style functions return success or fail in terms of the ECC enum. This doesn't really make sense, use true or false. As the result the ecc enum doesn't need to be exposed anymore, which makes more sense, not clear why it was exposed in the first place. Convert some of the ecc #defines to static inlines, shouldn't make any difference but feels safer. Fix minor stylistic and typo issues. Reviewed-By: Alistair Popple <alistair@popple.id.au> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add -Tn to ibm,loc-code for ethernet adaptorsDaniel Axtens2015-06-231-3/+31
| | | | | | | | | | | | | | | | | | | | | | On pHyp, the location code of ethernet adaptors ends with -Tn, where n is the port number on the card. Detect if an adaptor advertises itself as ethernet based on it's PCI class code, and if it does, give each PCI function a -Tn suffix, where n = function number + 1. (Therefore n is between 1 and 8 inclusive) This is a reasonably non-invasive change to match pHyp behaviour. Alternatives considered were: - putting this in kernel space, which requires messing with the device tree, which is frowned upon. - putting this in user space, which requires patching every userspace tool that might consume this data, of which there are several. As such, while it's a bit of a hack, this is the best place for it. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Support for Naples LPC serial interruptsBenjamin Herrenschmidt2015-06-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This adds support for the HW SerIRQ deserializer of the P8 LPC bridge which is properly wired up on Naples. It also adds support for detecting and reporting LPC error interrupts on all P8s. On most platforms (Rhesus is the exception here due to the way it lets Linux handle the UART interrupts directly), we modify the device-tree to properly represent the LPC controller as a cascaded interrupt-controller and the "interrupts" property of LPC devices to contain the actual LPC interrupt number for the device. We add a mechanism for drivers to register specific LPC interrupts, and a "workaround" for pre-Naples P8 which platforms can use to call all of them for when the external FPGA based deserializer is used. There's also a callback on LPC resets which isn't used yet, we need a bit more work on the general LPC error handling, but it can be done a separate patches. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Verify zalloc returned valid pointerAnanth N Mavinakayanahalli2015-06-191-0/+3
| | | | | | | | Else, we are dereferencing NULL Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Merge branch 'stable'Stewart Smith2015-06-161-2/+1
|\
| * cpu: Fix hang issue in opal_reinit_cpus()Hari Bathini2015-06-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Commit 87690bd19dbb introduced a label "again" so as to avoid holding the lock while waiting. But this leads to hang in scenarios like kdump, where 'cpu_state_os' will be the state for all offline cpus. Actaully, the wait loop doesn't really take off with the goto statement in it. This patch tries to fix this problem by removing the goto statement and unlocking/locking within the wait loop instead. Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | flash: fix offset and size parameters checkCédric Le Goater2015-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Copying the flash from the host fails : # cat /dev/mtd0 > pnor cat: /dev/mtd0: Input/output error and the kernel logs : [ 1357.866996] mtd mtd0: opal_flash_async_op(op=0) failed (rc -1) It seems that the check on the parameters in the opal_flash_op() routine are bit excessive and we fail to write or read the last block. Here is a fix below which should be enough to catch an out of bounds operation. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Move prlog(PR_TRACE) in cpu job to be before freeing CPU jobStewart Smith2015-06-151-1/+1
| | | | | | | | | | | | Use-after-free bug. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Fix assert test in run-mem_region_reservations.cStewart Smith2015-06-151-1/+1
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Fix assert tests in run-mem_region_next.cStewart Smith2015-06-151-6/+6
| | | | | | | | | | | | | | Assignments rather than checks, and the wrong way around for how new_region works. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Move boot_tracebuf to BSSStewart Smith2015-06-111-10/+5
| | | | | | | | | | | | this saves 65720 bytes from skiboot.lid Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | libflash: start using the blocklevel interface.Cyril Bur2015-06-091-15/+20
| | | | | | | | | | | | | | | | | | | | Converted all the libflash calls to use the blocklevel interface, modified all callers to libflash to use the blocklevel interface. This patch should introduce next to no functional change. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Merge branch 'stable'Stewart Smith2015-06-052-3/+4
|\|
| * core/mem_region: Create reservations of type REGION_HW_RESERVEDJeremy Kerr2015-06-052-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All current users of mem_reserve are actually wanting HW_RESERVED memory; these reservations are for memory initialised pre-skiboot. This change marks these regions as REGION_HW_RESERVED instead of REGION_RESERVED. We also rename mem_reserve to mem_reserve_hw to reflect this change. This fixes an issue where the PRD daemon cannot find reserved ranges (eg, the homer image) that have been created by skiboot itself. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Move the relax loop in secondary_cpu_entry to pure inline asmStewart Smith2015-05-291-2/+9
| | | | | | | | | | | | | | | | | | | | | | this means we won't have gcov statistics for the loop iterations, which greatly reduces the number of stores. This improves gcov boot time on some hardware by maybe a dozen seconds, especially noticeable as linux is starting and before it's brought up all CPUs. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Make cpu_relax() inlineStewart Smith2015-05-291-12/+0
| | | | | | | | | | | | | | | | | | | | This modifies code output when built with GCOV so that the store of counter data is out of some of the loops, thus improving things when built with gcov. Also, likely makes us do even less work when relaxing, so probably a good thing. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Make cpu_relax() nop instructions in one asm blockStewart Smith2015-05-281-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With SKIBOOT_GCOV=1 and multiple asm blocks for nop instruction, we end up with this: 1a5f8: 60 00 00 00 nop 1a5fc: 60 00 00 00 nop 1a600: 60 00 00 00 nop 1a604: 60 00 00 00 nop 1a608: 3d 42 00 0e addis r10,r2,14 1a60c: e9 2a 20 f8 ld r9,8440(r10) 1a610: 39 29 00 01 addi r9,r9,1 1a614: f9 2a 20 f8 std r9,8440(r10) 1a618: 60 00 00 00 nop 1a61c: 60 00 00 00 nop 1a620: 60 00 00 00 nop 1a624: 60 00 00 00 nop Which is not the desired code output for relaxing the cpu. By batching up the instructions into one asm block, we get the desired effect: just one set of mcount update
* | Merge PRD rework from stableStewart Smith2015-05-215-38/+246
|\|
| * hw/prd: Expose prd ranges via device treeJeremy Kerr2015-05-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the prd reserved ranges are present in the reserved-ranges nodes in the device tree. While this works, it's difficult to filter the actual PRD ranges from general reserved memory. This change links the prd ranges into the /reserved-memory nodes, by adding ibm,prd-label properties to those used for PRD. This change adds a prd node to the ibm,opal node too, to giver kernel & userspace information about the prd infrastructure provided by OPAL. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Add mem_region_nextJeremy Kerr2015-05-213-1/+144
| | | | | | | | | | | | | | This change adds a function to iterate mem_regions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Add node-style memory reservation to device treeJeremy Kerr2015-05-212-30/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux supports a newer memory reservation layout in the device-tree, where each reservation is represented by a subnode under a top-level "reserved-memory" node. This change adds these nodes, using the mem_region names as the property names (minus any cell addresses). The reserved-memory node looks like this: / { name = "reserved-memory"; ranges; #address-cells = <0x2>; #size-cells = <0x2>; ibm,firmware-code@30000000 { reg = <0x0 0x30000000 0x0 0x200000>; }; ibm,firmware-data@30e00000 { reg = <0x0 0x30e00000 0x0 0xc00000>; }; ibm,firmware-stacks@31a00000 { reg = <0x0 0x31a00000 0x0 0x8000000>; }; ibm,firmware-allocs-memory@39a00000 { reg = <0x0 0x39a00000 0x0 0x1c0200>; }; ibm,firmware-heap@30200000 { reg = <0x0 0x30200000 0x0 0xc00000>; }; }; We also store a pointer to the reservation nodes in struct mem_region, so they can be used by other skiboot code. We keep the property-style reservation information (reserved-names and reserved-ranges) unchanged. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Introduce REGION_HW_RESERVEDJeremy Kerr2015-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This change allows the mem_region code to distinguish reserved memory that was allocated before skiboot init, by introducing a new mem_region_type member. When we extract reserved ranges from the device tree, we mark them with this new type. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Rename mem_region->mem_node to ->nodeJeremy Kerr2015-05-211-5/+5
| | | | | | | | | | | | | | We'll want to store non-memory nodes in this pointer too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Prevent adding new regions after mem_region_add_dt_reservedJeremy Kerr2015-05-213-1/+199
| | | | | | | | | | | | | | | | | | | | | | | | If we reserve any memory after mem_region_add_dt_reserved, that reservation won't appear in the device tree. Ensure that we can't add new regions after this point. Also, add a testcase for the finalise, including some basic reserved-ranges property checks. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core/test: Use skiboot's own malloc for mem_region testsJeremy Kerr2015-05-211-15/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Comments in the run-mem_region test imply that it uses skiboot's own malloc for the malloc implementation, but this isn't true; a malloc inside the mem_region code itself will use the glibc malloc. This change implements the intention of the test, and uses skiboot malloc for the file-under-test. real_malloc() is available for actual glibc mallocs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core/test: simulate proper locking in run-mem_region testJeremy Kerr2015-05-211-2/+13
| | | | | | | | | | | | | | | | Currently, this test doesn't do locking during region changes or allocations. This change adds the appropriate locking. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Add asserts for region free-list lockingJeremy Kerr2015-05-217-1/+41
| | | | | | | | | | | | | | | | | | | | | | | | This change adds asserts to the mem_region calls that should have the per-region lock held. To keep the tests working, they need the lock_held_by_me() function. The run-mem_region.c test has a bogus implementation of this, as it doesn't do any locking at the moment. This will be addressed in a later change. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * core: Move free-list locking to a separate per-region lockJeremy Kerr2015-05-216-41/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we have a single lock for the entire mem_region system; this protects both the global region list, and the allocations from each region. This means we can't allocate memory while traversing the global region list, as any malloc/realloc/free will try to acquire the mem_region lock again. This change separates the locking into different functions. We keep the mem_region_lock to protect the regions list, and introduce a per-region lock to protect allocations from the regions' free_lists. Then we remove the open-coded invocations of mem_alloc, where we'd avoided malloc() due to the above locking issue. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * init: Display message before loading kernelJoel Stanley2015-05-011-0/+2
| | | | | | | | | | | | | | | | Reassure the user that boot is still working when the payload load is slow. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | flash: don't report nvram partitions through the device treeCyril Bur2015-05-201-30/+2
| | | | | | | | | | | | | | | | | | | | Skiboot parses the ffs header in the nvram and writes a devicetree entry for each partition that ffs returns. Skiboot doesn't need to do this as it exposes access to the entirety of the nvram to linux so any user of the nvram within linux can just read the ffs partition data themselves. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | core/console: fix dummy_console_pollAlistair Popple2015-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | If a console driver was registered dummy_console_poll() always sends an opal event indicating there is pending console data even if there wasn't. This was caused by setting a bool to the address of a function pointer instead of calling the function. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Construct linked list of gcov data structuresStewart Smith2015-05-152-3/+67
| | | | | | | | | | | | | | | | The gcov constructors call __gcov_init() for each gcov covered file, which we then need to turn into a linked list of all gcov files so that we can traverse them later to pull out gcov profiling data. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Run gcc constructorsStewart Smith2015-05-151-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of setting up GCOV data structures correctly, GCC/GCOV generates a bunch of constructor routines that the C runtime is expected to run really early on. skiboot was not running GCC generated constructors. Luckily, it's really easy to do so. This patch will run GCC constructors very early on during boot (if there are any) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Enable SKIBOOT_GCOV build option for building with profilingStewart Smith2015-05-152-0/+82
| | | | | | | | | | | | | | | | | | | | Enable build options for building skiboot with GCOV profiling, including a skeleton -lgcov replacement in the form of core/gcov-profiling.c We don't actually have to do anything as part of the gcov routines, gcov auto generates everything we need. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Dump out free space in each memory region on boot.Stewart Smith2015-05-152-1/+41
| | | | | | | | | | | | | | This way we can track free HEAP when we're done with all the skiboot boot magic and see what we have to play with at runtime. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Make relocate() return specific error as to what went wrongStewart Smith2015-05-151-4/+4
| | | | | | | | | | | | Useful in debugging odd problems, such as skiboot > 1MB. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | Make makefile for core/test a bit prettierStewart Smith2015-05-131-1/+13
| | | | | | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud