Linus Torvalds
bf4afc53b7
Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
...
This was done entirely with mindless brute force, using
git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'
to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.
Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.
For the same reason the 'flex' versions will be done as a separate
conversion.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2026-02-21 17:09:51 -08:00
Kees Cook
69050f8d6d
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
...
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:
Single allocations: kmalloc(sizeof(TYPE), ...)
are replaced with: kmalloc_obj(TYPE, ...)
Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with: kmalloc_objs(TYPE, COUNT, ...)
Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)
(where TYPE may also be *VAR)
The resulting allocations no longer return "void *", instead returning
"TYPE *".
Signed-off-by: Kees Cook <kees@kernel.org >
2026-02-21 01:02:28 -08:00
Maarten Lankhorst
a7ae083691
drm/xe/display: Avoid dereferencing xe_ggtt_node
...
Start using xe_ggtt_node_addr, and avoid comparing the base offset
as vma->node is dynamically allocated.
Also sneak in a xe_bo_size() for stolen, too small to put as separate
commit.
Reviewed-by: Matthew Brost <matthew.brost@intel.com >
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se >
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com >
Link: https://patch.msgid.link/20260108101014.579906-13-dev@lankhorst.se
2026-01-12 16:28:34 +01:00
Jani Nikula
0c085485a9
drm/{i915, xe}/stolen: make insert_node, area_address, area_size optional
...
Since the stolen memory hooks are function pointers, make some of them
optional instead of having to define them for xe.
insert_node, area_address, and area_size are only needed on platforms
not supported by xe.
Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com >
Link: https://patch.msgid.link/0dbb460e8bd1df29df98862d08fcdfda03912673.1764930576.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-12-10 11:36:11 +02:00
Jani Nikula
d6c862572b
drm/{i915, xe}/stolen: move stolen memory handling to display parent interface
...
Call the stolen memory interface through the display parent interface.
This makes xe compat gem/i915_gem_stolen.h redundant, and it can be
removed.
v2: Rebase, convert one more call that appeared
Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com >
Link: https://patch.msgid.link/350c82c49fe40f6319d14d309180e2e2752145ac.1764930576.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-12-10 11:36:11 +02:00
Jani Nikula
2397a4c662
drm/xe/stolen: unify interface with i915
...
Have i915_gem_stolen_node_offset() return u64, and pass const pointer to
them.
Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com >
Link: https://patch.msgid.link/e1ae0c5d3cc6f59d6e4f4ce810a6e9b3870109f8.1764930576.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-12-10 11:36:10 +02:00
Jani Nikula
d630a1bdd6
drm/xe/stolen: use the same types as i915 interface
...
Unify the i915 and xe interfaces by switching to the same types as i915.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://lore.kernel.org/r/f15d41bc232dfa957841f16d9a069c777af40194.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-09-29 12:41:31 +03:00
Jani Nikula
d3741f2c86
drm/{i915, xe}/stolen: convert stolen interface to struct drm_device
...
Make the stolen interface agnostic to i915/xe, and pass struct
drm_device instead.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://lore.kernel.org/r/bbfc2aeaeee3156e92d49c73983be05b6feeede2.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-09-29 12:41:31 +03:00
Jani Nikula
994c74ea5e
drm/{i915, xe}/stolen: use the stored i915/xe device pointer
...
Now that we store the i915/xe device pointer in struct
intel_stolen_node, we can reduce parameter passing in a number of
functions.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://lore.kernel.org/r/6f31114c8113ce2254d422ca53992088b673fb2f.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-09-29 12:41:30 +03:00
Jani Nikula
e8848d3d37
drm/{i915, xe}/stolen: add device pointer to struct intel_stolen_node
...
Add backpointers to i915/xe to allow simplifying some interfaces in
follow-up.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://lore.kernel.org/r/321354d47f9e530159caefef510d5394f4177470.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-09-29 12:41:30 +03:00
Jani Nikula
f74bab2d90
drm/{i915, xe}/stolen: make struct intel_stolen_node opaque
...
Add i915_gem_stolen_node_alloc() and i915_gem_stolen_node_free(),
returning struct intel_stolen_node pointer. Make struct
intel_stolen_node an opaque pointer, with different implementations in
i915 and xe.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://lore.kernel.org/r/3fe71bbb4c75ee86b4d129fafa3d4cd6526363f4.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-09-29 12:41:30 +03:00
Jani Nikula
33c8d948bc
drm/xe/stolen: convert compat static inlines to proper functions
...
Add display/xe_stolen.c as the implementation for the stolen interface
exposed to display. This allows hiding the implementation details that
shouldn't be exposed to display.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://lore.kernel.org/r/8e807c6aafc6151b18df08dda20053516813e001.1758732183.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-09-29 12:41:30 +03:00