dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: do not use passthrough mode in Xen dom0
@ 2022-04-26 23:57 Marek Marczykowski-Górecki
  2022-04-27 14:47 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Marczykowski-Górecki @ 2022-04-26 23:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Lijo Lazar, open list:DRM DRIVERS, Guchun Chen, David Airlie,
	Bokun Zhang, Jingwen Chen, Pan, Xinhui,
	Marek Marczykowski-Górecki, stable, Victor Skvortsov,
	Michel Dänzer, open list:RADEON and AMDGPU DRM DRIVERS,
	Bernard Zhao, Alex Deucher, Candice Li, Christian König,
	Hawking Zhang

While technically Xen dom0 is a virtual machine too, it does have
access to most of the hardware so it doesn't need to be considered a
"passthrough". Commit b818a5d37454 ("drm/amdgpu/gmc: use PCI BARs for
APUs in passthrough") changed how FB is accessed based on passthrough
mode. This breaks amdgpu in Xen dom0 with message like this:

    [drm:dc_dmub_srv_wait_idle [amdgpu]] *ERROR* Error waiting for DMUB idle: status=3

While the reason for this failure is unclear, the passthrough mode is
not really necessary in Xen dom0 anyway. So, to unbreak booting affected
kernels, disable passthrough mode in this case.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1985
Fixes: b818a5d37454 ("drm/amdgpu/gmc: use PCI BARs for APUs in passthrough")
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index a025f080aa6a..5e3756643da3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 
 #include <drm/drm_drv.h>
+#include <xen/xen.h>
 
 #include "amdgpu.h"
 #include "amdgpu_ras.h"
@@ -710,7 +711,8 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
 		adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
 
 	if (!reg) {
-		if (is_virtual_machine())	/* passthrough mode exclus sriov mod */
+		/* passthrough mode exclus sriov mod */
+		if (is_virtual_machine() && !xen_initial_domain())
 			adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
 	}
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: do not use passthrough mode in Xen dom0
  2022-04-26 23:57 [PATCH] drm/amdgpu: do not use passthrough mode in Xen dom0 Marek Marczykowski-Górecki
@ 2022-04-27 14:47 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2022-04-27 14:47 UTC (permalink / raw)
  To: Marek Marczykowski-Górecki
  Cc: Pan, Xinhui, Guchun Chen, David Airlie, Bokun Zhang,
	Jingwen Chen, Lijo Lazar, LKML, open list:DRM DRIVERS,
	Christian König, Michel Dänzer, for 3.8, Bernard Zhao,
	Alex Deucher, Victor Skvortsov,
	open list:RADEON and AMDGPU DRM DRIVERS, Candice Li,
	Hawking Zhang

Applied.  Thanks!

Alex

On Wed, Apr 27, 2022 at 3:12 AM Marek Marczykowski-Górecki
<marmarek@invisiblethingslab.com> wrote:
>
> While technically Xen dom0 is a virtual machine too, it does have
> access to most of the hardware so it doesn't need to be considered a
> "passthrough". Commit b818a5d37454 ("drm/amdgpu/gmc: use PCI BARs for
> APUs in passthrough") changed how FB is accessed based on passthrough
> mode. This breaks amdgpu in Xen dom0 with message like this:
>
>     [drm:dc_dmub_srv_wait_idle [amdgpu]] *ERROR* Error waiting for DMUB idle: status=3
>
> While the reason for this failure is unclear, the passthrough mode is
> not really necessary in Xen dom0 anyway. So, to unbreak booting affected
> kernels, disable passthrough mode in this case.
>
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1985
> Fixes: b818a5d37454 ("drm/amdgpu/gmc: use PCI BARs for APUs in passthrough")
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index a025f080aa6a..5e3756643da3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -24,6 +24,7 @@
>  #include <linux/module.h>
>
>  #include <drm/drm_drv.h>
> +#include <xen/xen.h>
>
>  #include "amdgpu.h"
>  #include "amdgpu_ras.h"
> @@ -710,7 +711,8 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
>                 adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
>
>         if (!reg) {
> -               if (is_virtual_machine())       /* passthrough mode exclus sriov mod */
> +               /* passthrough mode exclus sriov mod */
> +               if (is_virtual_machine() && !xen_initial_domain())
>                         adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
>         }
>
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-27 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 23:57 [PATCH] drm/amdgpu: do not use passthrough mode in Xen dom0 Marek Marczykowski-Górecki
2022-04-27 14:47 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).