From dded446a1ad4108f76565ea71f23e28d7bf8ebc0 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 30 Oct 2026 16:13:44 +0100 Subject: drm/mipi-dbi: Switch to drm_atomic_helper_connector_create_state The mipi-dbi connector implementation uses the deprecated drm_atomic_helper_connector_reset() as its reset hook. Switch to drm_atomic_helper_connector_create_state() instead. Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20261030-drm-no-more-connector-reset-v3-14-30e71d92c327@kernel.org Signed-off-by: Maxime Ripard --- include/drm/drm_mipi_dbi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h index d93e25fdc2e1..bb3296419910 100644 --- a/include/drm/drm_mipi_dbi.h +++ b/include/drm/drm_mipi_dbi.h @@ -257,8 +257,8 @@ void drm_mipi_dbi_crtc_helper_atomic_disable(struct drm_crtc *crtc, */ #define DRM_MIPI_DBI_CONNECTOR_FUNCS \ - .reset = drm_atomic_helper_connector_reset, \ .fill_modes = drm_helper_probe_single_connector_modes, \ + .atomic_create_state = drm_atomic_helper_connector_create_state, \ .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, \ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state -- cgit v1.2.3 From d39032fa757f781ac47838b165843e063c78153d Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 30 Oct 2026 16:14:01 +0100 Subject: drm/connector: Remove drm_atomic_helper_connector_reset() All drivers implementing the connector reset hook with drm_atomic_helper_connector_reset() have been converted to atomic_create_state. Remove drm_atomic_helper_connector_reset(). Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20261030-drm-no-more-connector-reset-v3-31-30e71d92c327@kernel.org Signed-off-by: Maxime Ripard --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 3 +-- drivers/gpu/drm/drm_atomic_state_helper.c | 20 -------------------- include/drm/drm_atomic_state_helper.h | 1 - include/drm/drm_connector.h | 2 +- 4 files changed, 2 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c index c63d439382bb..66ae678fc078 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -314,8 +314,7 @@ * * Initializes all HDMI resources from a @drm_connector_state without * actually allocating it. This is useful for HDMI drivers, in - * combination with __drm_atomic_helper_connector_state_init(), - * drm_atomic_helper_connector_reset(), or + * combination with __drm_atomic_helper_connector_state_init(), or * drm_atomic_helper_connector_create_state(). */ void __drm_atomic_helper_connector_hdmi_state_init(struct drm_connector_state *new_conn_state, diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 3534925636d5..5efda28bb2b0 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -435,26 +435,6 @@ __drm_atomic_helper_connector_reset(struct drm_connector *connector, } EXPORT_SYMBOL(__drm_atomic_helper_connector_reset); -/** - * drm_atomic_helper_connector_reset - default &drm_connector_funcs.reset hook for connectors - * @connector: drm connector - * - * Resets the atomic state for @connector by freeing the state pointer (which - * might be NULL, e.g. at driver load time) and allocating a new empty state - * object. - */ -void drm_atomic_helper_connector_reset(struct drm_connector *connector) -{ - struct drm_connector_state *conn_state = kzalloc_obj(*conn_state); - - if (connector->state) - __drm_atomic_helper_connector_destroy_state(connector->state); - - kfree(connector->state); - __drm_atomic_helper_connector_reset(connector, conn_state); -} -EXPORT_SYMBOL(drm_atomic_helper_connector_reset); - /** * drm_atomic_helper_connector_create_state - default &drm_connector_funcs.atomic_create_state hook for connectors * @connector: connector object diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index 5e8619aeef21..7bced7e9d860 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h @@ -68,7 +68,6 @@ void __drm_atomic_helper_connector_state_init(struct drm_connector_state *conn_s struct drm_connector *connector); void __drm_atomic_helper_connector_reset(struct drm_connector *connector, struct drm_connector_state *conn_state); -void drm_atomic_helper_connector_reset(struct drm_connector *connector); struct drm_connector_state * drm_atomic_helper_connector_create_state(struct drm_connector *connector); void drm_atomic_helper_connector_tv_state_init(struct drm_connector_state *state, diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 2ee7c59329aa..8b52360339e0 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1665,7 +1665,7 @@ struct drm_connector_funcs { * called by the core directly, only through drm_mode_config_reset(). * It's not a helper hook only for historical reasons. * - * Atomic drivers can use drm_atomic_helper_connector_reset() to reset + * Atomic drivers can use __drm_atomic_helper_connector_reset() to reset * atomic state using this hook. */ void (*reset)(struct drm_connector *connector); -- cgit v1.2.3 From c90151f2281da72582551dc588dfe9a2d9beabc0 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 30 Oct 2026 16:14:06 +0100 Subject: drm/connector: Remove __drm_atomic_helper_connector_reset() All drivers implementing the connector reset hook using __drm_atomic_helper_connector_reset() have been converted to atomic_create_state. Remove __drm_atomic_helper_connector_reset(). Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20261030-drm-no-more-connector-reset-v3-36-30e71d92c327@kernel.org Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_atomic_state_helper.c | 23 ----------------------- include/drm/drm_atomic_state_helper.h | 2 -- include/drm/drm_connector.h | 3 --- 3 files changed, 28 deletions(-) (limited to 'include') diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 5efda28bb2b0..267f44330629 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -412,29 +412,6 @@ __drm_atomic_helper_connector_state_init(struct drm_connector_state *conn_state, } EXPORT_SYMBOL(__drm_atomic_helper_connector_state_init); -/** - * __drm_atomic_helper_connector_reset - reset state on connector - * @connector: drm connector - * @conn_state: connector state to assign - * - * Initializes the newly allocated @conn_state and assigns it to - * the &drm_connector->state pointer of @connector, usually required when - * initializing the drivers or when called from the &drm_connector_funcs.reset - * hook. - * - * This is useful for drivers that subclass the connector state. - */ -void -__drm_atomic_helper_connector_reset(struct drm_connector *connector, - struct drm_connector_state *conn_state) -{ - if (conn_state) - __drm_atomic_helper_connector_state_init(conn_state, connector); - - connector->state = conn_state; -} -EXPORT_SYMBOL(__drm_atomic_helper_connector_reset); - /** * drm_atomic_helper_connector_create_state - default &drm_connector_funcs.atomic_create_state hook for connectors * @connector: connector object diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index 7bced7e9d860..1a822179f2ec 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h @@ -66,8 +66,6 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane, void __drm_atomic_helper_connector_state_init(struct drm_connector_state *conn_state, struct drm_connector *connector); -void __drm_atomic_helper_connector_reset(struct drm_connector *connector, - struct drm_connector_state *conn_state); struct drm_connector_state * drm_atomic_helper_connector_create_state(struct drm_connector *connector); void drm_atomic_helper_connector_tv_state_init(struct drm_connector_state *state, diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 8b52360339e0..a87cd13d0a45 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1664,9 +1664,6 @@ struct drm_connector_funcs { * Reset connector hardware and software state to off. This function isn't * called by the core directly, only through drm_mode_config_reset(). * It's not a helper hook only for historical reasons. - * - * Atomic drivers can use __drm_atomic_helper_connector_reset() to reset - * atomic state using this hook. */ void (*reset)(struct drm_connector *connector); -- cgit v1.2.3 From 27cae3ef057401b89f0e419633357720e05bf8f4 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Fri, 30 Oct 2026 16:14:07 +0100 Subject: drm/connector: Remove reset All the drivers that used to implement the reset hook have been converted to use atomic_create_state instead. Remove the reset hook from drm_connector_funcs, and the code calling it in drm_mode_config_reset(), drmm_connector_hdmi_init() and panel_bridge_attach(). Reviewed-by: Thomas Zimmermann Link: https://patch.msgid.link/20261030-drm-no-more-connector-reset-v3-37-30e71d92c327@kernel.org Signed-off-by: Maxime Ripard --- drivers/gpu/drm/drm_connector.c | 8 -------- drivers/gpu/drm/drm_mode_config.c | 4 +--- drivers/gpu/drm/drm_panel.c | 2 -- include/drm/drm_connector.h | 9 --------- 4 files changed, 1 insertion(+), 22 deletions(-) (limited to 'include') diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 893716a9e489..d66188521881 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -662,10 +662,6 @@ int drmm_connector_hdmi_init(struct drm_device *dev, return PTR_ERR(state); connector->state = state; - } else if (connector->funcs->reset) { - connector->funcs->reset(connector); - if (!connector->state) - return -ENOMEM; } drm_connector_attach_max_bpc_property(connector, 8, hdmi_funcs->max_bpc); @@ -770,10 +766,6 @@ int drmm_connector_hdmi_ini2(struct drm_device *dev, return PTR_ERR(state); connector->state = state; - } else if (connector->funcs->reset) { - connector->funcs->reset(connector); - if (!connector->state) - return -ENOMEM; } drm_connector_attach_max_bpc_property(connector, 8, max_bpc); diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index 48a56f23dadb..c1e993a78702 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -315,9 +315,7 @@ void drm_mode_config_reset(struct drm_device *dev) drm_connector_list_iter_begin(dev, &conn_iter); drm_for_each_connector_iter(connector, &conn_iter) { - if (connector->funcs->reset) - connector->funcs->reset(connector); - else if (connector->funcs->atomic_create_state) + if (connector->funcs->atomic_create_state) drm_mode_config_connector_reset_with_create_state(connector); } drm_connector_list_iter_end(&conn_iter); diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 8a97ffc8bd09..560ea57591bd 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -114,8 +114,6 @@ static int panel_bridge_attach(struct drm_bridge *bridge, } connector->state = conn_state; - } else if (connector->funcs->reset) { - connector->funcs->reset(connector); } drm_connector_register(connector); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index a87cd13d0a45..f656ed8324d3 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1658,15 +1658,6 @@ struct drm_connector_funcs { */ int (*dpms)(struct drm_connector *connector, int mode); - /** - * @reset: - * - * Reset connector hardware and software state to off. This function isn't - * called by the core directly, only through drm_mode_config_reset(). - * It's not a helper hook only for historical reasons. - */ - void (*reset)(struct drm_connector *connector); - /** * @detect: * -- cgit v1.2.3 From de30740dccd882b8177f260e7d8e26ad60f7c677 Mon Sep 17 00:00:00 2001 From: Brajesh Gupta Date: Fri, 6 Nov 2026 20:12:23 +0530 Subject: drm/imagination: Support for querying Firmware information Add a new subtype DRM_PVR_DEV_QUERY_FW_INFO_GET under DRM_IOCTL_PVR_DEV_QUERY to query Firmware information. This allows the userspace to detect any bug fixes and features present in the Firmware and take appropriate action. Currently it supports querying major and minor version of the Firmware. Mesa MR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40973 Signed-off-by: Brajesh Gupta Reviewed-by: Alessio Belle Acked-by: Luigi Santivetti Link: https://patch.msgid.link/20261106-fwversion-v5-1-d0074f992e75@imgtec.com Signed-off-by: Alessio Belle --- drivers/gpu/drm/imagination/pvr_drv.c | 5 ++++ drivers/gpu/drm/imagination/pvr_drv.h | 4 ++- drivers/gpu/drm/imagination/pvr_fw.c | 46 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/imagination/pvr_fw.h | 3 +++ include/uapi/drm/pvr_drm.h | 21 ++++++++++++++++ 5 files changed, 78 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/drivers/gpu/drm/imagination/pvr_drv.c b/drivers/gpu/drm/imagination/pvr_drv.c index 5c965ef0274f..2d522a8e46ad 100644 --- a/drivers/gpu/drm/imagination/pvr_drv.c +++ b/drivers/gpu/drm/imagination/pvr_drv.c @@ -6,6 +6,7 @@ #include "pvr_device.h" #include "pvr_drv.h" #include "pvr_free_list.h" +#include "pvr_fw.h" #include "pvr_gem.h" #include "pvr_hwrt.h" #include "pvr_job.h" @@ -658,6 +659,10 @@ pvr_ioctl_dev_query(struct drm_device *drm_dev, void *raw_args, case DRM_PVR_DEV_QUERY_STATIC_DATA_AREAS_GET: ret = pvr_static_data_areas_get(pvr_dev, args); break; + + case DRM_PVR_DEV_QUERY_FW_INFO_GET: + ret = pvr_fw_info_get(pvr_dev, args); + break; } drm_dev_exit(idx); diff --git a/drivers/gpu/drm/imagination/pvr_drv.h b/drivers/gpu/drm/imagination/pvr_drv.h index 7fa147312dd1..4e058a6fdd5c 100644 --- a/drivers/gpu/drm/imagination/pvr_drv.h +++ b/drivers/gpu/drm/imagination/pvr_drv.h @@ -13,9 +13,10 @@ /* * Driver interface version: * - 1.0: Initial interface + * - 1.1: Add DRM_PVR_DEV_QUERY_FW_INFO_GET query */ #define PVR_DRIVER_MAJOR 1 -#define PVR_DRIVER_MINOR 0 +#define PVR_DRIVER_MINOR 1 #define PVR_DRIVER_PATCHLEVEL 0 int pvr_get_uobj(u64 usr_ptr, u32 usr_size, u32 min_size, u32 obj_size, void *out); @@ -68,6 +69,7 @@ int pvr_set_uobj_array(const struct drm_pvr_obj_array *out, u32 min_stride, u32 PVR_UOBJ_DECL(struct drm_pvr_dev_query_heap_info, heaps) \ PVR_UOBJ_DECL(struct drm_pvr_static_data_area, offset) \ PVR_UOBJ_DECL(struct drm_pvr_dev_query_static_data_areas, static_data_areas) \ + PVR_UOBJ_DECL(struct drm_pvr_dev_query_fw_info, _padding_4) \ ) /** diff --git a/drivers/gpu/drm/imagination/pvr_fw.c b/drivers/gpu/drm/imagination/pvr_fw.c index c7988278df3f..cbde54c7291c 100644 --- a/drivers/gpu/drm/imagination/pvr_fw.c +++ b/drivers/gpu/drm/imagination/pvr_fw.c @@ -4,6 +4,7 @@ #include "pvr_ccb.h" #include "pvr_device.h" #include "pvr_device_info.h" +#include "pvr_drv.h" #include "pvr_fw.h" #include "pvr_fw_info.h" #include "pvr_fw_startstop.h" @@ -1514,3 +1515,48 @@ pvr_fw_hard_reset(struct pvr_device *pvr_dev) return 0; } + +/** + * pvr_fw_info_get() + * @pvr_dev: Device pointer. + * @args: [IN] Device query arguments containing a pointer to a userspace + * struct drm_pvr_dev_query_fw_info. + * + * If the query object pointer is NULL, the size field is updated with the + * expected size of the query object. + * + * Returns: + * * 0 on success, or if size is requested using a NULL pointer, or + * * -%EINVAL if args contained non-zero reserved fields or + * if the input object is smaller than the minimum required, or + * * -%EFAULT if local memory could not be copied to userspace. + */ +int +pvr_fw_info_get(const struct pvr_device *pvr_dev, + struct drm_pvr_ioctl_dev_query_args *args) +{ + struct drm_pvr_dev_query_fw_info fw_info = {0}; + int err; + + if (!args->pointer) { + args->size = sizeof(struct drm_pvr_dev_query_fw_info); + return 0; + } + + err = PVR_UOBJ_GET(fw_info, args->size, args->pointer); + if (err < 0) + return err; + if (fw_info._padding_4) + return -EINVAL; + + fw_info.major_version = pvr_dev->fw_version.major; + fw_info.minor_version = pvr_dev->fw_version.minor; + + err = PVR_UOBJ_SET(args->pointer, args->size, fw_info); + if (err < 0) + return err; + + if (args->size > sizeof(fw_info)) + args->size = sizeof(fw_info); + return 0; +} diff --git a/drivers/gpu/drm/imagination/pvr_fw.h b/drivers/gpu/drm/imagination/pvr_fw.h index 626a1fdb6a4d..dab8292a8479 100644 --- a/drivers/gpu/drm/imagination/pvr_fw.h +++ b/drivers/gpu/drm/imagination/pvr_fw.h @@ -490,4 +490,7 @@ int pvr_fw_process_elf_command_stream(struct pvr_device *pvr_dev, const u8 *fw, u8 *fw_code_ptr, u8 *fw_data_ptr, u8 *fw_core_code_ptr, u8 *fw_core_data_ptr); +int +pvr_fw_info_get(const struct pvr_device *pvr_dev, struct drm_pvr_ioctl_dev_query_args *args); + #endif /* PVR_FW_H */ diff --git a/include/uapi/drm/pvr_drm.h b/include/uapi/drm/pvr_drm.h index ccf6c2112468..1179c1e7d92d 100644 --- a/include/uapi/drm/pvr_drm.h +++ b/include/uapi/drm/pvr_drm.h @@ -434,6 +434,21 @@ struct drm_pvr_dev_query_static_data_areas { struct drm_pvr_obj_array static_data_areas; }; +/** + * struct drm_pvr_dev_query_fw_info - Container used to fetch information + * about the GPU Firmware like its version. + */ +struct drm_pvr_dev_query_fw_info { + /** @major_version: Major version of the Firmware. */ + __u16 major_version; + + /** @minor_version: Minor version of the Firmware. */ + __u16 minor_version; + + /** @_padding_4: Reserved. This field must be zeroed. */ + __u32 _padding_4; +}; + /** * enum drm_pvr_dev_query - For use with &drm_pvr_ioctl_dev_query_args.type to * indicate the type of the receiving container. @@ -476,6 +491,12 @@ enum drm_pvr_dev_query { * a pointer to &struct drm_pvr_dev_query_static_data_areas. */ DRM_PVR_DEV_QUERY_STATIC_DATA_AREAS_GET, + + /** + * @DRM_PVR_DEV_QUERY_FW_INFO_GET: The dev query args contain + * a pointer to &struct drm_pvr_dev_query_fw_info. + */ + DRM_PVR_DEV_QUERY_FW_INFO_GET, }; /** -- cgit v1.2.3 From ad76ba062d8b46d1179aab2bf49d3a463da758b4 Mon Sep 17 00:00:00 2001 From: Matthew Brost Date: Fri, 6 Nov 2026 10:42:16 -0800 Subject: drm/gpusvm: Add drm_gpusvm_pages unmapped and retry helpers Drivers which only use the drm_gpusvm_pages API (no drm_gpusvm_range) have no way to mark pages unmapped from their MMU notifier, as drm_gpusvm_range_set_unmapped() requires a range. They also have to open code the mmu_interval_read_retry() check on the recorded notifier_seq to commit pages faulted with &drm_gpusvm_ctx.no_dma_map. Split the pages part of drm_gpusvm_range_set_unmapped() into drm_gpusvm_pages_set_unmapped(), and add drm_gpusvm_pages_read_retry() which performs the commit side check with a lockdep assert on the notifier lock. Reviewed-by: Honglei Huang Reviewed-by: Matthew Brost Signed-off-by: Matthew Brost Signed-off-by: Lizhi Hou Link: https://patch.msgid.link/20261106184217.2720718-1-lizhi.hou@amd.com --- drivers/gpu/drm/drm_gpusvm.c | 49 +++++++++++++++++++++++++++++++------------- include/drm/drm_gpusvm.h | 29 ++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/drivers/gpu/drm/drm_gpusvm.c b/drivers/gpu/drm/drm_gpusvm.c index 45169eb6de61..de2fa2684e84 100644 --- a/drivers/gpu/drm/drm_gpusvm.c +++ b/drivers/gpu/drm/drm_gpusvm.c @@ -1761,9 +1761,8 @@ err_unmap: * * With &drm_gpusvm_ctx.no_dma_map no mapping state is recorded, so * drm_gpusvm_pages_valid() never returns true and success is only a snapshot: - * the caller must recheck mmu_interval_read_retry() against the recorded - * &drm_gpusvm_pages.notifier_seq under the notifier lock, and hold it until - * its work is visible to invalidation. + * the caller must recheck drm_gpusvm_pages_read_retry() under the notifier + * lock, and hold it until its work is visible to invalidation. * * Return: 0 on success, negative error code on failure. */ @@ -2021,6 +2020,38 @@ bool drm_gpusvm_has_mapping(struct drm_gpusvm *gpusvm, unsigned long start, } EXPORT_SYMBOL_GPL(drm_gpusvm_has_mapping); +/** + * drm_gpusvm_pages_set_unmapped() - Mark GPU SVM pages as unmapped + * @gpusvm: Pointer to the GPU SVM structure. + * @pages: Pointer to the GPU SVM pages structure(s). + * @pages_count: Number of GPU SVM pages structure(s) passed in. + * + * Mark @pages as unmapped, after which drm_gpusvm_get_pages() fails with + * -EFAULT for them. Intended to be called from the driver's MMU notifier on + * MMU_NOTIFY_UNMAP, and usable without a &drm_gpusvm_range by drivers that + * only use the drm_gpusvm_pages API. The caller must hold the notifier lock + * in write mode. + */ +void drm_gpusvm_pages_set_unmapped(struct drm_gpusvm *gpusvm, + struct drm_gpusvm_pages *pages, + unsigned int pages_count) +{ + unsigned int i; + + lockdep_assert_held_write(&gpusvm->notifier_lock); + + for (i = 0; i < pages_count; ++i) { + struct drm_gpusvm_pages_flags flags = { + .__flags = pages[i].flags.__flags, + }; + + flags.unmapped = true; + /* WRITE_ONCE pairs with READ_ONCE for opportunistic checks */ + WRITE_ONCE(pages[i].flags.__flags, flags.__flags); + } +} +EXPORT_SYMBOL_GPL(drm_gpusvm_pages_set_unmapped); + /** * drm_gpusvm_range_set_unmapped() - Mark a GPU SVM range as unmapped * @range: Pointer to the GPU SVM range structure. @@ -2039,20 +2070,10 @@ void drm_gpusvm_range_set_unmapped(struct drm_gpusvm_range *range, struct drm_gpusvm_range_flags range_flags = { .__flags = range->flags.__flags, }; - unsigned int i; - lockdep_assert_held_write(&range->gpusvm->notifier_lock); + drm_gpusvm_pages_set_unmapped(range->gpusvm, pages, pages_count); range_flags.unmapped = true; - for (i = 0; i < pages_count; ++i) { - struct drm_gpusvm_pages_flags flags = { - .__flags = pages[i].flags.__flags, - }; - - flags.unmapped = true; - /* WRITE_ONCE pairs with READ_ONCE for opportunistic checks */ - WRITE_ONCE(pages[i].flags.__flags, flags.__flags); - } if (drm_gpusvm_range_start(range) < mmu_range->start || drm_gpusvm_range_end(range) > mmu_range->end) range_flags.partial_unmap = true; diff --git a/include/drm/drm_gpusvm.h b/include/drm/drm_gpusvm.h index 4d31c6bba745..b43432af5637 100644 --- a/include/drm/drm_gpusvm.h +++ b/include/drm/drm_gpusvm.h @@ -349,6 +349,10 @@ void drm_gpusvm_range_set_unmapped(struct drm_gpusvm_range *range, unsigned int pages_count, const struct mmu_notifier_range *mmu_range); +void drm_gpusvm_pages_set_unmapped(struct drm_gpusvm *gpusvm, + struct drm_gpusvm_pages *pages, + unsigned int pages_count); + int drm_gpusvm_get_pages(struct drm_gpusvm *gpusvm, struct drm_gpusvm_pages *svm_pages, unsigned int num_pages, @@ -383,6 +387,31 @@ static inline void drm_gpusvm_init_pages(struct drm_gpusvm_pages *svm_pages, svm_pages->notifier_seq = LONG_MAX; } +/** + * drm_gpusvm_pages_read_retry() - Check whether GPU SVM pages went stale + * @gpusvm: Pointer to the GPU SVM structure. + * @svm_pages: Pointer to the drm_gpusvm_pages. + * @notifier: The notifier passed to drm_gpusvm_get_pages() for @svm_pages. + * + * Check whether @notifier was invalidated since the last successful + * drm_gpusvm_get_pages() for @svm_pages. This is the commit side check for + * pages faulted with &drm_gpusvm_ctx.no_dma_map, where no mapping state is + * tracked. Pages that were never faulted always report as stale. The caller + * must hold the notifier lock and keep holding it until its use of the pages + * is visible to the invalidation path. + * + * Return: True if the pages must be faulted again, false otherwise. + */ +static inline bool +drm_gpusvm_pages_read_retry(struct drm_gpusvm *gpusvm, + struct drm_gpusvm_pages *svm_pages, + struct mmu_interval_notifier *notifier) +{ + lockdep_assert_held(&gpusvm->notifier_lock); + + return mmu_interval_read_retry(notifier, svm_pages->notifier_seq); +} + /** * drm_gpusvm_pages_first_dma() - Resolve the device address array * @svm_pages: Pointer to the drm_gpusvm_pages. -- cgit v1.2.3 From ab6d8e9263902fce98193645f47dbcb7806315d7 Mon Sep 17 00:00:00 2001 From: "Uwe Kleine-König (The Capable Hub)" Date: Thu, 6 Aug 2026 18:16:06 +0200 Subject: drm: Drop #include from MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only .c files include (see git grep -l drm_dp_aux_bus\\.h ). From the device-id structures that provides there are: - 8 files using struct auxiliary_device_id; - 2 files using struct i2c_device_id; and - 10 files using struct of_device_id (and no other usages; see git grep -l drm_dp_aux_bus\\.h | xargs grep -oh -E "\<(acpi_device_id|amba_id|ap_device_id|apr_device_id|auxiliary_device_id|bcma_device_id|ccw_device_id|cdx_device_id|coreboot_device_id|css_device_id|dfl_device_id|dmi_(device|system)_id|eisa_device_id|fsl_mc_device_id|hda_device_id|hid_device_id|hv_vmbus_device_id|i2c_device_id|i3c_device_id|ieee1394_device_id|input_device_id|ipack_device_id|isapnp_device_id|ishtp_device_id|mcb_device_id|mdio_device_id|mei_cl_device_id|mhi_device_id|mips_cdmm_device_id|of_device_id|parisc_device_id|pci_device_id|pci_epf_device_id|pcmcia_device_id|platform_device_id|pnp_(card_)?device_id|rio_device_id|rpmsg_device_id|sdio_device_id|sdw_device_id|serio_device_id|slim_device_id|spi_device_id|spmi_device_id|ssam_device_id|ssb_device_id|tb_service_id|tee_client_device_id|typec_device_id|ulpi_device_id|usb_device_id|vchiq_device_id|vio_device_id|virtio_device_id|wmi_device_id|x86_(cpu|device)_id|zorro_device_id|cpu_feature)\>" | sort | uniq -c ). The 8 files using struct auxiliary_device_id already include , the 2 files using struct i2c_device_id include and drm_dp_aux_bus.h itself includes which provide struct auxiliary_device_id, struct i2c_device_id and struct of_device_id respectively. So the include of can just be dropped. This gets one step closer to being able to remove that header. Signed-off-by: Uwe Kleine-König (The Capable Hub) Reviewed-by: Thomas Zimmermann Signed-off-by: Thomas Zimmermann Link: https://patch.msgid.link/21c9390024479ec625ca7a2e7a5b959f04d85878.1786032838.git.u.kleine-koenig@baylibre.com --- include/drm/display/drm_dp_aux_bus.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/drm/display/drm_dp_aux_bus.h b/include/drm/display/drm_dp_aux_bus.h index 8a0a486383c5..ca8db8ccc1f9 100644 --- a/include/drm/display/drm_dp_aux_bus.h +++ b/include/drm/display/drm_dp_aux_bus.h @@ -11,7 +11,6 @@ #define _DP_AUX_BUS_H_ #include -#include /** * struct dp_aux_ep_device - Main dev structure for DP AUX endpoints -- cgit v1.2.3 From 45a0af0666f58d9342216e1ca8b466fbc4c51efd Mon Sep 17 00:00:00 2001 From: Dmitry Ilvokhin Date: Wed, 28 Oct 2026 08:19:46 +0000 Subject: drm/gem: Switch to __nonnull_args() macro Commit 22302af28d3f ("cleanup: Annotate guard constructors with nonnull") added the macro __nonnull_args() to wrap raw compiler attribute. Replace __attribute__((nonnull)) with __nonnull_args() to standardize nonnull attribute usage across the tree and keep the attribute's quirks in one place rather than open-coded at every call site. Suggested-by: Miguel Ojeda Signed-off-by: Dmitry Ilvokhin Reviewed-by: Thomas Zimmermann Signed-off-by: Thomas Zimmermann Link: https://patch.msgid.link/5bfdc1491d297b5e98cf42322c790f06481c28c7.1793027261.git.d@ilvokhin.com --- include/drm/drm_gem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h index ed329408acbe..56dd15921c7a 100644 --- a/include/drm/drm_gem.h +++ b/include/drm/drm_gem.h @@ -566,7 +566,7 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj) kref_get(&obj->refcount); } -__attribute__((nonnull)) +__nonnull_args() static inline void __drm_gem_object_put(struct drm_gem_object *obj) { -- cgit v1.2.3