On 1/12/24 01:13, Jiqian Chen wrote:
> When a device has been reset on dom0 side, the vpci on Xen
> side won't get notification, so the cached state in vpci is
> all out of date compare with the real device state.
> To solve that problem, add a new hypercall to clear all vpci
> device state. When the state of device is reset on dom0 side,
> dom0 can call this hypercall to notify vpci.
> 
> Co-developed-by: Huang Rui <[email protected]>
> Signed-off-by: Jiqian Chen <[email protected]>

Reviewed-by: Stewart Hildebrand <[email protected]>

If you send another version, the RFC tag may be dropped.

One thing to keep an eye out for below (not requesting any changes).

> ---
> diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
> index 72ef277c4f8e..c6df2c6a9561 100644
> --- a/xen/drivers/vpci/vpci.c
> +++ b/xen/drivers/vpci/vpci.c
> @@ -107,6 +107,16 @@ int vpci_add_handlers(struct pci_dev *pdev)
>  
>      return rc;
>  }
> +
> +int vpci_reset_device_state(struct pci_dev *pdev)
> +{
> +    ASSERT(pcidevs_locked());
> +    ASSERT(rw_is_write_locked(&pdev->domain->pci_lock));
> +
> +    vpci_remove_device(pdev);
> +    return vpci_add_handlers(pdev);

Note that these two functions may be renamed soon by the patch at [1].
Whichever patch goes in later will need to be rebased to account for the
rename.

[1] https://lists.xenproject.org/archives/html/xen-devel/2024-02/msg00134.html

> +}
> +
>  #endif /* __XEN__ */
>  
>  static int vpci_register_cmp(const struct vpci_register *r1,


Reply via email to