Something like this is the way I'd been wanting to refactor nested hv. The state load/store functions and data is (somewhat) abstracted, and the hcall interface remains in the hcall handlers.
If, hypothetically, you had a new flavour of nested enter hcall that had some other way of specifying the L2 state to load, then you would (hopefully) be able to extend and reuse the state struct and load/store helpers. Thanks, Nick Nicholas Piggin (4): spapr: H_ENTER_NESTED should restore host XER ca field spapr: Add a nested state struct spapr: load and store l2 state with helper functions spapr: Move spapr nested HV to a new file hw/ppc/meson.build | 1 + hw/ppc/spapr_hcall.c | 348 +--------------------- hw/ppc/spapr_nested.c | 496 ++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 61 +--- include/hw/ppc/spapr_cpu_core.h | 5 +- 5 files changed, 502 insertions(+), 409 deletions(-) create mode 100644 hw/ppc/spapr_nested.c -- 2.40.1