summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
...
* core/pci: Fix initial PCIe slot power stateGavin Shan2016-10-111-1/+14
| | | | | | | | | | | | | | | | | The initial PCIe slot power state should be retrieved from the PCIe Slot Control register (offset: +0x18), instead of having the fixed state (power-off) wrongly. Otherwise, we possibly have mismatched states by software and hardware. One side-effect is PCIe slot can not be powered off from hardware for the first time. This fixes above issue by fetching the initial PCIe slot power state from hardware (PCIe Slot Control register) if the power control is supported on the slot. Otherwise, it doesn't matter on what we have for the initial PCIe slot power state. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: use PCI_SLOT_POWER_ON|OFF rather than 1/0] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/pci: Print CRS retry timesGavin Shan2016-10-111-2/+2
| | | | | | | | | | It's useful to know the CRS retry times before the PCI device is detected successfully. In PCI hot add case, it usually indicates time consumed for the adapter's firmware to be partially ready (responsive PCI config space). Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* flash: Use blocklevel to do ECC readsAlistair Popple2016-10-111-3/+3
| | | | | | | | | | | | | flash_read_corrected() assumes the passed blocklevel device is an actual flash device. However the blocklevel flash abstraction supports automatically reading ECC protected data so use that instead. Signed-off-by: Alistair Popple <alistair@popple.id.au> [Cyril added true to last param to ffs_init() in flash_register()] [Cyril rebased onto 46c006f core/console: use char literals instead of numeric] Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* flash: Size NVRAM based on ECC for OpenPOWER platformsCyril Bur2016-10-111-2/+3
| | | | | | | | | If NVRAM has ECC (as per the ffs header) then the actual size of the partition is less than reported by the ffs header in the PNOR then the actual size of the partition is less than reported by the ffs header. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* init: rework tb_measure/verify so can work on preloaded kernelsStewart Smith2016-10-101-9/+14
| | | | | | | e.g. in a simulator, we could load in a STB container and verify/measure it. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: Compute built-in/preloaded BOOTKERNEL size from ELF and do ↵Stewart Smith2016-10-101-15/+40
| | | | | | | | | | | | | | | secure/trusted boot Using some basic math on the ELF headers, we can work out how big the BOOTKERNEL is that may be already loaded (e.g. in mambo, pointed to in the device tree or built into the skiboot binary). From there, we can measure the BOOTKERNEL in the TPM and/or verify signature. This is only useful in a simulation environment, as real machines will do all of this throught the load_resource API. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Initialize Secure/Trusted Boot (STB) during initClaudio Carvalho2016-10-101-0/+3
| | | | | | | | | | | While currently, the only platform with any support for trusted boot is a reworked habanero with a new hostboot, we act on the device tree entry of /ibm,secureboot which will be added by earlier system firmware (hostboot, or a simulator) in the event that we should be doing secure/trusted boot. Based-on-habanero-only-patch-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init.c: measure event separator before handover to skirootClaudio Carvalho2016-10-101-0/+6
| | | | | | | | | | | | | | As defined in the TCG Platform Firmware Profile specification revision 00.21, the digest of 0xFFFFFFFF or 0x00000000 must be extended in PCR[0-7] and an EV_SEPARATOR event must be recorded in the event log for PCR[0-7] prior to the first invocation of the first Ready to Boot call. This calls stb_final() before the handover to petitboot kernel in order to have a clean handover. stb_final() implements the steps above and also deallocates the memory allocated for secure and trusted boot. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/flash.c: verify and measure resourcesClaudio Carvalho2016-10-101-0/+8
| | | | | | | | | | | This changes core/flash.c to verify and measure the downloaded PNOR resource before it is returned to the caller. sb_verify() and tb_measure() do nothing if libstb is not initialized in the platform. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core: add flash_subpart_info()Claudio Carvalho2016-10-101-61/+83
| | | | | | | | | | | | | | | | | | Currently, the CAPP lid has the TOC (4K) and one supartition (36K). For secure boot we can either build one container for the TOC and another one for the subpartition, or build one container for the whole CAPP partition. We decided implement the second option. The first option would require changes to the CAPP TOC layout in order to correlate the TOC with the subpartitions. Besides that, the first option also increases the boot time since we would need to verify and measure the CAPP TOC. This patch adds the flash_subpart_info function so the correct CAPP subpartition can be selected also outside of the flash API. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/flash.c: load actual partition sizeClaudio Carvalho2016-10-101-1/+1
| | | | | | | | | | | We are downloading 0x20000 bytes from PNOR for CAPP, but currently the CAPP lid is only 40K. This loads the actual partition size as opposed to the total partition size. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init.c: adjust offset to run BOOTKERNEL containersClaudio Carvalho2016-10-101-1/+6
| | | | | | | | This adjusts the kernel header offset if BOOTKERNEL is a secure boot container Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: Fix failure of getting node in the free list.Pridhiviraj Paidipeddi2016-09-281-3/+7
| | | | | | | | | | | | | | | | Currently we are getting request to queue occ load opal message when host services got load occ request from FSP. This request we got before initializing opal messaging due to which we are failed to get list node from msg_free_list list. [3204300512,3] opalmsg: No available node in the free list, allocating This patch fixes this issue by initializing opal messaging(opal_init_msg) before platform.init, as in platform.init we are loading host services lid and getting occ load request command from FSP. So when opal_init_msg initializes we will be initialized msg_free_list with an empty list. Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* flash: Move flash node under ibm,opal/flash/Jack Miller2016-09-271-7/+24
| | | | | | | | | | | | | | | | | This changes the boot ABI, so it's only active for P9 and later systems, even though it's unrelated to hardware changes. There is an associated Linux change to properly search for this node as well. This change properly specifies #address-cells for the flash node, so we can avoid DTC errors like: device tree: Warning (reg_format): "reg" property in /ibm,opal/flash@0 has invalid length (8 bytes) (#address-cells == 0, #size-cells == 0) Base on a patch from Cyril Bur Signed-off-by: Jack Miller <jack@codezen.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: create the dt root in main_cpu_entryOliver O'Halloran2016-09-272-2/+3
| | | | | | | | | This is created seperately when parsing the hdat and when expanding the DT. There is no real reason for this and it makes more sense to create it in the main init path. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: remove master_cpu parameterOliver O'Halloran2016-09-271-4/+4
| | | | | | | | | | | | master_cpu is used to determine the ChipTOD master if no ChipTOD information is available in the HDAT. However, it is set to zero at every skiboot entry point (fdt_entry, the 0x180 FSP entry and opal_boot_trampoline) and is otherwise unused. This patch removes this passing around and uses the boot CPU PIR to find the ChipTOD master rather than zero. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/ipmi: Set interrupt-parent propertySam Mendoza-Jonas2016-09-221-1/+5
| | | | | | | | | This allows ipmi-opal to properly use the OPAL irqchip rather than falling back to the event interface in Linux. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core: Create event node to enable irqchipSam Mendoza-Jonas2016-09-221-0/+7
| | | | | | | | | This allows devices such as IPMI and serial consoles to use dynamic irq numbers and have separate irq numbers in Linux. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/pci: Fix the power-off timeout in pci_slot_power_off()Gavin Shan2016-09-221-1/+1
| | | | | | | | | | | | | | | | | | | The timeout should be 1000ms instead of 1000 ticks while powering off PCI slot in pci_slot_power_off(). Otherwise, it's likely to hit timeout powering off the PCI slot as below skiboot logs reveal: [47912590456,5] SkiBoot skiboot-5.3.6 starting... : [5399532365,7] PHB#0005:02:11.0 Bus 0f..ff scanning... [5399540804,7] PHB#0005:02:11.0 No card in slot [5399576870,5] PHB#0005:02:11.0 Timeout powering off slot [5401431782,3] FIRENZE-PCI: Wrong state 00000000 on slot 8000000002880005 This replaces time_wait() with time_wait_ms() to resolve the issue. Fixes: 358b4d654f100cfdfcba939cae012099a851b3bc Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init : Typo correctionMukesh Ojha2016-09-161-1/+1
| | | | | | | Sycnhronize => Synchronize Signed-off-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/platform: Replace printfs with prlogVipin K Parashar2016-09-141-4/+4
| | | | | | | Use prlog replacing printfs in core/platform.c Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/vpd: rename vpd to vpd_lidOliver O'Halloran2016-09-141-16/+17
| | | | | | | | | | | This file contains several helper functions which also take an argument named "vpd". Even at the best of times, the VPD parsing code is a soup of confusing terminology so lets not make a bad situation worse. This patch renames vpd to vpd_lid and vpd_size to vpd_lid_size to clarify the situation. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/vpd: remove reallocOliver O'Halloran2016-09-141-6/+0
| | | | | | | | | | | When setting up the VPD lid preload a buffer of VPD_LID_MAX_SIZE bytes is allocated. Once the lid has been transferred from the FSP this buffer is shrunk with realloc. However, the contents of the buffer are copied into the devicetree and the buffer is freed making the shrinking pointless. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/vpd: remove assert() when checking for VPDOliver O'Halloran2016-09-141-2/+7
| | | | | | | | | | | | | The VPD LID is used on FSP machines to discover hotpluggable PCI slots. Currently if we fail to load the LID skiboot will fail an assert() preventing the system from booting. This is excessive since this is an otherwise recoverable failure. This patch converts the assert() to an if-NULL-return check so we can continue to boot. Cc: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> [stewart@linux.vnet.ibm.com: fix missing verb] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/cpu.c: Add OPAL call to setup Nest MMUAlistair Popple2016-09-061-0/+32
| | | | | | | | | | | | | | | POWER9 has an off core MMU called the Nest MMU which allows other units within a chip to perform address translations. The context and setup for translations is handled by the requesting agents, however the Nest MMU does need to know where in system memory the page tables are located. This patch adds a call to setup the Nest MMU page table pointer on a per-chip basis. Signed-off-by: Alistair Popple <alistair@popple.id.au> Reviewed-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/flash: More pointer vs value fixesCyril Bur2016-09-061-3/+3
| | | | | | | | | | | | | | It appears the inital patch was incomplete and coverity has caught more issues. The initial patch addressed one aspect of passing pointers instead of values, actual function prototypes needed to be changed and callers adjusted. Fixes coverity 134277 and 134278 Fixes: 81a538a ("core/flash: Fix passing pointer instead of value") Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: ensure that HRMOR is zero at bootOliver O'Halloran2016-09-061-0/+10
| | | | | | | | | | We have only ever supported running with HRMOR = 0. Having a non-zero HRMOR causes all real mode accesses to have the value of HRMOR bitwise ORed into the address that would have been accessed. This causes issues when accessing MMIO registers such as the XSCOMs. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: ensure the current thread is initialisedOliver O'Halloran2016-09-061-0/+10
| | | | | | | | This patch adds a check when to verify that we have initialised the cpu_thread structure for the called in thread. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: add per_thread_sanity_checks()Oliver O'Halloran2016-09-061-0/+10
| | | | | | | | | This patch adds a function that is called early in the primary thread and secondary thread init paths. No actual checks are added in this patch. It just provides a sensible place to add them. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* consolidate gcov flags into HOSTGCOVFLAGS for host binariesStewart Smith2016-09-021-2/+2
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/pci: Support virtual deviceGavin Shan2016-09-022-3/+263
| | | | | | | | | | | | | | | | | | | | | | The NVLinks (v1 and v2 to be supported in future) are exposed to Linux kernel by emulated PCI devices (aka PCI virtual devices). Currently, the implementation is covered by NVLink driver (npu.c), meaning npu2.c will have similar implementation though it will be totally duplicated with that in npu.c. This supports PCI virtual device in the generic layer so that it can be shared by all NVLink drivers. The design is highlighted as: * There are 3 config spaces for every PCI virtual device, corresponds to the cached config space, readonly space, write-1-clear space. * Reuse PCI config register filter mechanism to allow NVLink driver to emulate the access to the designated config registers. The config values are fetched from or written to the cached config space when the config registers aren't covered by filter. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Reviewed-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* pci: Standardise on uint64_t pe_numberRussell Currey2016-08-301-9/+9
| | | | | | | | | | | | | | | Throughout skiboot (and the kernel) PE numbers are named "pe_no", "pe_num" and "pe_number", and sized as 16, 32 and 64bit uints depending on where you look. This is annoying and potentially misleading in cases such as the OPAL API, where different calls have different int sizes even though the PE number they want is the same. Fix this by making *everything* uint64_t pe_number. In doing this, there are some whitespace fixes and mve_number gets dragged into this as well for cases like set_msi_{32/64} where they essentially mean the same thing. Signed-off-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/test: add tests for nvram_query()Oliver O'Halloran2016-08-301-0/+46
| | | | | | | | Adds some basic functionality tests for nvram_query() to the core test suite. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/test: add test for nul check in nvram_format()Oliver O'Halloran2016-08-301-0/+6
| | | | | | | | Adds a test for nvram_check() that the ibm,skiboot nvram partition is correctly terminated. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: take bootargs from nvramOliver O'Halloran2016-08-301-1/+7
| | | | | | | | Adds support for supplying the kernel boot arguments from the "bootargs" configuration string in the ibm,skiboot partition. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/nvram: add support for skiboot config stringsOliver O'Halloran2016-08-301-0/+68
| | | | | | | | | | | | This allows the ibm,skiboot partition to be used to store NUL terminated key=value OF configuration strings. These strings can be written using the nvram utility found in the linux powerpc-utils package. Currently the only use case for this is passing command line arguments to the boot kernel so only ASCII strings are supported. The 0xFF binary escaping mechanism for configuration strings is not supported. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/init: recheck nvram on fast rebootOliver O'Halloran2016-08-302-10/+27
| | | | | | | | | If the previously running OS modifies the NVRAM it may be left in an invalid state. To prevent errors we need to re-validate the nvram format in the fast-reboot path. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* nvram: ibm,skiboot NUL terminator checkOliver O'Halloran2016-08-301-5/+22
| | | | | | | | | | NVRAM configuration strings are required to be NUL terminated and unused data bytes in the partition should be set to NUL. Badly behaved system software may not do this so same sanity checking is required. Ensuring that the final data byte in a partition is a NUL should be sufficient. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* nvram: rename nvram-format.h to nvram.hOliver O'Halloran2016-08-302-2/+2
| | | | | | | | | | The NVRAM handling code was split into two files so that the partition parsing could be separately tested. Currently there is no nvram.h and the tests #include nvram-format.c directly. This patch renames nvram-format.h to something more sensible. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* flash: Rework error paths and messages for multiple flash controllersMichael Neuling2016-08-251-22/+23
| | | | | | | | | | | | | | | | | | | | The current flash code was written with only one flash chip, which is a system_flash (ie. the PNOR image), in mind. Now that we have mambo bogusdisk flash, we can have many flash chips. This is resulting in some confusing output messages. This reworks some of the error paths and warnings to make this more coherent when we have multiple flash chips. We assume everything can be a system flash, so I've removed the is_system_flash parameter from flash_register(). We'll use the first system flash we find and warn if we find another since discovery order is not a guaranteed API. Signed-off-by: Michael Neuling <mikey@neuling.org> Acked-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* fwts: add annotation for manufacturing modeStewart Smith2016-08-251-0/+6
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* lpc: Log LPC SYNC errors as unrecoverable ones for manufacturingVipin K Parashar2016-08-251-1/+7
| | | | | | | | | | | | | High volume of SYNC errors onto LPC bus cause degraded system performance and are likely due to bad hardware present onto system. Thus once LPC SYNC errors cross a certain threshold, OPAL should log them onto BMC as unrecoverable errors in manufacturing mode. This will help manufacturing screen bad parts, causing such errors. Cc: stable Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: s/mfg/manufacturing/] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Make console-log time more readable: seconds rather than timebaseBalbir Singh2016-08-244-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've tried to align it with what the kernel prints today The existing logs show: [20287269125,5] PSI[0x000]: Found PSI bridge [working=1, active=0] [890425679,5] BT: Interface initialized, IO 0x00e4 [1249199642,4] SLW: HB-provided idle states property found [1249344409,5] NVRAM: Size is 576 KB [1484422964,3] NVRAM: Layout appears sane The mftb() output is not very meaningful, the changed output shows: [ 38.315784591,5] CENTAUR: FSI host: 0x0 cMFSI0 port 2 [ 38.315922971,5] PSI[0x000]: Found PSI bridge [working=1, active=0] [ 1.448765255,5] BT: Interface initialized, IO 0x00e4 [ 2.398136129,5] NVRAM: Size is 576 KB [ 3.145017865,3] NVRAM: Layout appears sane For the output sample, I've taken bits where one can see the time move back w.r.t. previous log, but that was always the case. I don't think that is worth fixing here Adds an additional divide and modulo for every log printed. I've also fixed the test cases that run as a part of make check Signed-off-by: Balbir Singh <bsingharora@gmail.com> [stewart@linux.vnet.ibm.com: fix up tb in console tests] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* chip: Add a quirk for when core direct control XSCOMs are missingBenjamin Herrenschmidt2016-08-221-2/+4
| | | | | | | | Those will be needed by fast reboot. For now, mark qemu and mambo as not having them. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu: Make endian switch message more informativeBenjamin Herrenschmidt2016-08-221-1/+6
| | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu: Display number of started CPUs during bootBenjamin Herrenschmidt2016-08-221-2/+4
| | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu: Add support for nap mode on P8Benjamin Herrenschmidt2016-08-222-1/+102
| | | | | | | | | | | This allows us to send threads to nap mode when either idle (waiting for a job) or when in a sleep delay (time_wait*). We only enable the functionality after the 0x100 vector has been patched, and we disable it before transferring control to Linux. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu: Remove pollers calling heuristics from cpu_wait_jobBenjamin Herrenschmidt2016-08-221-8/+4
| | | | | | | | | | | | | This will be handled by time_wait_ms(). Also remove a useless smt_medium(). Note that this introduce a difference in behaviour: time_wait will only call the pollers on the boot CPU while cpu_wait_job() could call them on any. However, I can't think of a case where this is a problem. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu: Remove global job queueBenjamin Herrenschmidt2016-08-221-26/+87
| | | | | | | | | | | | | | Instead, target a specific CPU for a global job at queuing time. This will allow us to wake up the target using an interrupt when implementing nap mode. The algorithm used is to look for idle primary threads first, then idle secondaries, and finally the less loaded thread. If nothing can be found, we fallback to a synchronous call. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* time: Setup DEC and call cpu_idle() in time_wait_nopoll()Benjamin Herrenschmidt2016-08-221-2/+15
| | | | | | | | This will currently do nothing more than spin but will eventually allow us to nap until the decrementer fires. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud