Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] drm/xe: Fix 32bit build
@ 2023-12-21 22:28 Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 1/6] drm/xe: Disable 32bits build Lucas De Marchi
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Lucas De Marchi @ 2023-12-21 22:28 UTC (permalink / raw)
  To: intel-xe; +Cc: daniel.vetter, Lucas De Marchi, dri-devel, Rodrigo Vivi, airlied

A few fixes when building xe with ARCH=i386. If getting the whole lot,
we can simply skip the first and last patches. However they probably
need to got through CI and be reviewed to avoid regressions. For the
current pull request, simply disabling 32bits build is an alternative,
so we'd apply patch 1 now and let the rest come later.

Lucas De Marchi (6):
  drm/xe: Disable 32bits build
  drm/xe: Use _ULL for u64 division
  drm/xe/mmio: Cast to u64 when printing
  drm/xe/display: Avoid calling readq()
  drm/xe: Fix cast on trace variable
  drm/xe: Enable 32bits build

 .../gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h   | 7 +++++--
 drivers/gpu/drm/xe/xe_device.c                             | 2 +-
 drivers/gpu/drm/xe/xe_mmio.c                               | 4 ++--
 drivers/gpu/drm/xe/xe_trace.h                              | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

-- 
2.40.1


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

* [PATCH 1/6] drm/xe: Disable 32bits build
  2023-12-21 22:28 [PATCH 0/6] drm/xe: Fix 32bit build Lucas De Marchi
@ 2023-12-21 22:28 ` Lucas De Marchi
  2023-12-22  0:07   ` Rodrigo Vivi
  2023-12-21 22:28 ` [PATCH 2/6] drm/xe: Use _ULL for u64 division Lucas De Marchi
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Lucas De Marchi @ 2023-12-21 22:28 UTC (permalink / raw)
  To: intel-xe; +Cc: daniel.vetter, Lucas De Marchi, dri-devel, Rodrigo Vivi, airlied

Add a dependency on CONFIG_64BIT since currently the xe driver doesn't
build on 32bits. It may be enabled again after all the issues are fixed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
index 5b3da06e7ba3..a53b0fdc15a7 100644
--- a/drivers/gpu/drm/xe/Kconfig
+++ b/drivers/gpu/drm/xe/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_XE
 	tristate "Intel Xe Graphics"
-	depends on DRM && PCI && MMU && (m || (y && KUNIT=y))
+	depends on DRM && PCI && MMU && (m || (y && KUNIT=y)) && 64BIT
 	select INTERVAL_TREE
 	# we need shmfs for the swappable backing store, and in particular
 	# the shmem_readpage() which depends upon tmpfs
-- 
2.40.1


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

* [PATCH 2/6] drm/xe: Use _ULL for u64 division
  2023-12-21 22:28 [PATCH 0/6] drm/xe: Fix 32bit build Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 1/6] drm/xe: Disable 32bits build Lucas De Marchi
@ 2023-12-21 22:28 ` Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 3/6] drm/xe/mmio: Cast to u64 when printing Lucas De Marchi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2023-12-21 22:28 UTC (permalink / raw)
  To: intel-xe; +Cc: daniel.vetter, Lucas De Marchi, dri-devel, Rodrigo Vivi, airlied

Use DIV_ROUND_UP_ULL() so it also works on 32bit build.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 86867d42d532..3f0dcf54277b 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -620,7 +620,7 @@ void xe_device_wmb(struct xe_device *xe)
 u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size)
 {
 	return xe_device_has_flat_ccs(xe) ?
-		DIV_ROUND_UP(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0;
+		DIV_ROUND_UP_ULL(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0;
 }
 
 bool xe_device_mem_access_ongoing(struct xe_device *xe)
-- 
2.40.1


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

* [PATCH 3/6] drm/xe/mmio: Cast to u64 when printing
  2023-12-21 22:28 [PATCH 0/6] drm/xe: Fix 32bit build Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 1/6] drm/xe: Disable 32bits build Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 2/6] drm/xe: Use _ULL for u64 division Lucas De Marchi
@ 2023-12-21 22:28 ` Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 4/6] drm/xe/display: Avoid calling readq() Lucas De Marchi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2023-12-21 22:28 UTC (permalink / raw)
  To: intel-xe; +Cc: daniel.vetter, Lucas De Marchi, dri-devel, Rodrigo Vivi, airlied

resource_size_t uses %pa format in printk since the size varies
depending on build options. However to keep the io_size/physical_size
addition in the same call we can't pass the address without adding yet
another variable in these function. Simply cast it to u64 and keep using
%llx.

Fixes: 286089ce6929 ("drm/xe: Improve vram info debug printing")
Cc: Oak Zeng <oak.zeng@intel.com>
Cc: Michael J. Ruhl <michael.j.ruhl@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_mmio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
index f660cfb79f50..5c46f2d0b6dc 100644
--- a/drivers/gpu/drm/xe/xe_mmio.c
+++ b/drivers/gpu/drm/xe/xe_mmio.c
@@ -272,8 +272,8 @@ int xe_mmio_probe_vram(struct xe_device *xe)
 		drm_info(&xe->drm, "VRAM[%u, %u]: Actual physical size %pa, usable size exclude stolen %pa, CPU accessible size %pa\n", id,
 			 tile->id, &tile->mem.vram.actual_physical_size, &tile->mem.vram.usable_size, &tile->mem.vram.io_size);
 		drm_info(&xe->drm, "VRAM[%u, %u]: DPA range: [%pa-%llx], io range: [%pa-%llx]\n", id, tile->id,
-			 &tile->mem.vram.dpa_base, tile->mem.vram.dpa_base + tile->mem.vram.actual_physical_size,
-			 &tile->mem.vram.io_start, tile->mem.vram.io_start + tile->mem.vram.io_size);
+			 &tile->mem.vram.dpa_base, tile->mem.vram.dpa_base + (u64)tile->mem.vram.actual_physical_size,
+			 &tile->mem.vram.io_start, tile->mem.vram.io_start + (u64)tile->mem.vram.io_size);
 
 		/* calculate total size using tile size to get the correct HW sizing */
 		total_size += tile_size;
-- 
2.40.1


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

* [PATCH 4/6] drm/xe/display: Avoid calling readq()
  2023-12-21 22:28 [PATCH 0/6] drm/xe: Fix 32bit build Lucas De Marchi
                   ` (2 preceding siblings ...)
  2023-12-21 22:28 ` [PATCH 3/6] drm/xe/mmio: Cast to u64 when printing Lucas De Marchi
@ 2023-12-21 22:28 ` Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 5/6] drm/xe: Fix cast on trace variable Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 6/6] drm/xe: Enable 32bits build Lucas De Marchi
  5 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2023-12-21 22:28 UTC (permalink / raw)
  To: intel-xe; +Cc: daniel.vetter, Lucas De Marchi, dri-devel, Rodrigo Vivi, airlied

readq() is not available in 32bits. iosys-map already has the logic in
place to use read u64 in all cases, so simply add a helper variable for
using that.

Fixes: 44e694958b95 ("drm/xe/display: Implement display support")
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 .../gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
index 5f19550cc845..6739dadaf1a9 100644
--- a/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h
@@ -7,6 +7,7 @@
 #define _I915_GEM_OBJECT_H_
 
 #include <linux/types.h>
+#include <linux/iosys-map.h>
 
 #include "xe_bo.h"
 
@@ -36,6 +37,7 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
 {
 	struct ttm_bo_kmap_obj map;
 	void *virtual;
+	struct iosys_map vaddr;
 	bool is_iomem;
 	int ret;
 
@@ -52,10 +54,11 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo,
 	ofs &= ~PAGE_MASK;
 	virtual = ttm_kmap_obj_virtual(&map, &is_iomem);
 	if (is_iomem)
-		*ptr = readq((void __iomem *)(virtual + ofs));
+		iosys_map_set_vaddr_iomem(&vaddr, (void __iomem *)(virtual));
 	else
-		*ptr = *(u64 *)(virtual + ofs);
+		iosys_map_set_vaddr(&vaddr, virtual);
 
+	*ptr = iosys_map_rd(&vaddr, ofs, u64);
 	ttm_bo_kunmap(&map);
 out_unlock:
 	xe_bo_unlock(bo);
-- 
2.40.1


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

* [PATCH 5/6] drm/xe: Fix cast on trace variable
  2023-12-21 22:28 [PATCH 0/6] drm/xe: Fix 32bit build Lucas De Marchi
                   ` (3 preceding siblings ...)
  2023-12-21 22:28 ` [PATCH 4/6] drm/xe/display: Avoid calling readq() Lucas De Marchi
@ 2023-12-21 22:28 ` Lucas De Marchi
  2023-12-21 22:28 ` [PATCH 6/6] drm/xe: Enable 32bits build Lucas De Marchi
  5 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2023-12-21 22:28 UTC (permalink / raw)
  To: intel-xe; +Cc: daniel.vetter, Lucas De Marchi, dri-devel, Rodrigo Vivi, airlied

Cast the pointer to unsigned long and let it be implicitly extended to
u64. This fixes the build on 32bits arch.

Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_trace.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_trace.h b/drivers/gpu/drm/xe/xe_trace.h
index 95163c303f3e..e4e7262191ad 100644
--- a/drivers/gpu/drm/xe/xe_trace.h
+++ b/drivers/gpu/drm/xe/xe_trace.h
@@ -31,7 +31,7 @@ DECLARE_EVENT_CLASS(xe_gt_tlb_invalidation_fence,
 			     ),
 
 		    TP_fast_assign(
-			   __entry->fence = (u64)fence;
+			   __entry->fence = (unsigned long)fence;
 			   __entry->seqno = fence->seqno;
 			   ),
 
-- 
2.40.1


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

* [PATCH 6/6] drm/xe: Enable 32bits build
  2023-12-21 22:28 [PATCH 0/6] drm/xe: Fix 32bit build Lucas De Marchi
                   ` (4 preceding siblings ...)
  2023-12-21 22:28 ` [PATCH 5/6] drm/xe: Fix cast on trace variable Lucas De Marchi
@ 2023-12-21 22:28 ` Lucas De Marchi
  5 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2023-12-21 22:28 UTC (permalink / raw)
  To: intel-xe; +Cc: daniel.vetter, Lucas De Marchi, dri-devel, Rodrigo Vivi, airlied

Now that all the issues with 32bits are fixed, enable it again.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
index a53b0fdc15a7..5b3da06e7ba3 100644
--- a/drivers/gpu/drm/xe/Kconfig
+++ b/drivers/gpu/drm/xe/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config DRM_XE
 	tristate "Intel Xe Graphics"
-	depends on DRM && PCI && MMU && (m || (y && KUNIT=y)) && 64BIT
+	depends on DRM && PCI && MMU && (m || (y && KUNIT=y))
 	select INTERVAL_TREE
 	# we need shmfs for the swappable backing store, and in particular
 	# the shmem_readpage() which depends upon tmpfs
-- 
2.40.1


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

* Re: [PATCH 1/6] drm/xe: Disable 32bits build
  2023-12-21 22:28 ` [PATCH 1/6] drm/xe: Disable 32bits build Lucas De Marchi
@ 2023-12-22  0:07   ` Rodrigo Vivi
  0 siblings, 0 replies; 8+ messages in thread
From: Rodrigo Vivi @ 2023-12-22  0:07 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: daniel.vetter, dri-devel, airlied, intel-xe

On Thu, Dec 21, 2023 at 02:28:04PM -0800, Lucas De Marchi wrote:
> Add a dependency on CONFIG_64BIT since currently the xe driver doesn't
> build on 32bits. It may be enabled again after all the issues are fixed.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/xe/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
> index 5b3da06e7ba3..a53b0fdc15a7 100644
> --- a/drivers/gpu/drm/xe/Kconfig
> +++ b/drivers/gpu/drm/xe/Kconfig
> @@ -1,7 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  config DRM_XE
>  	tristate "Intel Xe Graphics"
> -	depends on DRM && PCI && MMU && (m || (y && KUNIT=y))
> +	depends on DRM && PCI && MMU && (m || (y && KUNIT=y)) && 64BIT
>  	select INTERVAL_TREE
>  	# we need shmfs for the swappable backing store, and in particular
>  	# the shmem_readpage() which depends upon tmpfs
> -- 
> 2.40.1
> 

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

end of thread, other threads:[~2023-12-22  0:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-21 22:28 [PATCH 0/6] drm/xe: Fix 32bit build Lucas De Marchi
2023-12-21 22:28 ` [PATCH 1/6] drm/xe: Disable 32bits build Lucas De Marchi
2023-12-22  0:07   ` Rodrigo Vivi
2023-12-21 22:28 ` [PATCH 2/6] drm/xe: Use _ULL for u64 division Lucas De Marchi
2023-12-21 22:28 ` [PATCH 3/6] drm/xe/mmio: Cast to u64 when printing Lucas De Marchi
2023-12-21 22:28 ` [PATCH 4/6] drm/xe/display: Avoid calling readq() Lucas De Marchi
2023-12-21 22:28 ` [PATCH 5/6] drm/xe: Fix cast on trace variable Lucas De Marchi
2023-12-21 22:28 ` [PATCH 6/6] drm/xe: Enable 32bits build Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox