All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Michael Labriola <michael.d.labriola@gmail.com>, xen-devel@lists.xen.org
Subject: Re: Upstream Dom0 DRM problems regarding swiotlb
Date: Wed, 13 Feb 2019 11:56:57 -0500	[thread overview]
Message-ID: <20190213165657.GD22883@char.us.oracle.com> (raw)
In-Reply-To: <5C64413C0200007800216656@prv1-mh.provo.novell.com>

On Wed, Feb 13, 2019 at 09:09:32AM -0700, Jan Beulich wrote:
> >>> On 13.02.19 at 17:00, <michael.d.labriola@gmail.com> wrote:
> > On Wed, Feb 13, 2019 at 9:28 AM Jan Beulich <JBeulich@suse.com> wrote:
> >> >>> On 13.02.19 at 15:10, <michael.d.labriola@gmail.com> wrote:
> >> > Ah, so this isn't necessarily Xen-specific but rather any paravirtual
> >> > guest?  That hadn't crossed my mind.  Is there an easy way to find out
> >> > if we're a pv guest in the need_swiotlb conditionals?
> >>
> >> There's xen_pv_domain(), but I think xen_swiotlb would be more to
> >> the point if the check is already to be Xen-specific. There's no generic
> >> "is PV" predicate that I'm aware of.
> > 
> > Well, that makes doing conditional code right more difficult.  I
> > assume since there isn't a generic predicate, and PV isn't new, that
> > it's absence is by design?  To reign in the temptation to sprinkle
> > conditional code all over the kernel?  ;-)
> 
> Well, with lguest gone, Xen is the only PV environment the kernel
> can run in, afaik at least. I guess to decide between the suggested
> options or the need for some abstracting macro (or yet something
> else), you'll really need to ask the driver maintainers. Or simply
> send a patch their way implementing one of them, and see what
> their reaction is.

Could you try this out and see if it works and I will send it out:



diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index 9fc3296592fe..96bf1df0ed28 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -23,6 +23,7 @@
 #include <linux/firmware.h>
 #include <drm/drmP.h>
 #include <drm/drm_cache.h>
+#include <xen/xen.h>
 #include "amdgpu.h"
 #include "gmc_v6_0.h"
 #include "amdgpu_ucode.h"
@@ -887,6 +888,8 @@ static int gmc_v6_0_sw_init(void *handle)
 		dev_warn(adev->dev, "amdgpu: No coherent DMA available.\n");
 	}
 	adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
+	if (xen_pv_domain())
+		adev->need_swiotlb = 1;
 
 	r = gmc_v6_0_init_microcode(adev);
 	if (r) {
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 761dcfb2fec0..710ac0ece1b0 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -23,6 +23,7 @@
 #include <linux/firmware.h>
 #include <drm/drmP.h>
 #include <drm/drm_cache.h>
+#include <xen/xen.h>
 #include "amdgpu.h"
 #include "cikd.h"
 #include "cik.h"
@@ -1031,6 +1032,8 @@ static int gmc_v7_0_sw_init(void *handle)
 		pr_warn("amdgpu: No coherent DMA available\n");
 	}
 	adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
+	if (xen_pv_domain())
+		adev->need_swiotlb = 1;
 
 	r = gmc_v7_0_init_microcode(adev);
 	if (r) {
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 1ad7e6b8ed1d..c418a129bb32 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -23,6 +23,7 @@
 #include <linux/firmware.h>
 #include <drm/drmP.h>
 #include <drm/drm_cache.h>
+#include <xen/xen.h>
 #include "amdgpu.h"
 #include "gmc_v8_0.h"
 #include "amdgpu_ucode.h"
@@ -1156,6 +1157,8 @@ static int gmc_v8_0_sw_init(void *handle)
 		pr_warn("amdgpu: No coherent DMA available\n");
 	}
 	adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
+	if (xen_pv_domain())
+		adev->need_swiotlb = 1;
 
 	r = gmc_v8_0_init_microcode(adev);
 	if (r) {
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index bacdaef77b6c..85c0762c37ae 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -22,6 +22,7 @@
  */
 #include <linux/firmware.h>
 #include <drm/drm_cache.h>
+#include <xen/xen.h>
 #include "amdgpu.h"
 #include "gmc_v9_0.h"
 #include "amdgpu_atomfirmware.h"
@@ -1004,6 +1005,8 @@ static int gmc_v9_0_sw_init(void *handle)
 		printk(KERN_WARNING "amdgpu: No coherent DMA available.\n");
 	}
 	adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
+	if (xen_pv_domain())
+		adev->need_swiotlb = 1;
 
 	if (adev->gmc.xgmi.supported) {
 		r = gfxhub_v1_1_get_xgmi_info(adev);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 59c8a6647ff2..02fba6829936 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -35,6 +35,7 @@
 #include <linux/vgaarb.h>
 #include <linux/vga_switcheroo.h>
 #include <linux/efi.h>
+#include <xen/xen.h>
 #include "radeon_reg.h"
 #include "radeon.h"
 #include "atom.h"
@@ -1388,6 +1389,8 @@ int radeon_device_init(struct radeon_device *rdev,
 		pr_warn("radeon: No coherent DMA available\n");
 	}
 	rdev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
+	if (xen_pv_domain())
+		rdev->need_swiotlb = 1;
 
 	/* Registers mapping */
 	/* TODO: block userspace mapping of io register */

> 
> Jan
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-02-13 16:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 18:46 Upstream Dom0 DRM problems regarding swiotlb Michael Labriola
2019-02-13 10:34 ` Jan Beulich
2019-02-13 14:10   ` Michael Labriola
2019-02-13 14:28     ` Jan Beulich
2019-02-13 16:00       ` Michael Labriola
2019-02-13 16:09         ` Jan Beulich
2019-02-13 16:56           ` Konrad Rzeszutek Wilk [this message]
2019-02-13 18:16             ` Michael Labriola
2019-02-13 18:38               ` Michael Labriola
2019-02-13 19:16                 ` Konrad Rzeszutek Wilk
2019-02-13 20:15                   ` Michael Labriola
2019-02-13 20:21                     ` Andrew Cooper
2019-02-13 21:08                       ` Michael Labriola
2019-02-14  0:11                         ` Andrew Cooper
2019-02-14  6:03                           ` Juergen Gross
2019-02-14 17:57                             ` Christoph Hellwig
2019-02-15  5:57                               ` Juergen Gross
2019-02-15 16:07                                 ` Michael Labriola
2019-02-15 16:26                                   ` Konrad Rzeszutek Wilk
2019-02-15 16:26                                   ` [Xen-devel] " Konrad Rzeszutek Wilk via dri-devel
2019-02-15 16:42                                   ` Christoph Hellwig
2019-02-14  6:01                 ` Juergen Gross
2019-02-14  8:03             ` Jan Beulich
2019-02-13 17:45           ` Michael Labriola
2019-02-14  8:05             ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190213165657.GD22883@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=michael.d.labriola@gmail.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.