drm/xe: Fix 32bit build
Subsystems (3)
cover drm/xe: Fix 32bit build
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(-)
Signature · 1 line
2.40.1
PATCH 1/6 drm/xe: Disable 32bits build
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.
--- drivers/gpu/drm/xe/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/Kconfig +1 -1
@@ -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
Signature · 1 line
2.40.1
Re: [PATCH 1/6] drm/xe: Disable 32bits build
Quoted 4 lines · Lucas De Marchi
Add a dependency on
CONFIG_64BITsince 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 <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/xe/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/xe/Kconfig +1
-1@@ -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 tmpfsSignature · 1 line
2.40.1
PATCH 2/6 drm/xe: Use _ULL for u64 division
In reply to Lucas De MarchiUse DIV_ROUND_UP_ULL() so it also works on 32bit build.
--- drivers/gpu/drm/xe/xe_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_device.c +1 -1
@@ -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)
Signature · 1 line
2.40.1
PATCH 3/6 drm/xe/mmio: Cast to u64 when printing
In reply to Lucas De Marchiresource_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.
--- drivers/gpu/drm/xe/xe_mmio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_mmio.c +2 -2
@@ -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;
Signature · 1 line
2.40.1
PATCH 4/6 drm/xe/display: Avoid calling readq()
In reply to Lucas De Marchireadq() 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.
--- .../gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h +5 -2
@@ -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);
Signature · 1 line
2.40.1
PATCH 5/6 drm/xe: Fix cast on trace variable
In reply to Lucas De MarchiCast the pointer to unsigned long and let it be implicitly extended to u64. This fixes the build on 32bits arch.
--- drivers/gpu/drm/xe/xe_trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_trace.h +1 -1
@@ -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; ),
Signature · 1 line
2.40.1
PATCH 6/6 drm/xe: Enable 32bits build
In reply to Lucas De MarchiNow that all the issues with 32bits are fixed, enable it again.
--- drivers/gpu/drm/xe/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/Kconfig +1 -1
@@ -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
Signature · 1 line
2.40.1