qemu/include/hw/ppc
Michael Roth 6787d27b04 spapr: add option vector handling in CAS-generated resets
In some cases, ibm,client-architecture-support calls can fail. This
could happen in the current code for situations where the modified
device tree segment exceeds the buffer size provided by the guest
via the call parameters. In these cases, QEMU will reset, allowing
an opportunity to regenerate the device tree from scratch via
boot-time handling. There are potentially other scenarios as well,
not currently reachable in the current code, but possible in theory,
such as cases where device-tree properties or nodes need to be removed.

We currently don't handle either of these properly for option vector
capabilities however. Instead of carrying the negotiated capability
beyond the reset and creating the boot-time device tree accordingly,
we start from scratch, generating the same boot-time device tree as we
did prior to the CAS-generated and the same device tree updates as we
did before. This could (in theory) cause us to get stuck in a reset
loop. This hasn't been observed, but depending on the extensiveness
of CAS-induced device tree updates in the future, could eventually
become an issue.

Address this by pulling capability-related device tree
updates resulting from CAS calls into a common routine,
spapr_dt_cas_updates(), and adding an sPAPROptionVector*
parameter that allows us to test for newly-negotiated capabilities.
We invoke it as follows:

1) When ibm,client-architecture-support gets called, we
   call spapr_dt_cas_updates() with the set of capabilities
   added since the previous call to ibm,client-architecture-support.
   For the initial boot, or a system reset generated by something
   other than the CAS call itself, this set will consist of *all*
   options supported both the platform and the guest. For calls
   to ibm,client-architecture-support immediately after a CAS-induced
   reset, we call spapr_dt_cas_updates() with only the set
   of capabilities added since the previous call, since the other
   capabilities will have already been addressed by the boot-time
   device-tree this time around. In the unlikely event that
   capabilities are *removed* since the previous CAS, we will
   generate a CAS-induced reset. In the unlikely event that we
   cannot fit the device-tree updates into the buffer provided
   by the guest, well generate a CAS-induced reset.

2) When a CAS update results in the need to reset the machine and
   include the updates in the boot-time device tree, we call the
   spapr_dt_cas_updates() using the full set of negotiated
   capabilities as part of the reset path. At initial boot, or after
   a reset generated by something other than the CAS call itself,
   this set will be empty, resulting in what should be the same
   boot-time device-tree as we generated prior to this patch. For
   CAS-induced reset, this routine will be called with the full set of
   capabilities negotiated by the platform/guest in the previous
   CAS call, which should result in CAS updates from previous call
   being accounted for in the initial boot-time device tree.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
[dwg: Changed an int -> bool conversion to be more explicit]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2016-10-28 09:38:26 +11:00
..
fdt.h ppc: do not redefine CPUPPCState 2016-09-13 19:09:44 +02:00
mac_dbdma.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
openpic.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
pnv_core.h ppc/pnv: add XSCOM handlers to PnvCore 2016-10-28 09:38:25 +11:00
pnv_lpc.h ppc/pnv: add a LPC controller 2016-10-28 09:38:25 +11:00
pnv_xscom.h ppc/pnv: add a LPC controller 2016-10-28 09:38:25 +11:00
pnv.h ppc/pnv: add a ISA bus 2016-10-28 09:38:25 +11:00
ppc4xx.h Remove unused function declarations 2016-09-15 15:32:22 +03:00
ppc_e500.h intc/openpic: Build openpic only once 2013-07-09 21:33:02 +02:00
ppc.h ppc: parse cpu features once 2016-08-13 17:32:58 +10:00
spapr_cpu_core.h spapr: Introduce sPAPRCPUCoreClass 2016-09-23 12:39:06 +10:00
spapr_drc.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
spapr_ovec.h spapr_hcall: use spapr_ovec_* interfaces for CAS options 2016-10-28 09:38:26 +11:00
spapr_rtas.h tests: add RTAS command in the protocol 2016-09-23 10:29:40 +10:00
spapr_vio.h pseries: Consolidate construction of /vdevice device tree node 2016-10-28 09:38:26 +11:00
spapr.h spapr: add option vector handling in CAS-generated resets 2016-10-28 09:38:26 +11:00
xics.h pseries: Move construction of /interrupt-controller fdt node 2016-10-28 09:38:26 +11:00