drm/msm: default separate_gpu_kms to auto selection
Subsystems (4)
PATCH RESEND v3 1/1 drm/msm: default separate_gpu_kms to auto selection
On platforms with multiple display subsystems, such as SA8775P, the GPU binds to the first display subsystem that probes. This implicit binding prevents subsequent display subsystems from probing successfully, breaking multi-display support.
Use the tristate separate_gpu_kms module parameter with the default value set to auto (-1). In auto mode, the driver selects the binding behavior based on the number of GPUs and display subsystems. This allows display subsystems to probe independently when required, while preserving the existing single-card behavior on simpler systems.
The separate_gpu_kms module parameter has the following semantics:
-1 (auto, default):
Select the binding mode based on hardware topology. If exactly one GPU and one display subsystem are present, bind them together to form a single DRM device. Otherwise, expose the GPU and display subsystems as separate DRM devices.
0:
Always bind the GPU and display together to form a single DRM device.
1:
Always expose the GPU and display subsystems as separate DRM devices.
Additionally, ensure that display subsystems are always exposed as separate DRM devices when no recognized Adreno GPU is present, regardless of the separate_gpu_kms setting.
This ensures correct probing on multi-display platforms without affecting single-display, single-GPU systems.
---
Depends on:
https://lore.kernel.org/lkml/[email protected]/
When separate_gpu_kms is enabled, the GPU and display drivers are probed independently. In this configuration, the Adreno GPU driver may no longer be loaded implicitly via the display subsystem.
The referenced patch adds a MODULE_DEVICE_TABLE() entry for the Adreno GPU device, ensuring proper module autoloading based on device tree matching. This is required to guarantee that the GPU driver is loaded correctly when GPU and display probing are decoupled.
Changes in v3:
- Ensure display subsystems are always exposed as separate DRM devices when
no recognized Adreno GPU is present (!adreno_has_gpu()), regardless of separate_gpu_kms setting. (Dmitry)
- Extend auto-selection logic to account for legacy display controllers (MDP4 and MDP5). (Dmitry)
- Rename msm_mdss_count_masters() to msm_mdss_count() to better reflect functionality. (Dmitry)
- Common helper to determine presence of a valid Adreno GPU node, avoiding repeated adreno_has_gpu() and availability checks.
- Update commit message to reflect the above behavior.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Drop dependency on Lemans dual-DPU device tree changes as this patch
works independently (Dmitry)
- Switch separate_gpu_kms to tristate and default to auto mode (Rob)
- Rename msm_gpu_no_components() to msm_separate_gpu_kms_components() for clarity
- Link to v1: https://lore.kernel.org/r/[email protected]
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 14 +++++++ drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 14 +++++++ drivers/gpu/drm/msm/msm_drv.c | 64 ++++++++++++++++++++++++++---- drivers/gpu/drm/msm/msm_drv.h | 8 +++- drivers/gpu/drm/msm/msm_mdss.c | 15 +++++++ 6 files changed, 107 insertions(+), 10 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +1 -1
@@ -272,7 +272,7 @@ static const struct component_ops a3xx_ops = {static int adreno_probe (struct platform_device *pdev) {if (of_device_is_compatible (pdev->dev.of_node,"amd,imageon" ) || -msm_gpu_no_components ()) +msm_separate_gpu_kms_components ())return msm_gpu_probe (pdev, &a3xx_ops);return component_add (&pdev->dev, &a3xx_ops);
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +14 -0
@@ -15,6 +15,20 @@#include "msm_mmu.h" #include "mdp4_kms.h" +static const struct of_device_id mdp4_dt_match[]; +int msm_count_mdp4 (void ) +{ +struct device_node *np; +int count =0 ; + +for_each_matching_node (np, mdp4_dt_match) { +if (of_device_is_available (np)) + count++; + } + +return count; +} +static int mdp4_hw_init (struct msm_kms *kms) {struct mdp4_kms *mdp4_kms =to_mdp4_kms (to_mdp_kms (kms));
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +14 -0
@@ -19,6 +19,20 @@#include "msm_mmu.h" #include "mdp5_kms.h" +static const struct of_device_id mdp5_dt_match[]; +int msm_count_mdp5 (void ) +{ +struct device_node *np; +int count =0 ; + +for_each_matching_node (np, mdp5_dt_match) { +if (of_device_is_available (np)) + count++; + } + +return count; +} +static int mdp5_hw_init (struct msm_kms *kms) {struct mdp5_kms *mdp5_kms =to_mdp5_kms (to_mdp_kms (kms));
drivers/gpu/drm/msm/msm_drv.c +56 -8
93 lines not on this page · raw message
drivers/gpu/drm/msm/msm_drv.h +7 -1
@@ -555,6 +555,12 @@ void msm_kms_shutdown(struct platform_device *pdev);bool msm_disp_drv_should_bind (struct device *dev,bool dpu_driver); -bool msm_gpu_no_components (void ); +bool msm_separate_gpu_kms_components (void ); + +int msm_count_mdss (void ); + +int msm_count_mdp4 (void ); + +int msm_count_mdp5 (void );#endif /* __MSM_DRV_H__ */
drivers/gpu/drm/msm/msm_mdss.c +15 -0
@@ -73,6 +73,21 @@ static int msm_mdss_parse_data_bus_icc_path(struct device *dev,return 0 ; } +static const struct of_device_id mdss_dt_match[]; + +int msm_count_mdss (void ) +{ +struct device_node *np; +int count =0 ; + +for_each_matching_node (np, mdss_dt_match) { +if (of_device_is_available (np)) + count++; + } + +return count; +} +static void msm_mdss_irq (struct irq_desc *desc) {struct msm_mdss *msm_mdss =irq_desc_get_handler_data (desc);
---
base-commit: b84a0ebe421ca56995ff78b66307667b62b3a900
change-id: 20260316-separate_gpu_kms-04d2cf4d91e2
Best regards,
Signature · 1 line
Mahadevan P <[email protected]>
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Missing `of_node_put()` causes an OF node reference leak in `msm_separate_gpu_kms_components()`.…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing of_node_put() causes an OF node reference leak in msm_separate_gpu_kms_components(). --
commit 46360e93ded31d3fb12ccb01a8d959a4c7390270
Author: Mahadevan P <[email protected]>
drm/msm: default separate_gpu_kms to auto selection
This commit updates the separate_gpu_kms module parameter to a tristate, defaulting to an auto-selection mode. It allows the driver to automatically split the display and GPU devices depending on the hardware topology, improving support for multi-display platforms.
Quoted 3 lines
drivers/gpu/drm/msm/msm_drv.c +0
-0
[ ... ]
drivers/gpu/drm/msm/msm_drv.c static bool modeset = true; · line 114
Quoted 13 lines
drivers/gpu/drm/msm/msm_drv.c +11
-1+bool msm_separate_gpu_kms_components (void ) { -return separate_gpu_kms; +struct device_node *np; + + np =of_find_matching_node (NULL , msm_gpu_match); +if (!msm_gpu_node_present (np)) +return true; +if (separate_gpu_kms ==1 ) +return true; +if (separate_gpu_kms ==0 ) +return false; +return msm_separate_gpu_kms_auto ();
[Severity: Medium]
Does this code leak the device node reference in msm_separate_gpu_kms_components() in drivers/gpu/drm/msm/msm_drv.c?
The of_find_matching_node() function returns a node with its reference count incremented. When np is not NULL, the function returns through multiple paths without calling of_node_put() to release the reference.
Quoted 3 lines
}
static int
msm_drm_uninit(struct device *dev, const struct component_ops *gpu_ops)
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Mahadevan,
kernel test robot noticed the following build errors:
[auto build test ERROR on b84a0ebe421ca56995ff78b66307667b62b3a900]
url: https://github.com/intel-lab-lkp/linux/commits/Mahadevan-P/drm-msm-default-separate_gpu_kms-to-auto-selection/20260909-191834 base: b84a0ebe421ca56995ff78b66307667b62b3a900 patch link: https://lore.kernel.org/r/20260909-separate_gpu_kms-v3-1-eae64dfbb635%40oss.qualcomm.com patch subject: [PATCH RESEND v3] drm/msm: default separate_gpu_kms to auto selection config: powerpc-randconfig-001-20260912 (https://download.01.org/0day-ci/archive/20260913/[email protected]/config) compiler: powerpc-linux-gcc (GCC) 13.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260913/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "msm_count_mdp5" [drivers/gpu/drm/msm/msm.ko] undefined! >> ERROR: modpost: "msm_count_mdss" [drivers/gpu/drm/msm/msm.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Mahadevan,
kernel test robot noticed the following build errors:
[auto build test ERROR on b84a0ebe421ca56995ff78b66307667b62b3a900]
url: https://github.com/intel-lab-lkp/linux/commits/Mahadevan-P/drm-msm-default-separate_gpu_kms-to-auto-selection/20260909-191834 base: b84a0ebe421ca56995ff78b66307667b62b3a900 patch link: https://lore.kernel.org/r/20260909-separate_gpu_kms-v3-1-eae64dfbb635%40oss.qualcomm.com patch subject: [PATCH RESEND v3] drm/msm: default separate_gpu_kms to auto selection config: arm64-randconfig-r133-20260912 (https://download.01.org/0day-ci/archive/20260913/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 14.3.0 sparse: v0.6.5-rc1 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260913/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
aarch64-linux-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-ld: drivers/gpu/drm/msm/msm_drv.o: in function `msm_separate_gpu_kms_components':
>> msm_drv.c:(.text+0x1938): undefined reference to `msm_count_mdp4' >> aarch64-linux-ld: msm_drv.c:(.text+0x1940): undefined reference to `msm_count_mdp5' >> aarch64-linux-ld: msm_drv.c:(.text+0x1978): undefined reference to `msm_count_mdp4'
aarch64-linux-ld: msm_drv.c:(.text+0x197c): undefined reference to `msm_count_mdp5'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki