[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJt9su1k67KEFh6K@kroah.com>
Date: Wed, 12 May 2021 09:03:14 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Connor Davis <connojdavis@...il.com>
Cc: Mathias Nyman <mathias.nyman@...el.com>,
xen-devel@...ts.xenproject.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] usb: xhci: Notify xen when DbC is unsafe to use
On Tue, May 11, 2021 at 06:18:21PM -0600, Connor Davis wrote:
> When running as a dom0 guest on Xen, check if the USB3 debug
> capability is enabled before xHCI reset, suspend, and resume. If it
> is, call xen_dbgp_reset_prep() to notify Xen that it is unsafe to touch
> MMIO registers until the next xen_dbgp_external_startup().
>
> This notification allows Xen to avoid undefined behavior resulting
> from MMIO access when the host controller's CNR bit is set or when
> the device transitions to D3hot.
>
> Signed-off-by: Connor Davis <connojdavis@...il.com>
> ---
> drivers/usb/host/xhci-dbgcap.h | 6 ++++
> drivers/usb/host/xhci.c | 57 ++++++++++++++++++++++++++++++++++
> drivers/usb/host/xhci.h | 1 +
> 3 files changed, 64 insertions(+)
>
> diff --git a/drivers/usb/host/xhci-dbgcap.h b/drivers/usb/host/xhci-dbgcap.h
> index c70b78d504eb..24784b82a840 100644
> --- a/drivers/usb/host/xhci-dbgcap.h
> +++ b/drivers/usb/host/xhci-dbgcap.h
> @@ -227,4 +227,10 @@ static inline int xhci_dbc_resume(struct xhci_hcd *xhci)
> return 0;
> }
> #endif /* CONFIG_USB_XHCI_DBGCAP */
> +
> +#ifdef CONFIG_XEN_DOM0
> +int xen_dbgp_reset_prep(struct usb_hcd *hcd);
> +int xen_dbgp_external_startup(struct usb_hcd *hcd);
> +#endif /* CONFIG_XEN_DOM0 */
> +
> #endif /* __LINUX_XHCI_DBGCAP_H */
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index ca9385d22f68..afe44169183f 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -37,6 +37,57 @@ static unsigned long long quirks;
> module_param(quirks, ullong, S_IRUGO);
> MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
>
> +#ifdef CONFIG_XEN_DOM0
> +#include <xen/xen.h>
<snip>
Can't this #ifdef stuff go into a .h file?
thanks,
greg k-h
Powered by blists - more mailing lists