skiboot.git
2 hours agoskiboot v6.0.17 release notes master github/master
Stewart Smith [Wed, 20 Feb 2019 01:10:13 +0000 (12:10 +1100)] 
skiboot v6.0.17 release notes

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
(cherry picked from commit 229ed05931b5e138d240635341b85dce300a8826)
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 hours agoskiboot v6.2.1 release notes
Stewart Smith [Wed, 20 Feb 2019 01:04:08 +0000 (12:04 +1100)] 
skiboot v6.2.1 release notes

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
(cherry picked from commit 0647f2a2c4ebb47937a92d034af41d6848cb1313)
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agoplatforms/witherspoon: Make PCIe shared slot error message more informative
Andrew Donnellan [Thu, 22 Nov 2018 06:20:14 +0000 (17:20 +1100)] 
platforms/witherspoon: Make PCIe shared slot error message more informative

If we're missing chips for some reason, we print a warning when configuring
the PCIe shared slot.

The warning doesn't really make it clear what "shared slot" is, and if it's
printed, it'll come right after a bunch of messages about NPU setup, so
let's clarify the message to explicitly mention PCI.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
[stewart: bikeshed]
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agopflash: Don't try update RO ToC
Andrew Jeffery [Tue, 8 Jan 2019 02:58:14 +0000 (13:28 +1030)] 
pflash: Don't try update RO ToC

In the future it's likely the ToC will be marked as read-only. Don't
error out by assuming its writable.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agoopal: Deprecate reading the PHB status
Alexey Kardashevskiy [Fri, 11 Jan 2019 04:03:35 +0000 (15:03 +1100)] 
opal: Deprecate reading the PHB status

The OPAL_PCI_EEH_FREEZE_STATUS call takes a bunch of parameters, one of
them is @phb_status. It is defined as __be64* and always NULL in
the current Linux upstream but if anyone ever decides to read that status,
then the PHB3's handler will assume it is struct OpalIoPhb3ErrorData*
(which is a lot bigger than 8 bytes) and zero it causing the stack
corruption; p7ioc-phb has the same issue.

This removes @phb_status from all eeh_freeze_status() hooks and moves
the error message from PHB4 to the affected OPAL handlers.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-By: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agophb4: Update some comments
Oliver O'Halloran [Fri, 1 Feb 2019 03:57:46 +0000 (14:57 +1100)] 
phb4: Update some comments

I now know what an IODA cache is and I'm not happy about it. With
the power of Comments™ you too can share the misery.

Remove the big WARNING about the P8 specific hardware bug while
we're here. That seems to have been copied over from phb3.c and
no one thought about it too hard.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agophb4: Eliminate peltv_cache
Oliver O'Halloran [Fri, 1 Feb 2019 03:57:45 +0000 (14:57 +1100)] 
phb4: Eliminate peltv_cache

The PELT-V is also an in-memory table and there is no reason to have two
copies of it. Removing the cache shaves another 128KB off the size of
each struct phb4.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agophb4: Eliminate p->rte_cache
Oliver O'Halloran [Fri, 1 Feb 2019 03:57:44 +0000 (14:57 +1100)] 
phb4: Eliminate p->rte_cache

In ancient times we added a caches to struct phb3 for some of the IODA
tables which can only be accessed in-directly via XSCOM. A cache for the
Requester Translation Table (RTT) was also added even though this is an
in-memory table. This was carried over to PHB4 when Ben did the initial
copy and paste, but it's still largely pointless.

There's no real need to have a second copy of the table. This patch
removes the "cache" and changes all the users to reference the RTT
directly if we need to. This reduces the size of the struct phb4 by
128KB.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agophb4: Remove pointless NULL checks
Oliver O'Halloran [Fri, 1 Feb 2019 03:57:43 +0000 (14:57 +1100)] 
phb4: Remove pointless NULL checks

When we allocate the various in-memory tables we assert() on the
allocation. There's no point in checking if the table pointer is NULL
or not at runtime.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agophb4: Rework BDFN filtering in phb4_set_pe()
Oliver O'Halloran [Fri, 1 Feb 2019 03:57:42 +0000 (14:57 +1100)] 
phb4: Rework BDFN filtering in phb4_set_pe()

General cleanup. For a function that does nothing more than a
mask-and-compare the current implementation is way more convoluted
than it has any right to be.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agodevicetree: Add Makefile to build dtb binaries
Reza Arbab [Wed, 13 Feb 2019 21:42:38 +0000 (15:42 -0600)] 
devicetree: Add Makefile to build dtb binaries

Add a simple Makefile to build external/devicetree/*.dtb.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agodevicetree: Add p9-simics.dts
Reza Arbab [Wed, 13 Feb 2019 21:42:37 +0000 (15:42 -0600)] 
devicetree: Add p9-simics.dts

Add a p9-based devicetree that's suitable for use with Simics.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agodevicetree: Move power9-phb4.dts
Reza Arbab [Wed, 13 Feb 2019 21:42:36 +0000 (15:42 -0600)] 
devicetree: Move power9-phb4.dts

Clean up the formatting of power9-phb4.dts and move it to
external/devicetree/p9.dts. This sets us up to include it as the basis
for other trees.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agodevicetree: Add nx node to power9-phb4.dts
Reza Arbab [Wed, 13 Feb 2019 21:42:35 +0000 (15:42 -0600)] 
devicetree: Add nx node to power9-phb4.dts

A (non-qemu) p9 without an nx node will assert in p9_darn_init():

  dt_for_each_compatible(dt_root, nx, "ibm,power9-nx")
          break;
  if (!nx) {
          if (!dt_node_is_compatible(dt_root, "qemu,powernv"))
                assert(nx);
          return;
  }

Since NX is this essential, add it to the device tree.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agodevicetree: Fix typo in power9-phb4.dts
Reza Arbab [Wed, 13 Feb 2019 21:42:34 +0000 (15:42 -0600)] 
devicetree: Fix typo in power9-phb4.dts

Change "impi" to "ipmi".

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agodevicetree: Fix syntax error in power9-phb4.dts
Reza Arbab [Wed, 13 Feb 2019 21:42:33 +0000 (15:42 -0600)] 
devicetree: Fix syntax error in power9-phb4.dts

Remove the extra space causing this:

  Error: power9-phb4.dts:156.15-16 syntax error
  FATAL ERROR: Unable to parse input tree

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agolibflash/ecc: Fix compilation warning
Vasant Hegde [Mon, 18 Feb 2019 08:05:54 +0000 (13:35 +0530)] 
libflash/ecc: Fix compilation warning

We are hitting below warning on gcc9.

gcc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -O2 -Wall -Werror -Wno-stringop-truncation -I. -c libflash/ecc.c -o libflash-ecc.o
libflash/ecc.c: In function 'memcpy_to_ecc_unaligned':
libflash/ecc.c:419:24: error: taking address of packed member of 'struct ecc64' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  419 |   memcpy(inc_uint64_by(&ecc_word.data, alignment), src, bytes_wanted);
      |                        ^~~~~~~~~~~~~~
libflash/ecc.c:448:24: error: taking address of packed member of 'struct ecc64' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  448 |   memcpy(inc_uint64_by(&ecc_word.data, len), inc_ecc64_by(dst, len),
      |                        ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Fixes: https://github.com/open-power/skiboot/issues/218
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agohdata/i2c: Reduce severity of log message
Vasant Hegde [Mon, 18 Feb 2019 08:24:46 +0000 (13:54 +0530)] 
hdata/i2c: Reduce severity of log message

Looks like WARNING message resulting in some unnecessary bug report.
Lets reduce severity to PR_NOTICE.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
23 hours agoipmi/power: Fix system reboot issue
Vasant Hegde [Mon, 18 Feb 2019 09:36:26 +0000 (15:06 +0530)] 
ipmi/power: Fix system reboot issue

Kernel makes reboot/shudown OPAL call for reboot/shutdown. Once kernel
gets response from OPAL it runs opal_poll_events() until firmware
handles the request.

On BMC based system, OPAL makes IPMI call (IPMI_CHASSIS_CONTROL) to
initiate system reboot/shutdown. At present OPAL queues IPMI messages
and return SUCESS to Host. If BMC is not ready to accept command (like
BMC reboot), then these message will fail. We have to manually
reboot/shutdown the system using BMC interface.

This patch adds logic to validate message return value. If message failed,
then it will resend the message. At some stage BMC will be ready to accept
message and handles IPMI message.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
5 days agopflash: Support encoding/decoding ECC'd partitions
Stewart Smith [Tue, 11 Dec 2018 04:18:30 +0000 (15:18 +1100)] 
pflash: Support encoding/decoding ECC'd partitions

With the new --ecc option, pflash can add/remove ECC when
reading/writing flash partitions protected by ECC.

This is *not* flawless with current PNORs out in the wild though, as
they do not typically fill the whole partition with valid ECC data, so
you have to know how big the valid ECC'd data is and specify the size
manually. Note that for some partitions this is pratically impossible
without knowing the details of the content of the partition.

A future patch is likely to introduce an option to "stop reading data
when ECC starts failing and assume everything is okay rather than error
out" to support reading the "valid" data from existing PNOR images.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agofirmware-versions: Add test case for parsing VERSION
Stewart Smith [Mon, 17 Dec 2018 05:56:06 +0000 (16:56 +1100)] 
firmware-versions: Add test case for parsing VERSION

Also make it possible to use with afl-lop/afl-fuzz just to help make
*sure* we're all good.

Additionally, if we hit a entry in VERSION that is larger than our
buffer size, we skip over it gracefully rather than overwriting the
stack. This is only a problem if VERSION isn't trusted, which as of
4b8cc05a94513816d43fb8bd6178896b430af08f it is verified as part of
Secure Boot.

CC: stable # v5.9+
Fixes: 9727fe384b8685270d344201f7e051475eea3a0b
[stewart: fix up include ordering for building on centos7]
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agodoc: Adjusting tags in release notes to eliminate global conflict for singlehtml...
Jeff Scheel [Wed, 6 Feb 2019 15:49:23 +0000 (09:49 -0600)] 
doc: Adjusting tags in release notes to eliminate global conflict for singlehtml builds

Change tags shared-slot-rn and capi2-rn tags to reduce conflict tags in
skiboot-5.7.rst

For the singlehtml builds to work correctly, the same tags cannot be used
globally in any files.  These two tags, shared-slot-rn and capi2-rn, also
appear in skiboot-5.7.rst. To eliminate, the
tags had a suffix "-rc1" for both the definition and use of each tag.

Signed-off-by: Jeff Scheel <scheel@us.ibm.com>
[stewart: use 5.7 in tag just to be complete]
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agocore/exceptions: implement support for MCE interrupts in powersave
Nicholas Piggin [Mon, 7 Jan 2019 14:04:28 +0000 (00:04 +1000)] 
core/exceptions: implement support for MCE interrupts in powersave

The ISA specifies that MCE interrupts in power saving modes will enter
at 0x200 with powersave bits in SRR1 set. This is not currently
supported properly, the MCE will just happen like a normal interrupt,
but GPRs could be lost, which would lead to crashes (e.g., r1, r2, r13
etc).

So check the power save bits similarly to the sreset vector, and
handle this properly.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agocore/exceptions: allow recoverable sreset exceptions
Nicholas Piggin [Mon, 7 Jan 2019 14:04:27 +0000 (00:04 +1000)] 
core/exceptions: allow recoverable sreset exceptions

This requires implementing the MSR[RI] bit. Then just allow all
non-fatal sreset exceptions to recover.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agocore/exceptions: implement an exception handler for non-powersave sresets
Nicholas Piggin [Mon, 7 Jan 2019 14:04:26 +0000 (00:04 +1000)] 
core/exceptions: implement an exception handler for non-powersave sresets

Detect non-powersave sresets and send them to the normal exception
handler which prints registers and stack.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agoasm/head: sreset handler remove FIXUP_ENDIAN
Nicholas Piggin [Mon, 7 Jan 2019 14:04:25 +0000 (00:04 +1000)] 
asm/head: sreset handler remove FIXUP_ENDIAN

Remove FIXUP_ENDIAN from the normal sreset handler (not the fast
reboot handler), to prevent it from trashing registers and CFAR.

This mean sreset can be used to report a reliable register dump,
and even be recoverable. A watchdog could be implemented to
catch and diagnose stuck CPUs during boot using sreset.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agocore/fast-reboot: fast reboot specific sreset patch
Nicholas Piggin [Mon, 7 Jan 2019 14:04:24 +0000 (00:04 +1000)] 
core/fast-reboot: fast reboot specific sreset patch

Provide an sreset handler specifically for fast reboots, which allows
FIXUP_ENDIAN to be removed from the normal sreset handler in the next
patch.

The save_1 == 0 condition is no longer required to signal a fast
reboot.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agoasm/head: provide asm support for interrupts to be returned from
Nicholas Piggin [Mon, 7 Jan 2019 14:04:23 +0000 (00:04 +1000)] 
asm/head: provide asm support for interrupts to be returned from

This adds the redzone to the interrupt stack, and code to restore
registers.

This can be used for a number of things. Initially it will be used
to recover from system reset interrupts, it could later be used to
handle recoverable machine checks, use the decrementer to implement
a watchdog, handle HMI interrupts at boot, and to implement virtual
memory.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agocore/init: enable machine check on secondaries
Nicholas Piggin [Mon, 7 Jan 2019 14:04:22 +0000 (00:04 +1000)] 
core/init: enable machine check on secondaries

Secondary CPUs currently run with MSR[ME]=0 during boot, whih means
if they take a machine check, the system will checkstop.

Enable ME where possible and allow them to print registers.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agocore/fast-reboot: improve NMI handling during fast reset
Nicholas Piggin [Mon, 7 Jan 2019 14:04:21 +0000 (00:04 +1000)] 
core/fast-reboot: improve NMI handling during fast reset

Improve sreset and MCE handling in fast reboot. Switch the HILE bit
off before copying OPAL's exception vectors, so NMIs can be handled
properly. Also disable MSR[ME] while the vectors are being overwritten.

Some of the remaining problem cases are documented in comments.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
6 days agocore/init: rearrange final boot steps
Nicholas Piggin [Mon, 7 Jan 2019 14:04:20 +0000 (00:04 +1000)] 
core/init: rearrange final boot steps

Take secondaries out of sleep mode as late as possible, which tends to
help with simulator boot speeds. Make give_self_os() the last step
before starting the kernel, which matches the way secondaries behave.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
7 days agoasm/head: use HSRR exception registers in FIXUP_ENDIAN
Nicholas Piggin [Mon, 7 Jan 2019 14:04:18 +0000 (00:04 +1000)] 
asm/head: use HSRR exception registers in FIXUP_ENDIAN

Taken from the Linux FIXUP_ENDIAN_HV macro, use the HSRR registers in
FIXUP_ENDIAN. This allows the 0x100 exception handler (the single user
of the macro) to preserve SRR registers and potentially recover, debug,
or do something useful with them.

This also allows the maco to be used in code with MSR[RI]=1, if the need
arises.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
7 days agocore/exceptions: save current MSR in exception frame
Nicholas Piggin [Mon, 7 Jan 2019 14:04:17 +0000 (00:04 +1000)] 
core/exceptions: save current MSR in exception frame

Save and print the MSR of the interrupt context. This can be derived
from the interrupt type, SRR1, and other system register settings. But
it can be useful to quickly verify what's happening.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
7 days agocore/cpu: do not inline cpu_relax
Nicholas Piggin [Mon, 7 Jan 2019 14:04:16 +0000 (00:04 +1000)] 
core/cpu: do not inline cpu_relax

The added nops now push it up in size, and -Os uninlines it for every
compilation unit that calls it more than once, so it's much better to
just uninline.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
7 days agocore/init: rename setup_reset_vector
Nicholas Piggin [Mon, 7 Jan 2019 14:04:15 +0000 (00:04 +1000)] 
core/init: rename setup_reset_vector

Use the word copy, to match copy_exception_vectors.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
7 days agoexternal/mambo: allow CPU targeting for most debug utils
Nicholas Piggin [Mon, 7 Jan 2019 14:04:14 +0000 (00:04 +1000)] 
external/mambo: allow CPU targeting for most debug utils

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>
7 days agocore/cpu: HID update race
Nicholas Piggin [Mon, 7 Jan 2019 14:04:13 +0000 (00:04 +1000)] 
core/cpu: HID update race

If the per-core HID register is updated concurrently by multiple
threads, updates can get lost. This has been observed during fast
reboot where the HILE bit does not get cleared on all cores, which
can cause machine check exception interrupts to crash.

Fix this by only updating HID on thread0.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
8 days agoAdd PVR_TYPE_P9P
Reza Arbab [Sun, 10 Feb 2019 20:42:18 +0000 (14:42 -0600)] 
Add PVR_TYPE_P9P

Enable a new PVR to get us running on another p9 variant.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
8 days agoRevert "astbmc: Try IPMI HIOMAP for P8"
Joel Stanley [Thu, 7 Feb 2019 00:11:41 +0000 (10:41 +1030)] 
Revert "astbmc: Try IPMI HIOMAP for P8"

This reverts commit bd9839684d482417e8c60449592f4308e9a91dac as it broke
booting on P8 systems, including Garrison (AMI BMC), Firestone (AMI BMC)
and QEMU (BMC simulator).

Issue https://github.com/open-power/skiboot/issues/217 tracks the
failure. The P8 IPMI HIOMAP feature can be re-enabled once this issue is
resolved.

Reported-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
Reported-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Acked-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
Acked-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Acked-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
8 days agocpufeatures: Always advertise POWER8NVL as DD2
Alexey Kardashevskiy [Thu, 7 Feb 2019 00:41:28 +0000 (11:41 +1100)] 
cpufeatures: Always advertise POWER8NVL as DD2

Despite the major version of PVR being 1 (0x004c0100) for POWER8NVL,
these chips are functionally equalent to P8/P8E DD2 levels.

This advertises POWER8NVL as DD2. As the result, skiboot adds
ibm,powerpc-cpu-features/processor-control-facility for such CPUs and
the linux kernel can use hypervisor doorbell messages to wake secondary
threads; otherwise "KVM: CPU %d seems to be stuck" would appear because
of missing LPCR_PECEDH.

Fixes: 7f4c8e8ce0b "dt: add /cpus/ibm, powerpc-cpu-features device tree bindings"
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 weeks agoskiboot v6.0.16 release notes
Vasant Hegde [Thu, 31 Jan 2019 17:07:47 +0000 (22:37 +0530)] 
skiboot v6.0.16 release notes

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
[stewart: add in the extra patches I merged]
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
(cherry picked from commit 9e22b74601cc1d042c4d1d2027f545b4ae304ae8)
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 weeks agodoc: clarify OPAL_RTC_READ return values
Stewart Smith [Wed, 12 Dec 2018 04:21:52 +0000 (15:21 +1100)] 
doc: clarify OPAL_RTC_READ return values

It's a quirky call. There was some discussion ages ago surrounding the
fact that we barely document what it returns and when. So, umm... make
it slightly less terrible, but still terrible.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 weeks agocore/opal: Print PIR value in exit path
Vasant Hegde [Mon, 4 Feb 2019 06:03:18 +0000 (11:33 +0530)] 
core/opal: Print PIR value in exit path

Useful for debugging.

CC: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 weeks agocore/ipmi: Improve error message
Vasant Hegde [Mon, 4 Feb 2019 06:01:31 +0000 (11:31 +0530)] 
core/ipmi: Improve error message

Useful for debugging.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 weeks agocore/lock: Stop drop_my_locks() from always causing abort
Reza Arbab [Fri, 18 Jan 2019 20:01:19 +0000 (14:01 -0600)] 
core/lock: Stop drop_my_locks() from always causing abort

The loop in drop_my_locks() looks like this:

while((l = list_pop(&this_cpu()->locks_held, struct lock, list)) != NULL) {
if (warn)
prlog(PR_ERR, "  %s\n", l->owner);
unlock(l);
}

Both list_pop() and unlock() call list_del(). This means that on the
last iteration of the loop, the list will be empty when we get to
unlock_check(), causing this:

  LOCK ERROR: Releasing lock we don't hold depth @0x30493d20 (state: 0x0000000000000001)
  [13836.000173140,0] Aborting!
  CPU 0000 Backtrace:
   S: 0000000031c03930 R: 000000003001d840   ._abort+0x60
   S: 0000000031c039c0 R: 000000003001a0c4   .lock_error+0x64
   S: 0000000031c03a50 R: 0000000030019c70   .unlock+0x54
   S: 0000000031c03af0 R: 000000003001a040   .drop_my_locks+0xf4

To fix this, change list_pop() to list_top().

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 weeks agop9dsu: Fix p9dsu slot tables
Deb McLemore [Fri, 1 Feb 2019 00:26:35 +0000 (18:26 -0600)] 
p9dsu: Fix p9dsu slot tables

Set the attributes on the slot tables to account for
builtin or pluggable etypes, this will allow pci
enumeration to calculate subordinate buses.

Update some slot label strings.

Add WIO Slot5 which is standard on the ESS config.

Signed-off-by: Deb McLemore <debmc@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
3 weeks agop9dsu: Fix p9dsu default variant
Deb McLemore [Wed, 23 Jan 2019 03:17:48 +0000 (21:17 -0600)] 
p9dsu: Fix p9dsu default variant

Add the default when no riser_id is returned from the ipmi query.

This addresses: https://github.com/open-power/boston-openpower/issues/1369

Allow a little more time for BMC reply and cleanup some label strings.

Signed-off-by: Deb McLemore <debmc@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
3 weeks agoRemove POWER9N DD1 support
Nicholas Piggin [Wed, 16 Jan 2019 03:58:40 +0000 (13:58 +1000)] 
Remove POWER9N DD1 support

This is not a shipping product and is no longer supported by Linux
or other firmware components.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
3 weeks agoxive: remove POWER9N DD1 NVT table size workaround
Nicholas Piggin [Wed, 16 Jan 2019 03:58:41 +0000 (13:58 +1000)] 
xive: remove POWER9N DD1 NVT table size workaround

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
3 weeks agophb4: remove POWER9N DD1 creset workaround
Nicholas Piggin [Wed, 16 Jan 2019 03:58:42 +0000 (13:58 +1000)] 
phb4: remove POWER9N DD1 creset workaround

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
3 weeks agoSLW: Print verbose info on errors only
Akshay Adiga [Wed, 16 Jan 2019 09:25:36 +0000 (14:55 +0530)] 
SLW: Print verbose info on errors only

Change print level from debug to warning for reporting
bad EC_PPM_SPECIAL_WKUP_* scom values. To reduce cluttering
in the log print only on error.

Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
3 weeks agoSLW: Remove Idle state support tor Power8 DD1
Akshay Adiga [Wed, 16 Jan 2019 09:26:27 +0000 (14:56 +0530)] 
SLW: Remove Idle state support tor Power8 DD1

Removing init routines required for Power8 DD1, but was enabled for all
Power8 DD versions.

Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agop8dtu: Configure BMC graphics
Andrew Jeffery [Tue, 18 Dec 2018 00:22:47 +0000 (10:52 +1030)] 
p8dtu: Configure BMC graphics

We can no-longer read the values from the BMC in the way we have in the
past. Values were provided by Eric Chen of SMC.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agop8dtu: Enable HIOMAP support
Andrew Jeffery [Tue, 18 Dec 2018 00:22:46 +0000 (10:52 +1030)] 
p8dtu: Enable HIOMAP support

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agoastbmc: Try IPMI HIOMAP for P8
Andrew Jeffery [Tue, 18 Dec 2018 00:22:45 +0000 (10:52 +1030)] 
astbmc: Try IPMI HIOMAP for P8

The HIOMAP protocol was developed after the release of P8 in preparation
for P9. As a consequence P9 always uses it, but it has rarely been
enabled for P8. P8DTU has recently added IPMI HIOMAP support to its BMC
firmware, so enable its use in skiboot with P8 machines. Doing so
requires some rework to ensure fallback works correctly as in the past
the fallback was to mbox, which will only work for P9.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agozaius: zaius_ocapi can be static
Stewart Smith [Mon, 17 Dec 2018 07:28:10 +0000 (18:28 +1100)] 
zaius: zaius_ocapi can be static

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agozz: platform_ocapi can be static
Stewart Smith [Mon, 17 Dec 2018 07:28:09 +0000 (18:28 +1100)] 
zz: platform_ocapi can be static

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agosparse: Make tree 'constant is so big' warning clean
Stewart Smith [Mon, 17 Dec 2018 07:28:08 +0000 (18:28 +1100)] 
sparse: Make tree 'constant is so big' warning clean

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agoqemu: bt device isn't always hanging off /
Stewart Smith [Tue, 18 Dec 2018 00:57:10 +0000 (11:57 +1100)] 
qemu: bt device isn't always hanging off /

Just use the normal for_each_compatible instead.

Otherwise in the qemu model as executed by op-test,
we wouldn't go down the astbmc_init() path, thus not having flash.

Cc: stable # v6.2+
Fixes: 2f0b6af6e01c5f7b3c762647d06c4f792e2cb3b7
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agonpu2: Replace open coded dt_find_by_name_addr()
Reza Arbab [Wed, 9 Jan 2019 15:58:51 +0000 (09:58 -0600)] 
npu2: Replace open coded dt_find_by_name_addr()

We now have a dt function to do this. Use it.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agonpu2: Remove redundant assignment to p->phb_nvlink.scan_map
Reza Arbab [Wed, 9 Jan 2019 15:58:50 +0000 (09:58 -0600)] 
npu2: Remove redundant assignment to p->phb_nvlink.scan_map

In npu2_populate_devices(), we do

    p->phb_nvlink.scan_map |= 0x1 << ((dev->bdfn & 0xf8) >> 3);
    :

    dev->nvlink.pvd = pci_virt_add_device(&p->phb_nvlink, dev->bdfn, 0x100, dev);
    /* At this point, dev->nvlink.pvd->bdfn = dev->bdfn */

    if (dev->nvlink.pvd) {
        p->phb_nvlink.scan_map |= 0x1 << ((dev->nvlink.pvd->bdfn & 0xf8) >> 3);
        :
    }

Because dev->nvlink.pvd->bdfn equals dev->bdfn, the second assignment to
scan_map is redundant. Remove it.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agonpu2: Fix missing iteration in tce kill loop
Reza Arbab [Wed, 9 Jan 2019 15:58:49 +0000 (09:58 -0600)] 
npu2: Fix missing iteration in tce kill loop

When killing multiple pages, npu2_tce_kill() loops doing single page
kills, but never advances the address. Fix this.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agonpu2: Remove unused npu2_dev_nvlink::vendor_cap
Reza Arbab [Wed, 9 Jan 2019 15:58:48 +0000 (09:58 -0600)] 
npu2: Remove unused npu2_dev_nvlink::vendor_cap

This variable is never used. Remove it.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agonpu2: Remove unused npu2_dev::procedure_data
Reza Arbab [Wed, 9 Jan 2019 15:58:47 +0000 (09:58 -0600)] 
npu2: Remove unused npu2_dev::procedure_data

This variable is never used. Remove it.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agonpu2: Remove unused npu2::lxive_cache
Reza Arbab [Wed, 9 Jan 2019 15:58:46 +0000 (09:58 -0600)] 
npu2: Remove unused npu2::lxive_cache

This variable is never used. Remove it.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agonpu2: Remove unused npu2::bdf2pe_cache
Reza Arbab [Wed, 9 Jan 2019 15:58:45 +0000 (09:58 -0600)] 
npu2: Remove unused npu2::bdf2pe_cache

This cache is written but never read. Wiring it up would gain us little
(except added complexity), and it obviously hasn't been missed thus far,
so remove it altogether.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agonpu2: Remove dead code from npu2_cfg_write_bar()
Reza Arbab [Wed, 9 Jan 2019 15:58:44 +0000 (09:58 -0600)] 
npu2: Remove dead code from npu2_cfg_write_bar()

We assign pci_cmd, but it never gets used. Remove it.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agoRemove duplicate npu2-common.o from $(HW_OBJS)
Reza Arbab [Wed, 9 Jan 2019 15:58:43 +0000 (09:58 -0600)] 
Remove duplicate npu2-common.o from $(HW_OBJS)

We've listed npu2-common.o twice. Remove one.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agocapp/phb4: Prevent HMI from getting triggered when disabling CAPP
Vaibhav Jain [Sun, 13 Jan 2019 05:37:15 +0000 (11:07 +0530)] 
capp/phb4: Prevent HMI from getting triggered when disabling CAPP

While disabling CAPP an HMI gets triggered as soon as ETU is put in
reset mode. This is caused as before we can disabled CAPP, it detects
PHB link going down and triggers an HMI requesting Opal to perform
CAPP recovery. This has an un-intended side effect of spamming the
Opal logs with malfunction alert messages and may also confuse the
user.

To prevent this we mask the CAPP FIR error 'PHB Link Down' Bit(31)
when we are disabling CAPP just before we put ETU in reset in
phb4_creset(). Also now since bringing down the PHB link now wont
trigger an HMI and CAPP recovery, hence we manually set the
PHB4_CAPP_RECOVERY flag on the phb to force recovery during creset.

Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agophb4/capp: Implement sequence to disable CAPP and enable fast-reset
Vaibhav Jain [Sun, 13 Jan 2019 05:37:14 +0000 (11:07 +0530)] 
phb4/capp: Implement sequence to disable CAPP and enable fast-reset

We implement h/w sequence to disable CAPP in disable_capi_mode() and
with it also enable fast-reset for CAPI mode in phb4_set_capi_mode().

Sequence to disable CAPP is executed in three phases. The first two
phase is implemented in disable_capi_mode() where we reset the CAPP
registers followed by PEC registers to their init values. The final
third final phase is to reset the PHB CAPI Compare/Mask Register and
is done in phb4_init_ioda3(). The reason to move the PHB reset to
phb4_init_ioda3() is because by the time Opal PCI reset state machine
reaches this function the PHB is already un-fenced and its
configuration registers accessible via mmio.

Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agocapp/phb4: Introduce PHB4 flag, PHB4_CAPP_DISABLE to disable CAPP
Vaibhav Jain [Sun, 13 Jan 2019 05:37:13 +0000 (11:07 +0530)] 
capp/phb4: Introduce PHB4 flag, PHB4_CAPP_DISABLE to disable CAPP

This patch introduces a PHB4 flag PHB4_CAPP_DISABLE and scaffolding
necessary to handle it during CRESET flow. The flag is set when CAPP
is request to switch to PCIe mode via call to phb4_set_capi_mode()
with mode OPAL_PHB_CAPI_MODE_PCIE. This starts the below sequence that
ultimately ends in newly introduced phb4_slot_sm_run_completed()

1. Set PHB4_CAPP_DISABLE to phb4->flags.

2. Start a CRESET on the phb slot. This also starts the opal pci reset
state machine.

3. Wait for slot state to be PHB4_SLOT_CRESET_WAIT_CQ.

4. Perform CAPP recovery as PHB is still fenced, by calling
do_capp_recovery_scoms().

5. Call newly introduced 'disable_capi_mode()' to disable CAPP.

6. Wait for slot reset to complete while it transitions to
PHB4_SLOT_FRESET and optionally to PHB4_SLOT_LINK_START.

7. Once slot reset is complete opal pci-core state machine will call
slot->ops.completed_sm_run().

8. For PHB4 this branches newly introduced 'phb4_slot_sm_run_completed()'.

9. Inside this function we mark the CAPP as disabled and un-register
the opal syncer phb4_host_sync_reset().

10. Optionally if the slot reset was unsuccessful disable
fast-reboot.

****************************
Notes:
****************************
a. Function 'disable_capi_mode()' performs various sanity tests on CAPP to
to determine if its ok to disable it and perform necessary xscoms
to disable it. However the current implementation proposed in this
patch is a skeleton one that just does sanity tests. A followup patch
will be proposed that implements the xscoms necessary to disable CAPP.

b. The sequence expects that Opal PCI reset state machine makes
forward progress hence needs someone to call slot->ops.run_sm(). This
can be either from phb4_host_sync_reset() or opal_pci_poll().

Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agocapp/phb4: Force CAPP to PCIe mode during kernel shutdown
Vaibhav Jain [Sun, 13 Jan 2019 05:37:12 +0000 (11:07 +0530)] 
capp/phb4: Force CAPP to PCIe mode during kernel shutdown

This patch introduces a new opal syncer for PHB4 named
phb4_host_sync_reset(). We register this opal syncer when CAPP is
activated successfully in phb4_set_capi_mode() so that it will be
called at kernel shutdown during fast-reset.

During kernel shutdown the function will then repeatedly call
phb->ops->set_capi_mode() to switch switch CAPP to PCIe mode. In case
set_capi_mode() indicates its OPAL_BUSY, which indicates that CAPP is
still transitioning to new state; it calls slot->ops.run_sm() to
ensure that Opal slot reset state machine makes forward progress.

Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agophb4/capp: Update and re-factor phb4_set_capi_mode()
Vaibhav Jain [Sun, 13 Jan 2019 05:37:11 +0000 (11:07 +0530)] 
phb4/capp: Update and re-factor phb4_set_capi_mode()

Presently phb4_set_capi_mode() performs certain CAPP checks
like, checking of CAPP ucode loaded or checks if CAPP is still in
recovery, even when the requested mode is to switch to PCI mode.

Hence this patch updates and re-factors phb4_set_capi_mode() to make
sure CAPP related checks are only performed when request to enable
CAPP is made by mode==OPAL_PHB_CAPI_MODE_CAPI/DMA_TVT1. We also update
other possible modes requests to return a more appropriate status code
based on if CAPP is activated or not.

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agocapp/phb: Introduce 'struct capp' to hold capp related info in 'struct phb'
Vaibhav Jain [Sun, 13 Jan 2019 05:37:10 +0000 (11:07 +0530)] 
capp/phb: Introduce 'struct capp' to hold capp related info in 'struct phb'

Previously struct proc_chip member 'capp_phb3_attached_mask' was used
for Power-8 to keep track of PHB attached to the single CAPP on the
chip. CAPP on that chip supported a flexible PHB assignment
scheme. However since then new chips only support a static assignment
i.e a CAPP can only be attached to a specific PEC.

Hence instead of using 'proc_chip.capp_phb4_attached_mask' to manage
CAPP <-> PEC assignments which needs a global lock (capi_lock) to be
updated, we introduce a new struct named 'capp' a pointer to which
resides inside struct 'phb4'. Since updates to struct 'phb4' already
happen in context of phb_lock; this eliminates the
need to use mutex 'capi_lock' while updating
'capp_phb4_attached_mask'.

This struct is also used to hold CAPP specific variables such as
pointer to the 'struct phb' to which the CAPP is attached,
'capp_xscom_offset' which is the xscom offset to be added to CAPP
registers in case there are more than 1 on the chip, 'capp_index'
which is the index of the CAPP on the chip, and attached_pe' which is
the process endpoint index to which CAPP is attached. Finally member
'chip_id' holds the chip-id thats used for performing xscom
read/writes.

Also new helpers named capp_xscom_read()/write() are introduced to
make access to CAPP xscom registers easier.

Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agocore/pci: Introduce a new pci_slot_op named completed_sm_run()
Vaibhav Jain [Sun, 13 Jan 2019 05:37:09 +0000 (11:07 +0530)] 
core/pci: Introduce a new pci_slot_op named completed_sm_run()

At times we need to perform some cleanup activities when the Opal PCI
state machine that perform creset/freset/hreset (driven by
pci_slot_ops->run_sm which) of a slot completes. One example can be to
mark CAPP attached to a PHB, as deactivated when creset/freset of a
CAPI card slot is completed.

However the calls to pci_slot_ops->run_sm() is scattered through out
the code and patching each call site to check for the return value and
perform custom cleanup tacks is difficult.

Hence this patch introduces a new pci_slot_ops named
completed_sm_run() which should be called when pci_slot_ops->run_sm()
determines that the reset state machine is complete. This provides a
more centralized way to handle slot related cleanup activities.

Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
4 weeks agoopal: Update opal_del_host_sync_notifier() to accept 'void *data'
Vaibhav Jain [Sun, 13 Jan 2019 05:37:08 +0000 (11:07 +0530)] 
opal: Update opal_del_host_sync_notifier() to accept 'void *data'

Current implementation of opal_del_host_sync_notifier() will only
delete the first entry of the 'notify' callback found from opal_syncers
list irrespective of the 'data' of list-node. This is problematic when
multiple notifiers with same callback function but different 'data'
are registered. In this case when the cleanup code will call
opal_del_host_sync_notifier() it cannot be sure if correct opal_syncer
is removed.

Hence this patch updates the function to accept a new argument named
'void *data' which is then used to iterates over the opal_syncers list
and only remove the first node node having the matching value for
'notify' callback as 'data'.

Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoskiboot v6.0.15 release notes
Vasant Hegde [Fri, 14 Dec 2018 05:59:14 +0000 (11:29 +0530)] 
skiboot v6.0.15 release notes

[ Upstream commit 3bcfff5498b73bdd5697f2e4e0a8b414ad0ae680 ]

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoskiboot v6.2 release notes v6.2
Stewart Smith [Fri, 14 Dec 2018 05:30:09 +0000 (16:30 +1100)] 
skiboot v6.2 release notes

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoopal-ci: Drop fedora27, add fedora29
Stewart Smith [Thu, 29 Nov 2018 05:54:06 +0000 (16:54 +1100)] 
opal-ci: Drop fedora27, add fedora29

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoci: Bump Qemu version
Joel Stanley [Wed, 12 Dec 2018 05:02:58 +0000 (15:32 +1030)] 
ci: Bump Qemu version

This moves the qemu version to qemu-powernv-for-skiboot-7 which is based
on upstream's 3.1.0, and supports a Power9 machine.

It also includes a fix for the skiboot XSCOM errors:

 XSCOM: read error gcid=0x0 pcb_addr=0x1020013 stat=0x0

There is no modelling of the xscom behaviour but the reads/writes
now succeed which is enough for skiboot to not error out.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agotest: Update qemu arguments to use bmc simulator
Joel Stanley [Wed, 12 Dec 2018 05:02:57 +0000 (15:32 +1030)] 
test: Update qemu arguments to use bmc simulator

THe qemu skiboot platform as of 8340a9642bba ("plat/qemu: use the common
OpenPOWER routines to initialize") uses the common aspeed BMC setup
routines. This means a BT interface is always set up, and if the
corresponding Qemu model is not present the timeout is 30 seconds.

It looks like this every time an IPMI message is sent:

 BT: seq 0x9e netfn 0x06 cmd 0x31: Maximum queue length exceeded
 BT: seq 0x9d netfn 0x06 cmd 0x31: Removed from queue
 BT: seq 0x9f netfn 0x06 cmd 0x31: Maximum queue length exceeded
 BT: seq 0x9e netfn 0x06 cmd 0x31: Removed from queue
 BT: seq 0xa0 netfn 0x06 cmd 0x31: Maximum queue length exceeded
 BT: seq 0x9f netfn 0x06 cmd 0x31: Removed from queue

Avoid this by adding the bmc simulator model to the Qemu powernv
machine.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoci: Add opal-utils to Debian unstable
Joel Stanley [Wed, 12 Dec 2018 05:02:56 +0000 (15:32 +1030)] 
ci: Add opal-utils to Debian unstable

This puts a 'pflash' in the users PATH, allowing more test coverage of
ffspart.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoci: Drop P8 mambo from Debian unstable
Joel Stanley [Wed, 12 Dec 2018 05:02:55 +0000 (15:32 +1030)] 
ci: Drop P8 mambo from Debian unstable

Debian Unstable has removed OpenSSL 1.0.0 from the repository so mambo
no longer runs:

  /opt/ibm/systemsim-p8/bin/systemsim-pegasus: error while loading shared
  libraries: libcrypto.so.1.0.0: cannot open shared object file: No such
  file or directory

By removing it from the container these tests will be automatically
skipped.

Tracked in https://github.com/open-power/op-build/issues/2519

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoci: Add dtc dependencies for rawhide
Joel Stanley [Wed, 12 Dec 2018 05:02:54 +0000 (15:32 +1030)] 
ci: Add dtc dependencies for rawhide

Both F28 and Rawhide build their own dtc version. Rawhide was missing
the required build deps.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoci: Update Debian unstable packages
Joel Stanley [Wed, 12 Dec 2018 05:02:53 +0000 (15:32 +1030)] 
ci: Update Debian unstable packages

This syncs Debian unstable with Ubuntu 18.04 in order to get the clang
package. It also adds qemu to the Debian install, which makes sense
Debian also has 2.12.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoci: Use Ubuntu latest config for Debian unstable
Joel Stanley [Wed, 12 Dec 2018 05:02:52 +0000 (15:32 +1030)] 
ci: Use Ubuntu latest config for Debian unstable

Debian unstable has the same GCOV issue with 8.2 as Ubuntu latest so it
makes sense to share configurations there.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoci: Disable GCOV builds in ubuntu-latest
Joel Stanley [Wed, 12 Dec 2018 05:02:51 +0000 (15:32 +1030)] 
ci: Disable GCOV builds in ubuntu-latest

They are known to be broken with GCC 8.2:

 https://github.com/open-power/skiboot/issues/206

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoci: Update gcov comment in Fedora 28
Joel Stanley [Wed, 12 Dec 2018 05:02:50 +0000 (15:32 +1030)] 
ci: Update gcov comment in Fedora 28

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoplat/qemu: fix platform initialization when the BT device is not present
Cédric Le Goater [Wed, 12 Dec 2018 08:25:26 +0000 (09:25 +0100)] 
plat/qemu: fix platform initialization when the BT device is not present

A QEMU PowerNV machine does not necessarily have a BT device. It needs
to be defined on the command line with :

  -device ipmi-bmc-sim,id=bmc0 -device isa-ipmi-bt,bmc=bmc0,irq=10

When the QEMU platform is initialized by skiboot, we need to check
that such a device is present and if not, skip the AST initialization.

Fixes: 8340a9642bba ("plat/qemu: use the common OpenPOWER routines to initialize")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoi2c: Fix i2c request hang during opal init if timers are not checked
Frederic Barrat [Thu, 29 Nov 2018 18:17:17 +0000 (19:17 +0100)] 
i2c: Fix i2c request hang during opal init if timers are not checked

If an i2c request cannot go through the first time, because the bus is
found in error and need a reset or it's locked by the OCC for example,
the underlying i2c implementation is using timers to manage the
request. However during opal init, opal pollers may not be called, it
depends in the context in which the i2c request is made. If the
pollers are not called, the timers are not checked and we can end up
with an i2c request which will not move foward and skiboot hangs.

Fix it by explicitly checking the timers if we are waiting for an i2c
request to complete and it seems to be taking a while.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoopal-prd: hservice: Enable hservice->wakeup() in BMC
Shilpasri G Bhat [Tue, 13 Nov 2018 05:28:54 +0000 (10:58 +0530)] 
opal-prd: hservice: Enable hservice->wakeup() in BMC

This patch enables HBRT to use HYP special wakeup register in openBMC
which until now was only used in FSP based machines.

This patch also adds a capability check for opal-prd so that HBRT can
decide if the host special wakeup register can be used.

Fixes: 49999302251b("opal-prd: Add support for runtime OCC reset in ZZ")
Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoffspart: Support flashing already ECC protected images
Stewart Smith [Mon, 10 Dec 2018 06:48:49 +0000 (17:48 +1100)] 
ffspart: Support flashing already ECC protected images

We do this by assuming filenames with '.ecc' in them are already ECC
protected.

This solves a practical problem in transitioning op-build to use ffspart
for pnor assembly rather than three perl scripts and a lot of XML.

We also update the ffspart tests to take into account ECC requirements.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoffspart: Increase MAX_LINE to above PATH_MAX
Stewart Smith [Mon, 3 Dec 2018 00:19:36 +0000 (11:19 +1100)] 
ffspart: Increase MAX_LINE to above PATH_MAX

Otherwise we saw failures in CI and the ~221 character paths Jankins
likes to have.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agolibflash/file: greatly increase perf of file_erase()
Stewart Smith [Mon, 3 Dec 2018 00:05:42 +0000 (11:05 +1100)] 
libflash/file: greatly increase perf of file_erase()

Do 4096 byte chunks not 8 byte chunks. A ffspart invocation constructing
a 64MB PNOR goes from a couple of seconds to ~0.1seconds with this
patch.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoRevert "npu2: Allow ATSD for LPAR other than 0"
Stewart Smith [Wed, 12 Dec 2018 03:49:23 +0000 (14:49 +1100)] 
Revert "npu2: Allow ATSD for LPAR other than 0"

This reverts commit d8b161f4b361f70a7bb43be47d4a32b8f937287a.
As discussed on list, a bit premature to merge, removing for now.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agohw/bt.c: Move some debug ifdef to make static analysis happy
Stewart Smith [Thu, 29 Nov 2018 04:28:33 +0000 (15:28 +1100)] 
hw/bt.c: Move some debug ifdef to make static analysis happy

Okay, so maybe the static analysis warning is all useless, and maybe
having the ifdef around a call is actually useful. I'll take the less
noise in my CI static analysis thing.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agohdata/iohub.c: remove condition that was always true
Stewart Smith [Thu, 29 Nov 2018 04:28:32 +0000 (15:28 +1100)] 
hdata/iohub.c: remove condition that was always true

Caught by static analysis. The previous if() condition was ensuring lxr
was not null, so we don't need this additional check.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agovpd: Force static analysis to not think about NULL term strings
Stewart Smith [Thu, 29 Nov 2018 04:28:31 +0000 (15:28 +1100)] 
vpd: Force static analysis to not think about NULL term strings

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoopal_sync_host_reboot: clarify when we return OPAL_BUSY_EVENT
Stewart Smith [Thu, 29 Nov 2018 04:28:30 +0000 (15:28 +1100)] 
opal_sync_host_reboot: clarify when we return OPAL_BUSY_EVENT

Basically to shut up static analysis of using a boolean in a non-boolean
context (bitwise).

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
2 months agoopal_trace_entry: Move ifdef around to shut up static analysis
Stewart Smith [Thu, 29 Nov 2018 04:28:29 +0000 (15:28 +1100)] 
opal_trace_entry: Move ifdef around to shut up static analysis

Again, this makes things look slightly different so I don't keep seeing
the static analysis warning.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>