Rebase v7.0 to support 6.6KV#348
Conversation
90e2aa3 to
a26e551
Compare
6e05b38 to
0a77c00
Compare
d00c7f5 to
61711a9
Compare
| @@ -1,6 +1,5 @@ | |||
| /* SPDX-License-Identifier: GPL-2.0 */ | |||
| /* | |||
| * workqueue.h --- work queue handling for Linux. | |||
There was a problem hiding this comment.
Removes the comment "workqueue.h --- work queue handling for Linux." — unrelated, unintended change.
There was a problem hiding this comment.
Yes, reverted it back now.
Rebase the DRM_GPUVM conditional on the backport build flag so the xe-drm driver only selects GPUVM when the compat layer actually provides it. Also to resolve the failure need to fix the offset values. Reference: bdcdf968be314b6 drm, drm/xe: Fix xe userptr in the absence of CONFIG_DEVICE_PRIVATE Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
When the CONFIG_INTEL_EHL_PSE_IO was added, it caused the hunk failure due to mislignment of line offset. Reference: a0c83150eea5 platform/x86/intel: Introduce Intel Elkhart Lake PSE I/O Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
fbc358a to
487d1df
Compare
The memory allocation helper macros introduced were introduced from v7.0-rc1 kernel with the new allocation helpers being introduced, to simplify that default case. errors are listed below where compilation fails on older kernels ------------------------------------------------------------------- - ttm_sys_manager.c: implicit declaration of 'kzalloc_obj' - ttm_range_manager.c: implicit declaration of 'kzalloc_flex' - ttm_agp_backend.c: implicit declaration of ‘kmalloc_obj’ - vsec.c: implicit declaration of ‘kzalloc_objs’ - ttm_tt.c: implicit declaration of ‘kvzalloc_objs’ - sched_main.c: implicit declaration of ‘kmalloc_objs - xe_vm.c: implicit declaration of ‘kvmalloc_objs’ ------------------------------------------------------------------- Therefore added backport compatibility layer that provides fallback definitions for the following allocation helpers when missing: - kzalloc_obj() - Allocate and zero memory for single object - kzalloc_flex() - Allocate flexible array structure - kmalloc_obj(), kmalloc_objs() - kzalloc_objs(), kvzalloc_objs(), kvmalloc_objs() - default_gfp() helper macro The backport uses typeof() and size_mul() to maintain type safety and overflow protection, matching the upstream implementation. Reference: e19e1b480ac7 add default_gfp() helper macro and use it in the new *alloc_obj() helpers Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
The EMPTY_VMA_FLAGS macro changed from VM_NONE (0) to ((vma_flags_t){ })
when the vma_flags_t type was introduced. For older kernels lack both the
vma_flags_t type and the EMPTY_VMA_FLAGS definition.
error is listed below:
-----------------------------------------------------------------
error: ‘EMPTY_VMA_FLAGS’ undeclared (first use in this function)
-----------------------------------------------------------------
Implemented conditional definition that adapts to kernel capabilities:
- For kernels without vma_flags_t: define EMPTY_VMA_FLAGS as 0
- For kernels with vma_flags_t: define as ((vma_flags_t){ })
- For v7.0-rc1kv onwards: use native EMPTY_VMA_FLAGS
Reference:
bae0ba7c7c0a02
mm: add basic VMA flag operation helper functions
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
For struct drm_device huge_mnt member introduced in v7.0kv to support transparent hugepage allocation in shmfs-backed gem objects. error: ------------------------------------------------------------------------- drm_gem.h:522: error: 'struct drm_device' has no member named 'huge_mnt' ------------------------------------------------------------------------- Added huge_mnt field to struct drm_device for transparent hugepage support. In kernels which are below v7.0 lack this infrastructure, causing direct member access to fail. - Implemented autoconf detection for huge_mnt member availability via struct compilation probe. - Return NULL for kernels without CONFIG_TRANSPARENT_HUGEPAGE support - Return NULL for kernels lacking huge_mnt member in drm_device Reference: 6e0b1b82017b9b drm/gem: Add huge tmpfs mountpoint helpers Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
487d1df to
e187203
Compare
In 7.0kv system_percpu_wq as a dedicated per-CPU workqueue. The gpu scheduler uses this for timeout handling, but relies on transitive includes the backport compatibility layer from activating. error: ------------------------------------------------------------------------------ ‘system_percpu_wq’ undeclared; did you mean ‘system_long_wq’? args->timeout_wq ------------------------------------------------------------------------------ Reference: 83646541d197 drm/sched: Replace use of system_wq with system_percpu_wq Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Add drm_dumb_buffers.h and drm_pagemap_util.h for xe-oot compatability
error:
----------------------------------------------------------------------
xe_vm_types.h: error: drm/drm_pagemap_util.h: No such file or directory
xe_bo.c: error: drm/drm_dumb_buffers.h: No such file or directory
----------------------------------------------------------------------
for drm_dumb_buffers.h
Reference:
fb24aaf5415c
drm/dumb-buffers: Provide helper to set pitch and size
for drm_pagemap_util.h
Reference:
77f14f2f2d73f
drm/pagemap: Add a drm_pagemap cache and shrinker
Above mentioned files are introduced from v7.0-rc1 kernel.
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Implement compatibility layer for get_region_info_caps callback in struct vfio_device_ops introduced in v7.0kv to support vfio-pci operations on older kernels. error: ------------------------------------------------------------------------------- error: ‘const struct vfio_device_ops’ has no member named ‘get_region_info_caps’ ------------------------------------------------------------------------------- In 7.0kv get_region_info_caps introduced to call struct vfio_device_ops inorder to enable drivers to provide custom region capability information. But in older kernels this mechanism lack this callback member in the vfio_device_ops structure. So, implemented autoconf detection and conditional compilation to detect get_region_info_caps member availability via struct compilation probe. Reference: 775f726a742a vfio: Add get_region_info_caps op Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
e187203 to
a8742e8
Compare
ACQUIRE and ACQUIRE_ERR cleanup guard macros in v7.0 as part of the cleanup.h infrastructure for automatic resource management. The xe driver uses these for PM runtime locking in ioctl handlers. error: ----------------------------------------------------------------------------- error: implicit declaration of function ACQUIRE(xe_pm_runtime_ioctl, pm)(xe); error: implicit declaration of function ACQUIRE_ERR(xe_pm_runtime_ioctl, &pm); ----------------------------------------------------------------------------- Implemented autoconf detection and conditional fallback pattern to detect ACQUIRE macro availability via cleanup.h compilation probe. Reference: 857d18f23ab1 cleanup: Introduce ACQUIRE() and ACQUIRE_ERR() for conditional locks Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Implement compatibility layer for DEFINE_GUARD_COND macro signature change from 3 to 4 arguments introduced in v7.0kv to support xe-power management guard helpers. error: ------------------------------------------------------------------------------- error: macro "DEFINE_GUARD_COND" passed 4 arguments, but takes just 3 DEFINE_GUARD_COND(xe_pm_runtime, _ioctl, xe_pm_runtime_get_ioctl(_T), _RET >= 0) ------------------------------------------------------------------------------- In 7.0kv the implementation extended DEFINE_GUARD_COND from 3 to 4 arguments by adding a condition parameter (_RET >= 0) to determine guard success. The xe PM runtime ioctl guard uses the 4-argument form to check return values. But in older kernel it support the 3-argument form without condition checking. Implemented autoconf detection and conditional macro usage: - Use 3-argument form (without condition check) on older kernels - Use 4-argument form (with _RET >= 0 condition) on v7.0+ kernels Reference: e4ab322fbaaaf cleanup: Add conditional guard support Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Other subsystem(s) may want to reuse the for_each_if() macro.
Move it to util_macros.h to make it globally available.
error:
--------------------------------------------------------------------------------
error: implicit declaration of function for_each_if(!(__entity) ||
(__job)->entity == (__entity))
--------------------------------------------------------------------------------
The for_each_if macro was introduced to linux/util_macros.h for conditional
iteration filtering. DRM GPU scheduler uses this in
drm_sched_for_each_pending_job() iterator to filter jobs by entity.
Implemented autoconf detection to detect for_each_if availability via
util_macros.h compilation probe and define as conditional empty-block pattern
when unavailable.
Reference:
b2108fc82a0a
drm: Move for_each_if() to util_macros.h for wider use
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Implemented compatibility layer for init_llist_node function introduced in v6.7 kernel onwards to support DRM GPUVM lock-less list initialization. error: ------------------------------------------------------------------------------- implicit declaration of function ‘init_llist_head’ ------------------------------------------------------------------------------- The function init_llist_node() in v6.7 for proper initialization of lock-less list nodes. The DRM GPUVM uses this to initialize deferred BO list entries. So in v6.6 kernels lack this helper function. Therefore, implemented autoconf to detect init_llist_node availability through llist.h and provided inline implementation using WRITE_ONCE when unavailable. Reference: d6b3358a2813 llist: add interface to check if a node is on a list Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
In v7.0-rc1 shmem_writeout() was renamed from shmem_writepage() to shmem_writeout() as a simplified helper for writing shmem folios to swap. The TTM backup module uses this for efficient memory reclaim during buffer object swapping. error: ------------------------------------------------------------------------------- error: implicit declaration of function shmem_writeout(to_folio, NULL, NULL); ERROR: modpost: "shmem_writeout" [~/src/drivers/gpu/drm/ttm/ttm.ko] undefined! ------------------------------------------------------------------------------- Reference: 7b73c12c6ebf0 shmem: Add shmem_writeout() Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
The poll_timeout_us macro was introduced to linux/iopoll.h
for simplified polling operations with microsecond precision. XE driver
uses this extensively for GuC firmware load status checks and power
management state transitions. Legacy kernels lack this utility macro.
error:
--------------------------------------------------------------------------------
implicit declaration of function poll_timeout_us(load_result =
guc_load_done(gt, &status, &tries), load_result,
--------------------------------------------------------------------------------
Provided backport implementation in iopoll.h wrapper:
- Define poll_timeout_us macro with full upstream semantics
- Support sleep between polls with usleep_range()
- Support optional sleep-before-first-poll behavior
- Return 0 on success, -ETIMEDOUT on timeout
- Include barrier() for proper memory ordering
Reference:
9df8043a546d
iopoll: Generalize read_poll_timeout() into poll_timeout_us()
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
…bility
In v7.0-rc1 kernel onwards dma_fence_check_and_signal_locked() was introduced
as an atomic operation that checks if a fence is already signaled
and signals it if not, all while holding the fence lock. The XE driver
uses this for hardware fence cleanup paths.
error:
------------------------------------------------------------------------
implicit declaration of function ‘dma_fence_check_and_signal_locked’;
XE_WARN_ON(dma_fence_check_and_signal_locked(&fence->dma));
------------------------------------------------------------------------
Implementation:
- Detect dma_fence_check_and_signal_locked availability via compilation probe
- Provide implementation combining test_signaled_flag and signal_locked
- Export symbol for module usage
- Declare function prototype in backport header
Reference:
c891b99d25dd
dma-buf/dma-fence: Add dma_fence_check_and_signal()
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
20b32be to
2240d5c
Compare
knayana-gse
left a comment
There was a problem hiding this comment.
conditional approve.
Please take care of latest comments.
Please check compilation of supported OSVs/kernels and add BAT results here as well.
| u32 pci_iov_vf_bar_get_sizes(struct pci_dev *dev, int resno, int num_vfs); | ||
| #endif | ||
|
|
||
| #ifdef BPM_PCI_RESIZE_RESOURCE_ARG4_NOT_PRESENT |
There was a problem hiding this comment.
can you check with these change pci Resizable BAR is working fine or not.
steps are mentioned in jira: VLK-83694
There was a problem hiding this comment.
Status before installing dkms
command: sudo lspci -vv -s 03:00.0
Capabilities: [420 v1] Physical Resizable BAR
BAR 2: current size: 16GB, supported: 256MB 512MB 1GB 2GB 4GB 8GB 16GB
Capabilities: [220 v1] Virtual Resizable BAR
BAR 2: current size: 2GB, supported: 256MB 512MB 1GB 2GB 4GB 8GB 16GB
Capabilities: [320 v1] Single Root I/O Virtualization (SR-IOV)
IOVCap: Migration- 10BitTagReq+ Interrupt Message Number: 000
IOVCtl: Enable- Migration- Interrupt- MSE- ARIHierarchy+ 10BitTagReq-
IOVSta: Migration-
Initial VFs: 12, Total VFs: 12, Number of VFs: 0, Function Dependency Link: 00
VF offset: 1, stride: 1, Device ID: e20b
Supported Page Size: 00000553, System Page Size: 00000001
Region 0: Memory at 0000004601000000 (64-bit, prefetchable)
Region 2: Memory at 0000004c00000000 (64-bit, prefetchable)
VF Migration: offset: 00000000, BIR: 0
Status after installing dkms
command: sudo lspci -vv -s 03:00.0
Capabilities: [420 v1] Physical Resizable BAR
BAR 2: current size: 16GB, supported: 256MB 512MB 1GB 2GB 4GB 8GB 16GB
Capabilities: [220 v1] Virtual Resizable BAR
BAR 2: current size: 16GB, supported: 256MB 512MB 1GB 2GB 4GB 8GB 16GB
| @@ -0,0 +1,73 @@ | |||
| /* SPDX-License-Identifier: GPL-2.0 */ | |||
| /* | |||
| static void zconfprint(const char *err, ...); | ||
| static void zconf_error(const char *err, ...); | ||
| static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); | ||
| static const struct kconf_id *kconf_id_lookup(const char *str, unsigned int len); |
Below are the compilation issues which are faced while compiling against 6.6
headers
error:
-------------------------------------------------------------------------------
error: too many arguments to function pci_resize_resource(pdev, resno,
bar_size, 0);
error: implicit declaration of function pci_rebar_size_supported,
pci_rebar_size_to_bytes, pci_rebar_get_max_size
-------------------------------------------------------------------------------
Extended pci_resize_resource() from 3 to 4 arguments in v6.19, adding an
exclude_bars parameter to control which BARs should be excluded from resizing.
The xe driver uses the 4-argument form for PCBAR expansion. But in older
kernels only support the 3-argument form without the exclude_bars parameter.
Similarly, there are three another compilation issues those are
- pci_rebar_size_supported() - validate if size is supported for BAR
- pci_rebar_size_to_bytes() - convert size encoding to byte values
- pci_rebar_get_max_size() - query maximum supported BAR size
Implementation:
- pci_resize_resource: detect pci_resize_resource 4-argument support via
compilation probe
- pci_rebar_size_supported: check if size is in supported bitmap
- pci_rebar_size_to_bytes: convert encoding to bytes using bit shift
- pci_rebar_get_max_size: find highest set bit in size bitmap
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Implement compatibility layer for __assign_str tracing macro signature
change from 1 to 2 arguments that occurred between kernel versions to
support xe driver tracepoints across all target kernels.
error:
-------------------------------------------------------------------------------
error: macro "__assign_str" requires 2 arguments, but only 1 given __assign_str
undeclared (first use in this function)
-------------------------------------------------------------------------------
The kernel tracing subsystem changed __assign_str macro signature between
versions. But in older kernels use single-argument form:__assign_str(field);
From v7.0 kernels require two-argument form with explicit source value:
__assign_str(field, source_value);
Reference:
c759e609030c
tracing: Remove __assign_str_len()
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Implement compatibility layer for configfs_group_operations.is_visible
member introduced in upstream 6.12 kernels to allow dynamic visibility
control of configfs attributes. This uses this for controlling
visibility of device and SR-IOV configuration groups based on device
capabilities.
error:
-----------------------------------------------------------------------------
error: ‘struct configfs_group_operations’ has no member named ‘is_visible’
.is_visible = xe_config_device_is_visible,
-----------------------------------------------------------------------------
So implemeted and conditional probe if is_visible member availability via
struct then include member assignment only when supported but member isn't
assigned on old kernels which holds original implementation.
Reference:
0e6a35b93745bb
fs/configfs: Add a callback to determine attribute visibility
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Add a compatibility macro for drm_warn_once() which is not available in older kernel versions e.g in 6.12kv and below. The fallback implementation uses dev_warn_once() to provide equivalent functionality. This resolves compilation errors in drm_dumb_buffers.c and other files that use drm_warn_once() when building against kernels that don't provide this macro natively. error: ------------------------------------------------------------------------------- error: implicit declaration of function ‘drm_warn_once’; drm_warn_once(dev, modpost: "drm_mode_size_dumb" [~/src/drivers/gpu/drm/xe/xe.ko] undefined! ------------------------------------------------------------------------------- Reference: fb6c7ab8718e drm/print: introduce new struct drm_device based logging macros Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Add detection and fallback implementation for drm_pagemap_put() which was introduced in kernel v7.0. For older kernels, provide a static inline implementation that uses the drm_pagemap operations release callback via kref_put(). The compatibility is handled entirely in the header file with a static inline function that properly decrements the reference count and invokes the destroy operation when the reference reaches zero. This function is used extensively in xe_vm_madvise.c and xe_svm.c for managing DRM pagemap lifecycle. error: ------------------------------------------------------------------------------- modpost: "drm_pagemap_put" [~/src/drivers/gpu/drm/xe/xe.ko] undefined! ------------------------------------------------------------------------------- Reference: a599b98607de drm/pagemap, drm/xe: Add refcounting to struct drm_pagemap Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
…n for lock For drm_gpuvm_bo_obtain_locked() and drm_gpuvm_madvise_ops_create() which are used by the xe driver for GPU virtual memory management but not available in kernels below v7.0 kernels. error: ------------------------------------------------------------------------------- modpost: "drm_gpuvm_bo_obtain_locked" [~/src/drivers/gpu/drm/xe/xe.ko] modpost: "drm_gpuvm_madvise_ops_create" [~/src/drivers/gpu/drm/xe/xe.ko] ------------------------------------------------------------------------------- drm_gpuvm_bo_obtain_locked(): This function obtains or creates a drm_gpuvm_bo instance representing the combination of a drm_gpuvm and drm_gem_object. The backport implementation uses drm_gpuvm_bo_find() to search for existing instances, and drm_gpuvm_bo_create() to allocate new ones if needed. drm_gpuvm_madvise_ops_create(): This function creates operations for memory advisory hints. For kernels without madvise support, the implementation falls back to drm_gpuvm_sm_map_ops_create() which provides compatible mapping operations. Both functions are properly exported with EXPORT_SYMBOL_GPL for use by the xe.ko module. Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
Moved the #include "kconf_id.c" from the mid-grammar %{ %} block to the
bottom of the file alongside the other implementation includes. The
mid-grammar placement caused kconf_id.c to be included before the
bison-generated token constants were defined, leading to build failures
with certain bison/flex versions.
Added a forward declaration for kconf_id_lookup() in the top-level
declarations block so the parser rules can reference it before the
definition is included at the end of the file.
Signed-off-by: Akanksha Hotta <akanksha.hotta@intel.com>
2240d5c to
bf46199
Compare
BAT results: https://gtax-ril-fm.intel.com/#/jobs/4737065 |
No description provided.