From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: "Szymon Acedański" <accek@invisiblethingslab.com>,
intel-xe@lists.freedesktop.org
Cc: matthew.brost@intel.com, rodrigo.vivi@intel.com,
maarten.lankhorst@linux.intel.com, hch@lst.de,
bob.beckett@collabora.com, dri-devel@lists.freedesktop.org,
marmarek@invisiblethingslab.com, xen-devel@lists.xenproject.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] drm/xe: Limit sg segment size to PAGE_SIZE on Xen PV
Date: Mon, 21 Sep 2026 15:57:49 +0200 [thread overview]
Message-ID: <49da6f28a4ba582d32ac6cdccd6dea65d75eefbf.camel@linux.intel.com> (raw)
In-Reply-To: <20260916173030.3223833-1-accek@invisiblethingslab.com>
On Wed, 2026-09-16 at 19:30 +0200, Szymon Acedański wrote:
> Fix display corruption on Xen PV dom0, where DMA buffers are not
> guaranteed machine-contiguous, in which case bounce buffering kicks
> in, breaking xe's memory coherency assumptions.
>
> Apply the same workaround i915 carries in i915_sg_segment_size()
> since
> commit 78a07fe777c4 ("drm/i915: stop abusing swiotlb_max_segment").
>
> Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel
> GPUs")
> Reported-by: Marek Marczykowski-Górecki
> <marmarek@invisiblethingslab.com>
> Closes:
> https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/8382
> Link: https://lore.kernel.org/xen-devel/aYtznP_tT6xNPwf-@mail-itl/
> Link:
> https://lore.kernel.org/all/20221020110308.1582518-1-hch@lst.de/ #
> i915 counterpart
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Robert Beckett <bob.beckett@collabora.com>
> Cc: stable@vger.kernel.org # v6.8+
> Signed-off-by: Szymon Acedański <accek@invisiblethingslab.com>
> ---
> v2:
> - Imperative language in the commit message (Thomas Hellström)
> - CC the authors of the original i915 workaround (Thomas Hellström)
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
> drivers/gpu/drm/xe/xe_bo.h | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
> index 290ca62..341fa93 100644
> --- a/drivers/gpu/drm/xe/xe_bo.h
> +++ b/drivers/gpu/drm/xe/xe_bo.h
> @@ -9,6 +9,8 @@
> #include <drm/drm_prime.h>
> #include <drm/ttm/ttm_tt.h>
>
> +#include <xen/xen.h>
> +
> #include "xe_bo_types.h"
> #include "xe_ggtt.h"
> #include "xe_macros.h"
> @@ -574,6 +576,23 @@ static inline unsigned int
> xe_sg_segment_size(struct device *dev)
> struct scatterlist __maybe_unused sg;
> size_t max = BIT_ULL(sizeof(sg.length) * 8) - 1;
>
> + /*
> + * For Xen PV guests pages aren't contiguous in DMA
> (machine) address
> + * space. The DMA API takes care of that both in
> dma_alloc_* (by
> + * calling into the hypervisor to make the pages contiguous)
> and in
> + * dma_map_* (by bounce buffering). But xe (like i915, see
> commit
> + * 78a07fe777c4) ignores the coherency aspects of the DMA
> API and thus
> + * can't cope with bounce buffering actually happening, so
> add a hack
> + * here to force small allocations and mappings when running
> in PV
> + * mode on Xen.
> + *
> + * Note this will still break if bounce buffering is
> required for other
> + * reasons, like confidential computing hypervisors or PCIe
> root ports
> + * with addressing limitations.
> + */
> + if (xen_pv_domain())
> + return PAGE_SIZE;
> +
> max = min_t(size_t, max, dma_max_mapping_size(dev));
>
> /*
>
> base-commit: baafc300cd079a5210c1e70e5ea3d93518e40b38
next prev parent reply other threads:[~2026-09-21 13:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 17:30 [PATCH v2] drm/xe: Limit sg segment size to PAGE_SIZE on Xen PV Szymon Acedański
2026-09-17 12:16 ` ✗ LGCI.VerificationFailed: failure for drm/xe: Limit sg segment size to PAGE_SIZE on Xen PV (rev2) Patchwork
2026-09-21 6:34 ` ✓ CI.KUnit: success for drm/xe: Limit sg segment size to PAGE_SIZE on Xen PV (rev3) Patchwork
2026-09-21 7:49 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-09-21 9:30 ` Szymon Acedański
2026-09-21 9:47 ` ✗ Xe.CI.FULL: " Patchwork
2026-09-21 10:07 ` Szymon Acedański
2026-09-21 13:57 ` Thomas Hellström [this message]
2026-09-21 14:30 ` [PATCH v2] drm/xe: Limit sg segment size to PAGE_SIZE on Xen PV Thomas Hellström
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=49da6f28a4ba582d32ac6cdccd6dea65d75eefbf.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=accek@invisiblethingslab.com \
--cc=bob.beckett@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=intel-xe@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marmarek@invisiblethingslab.com \
--cc=matthew.brost@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=stable@vger.kernel.org \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox