spapr: nvdimm: Implement H_SCM_FLUSH hcall
commitb5513584a08db477160ea7f0b700a2367028720c
authorShivaprasad G Bhat <sbhat@linux.ibm.com>
Fri, 18 Feb 2022 07:34:14 +0000 (18 08:34 +0100)
committerCédric Le Goater <clg@kaod.org>
Fri, 18 Feb 2022 07:34:14 +0000 (18 08:34 +0100)
tree8b2bdbc7797bc846ef47e167b6500d7c44f0b605
parent3e35960bf130f759c1b6d72f6a8c08039c08ec16
spapr: nvdimm: Implement H_SCM_FLUSH hcall

The patch adds support for the SCM flush hcall for the nvdimm devices.
To be available for exploitation by guest through the next patch. The
hcall is applicable only for new SPAPR specific device class which is
also introduced in this patch.

The hcall expects the semantics such that the flush to return with
H_LONG_BUSY_ORDER_10_MSEC when the operation is expected to take longer
time along with a continue_token. The hcall to be called again by providing
the continue_token to get the status. So, all fresh requests are put into
a 'pending' list and flush worker is submitted to the thread pool. The
thread pool completion callbacks move the requests to 'completed' list,
which are cleaned up after collecting the return status for the guest
in subsequent hcall from the guest.

The semantics makes it necessary to preserve the continue_tokens and
their return status across migrations. So, the completed flush states
are forwarded to the destination and the pending ones are restarted
at the destination in post_load. The necessary nvdimm flush specific
vmstate structures are also introduced in this patch which are to be
saved in the new SPAPR specific nvdimm device to be introduced in the
following patch.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <164396254862.109112.16675611182159105748.stgit@ltczzess4.aus.stglabs.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
hw/ppc/spapr.c
hw/ppc/spapr_nvdimm.c
include/hw/ppc/spapr.h
include/hw/ppc/spapr_nvdimm.h