Skip to content

backport-include/sysfs.h: guard fallback sysfs visibility macros#300

Open
knayana-gse wants to merge 7 commits intointel-gpu:oot-backport/mainfrom
knayana-gse:oot-bp-rh10-0315
Open

backport-include/sysfs.h: guard fallback sysfs visibility macros#300
knayana-gse wants to merge 7 commits intointel-gpu:oot-backport/mainfrom
knayana-gse:oot-bp-rh10-0315

Conversation

@knayana-gse
Copy link

Define fallback sysfs visibility helper macros only when
missing to avoid redefinition warnings with RHEL 10.1 headers.
This keeps compatibility with kernel 6.6 and 6.12.

Warning:

"DEFINE_SIMPLE_SYSFS_BIN_GROUP_VISIBLE" redefined

Signed-off-by: Kanaka Raju Nayana kanaka.raju.nayana@intel.com

Define fallback sysfs visibility helper macros only when
missing to avoid redefinition warnings with RHEL 10.1 headers.
This keeps compatibility with kernel 6.6 and 6.12.

Warning:
---------------------------------------------------------------------
"DEFINE_SIMPLE_SYSFS_BIN_GROUP_VISIBLE" redefined
---------------------------------------------------------------------

Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
RHEL 10.1 headers require string-literal namespaces in MODULE_IMPORT_NS.
Use BPM_MODULE_IMPORT_TO_STRING_LITERAL_PRESENT to select unquoted vs
quoted namespace form in dma-buf and intel_vsec backport headers.

Error:
-------------------------------------------------------------------------------
Fixes compile error: expected ',' or ';' before 'DMA_BUF'.
Fixes compile error: expected ',' or ';' before 'INTEL_VSEC'.
-------------------------------------------------------------------------------

Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
RHEL 10.1 headers already define secs_to_jiffies, which triggers
a macro redefinition warning in backport builds. Guard the fallback
with #ifndef secs_to_jiffies so it is only defined when missing.

Also update the configure probe to check secs_to_jiffies via
the jiffies API header, avoiding false “not present” detection.

Warning:
---------------------------------------------------------------------
"secs_to_jiffies" redefined
---------------------------------------------------------------------

Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
The configure probe used the wrong return type for drmm_cgroup_register_region
(struct drm_cgroup_state *), while newer headers (including RHEL 10.1)
expose struct dmem_cgroup_region *.

With -Werror, this mismatch can fail the probe, incorrectly define
BPM_DRMM_CGROUP_REGISTER_REGION_NOT_PRESENT, and trigger a conflicting
backport static declaration.

Use struct dmem_cgroup_region * in the probe to detect API availability
correctly and avoid the static/non-static declaration conflict.

Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
RHEL 10.1 kernels expose drm_dev_wedged_event with two arguments, while
mainline kernels use three arguments. Add separate configure probes
for API presence and third-argument support.

This allows selecting the correct compatibility path and avoids
conflicting drm_dev_wedged_event declarations during build.

Error:
-------------------------------------------------------------------------------
conflicting types for ‘drm_dev_wedged_event’; have ‘int(struct drm_device *,
long unsigned int, struct drm_wedge_task_info *)’
-------------------------------------------------------------------------------

Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
AC_DRV_DATE_NOT_PRESENT had inverted probe handling and could leave
BPM_DRV_DATE_NOT_PRESENT unset when .date is not available in
struct drm_driver as seen with RHEL 10.1 headers.

Move the AC_DEFINE(BPM_DRV_DATE_NOT_PRESENT, 1, ...) action to the
compile-failure branch so .date = DRIVER_DATE is correctly disabled
when the field is absent.

Error:
-------------------------------------------------------------------------------
initializer element is not computable at load time
9 | #define DRIVER_DATE "20201103"
-------------------------------------------------------------------------------

Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>
The AC_CONST_STRUCT_BIN_ATTRIBUTE_IS_NOT_PRESENT check defined
a helper function inside the compile body, which can cause probe
failures unrelated to the actual bin_attribute::mmap callback type.

Move test_mmap() to the compile section so the probe accurately
detects whether mmap expects const struct bin_attribute *.

This fixes incorrect configure detection seen with RHEL 10.1 headers.

Error:
-------------------------------------------------------------------------------
assignment to ‘int (*)(struct file *, struct kobject *, const struct
bin_attribute *, struct vm_area_struct *)’ from incompatible
pointer type ‘int (*)(struct file *, struct kobject *,
struct bin_attribute *, struct vm_area_struct *)’
-------------------------------------------------------------------------------

Signed-off-by: Kanaka Raju Nayana <kanaka.raju.nayana@intel.com>

#ifdef BPM_SECS_TO_JIFFIES_NOT_PRESENT

#ifndef secs_to_jiffies
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need M4 if we are using conditional check

],[
struct drm_device *dev = NULL;
struct drm_cgroup_state *cg;
struct dmem_cgroup_region *cg;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it wrong m4 previously. did we verify all the variants true or false

#include <drm/drm_drv.h>
],[
struct drm_device drm;
drm_dev_wedged_event(&drm, 0, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why different trails hear? can we move it to conditional M4. looks we may have both ways

unsigned long method,
struct drm_wedge_task_info *info)
{
(void)info;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is info for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants