[Skiboot] [PATCH v3 00/11] MBOX Protocol: Onwards to V3

Cyril Bur cyril.bur at au1.ibm.com
Tue Dec 5 12:01:02 AEDT 2017

This is a respin of V2. The only real change I made is that we're
using a compile time check to ensure that the handler arrays are big
enough. This should catch mistakes when adding commands in the future.
The merged v3 spec used different command numbers than I expected, so
v2 did need a respin, I adjusted the constants.

There are still caveats. There is currently no BMC v3 daemon. I have
tested it against a proof of concept by Suraj but that is quite
rudimentary testing at best.

This series doesn't implement all of the V3 protocol. Skiboot doesn't
actually need to implement all of the protocol. If it isn't going to
use a command, it really doesn't need to have code for it. A future
patch can implement the functionality if we decide we want/need it.

V2 cover-letter below.

Firstly, let me apologise for the amount of rework in this series.
Ultimately the goal here was really the last three patches.
Unfortunately in the process of writing them I started thinking about
some of the problems in version 2.

The easiest to address is a bug that came up in testing V3 which is
that if opening a window fails, skiboot will assume that the previously
opened window is still valid this is incorrect. Patch 2 address this

Then I got to thinking about errors and timeouts. It turns out that
currently if mbox-flash decides a message times out, it will not be
able to send anymore due to the lpc-mbox driver needing a response for
every message it sent out - patch 4 deals with this. However after
writing a significantly less invasive fix I realised that the entire
handling of timeouts/retries/resends/late responses was racey. So a
much simpler version of patch 4 became patches 3-6.

Then there was some extra version 2 stuff that wasn't necessary but is
nice to have - patch 7.

Then on to actually implementing version 3 - at the time of writing
version 2 Suraj did suggest what has become patch 8. This actually
makes the version 3 patch - patch 9 very easy.

The final patch is an extended, reworked and even more improved
version of the tests I sent with version 2 (which weren't merged at
the time)

One final note: this series passes all the tests I can throw at it
however I do not have reliable access to a MBOX version 3 Daemon
running on real hardware. Suraj has been kind enough to use (very)
similar versions of this series in his testing and he informs me that
there are no problems, however this exact code has never run on real

Cyril Bur (11):
  libflash/mbox-flash: Add v2 error codes
  libflash/mbox-flash: Always close windows before opening a new window
  libflash/mbox-flash: Move sequence handling to driver level
  libflash/mbox-flash: Allow mbox-flash to tell the driver msg timeouts
  hw/lpc-mbox: Simplify message bookkeeping and timeouts
  libflash/mbox-flash: Simplify message sending
  libflash/mbox-flash: Use BMC suggested timeout value
  libflash/mbox-flash: Use static arrays of function pointers
  libflash/mbox-flash: Understand v3
  libflash/mbox-flash: Add the ability to lock flash
  libflash/test: Add tests for mbox-flash

 .gitignore                   |   1 +
 hw/lpc-mbox.c                |  53 +++--
 include/lpc-mbox.h           |  10 +-
 include/skiboot.h            |   2 +
 libflash/mbox-flash.c        | 420 ++++++++++++++++++++++--------------
 libflash/mbox-flash.h        |   1 +
 libflash/test/Makefile.check |  17 +-
 libflash/test/mbox-server.c  | 499 +++++++++++++++++++++++++++++++++++++++++++
 libflash/test/mbox-server.h  |  10 +
 libflash/test/stubs.c        |  78 ++++++-
 libflash/test/stubs.h        |  27 +++
 libflash/test/test-mbox.c    | 341 +++++++++++++++++++++++++++++
 12 files changed, 1268 insertions(+), 191 deletions(-)
 create mode 100644 libflash/test/mbox-server.c
 create mode 100644 libflash/test/mbox-server.h
 create mode 100644 libflash/test/stubs.h
 create mode 100644 libflash/test/test-mbox.c


More information about the Skiboot mailing list