Re: [PATCH v5 04/27] cxl: Add cxl_reset_dvsec_sequence() for vfio-pci
From: Jonathan Cameron
Date: Fri Sep 25 2026 - 16:41:43 EST
On Thu, 17 Sep 2026 00:05:17 +0530
<mhonap@xxxxxxxxxx> wrote:
> From: Manish Honap <mhonap@xxxxxxxxxx>
>
> vfio-pci needs to run a CXL reset on a passed-through Type-2 device
> without the host-memory handling in cxl_reset_function(): the memory
> behind the decoder belongs to the guest, so the HDM range collection and
> host CPU cache flush that the host path performs must be skipped.
Hi Manish,
This cache flush being skipped bit concerns me. Who is issuing the
necessary flushes in the vfio case? That is there to ensure we don't
end up with random lines cached by PA (as well as VA if relevant),
so they affect a guest just as much as the host.
I'm not sure why it makes any difference who the memory belongs to.
>
> Add cxl_reset_dvsec_sequence(), which runs the DVSEC reset under the
> device lock and restores HDM state through
> cxl_restore_state_after_pci_reset(), and cxl_reset_capable() to gate it on
> a function-scoped reset. Both are exported to the vfio-cxl module so
> vfio-pci core does not import the CXL namespace.
>
> CXL Reset always clears memory, so there is no caller Memory Clear choice.
>
> Assisted-by: LLM
> Signed-off-by: Manish Honap <mhonap@xxxxxxxxxx>