From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 743EF606A32F for ; Thu, 3 Dec 2026 19:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iW/2snQ7 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37BDD10EB20; Thu, 3 Dec 2026 19:31:50 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 501B7112B41 for ; Thu, 3 Dec 2026 19:31:44 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 3F484600ED; Thu, 3 Dec 2026 19:31:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8F1B1F000CE; Thu, 3 Dec 2026 19:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796326303; bh=AFo3hya2J8OR5a/J1AJJYJM7R5AL9AAbu+YWzVootoM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=iW/2snQ7Y5vPINQPtuD2ahGjMs4VQhn4gHEMraDFc0GMkKS12zLx5OYxpMh+0UdlN eu1Vs6KgIyGD+OYys9RD4qGYWoudPBXP0z49jkveTzOqosUq2f/Vop8YrjQrp0xcFP gJ8cGeEURa8WFI2gkz/xd/daNMvVBcZ3mDQTdOOZuHlUjbqzg51PiO8nQ4FjJ7UGYr iU728QiYdrck+SCHR3krN84CPC81e+xjbRKrJ4H5WF8gsc4TqWt5JRhYyiVaMtUkNt ljkDfjys5yt517YRVoqh0kTHFpXU4dXBM9lEwhk2l83J6/vOMlO9YblV4Zt/w1vCjW L4MVMB4zkHkGw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] drm/xe: Work around media 52-bit limitation on CRI To: "Stuart Summers" Cc: intel-xe@lists.freedesktop.org In-Reply-To: <20261203190926.249488-6-stuart.summers@intel.com> References: <20261203190926.249488-4-stuart.summers@intel.com> <20261203190926.249488-6-stuart.summers@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 19:31:42 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 6 potential issues to consider: - [High] drm/xe: xe_sysctrl_media_defeature() never sends media disable command - [High] drm/xe: DIRECT_MAP_PHYSMEM_END breaks modular builds on unexported symbols - [Medium] drm/xe: sysctrl_media_drop() leaves xe->info.gt_count stale - [Medium] drm/xe: xe_sysctrl_media_defeature() permanently disables WA on any error - [Low] drm/xe: unused xe_force_wake.h include added in xe_sysctrl.c - [Low] drm/xe: unconditional xe_info() in sysctrl_media_defeature_send() -- commit 0799470412771e8575e374d3b80f09789379d8d6 Author: Stuart Summers drm/xe: Work around media 52-bit limitation on CRI This commit disables media by default on CRI to work around its 46-bit GPA limitation and clamps the DMA mask to 46 bits when media is enabled. It al= so adds a System Controller mailbox command to defeature media when disabled or disable media address translation when enabled. > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c > index 7afd20d1d2983..7184cd25bfea7 100644 > --- a/drivers/gpu/drm/xe/xe_pci.c > +++ b/drivers/gpu/drm/xe/xe_pci.c [ ... ] > @@ -789,6 +792,44 @@ static int xe_probe_info_early(struct xe_device *xe, > return 0; > } > =20 > +/* > + * Number of address bits media is able to reach on CRI, where it has no > + * address translation of its own. > + */ > +#define XE_CRI_MEDIA_ADDR_BITS 46 > + > +static bool device_iommu_iova_backed(struct device *dev) > +{ > + struct iommu_domain *domain =3D iommu_get_domain_for_dev(dev); > + > + return domain && domain->type !=3D IOMMU_DOMAIN_IDENTITY; > +} > + > +/* > + * Decide whether media can be used on CRI. Media there cannot translate > + * addresses, so it is only usable if device DMA is guaranteed to stay w= ithin > + * XE_CRI_MEDIA_ADDR_BITS. The IOMMU guarantees that by allocating IOVAs > + * below the device dma mask. Without it, DMA addresses are host physic= al > + * addresses, so media is only usable when the host cannot produce an ad= dress > + * wider than media can reach. > + */ > +static bool cri_media_addressable(struct xe_device *xe) > +{ > + u64 host_max_addr =3D DIRECT_MAP_PHYSMEM_END; [Severity: High] Does referencing DIRECT_MAP_PHYSMEM_END here break modular builds (CONFIG_DRM_XE=3Dm)? On x86_64 with CONFIG_RANDOMIZE_MEMORY=3Dy, DIRECT_MAP_PHYSMEM_END expands to direct_map_physmem_end in arch/x86/mm/kaslr.c, which is not exported to modules, failing modpost (and arm64 KASAN and LoongArch similarly reference unexported symbols). Additionally, on x86_64 with CONFIG_X86_5LEVEL=3Dy and CONFIG_ZONE_DEVICE= =3Dy, direct_map_physmem_end stays at (1ULL << 52) - 1 regardless of installed RAM, so cri_media_addressable() disables media whenever the IOMMU is off or in identity mode. [ ... ] > diff --git a/drivers/gpu/drm/xe/xe_sysctrl.c b/drivers/gpu/drm/xe/xe_sysc= trl.c > index d362e8156fca2..2095355ae6745 100644 > --- a/drivers/gpu/drm/xe/xe_sysctrl.c > +++ b/drivers/gpu/drm/xe/xe_sysctrl.c > @@ -5,12 +5,16 @@ > =20 > #include > #include > +#include > =20 > #include > =20 > +#include > + > #include "regs/xe_irq_regs.h" > #include "regs/xe_sysctrl_regs.h" > #include "xe_device.h" > +#include "xe_force_wake.h" [Severity: Low] xe_force_wake.h appears to be unused in xe_sysctrl.c; can this include be dropped? [ ... ] > +/* Send the media defeature command and report the outcome */ > +static int sysctrl_media_defeature_send(struct xe_device *xe, u8 feature) > +{ > + bool media_allowed =3D feature =3D=3D XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DI= SABLE; > + int ret; > + > + ret =3D sysctrl_media_defeature(xe, feature); > + if (ret) { > + xe_err(xe, "sysctrl: failed to defeature media (0x%02x): %pe\n", > + feature, ERR_PTR(ret)); > + return ret; > + } > + > + xe_info(xe, "sysctrl: media %s, %s defeatured\n", > + media_allowed ? "enabled" : "disabled", > + media_allowed ? "address translation" : "media"); > + > + return 0; > +} [Severity: Low] Will this xe_info() spam dmesg on every runtime PM resume? xe_pm_runtime_resume() calls xe_sysctrl_media_defeature() on every resume, so with media enabled and ATS active this prints at info level on each wakeup. Using xe_dbg() here (or logging once at probe in xe_sysctrl_media_probe()) would avoid flooding the kernel log. [ ... ] > +int xe_sysctrl_media_defeature(struct xe_device *xe) > +{ > + bool media_allowed =3D xe_device_media_allowed(xe); > + u8 feature; > + int ret =3D 0; > + > + if (!sysctrl_media_defeature_needed(xe)) > + return 0; > + > + feature =3D media_allowed ? XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE : > + XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE; > + > + /* > + * If media is not present or if it is allowed but ATS is disabled, > + * nothing to do. > + */ > + if (xe_device_get_root_tile(xe)->media_gt) > + if (!media_allowed || (media_allowed && sysctrl_ats_enabled(xe))) > + ret =3D sysctrl_media_defeature_send(xe, feature); [Severity: High] Can the !media_allowed branch ever run here? In xe_pci.c, alloc_media_gt() returns NULL whenever !xe_device_media_allowed(xe), so root tile->media_gt is always NULL when media_allowed is false. As a result, XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE is never sent and the media IP stays powered on. Checking physical media presence (such as xe->info.media_verx100) instead of tile->media_gt would allow sending the disable command. > + if (ret) > + xe->sc.has_media_feature_disable =3D false; > + > + return ret; > +} [Severity: Medium] Should a failure here permanently clear has_media_feature_disable after probe? If a transient mailbox error occurs during xe_device_resume() or xe_pm_runtime_resume() while media_gt is active, clearing the flag causes all later resumes to skip XE_SYSCTRL_MEDIA_DEFEATURE_ATS_DISABLE and bring up media with ATS still enabled. In xe_sysctrl_media_probe(), clearing the flag before the fallback XE_SYSCTRL_MEDIA_DEFEATURE_DISABLE call also prevents future resumes from re-sending media disable even if that fallback succeeds. [ ... ] > +static void sysctrl_media_drop(struct xe_device *xe) > +{ > + struct xe_tile *tile; > + u8 id; > + > + xe->info.media_allowed =3D false; > + > + for_each_tile(tile, xe, id) > + tile->media_gt =3D NULL; > +} [Severity: Medium] Does sysctrl_media_drop() leave xe->info.gt_count out of sync with the remaining GTs? xe_info_init() already counts tile->media_gt into xe->info.gt_count before xe_sysctrl_media_probe() runs. Clearing tile->media_gt without decrementing gt_count leaves query_gt_list() exposing a trailing zero-filled phantom GT entry in DRM_XE_DEVICE_QUERY_GT_LIST. GuC G2G setup (guc_g2g_start()) also relies on gt_count matching the active GTs. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203190926.2494= 88-4-stuart.summers@intel.com?part=3D2