drm: Switch drivers to drm_mode_config_create_initial_state
Subsystems (92)
Maxime Ripard
maintainercover drm: Switch drivers to drm_mode_config_create_initial_state
drm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles. However, the two roles need different behaviors, notably for objects like drm_private_obj that must persist across suspend/resume and are excluded from drm_mode_config_reset() by design.
Previous series introduced drm_mode_config_create_initial_state() to handle only the initial state creation at probe time, including drm_private_obj. Unlike drm_mode_config_reset(), it returns an error code, allowing drivers to properly handle allocation failures.
This series switches all drivers calling drm_mode_config_reset() at probe time to drm_mode_config_create_initial_state(). The conversion was done using a Coccinelle semantic patch.
This is part, and the final piece, of a larger transition to remove the overloaded reset semantics from the KMS subsystem, following similar series for planes, CRTCs, connectors, and bridges.
---
Maxime Ripard (83):
drm/adp: Switch to drm_mode_config_create_initial_state
drm/amdgpu: Switch to drm_mode_config_create_initial_state drm/appletbdrm: Switch to drm_mode_config_create_initial_state drm/komeda: Switch to drm_mode_config_create_initial_state
drm/hdlcd: Switch to drm_mode_config_create_initial_state
drm/malidp: Switch to drm_mode_config_create_initial_state
drm/armada: Switch to drm_mode_config_create_initial_state
drm/aspeed: Switch to drm_mode_config_create_initial_state
drm/ast: Switch to drm_mode_config_create_initial_state drm/atmel-hlcdc: Switch to drm_mode_config_create_initial_state drm/exynos: Switch to drm_mode_config_create_initial_state drm/fsl-dcu: Switch to drm_mode_config_create_initial_state
drm/gud: Switch to drm_mode_config_create_initial_state drm/hisilicon/hibmc: Switch to drm_mode_config_create_initial_state drm/hisilicon/kirin: Switch to drm_mode_config_create_initial_state drm/hyperv: Switch to drm_mode_config_create_initial_state
drm/imx/dc: Switch to drm_mode_config_create_initial_state drm/imx/dcss: Switch to drm_mode_config_create_initial_state drm/imx/ipuv3: Switch to drm_mode_config_create_initial_state drm/ingenic: Switch to drm_mode_config_create_initial_state
drm/kmb: Switch to drm_mode_config_create_initial_state
drm/logicvc: Switch to drm_mode_config_create_initial_state drm/loongson: Switch to drm_mode_config_create_initial_state
drm/mcde: Switch to drm_mode_config_create_initial_state
drm/mediatek: Switch to drm_mode_config_create_initial_state drm/meson: Switch to drm_mode_config_create_initial_state
drm/mgag200: Switch to drm_mode_config_create_initial_state
drm/msm: Switch to drm_mode_config_create_initial_state
drm/lcdif: Switch to drm_mode_config_create_initial_state
drm/mxsfb: Switch to drm_mode_config_create_initial_state
drm/nouveau: Switch to drm_mode_config_create_initial_state
drm/omap: Switch to drm_mode_config_create_initial_state
drm/pl111: Switch to drm_mode_config_create_initial_state
drm/qxl: Switch to drm_mode_config_create_initial_state
drm/rcar-du: Switch to drm_mode_config_create_initial_state
drm/rz-du: Switch to drm_mode_config_create_initial_state drm/shmobile: Switch to drm_mode_config_create_initial_state drm/rockchip: Switch to drm_mode_config_create_initial_state drm/st7571: Switch to drm_mode_config_create_initial_state
drm/st7586: Switch to drm_mode_config_create_initial_state drm/st7735r: Switch to drm_mode_config_create_initial_state drm/st7920: Switch to drm_mode_config_create_initial_state drm/ssd130x: Switch to drm_mode_config_create_initial_state
drm/sprd: Switch to drm_mode_config_create_initial_state
drm/sti: Switch to drm_mode_config_create_initial_state
drm/stm: Switch to drm_mode_config_create_initial_state
drm/sun4i: Switch to drm_mode_config_create_initial_state drm/corebootdrm: Switch to drm_mode_config_create_initial_state drm/efidrm: Switch to drm_mode_config_create_initial_state
drm/ofdrm: Switch to drm_mode_config_create_initial_state drm/simpledrm: Switch to drm_mode_config_create_initial_state drm/vesadrm: Switch to drm_mode_config_create_initial_state
drm/tegra: Switch to drm_mode_config_create_initial_state
drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state drm/tests: drm_atomic_test: Switch to drm_mode_config_create_initial_state drm/tests: drm_bridge_test: Switch to drm_mode_config_create_initial_state drm/tests: drm_hdmi_state_helper_test: Switch to drm_mode_config_create_initial_state drm/tidss: Switch to drm_mode_config_create_initial_state
drm/tilcdc: Switch to drm_mode_config_create_initial_state
drm/arcpgu: Switch to drm_mode_config_create_initial_state
drm/bochs: Switch to drm_mode_config_create_initial_state drm/cirrus-qemu: Switch to drm_mode_config_create_initial_state drm/gm12u320: Switch to drm_mode_config_create_initial_state drm/hx8357d: Switch to drm_mode_config_create_initial_state drm/ili9163: Switch to drm_mode_config_create_initial_state drm/ili9225: Switch to drm_mode_config_create_initial_state drm/ili9341: Switch to drm_mode_config_create_initial_state drm/ili9486: Switch to drm_mode_config_create_initial_state drm/mi0283qt: Switch to drm_mode_config_create_initial_state drm/panel-mipi-dbi: Switch to drm_mode_config_create_initial_state drm/pixpaper: Switch to drm_mode_config_create_initial_state drm/repaper: Switch to drm_mode_config_create_initial_state drm/sharp-memory: Switch to drm_mode_config_create_initial_state drm/tve200: Switch to drm_mode_config_create_initial_state
drm/udl: Switch to drm_mode_config_create_initial_state
drm/vboxvideo: Switch to drm_mode_config_create_initial_state
drm/vc4: Switch to drm_mode_config_create_initial_state drm/verisilicon: Switch to drm_mode_config_create_initial_state drm/virtio: Switch to drm_mode_config_create_initial_state
drm/vkms: Switch to drm_mode_config_create_initial_state
drm/vmwgfx: Switch to drm_mode_config_create_initial_state
drm/xen: Switch to drm_mode_config_create_initial_state
drm/xlnx: Switch to drm_mode_config_create_initial_state
drivers/gpu/drm/adp/adp_drv.c | 4 +--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 4 +++- .../amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c | 3 ++- .../amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 4 +++- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 4 +++- drivers/gpu/drm/arm/hdlcd_drv.c | 4 +++- drivers/gpu/drm/arm/malidp_drv.c | 4 +++- drivers/gpu/drm/armada/armada_drv.c | 4 +++- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 4 +--- drivers/gpu/drm/ast/ast_mode.c | 4 +++- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 +++- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +++- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 4 +++- drivers/gpu/drm/gud/gud_drv.c | 4 +++- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 ++++-- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 6 ++++-- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 +--- drivers/gpu/drm/imx/dc/dc-kms.c | 4 +++- drivers/gpu/drm/imx/dcss/dcss-kms.c | 4 +++- drivers/gpu/drm/imx/ipuv3/imx-drm-core.c | 4 +++- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 +++- drivers/gpu/drm/kmb/kmb_drv.c | 3 +-- drivers/gpu/drm/logicvc/logicvc_mode.c | 4 +++- drivers/gpu/drm/loongson/lsdc_drv.c | 4 +++- drivers/gpu/drm/mcde/mcde_drv.c | 4 +++- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 +++++++- drivers/gpu/drm/meson/meson_drv.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh5.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200er.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ev.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ew3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200se.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200wb.c | 4 +++- drivers/gpu/drm/msm/msm_kms.c | 4 +++- drivers/gpu/drm/mxsfb/lcdif_drv.c | 4 +++- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_display.c | 4 +++- drivers/gpu/drm/omapdrm/omap_drv.c | 4 +++- drivers/gpu/drm/pl111/pl111_drv.c | 4 +++- drivers/gpu/drm/qxl/qxl_display.c | 3 +-- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 4 +++- drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c | 4 +++- drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c | 4 +++- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 4 +++- drivers/gpu/drm/sitronix/st7571.c | 4 +++- drivers/gpu/drm/sitronix/st7586.c | 4 +++- drivers/gpu/drm/sitronix/st7735r.c | 4 +++- drivers/gpu/drm/sitronix/st7920.c | 4 +--- drivers/gpu/drm/solomon/ssd130x.c | 4 +--- drivers/gpu/drm/sprd/sprd_drm.c | 6 ++++-- drivers/gpu/drm/sti/sti_drv.c | 6 +++++- drivers/gpu/drm/stm/drv.c | 4 +++- drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 4 +++- drivers/gpu/drm/sysfb/corebootdrm.c | 4 +++- drivers/gpu/drm/sysfb/efidrm.c | 4 +++- drivers/gpu/drm/sysfb/ofdrm.c | 4 +++- drivers/gpu/drm/sysfb/simpledrm.c | 4 +++- drivers/gpu/drm/sysfb/vesadrm.c | 4 +++- drivers/gpu/drm/tegra/drm.c | 4 +++- drivers/gpu/drm/tests/drm_atomic_commit_test.c | 4 +++- drivers/gpu/drm/tests/drm_atomic_test.c | 4 +++- drivers/gpu/drm/tests/drm_bridge_test.c | 12 +++++++++--- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 4 +++- drivers/gpu/drm/tidss/tidss_drv.c | 6 +++++- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 +++- drivers/gpu/drm/tiny/appletbdrm.c | 4 +--- drivers/gpu/drm/tiny/arcpgu.c | 4 +++- drivers/gpu/drm/tiny/bochs.c | 4 +--- drivers/gpu/drm/tiny/cirrus-qemu.c | 4 +++- drivers/gpu/drm/tiny/gm12u320.c | 4 +++- drivers/gpu/drm/tiny/hx8357d.c | 4 +++- drivers/gpu/drm/tiny/ili9163.c | 4 +++- drivers/gpu/drm/tiny/ili9225.c | 4 +++- drivers/gpu/drm/tiny/ili9341.c | 4 +++- drivers/gpu/drm/tiny/ili9486.c | 4 +++- drivers/gpu/drm/tiny/mi0283qt.c | 4 +++- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 +++- drivers/gpu/drm/tiny/pixpaper.c | 4 +++- drivers/gpu/drm/tiny/repaper.c | 4 +++- drivers/gpu/drm/tiny/sharp-memory.c | 4 +++- drivers/gpu/drm/tve200/tve200_drv.c | 4 +++- drivers/gpu/drm/udl/udl_modeset.c | 4 +++- drivers/gpu/drm/vboxvideo/vbox_mode.c | 5 ++++- drivers/gpu/drm/vc4/vc4_kms.c | 4 +++- drivers/gpu/drm/verisilicon/vs_drm.c | 4 +++- drivers/gpu/drm/virtio/virtgpu_display.c | 3 +-- drivers/gpu/drm/vkms/vkms_output.c | 4 +--- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 4 +++- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 +--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 +--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 4 +++- drivers/gpu/drm/xlnx/zynqmp_kms.c | 6 ++++-- 95 files changed, 277 insertions(+), 124 deletions(-)
---
base-commit: d2a8cee91bfa8616f713c7c8f539a81e8e3554ea
change-id: 20260712-drm-no-more-config-reset-1ea89f56693d
Best regards,
-----BEGIN PGP SIGNATURE-----
iJUEABMJAB0WIQTkHFbLp4ejekA/qfgnX84Zoj2+dgUCauyPHAAKCRAnX84Zoj2+ dkwsAX9NFbbJHCN9xg2CeHNoUE2b74hoQ5+vO2GWUoHj4SnPtC+G3wjjcqEZiRKZ xMEy+OMBgLIpXnrk4sqLj7r+OWFunhZwYsLromcY/UpASSNAT98Hro2QnIUo8S4f xStpohEISg==
=9Kfg
-----END PGP SIGNATURE-----
Signature · 1 line
Maxime Ripard <[email protected]>
Maxime Ripard
maintainerPATCH RESEND 1/83 drm/adp: Switch to drm_mode_config_create_initial_state
drm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Janne Grunau <[email protected]>
Cc: Sasha Finkelstein <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/adp/adp_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/adp/adp_drv.c +1 -3
@@ -451,7 +451,5 @@ static int adp_setup_mode_config(struct adp_drv_private *adp) } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); }
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 2/83 drm/amdgpu: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: "Christian König" <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 4 +++- .../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c | 3 ++- .../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +3 -1
@@ -362,5 +362,7 @@ static int amdgpu_vkms_output_init(struct drm_device *dev, struct } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_attach;return 0 ;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +2 -1
@@ -9966,5 +9966,6 @@ dm_test_force_ctx_alloc(struct kunit *test, const struct drm_connector_funcs *fu ctx->aconnector->base.encoder = encoder; -drm_mode_config_reset (ctx->drm); +KUNIT_ASSERT_EQ (test, +drm_mode_config_create_initial_state (ctx->drm),0 );drm_modeset_acquire_init (&ctx->acquire_ctx,0 );
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_mst_types_test.c +3 -1
@@ -3794,5 +3794,7 @@ dm_mst_test_alloc_dsc_link_ctx(struct kunit *test, int total_avail_slots) &dm_mst_test_dsc_link_conn_funcs, DRM_MODE_CONNECTOR_DisplayPort, NULL), 0); -drm_mode_config_reset (ctx->drm); + +KUNIT_ASSERT_EQ (test, +drm_mode_config_create_initial_state (ctx->drm),0 ); KUNIT_ASSERT_EQ(test,
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 3/83 drm/appletbdrm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Aditya Garg <[email protected]>
Cc: Aun-Ali Zaidi <[email protected]>
--- drivers/gpu/drm/tiny/appletbdrm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/tiny/appletbdrm.c +1 -3
@@ -730,7 +730,5 @@ static int appletbdrm_setup_mode_config(struct appletbdrm_device *adev) } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); }
Signature · 1 line
2.55.0
Re: [PATCH RESEND 03/83] drm/appletbdrm: Switch to drm_mode_config_create_initial_state
Quoted 8 lines · Maxime Ripard
drm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 2 lines
---
Cc: Aditya Garg <[email protected]>
Pls use my correct email address ;)
Quoted 22 lines
Cc Aun-Ali Zaidi <[email protected]>---
drivers/gpu/drm/tiny/appletbdrm.c| 4 +---1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/tiny/appletbdrm.c +1
-4@@ -730,7 +730,5 @@ static int appletbdrm_setup_mode_config(struct appletbdrm_device *adev) } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); } --2.55.0
Maxime Ripard
maintainerPATCH RESEND 4/83 drm/komeda: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Liviu Dudau <[email protected]>
--- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/display/komeda/komeda_kms.c +3 -1
@@ -310,5 +310,7 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) goto cleanup_mode_config; -drm_mode_config_reset (drm); + err =drm_mode_config_create_initial_state (drm); +if (err) + goto cleanup_mode_config; err = devm_request_irq(drm->dev, mdev->irq,
Signature · 1 line
2.55.0
Re: [PATCH RESEND 04/83] drm/komeda: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Best regards,
Liviu
Quoted 23 lines
---
Cc: Liviu Dudau <[email protected]>--- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/arm/display/komeda/komeda_kms.c +3
-1@@ -310,5 +310,7 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) goto cleanup_mode_config; -drm_mode_config_reset (drm); + err =drm_mode_config_create_initial_state (drm); +if (err) + goto cleanup_mode_config; err = devm_request_irq(drm->dev, mdev->irq,Signature · 2 lines
-- 2.55.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Maxime Ripard
maintainerPATCH RESEND 5/83 drm/hdlcd: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Liviu Dudau <[email protected]>
--- drivers/gpu/drm/arm/hdlcd_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/hdlcd_drv.c +3 -1
@@ -319,5 +319,7 @@ static int hdlcd_probe(struct platform_device *pdev) } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_vblank;drm_kms_helper_poll_init (drm);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 05/83] drm/hdlcd: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Best regards,
Liviu
Quoted 23 lines
---
Cc: Liviu Dudau <[email protected]>--- drivers/gpu/drm/arm/hdlcd_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/arm/hdlcd_drv.c +3
-1@@ -319,5 +319,7 @@ static int hdlcd_probe(struct platform_device *pdev) } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_vblank;drm_kms_helper_poll_init (drm);Signature · 2 lines
-- 2.55.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯[email protected]
AI reviewRe: [PATCH RESEND 05/83] drm/hdlcd: Switch to drm_mode_config_create_initial_state
In reply to Maxime RipardThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/hdlcd: invalid drm_atomic_helper_shutdown() on hdlcd_probe() error path --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/hdlcd: invalid drm_atomic_helper_shutdown() on hdlcd_probe() error path --
commit 05385ee4b911593ec2d698a13a97eb831b545f6c
Author: Maxime Ripard <[email protected]>
drm/hdlcd: Switch to drm_mode_config_create_initial_state
This commit replaces the probe-time call to drm_mode_config_reset() in hdlcd_probe() with drm_mode_config_create_initial_state() and jumps to err_vblank on error.
drivers/gpu/drm/arm/hdlcd_drv.c static int hdlcd_probe(struct platform_device *pdev) · line 323
Quoted 12 lines
drivers/gpu/drm/arm/hdlcd_drv.c +3
-1@@ -318,7 +318,9 @@ static int hdlcd_probe(struct platform_device *pdev)aperture_remove_all_conflicting_devices (hdlcd_driver.name); } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_vblank;
[Severity: Medium]
If drm_mode_config_create_initial_state() fails in hdlcd_probe() in drivers/gpu/drm/arm/hdlcd_drv.c, jumping to err_vblank disables runtime PM and falls through to err_pm_active, which calls drm_atomic_helper_shutdown():
err_vblank:
pm_runtime_disable(drm->dev); err_pm_active: drm_atomic_helper_shutdown(drm);
In drm_mode_config_create_initial_state(), initial state objects are allocated sequentially for private objects, colorops, planes, CRTCs, and connectors. If state allocation fails before or during drm_mode_config_crtc_create_state(), hdlcd->crtc.state remains NULL.
Calling drm_atomic_helper_shutdown() then invokes:
drm_atomic_helper_shutdown()
drm_atomic_helper_disable_all()
drm_atomic_get_crtc_state()
drm_atomic_helper_crtc_duplicate_state()
where drm_atomic_helper_crtc_duplicate_state() indrivers/gpu/drm/drm_atomic_state_helper.c hits:
if (WARN_ON(!crtc->state)) return NULL;
Even if crtc->state was allocated and connector state allocation failed, drm_atomic_helper_shutdown() attempts an atomic commit on partially initialized KMS state after pm_runtime_disable() has already disabled runtime PM (and before any modeset was committed, which also affects the existing pm_runtime_set_active() and drm_vblank_init() error paths).
Should drm_atomic_helper_shutdown() be avoided on probe error paths where initial KMS state creation has not completed or runtime PM is already disabled?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Maxime Ripard
maintainerPATCH RESEND 6/83 drm/malidp: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Liviu Dudau <[email protected]>
--- drivers/gpu/drm/arm/malidp_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_drv.c +3 -1
@@ -857,5 +857,7 @@ static int malidp_bind(struct device *dev)pm_runtime_put (dev); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto register_fail;drm_kms_helper_poll_init (drm);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 06/83] drm/malidp: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Best regards,
Liviu
Quoted 23 lines
---
Cc: Liviu Dudau <[email protected]>--- drivers/gpu/drm/arm/malidp_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/arm/malidp_drv.c +3
-1@@ -857,5 +857,7 @@ static int malidp_bind(struct device *dev)pm_runtime_put (dev); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto register_fail;drm_kms_helper_poll_init (drm);Signature · 2 lines
-- 2.55.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Maxime Ripard
maintainerPATCH RESEND 7/83 drm/armada: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Russell King <[email protected]>
--- drivers/gpu/drm/armada/armada_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/armada/armada_drv.c +3 -1
@@ -127,5 +127,7 @@ static int armada_drm_bind(struct device *dev) goto err_comp; -drm_mode_config_reset (&priv->drm); + ret =drm_mode_config_create_initial_state (&priv->drm); +if (ret) + goto err_comp;drm_kms_helper_poll_init (&priv->drm);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 8/83 drm/aspeed: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Andrew Jeffery <[email protected]>
Cc: Joel Stanley <[email protected]>
--- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +1 -3
@@ -229,7 +229,5 @@ static int aspeed_gfx_load(struct drm_device *drm) } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); }
Signature · 1 line
2.55.0
Re: [PATCH RESEND 08/83] drm/aspeed: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Maxime Ripard
maintainerPATCH RESEND 9/83 drm/ast: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Jocelyn Falempe <[email protected]>
--- drivers/gpu/drm/ast/ast_mode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_mode.c +3 -1
@@ -1074,5 +1074,7 @@ int ast_mode_config_init(struct ast_device *ast)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drmm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 10/83 drm/atmel-hlcdc: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alexandre Belloni <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Dharma Balasubiramani <[email protected]>
Cc: Manikandan Muralidharan <[email protected]>
Cc: Nicolas Ferre <[email protected]>
--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +3 -1
@@ -880,5 +880,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev) } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_periph_clk_disable;pm_runtime_get_sync (dev->dev);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 10/83] drm/atmel-hlcdc: Switch to drm_mode_config_create_initial_state
Quoted 6 lines · Maxime Ripard
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 27 lines
---
Cc: Alexandre Belloni <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Dharma Balasubiramani <[email protected]>
Cc: Manikandan Muralidharan <[email protected]>
Cc: Nicolas Ferre <[email protected]>--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +3
-2@@ -880,5 +880,7 @@ static int atmel_hlcdc_dc_load(struct drm_device *dev) } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_periph_clk_disable;pm_runtime_get_sync (dev->dev); --2.55.0
Signature · 2 lines
Thanks and Regards, Manikandan M.
Maxime Ripard
maintainerPATCH RESEND 11/83 drm/exynos: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alim Akhtar <[email protected]>
Cc: Inki Dae <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Kyungmin Park <[email protected]>
Cc: Peter Griffin <[email protected]>
Cc: Seung-Woo Kim <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +3 -1
@@ -278,5 +278,7 @@ static int exynos_drm_bind(struct device *dev) goto err_unbind_all; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_unbind_all;/* init kms poll for handling hpd */
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 12/83 drm/fsl-dcu: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alison Wang <[email protected]>
Cc: Stefan Agner <[email protected]>
--- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c +3 -1
@@ -43,5 +43,7 @@ int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev) goto err; -drm_mode_config_reset (fsl_dev->drm); + ret =drm_mode_config_create_initial_state (fsl_dev->drm); +if (ret) + goto err;drm_kms_helper_poll_init (fsl_dev->drm);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 13/83 drm/gud: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Ruben Wauters <[email protected]>
--- drivers/gpu/drm/gud/gud_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/gud/gud_drv.c +3 -1
@@ -641,5 +641,7 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id) } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret;drm_kms_helper_poll_init (drm);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 13/83] drm/gud: Switch to drm_mode_config_create_initial_state
Quoted 10 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.
Quoted 3 lines
Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 21 lines
---
Cc: Ruben Wauters <[email protected]>
---
drivers/gpu/drm/gud/gud_drv.c | 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/gud/gud_drv.c +0
-0@@ -641,5 +641,7 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id) }drivers/gpu/drm/gud/gud_drv.c +3
-1-drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret;
drm_kms_helper_poll_init(drm);
Maxime Ripard
maintainerPATCH RESEND 14/83 drm/hisilicon/hibmc: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Tian Tao <[email protected]>
Cc: Xinwei Kong <[email protected]>
Cc: Yongbang Shi <[email protected]>
--- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +4 -2
@@ -412,6 +412,8 @@ static int hibmc_load(struct drm_device *dev) } -/* reset all the states of crtc/plane/encoder/connector */ -drm_mode_config_reset (dev); +/* Create all the states of crtc/plane/encoder/connector */ + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err;drmm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 14/83] drm/hisilicon/hibmc: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/hisilicon/hibmc: WARN_ON in hibmc_unload() on hibmc_load() error --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/hisilicon/hibmc: WARN_ON in hibmc_unload() on hibmc_load() error --
commit 289d0414bb2d6ac0dd51c3f3424d35a2428b1b8c
Author: Maxime Ripard <[email protected]>
drm/hisilicon/hibmc: Switch to drm_mode_config_create_initial_state
This commit replaces drm_mode_config_reset() with drm_mode_config_create_initial_state() in hibmc_load() to initialize the KMS state at probe time.
Quoted 5 lines
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +0
-0
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c static int hibmc_load(struct drm_device *dev) · line 417
Quoted 9 lines
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +4
-2@@ -411,8 +411,10 @@ static int hibmc_load(struct drm_device *dev) goto err; } -/* reset all the states of crtc/plane/encoder/connector */ -drm_mode_config_reset (dev); +/* Create all the states of crtc/plane/encoder/connector */ + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err;
[Severity: Medium]
If drm_mode_config_create_initial_state() fails while allocating the plane or CRTC state in hibmc_load(), jumping to err calls hibmc_unload() while priv->crtc.state is still NULL:
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c:hibmc_load() {
...
err:
hibmc_unload(dev);
drm_err(dev, "failed to initialize drm driver: %d\n", ret);
return ret;
}drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c:hibmc_unload() {
drm_atomic_helper_shutdown(dev);
}Since hibmc_kms_init() has already registered priv->crtc on dev->mode_config.crtc_list, won't the call chain
hibmc_unload()
-> drm_atomic_helper_shutdown()
-> drm_atomic_helper_disable_all()
-> drm_atomic_get_crtc_state()
-> drm_atomic_helper_crtc_duplicate_state()
trigger WARN_ON(!crtc->state) in drm_atomic_helper_crtc_duplicate_state()?
(The earlier error jumps in hibmc_load() for hibmc_kms_init(), drm_vblank_init(), and hibmc_msi_init() also jump to err and call hibmc_unload() before drm_mode_config_create_initial_state() has populated crtc->state.)
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
Maxime Ripard
maintainerPATCH RESEND 15/83 drm/hisilicon/kirin: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: John Stultz <[email protected]>
Cc: Sumit Semwal <[email protected]>
Cc: Xinliang Liu <[email protected]>
Cc: Yongqin Liu <[email protected]>
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +4 -2
@@ -188,6 +188,8 @@ static int kirin_drm_kms_init(struct drm_device *dev, } -/* reset all the states of crtc/plane/encoder/connector */ -drm_mode_config_reset (dev); +/* Create all the states of crtc/plane/encoder/connector */ + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_unbind_all;/* init kms poll for handling hpd */
Signature · 1 line
2.55.0
Re: [PATCH RESEND 15/83] drm/hisilicon/kirin: Switch to drm_mode_config_create_initial_state
Quoted 5 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
No objections from me, though I don't have the hardware anymore to test.
Maxime Ripard
maintainerPATCH RESEND 16/83 drm/hyperv: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dexuan Cui <[email protected]>
Cc: Long Li <[email protected]>
Cc: Saurabh Sengar <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +1 -3
@@ -337,6 +337,4 @@ int hv_drm_mode_config_init(struct hv_drm_device *hv)return ret; -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 17/83 drm/imx/dc: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Liu Ying <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/imx/dc/dc-kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/imx/dc/dc-kms.c +3 -1
@@ -130,5 +130,7 @@ int dc_kms_init(struct dc_drm_device *dc_drm) } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret;drm_kms_helper_poll_init (drm);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 17/83] drm/imx/dc: Switch to drm_mode_config_create_initial_state
Quoted 19 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Liu Ying <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: [email protected]
Quoted 3 lines
--- drivers/gpu/drm/imx/dc/dc-kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Maxime Ripard
maintainerPATCH RESEND 18/83 drm/imx/dcss: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Laurentiu Palcu <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/imx/dcss/dcss-kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/imx/dcss/dcss-kms.c +3 -1
@@ -142,5 +142,7 @@ struct dcss_kms_dev *dcss_kms_attach(struct dcss_dev *dcss) goto cleanup_mode_config; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto cleanup_crtc;drm_kms_helper_poll_init (drm);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 18/83] drm/imx/dcss: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
I think I already gave my r-b tag on this before the resend... Anyway,
Quoted 29 lines
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Laurentiu Palcu <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/imx/dcss/dcss-kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/imx/dcss/dcss-kms.c +3
-1@@ -142,5 +142,7 @@ struct dcss_kms_dev *dcss_kms_attach(struct dcss_dev *dcss) goto cleanup_mode_config; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto cleanup_crtc;drm_kms_helper_poll_init (drm);Signature · 2 lines
-- 2.55.0
Signature · 2 lines
Thanks, Laurentiu
Maxime Ripard
maintainerPATCH RESEND 19/83 drm/imx/ipuv3: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Philipp Zabel <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/imx/ipuv3/imx-drm-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/imx/ipuv3/imx-drm-core.c +3 -1
@@ -245,5 +245,7 @@ static int imx_drm_bind(struct device *dev) goto err_kms; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_poll_fini;/*
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 20/83 drm/ingenic: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Paul Cercueil <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +3 -1
@@ -1355,5 +1355,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_drvdata; ret =clk_prepare_enable (priv->pix_clk);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 20/83] drm/ingenic: Switch to drm_mode_config_create_initial_state
Hi Maxime,
Le jeudi 05 novembre 2026 à 16:29 +0100, Maxime Ripard a écrit :
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Cheers,
-Paul
Quoted 22 lines
---
Cc: Paul Cercueil <[email protected]>
Cc: [email protected]
---
drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/ingenic/ingenic-drm-drv.c +0
-0@@ -1355,5 +1355,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) }drivers/gpu/drm/ingenic/ingenic-drm-drv.c +3
-1-drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_drvdata;
ret =clk_prepare_enable(priv->pix_clk);
[email protected]
AI reviewRe: [PATCH RESEND 20/83] drm/ingenic: Switch to drm_mode_config_create_initial_state
In reply to Maxime RipardThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/ingenic: drm_mode_config_create_initial_state() called before private_obj --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/ingenic: drm_mode_config_create_initial_state() called before private_obj --
commit 7ffae382d87f4623df938c8f5b08713c0f72e24e
Author: Maxime Ripard <[email protected]>
drm/ingenic: Switch to drm_mode_config_create_initial_state
This commit replaces the probe-time call to drm_mode_config_reset() in ingenic_drm_bind() with drm_mode_config_create_initial_state() and checks its return value.
drivers/gpu/drm/ingenic/ingenic-drm-drv.c static int ingenic_drm_bind(struct device *dev, bool has_components) · line 1359
Quoted 12 lines
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +3
-1@@ -1354,7 +1354,9 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) goto err_drvdata; } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_drvdata;
[Severity: Medium]
Should drm_mode_config_create_initial_state(drm) be called after priv->private_obj is initialized with drm_atomic_private_obj_init(), or should drm_atomic_private_obj_init() be moved before this call?
In drivers/gpu/drm/drm_mode_config.c, drm_mode_config_create_initial_state() iterates over dev->mode_config.privobj_list to allocate the initial state for registered private objects and propagate any allocation error:
drivers/gpu/drm/drm_mode_config.c:drm_mode_config_create_initial_state() {
drm_for_each_privobj(privobj, dev) {
struct drm_private_state *privobj_state;
if (privobj->state)
continue;
if (!privobj->funcs->atomic_create_state)
continue;
privobj_state = privobj->funcs->atomic_create_state(privobj);
if (IS_ERR(privobj_state))
return PTR_ERR(privobj_state);
privobj->state = privobj_state;
}
...
}In drivers/gpu/drm/ingenic/ingenic-drm-drv.c, ingenic_drm_bind() currently initializes priv->private_obj later in the function without checking its return value:
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:ingenic_drm_bind() {
...
ret = drm_mode_config_create_initial_state(drm);
if (ret)
goto err_drvdata;
...
drm_atomic_private_obj_init(drm, &priv->private_obj,
&ingenic_drm_private_state_funcs);
...
}Because priv->private_obj is not yet on drm->mode_config.privobj_list when drm_mode_config_create_initial_state(drm) runs, it is skipped. If ingenic_drm_create_state() fails with -ENOMEM during drm_atomic_private_obj_init() (or once drm_atomic_private_obj_init() stops allocating state directly), priv->private_obj is left on drm->mode_config.privobj_list with priv->private_obj.state set to NULL. When the first atomic commit duplicates the private state (for example via drm_client_setup()), ingenic_drm_duplicate_state() will dereference NULL:
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:ingenic_drm_duplicate_state() {
struct ingenic_drm_private_state *state = to_ingenic_drm_priv_state(obj->state);
state = kmemdup(state, sizeof(*state), GFP_KERNEL);
...
}Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=20
Maxime Ripard
maintainerPATCH RESEND 21/83 drm/kmb: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Anitha Chrisanthus <[email protected]>
--- drivers/gpu/drm/kmb/kmb_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/kmb/kmb_drv.c +1 -2
@@ -199,6 +199,5 @@ static int kmb_setup_mode_config(struct drm_device *drm) } -drm_mode_config_reset (drm); -return 0 ; +return drm_mode_config_create_initial_state (drm); }
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 22/83 drm/logicvc: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Paul Kocialkowski <[email protected]>
--- drivers/gpu/drm/logicvc/logicvc_mode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/logicvc/logicvc_mode.c +3 -1
@@ -62,5 +62,7 @@ int logicvc_mode_init(struct logicvc_drm *logicvc) mode_config->funcs = &logicvc_mode_config_funcs; -drm_mode_config_reset (drm_dev); + ret =drm_mode_config_create_initial_state (drm_dev); +if (ret) +return ret;drm_kms_helper_poll_init (drm_dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 23/83 drm/loongson: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Huacai Chen <[email protected]>
Cc: Icenowy Zheng <[email protected]>
Cc: Jianmin Lv <[email protected]>
Cc: Mingcong Bai <[email protected]>
Cc: Qianhai Wu <[email protected]>
Cc: Xi Ruoyao <[email protected]>
--- drivers/gpu/drm/loongson/lsdc_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/loongson/lsdc_drv.c +3 -1
@@ -248,5 +248,7 @@ lsdc_create_device(struct pci_dev *pdev,return ERR_PTR (ret); -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) +return ERR_PTR (ret);return ldev;
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 23/83] drm/loongson: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/loongson: skipped CRTC and encoder hardware reset in lsdc_create_device() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/loongson: skipped CRTC and encoder hardware reset in lsdc_create_device() --
commit 648f0256277cc04b62e3a2eb71b3474bb1ab8054
Author: Maxime Ripard <[email protected]>
drm/loongson: Switch to drm_mode_config_create_initial_state
This commit replaces drm_mode_config_reset() with drm_mode_config_create_initial_state() in lsdc_create_device() during probe.
drivers/gpu/drm/loongson/lsdc_drv.c lsdc_create_device(struct pci_dev *pdev, · line 252
Quoted 12 lines
drivers/gpu/drm/loongson/lsdc_drv.c +3
-1@@ -247,7 +247,9 @@ lsdc_create_device(struct pci_dev *pdev,if (ret)return ERR_PTR (ret); -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) +return ERR_PTR (ret);
[Severity: High]
Does switching from drm_mode_config_reset() to drm_mode_config_create_initial_state() in lsdc_create_device() skip required CRTC and encoder hardware initialization at probe time?
Unlike drm_mode_config_reset(), drm_mode_config_create_initial_state() does not invoke crtc->helper_private->hw_reset() or encoder->funcs->reset().
In drivers/gpu/drm/loongson/lsdc_crtc.c, lsdc_crtc_hw_reset() calls lsdc_crtc0_reset() and lsdc_crtc1_reset():
static void lsdc_crtc0_reset(struct lsdc_crtc *lcrtc)
{
struct lsdc_device *ldev = lcrtc->ldev;
lsdc_wreg32(ldev, LSDC_CRTC0_CFG_REG, CFG_RESET_N | LSDC_PF_XRGB8888);
}Other runtime accesses to LSDC_CRTC0_CFG_REG and LSDC_CRTC1_CFG_REG during modeset and plane updates (such as lsdc_crtc0_enable(), lsdc_crtc0_disable(), lsdc_crtc0_set_dma_step(), and lsdc_primary0_update_fb_format()) perform read-modify-write operations that neither assert CFG_RESET_N nor clear stale firmware bits such as CFG_HW_CLONE or CFG_GAMMA_EN.
In addition, the encoder reset hooks in drivers/gpu/drm/loongson/lsdc_output_7a1000.c and drivers/gpu/drm/loongson/lsdc_output_7a2000.c are the only places in the driver that program LSDC_CRTC0_DVO_CONF_REG and LSDC_CRTC1_DVO_CONF_REG:
static void ls7a2000_hdmi0_encoder_reset(struct drm_encoder *encoder)
{
struct drm_device *ddev = encoder->dev;
struct lsdc_device *ldev = to_lsdc(ddev);
u32 val;
val = PHY_CLOCK_POL | PHY_CLOCK_EN | PHY_DATA_EN;
lsdc_wreg32(ldev, LSDC_CRTC0_DVO_CONF_REG, val);
/* using software gpio emulated i2c */
val = lsdc_rreg32(ldev, LSDC_HDMI0_INTF_CTRL_REG);
val &= ~HW_I2C_EN;
lsdc_wreg32(ldev, LSDC_HDMI0_INTF_CTRL_REG, val);
/* help the hdmi phy to get out of reset state */
lsdc_wreg32(ldev, LSDC_HDMI0_PHY_CTRL_REG, HDMI_PHY_RESET_N);
mdelay(20);
}On LS7A2000, skipping ls7a2000_hdmi0_encoder_reset() and ls7a2000_hdmi1_encoder_reset() at probe time also leaves HW_I2C_EN set in LSDC_HDMI0_INTF_CTRL_REG and LSDC_HDMI1_INTF_CTRL_REG and leaves the HDMI PHY in reset, breaking software GPIO-emulated I2C DDC probing in ls7a2000_hdmi0_vga_connector_detect() and ls7a2000_connector_get_modes() before any atomic enable commit runs.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=23
Maxime Ripard
maintainerPATCH RESEND 24/83 drm/mcde: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Linus Walleij <[email protected]>
--- drivers/gpu/drm/mcde/mcde_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/mcde/mcde_drv.c +3 -1
@@ -194,5 +194,7 @@ static int mcde_modeset_init(struct drm_device *drm) } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret;drm_kms_helper_poll_init (drm);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 24/83] drm/mcde: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Yours,
Linus Walleij
Maxime Ripard
maintainerPATCH RESEND 25/83 drm/mediatek: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: AngeloGioacchino Del Regno <[email protected]>
Cc: Chun-Kuang Hu <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Philipp Zabel <[email protected]>
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +7 -1
@@ -580,8 +580,14 @@ static int mtk_drm_kms_init(struct drm_device *drm)drm_kms_helper_poll_init (drm); -drm_mode_config_reset (drm); + + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_fini_poll;return 0 ; +err_fini_poll: +drm_kms_helper_poll_fini (drm); + err_component_unbind:for (i =0 ; i < private->data->mmsys_dev_num; i++)
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 26/83 drm/meson: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Jerome Brunet <[email protected]>
Cc: Kevin Hilman <[email protected]>
Cc: Martin Blumenstingl <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/meson/meson_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/meson/meson_drv.c +3 -1
@@ -345,5 +345,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) goto exit_afbcd; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto uninstall_irq;drm_kms_helper_poll_init (drm);
Signature · 7 lines
2.55.0 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Re: [PATCH RESEND 26/83] drm/meson: Switch to drm_mode_config_create_initial_state
Quoted 27 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Jerome Brunet <[email protected]>
Cc: Kevin Hilman <[email protected]>
Cc: Martin Blumenstingl <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/meson/meson_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/meson/meson_drv.c +0
-0
drivers/gpu/drm/meson/meson_drv.c static int meson_drv_bind_master(struct device *dev, bool has_components) · line 351
Quoted 8 lines
drivers/gpu/drm/meson/meson_drv.c +3
-1@@ -345,5 +345,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) goto exit_afbcd; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto uninstall_irq;drm_kms_helper_poll_init (drm);
Thanks,
Neil
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Maxime Ripard
maintainerPATCH RESEND 27/83 drm/mgag200: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Jocelyn Falempe <[email protected]>
--- drivers/gpu/drm/mgag200/mgag200_g200.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200eh5.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200er.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ev.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200ew3.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200se.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_g200wb.c | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-)
drivers/gpu/drm/mgag200/mgag200_g200.c +3 -1
@@ -402,5 +402,7 @@ struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const structreturn ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
drivers/gpu/drm/mgag200/mgag200_g200eh.c +3 -1
@@ -274,5 +274,7 @@ struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const strureturn ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
drivers/gpu/drm/mgag200/mgag200_g200eh3.c +3 -1
@@ -179,5 +179,7 @@ struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev,return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
drivers/gpu/drm/mgag200/mgag200_g200eh5.c +3 -1
@@ -199,5 +199,7 @@ struct mga_device *mgag200_g200eh5_device_create(struct pci_dev *pdev,return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
drivers/gpu/drm/mgag200/mgag200_g200er.c +3 -1
@@ -307,5 +307,7 @@ struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const strureturn ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
drivers/gpu/drm/mgag200/mgag200_g200ev.c +3 -1
@@ -312,5 +312,7 @@ struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const strureturn ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
drivers/gpu/drm/mgag200/mgag200_g200ew3.c +3 -1
@@ -197,5 +197,7 @@ struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev,return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
drivers/gpu/drm/mgag200/mgag200_g200se.c +3 -1
@@ -519,5 +519,7 @@ struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const strureturn ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
drivers/gpu/drm/mgag200/mgag200_g200wb.c +3 -1
@@ -321,5 +321,7 @@ struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const strureturn ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);drm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 28/83 drm/msm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Abhinav Kumar <[email protected]>
Cc: Dmitry Baryshkov <[email protected]>
Cc: Jessica Zhang <[email protected]>
Cc: Marijn Suijten <[email protected]>
Cc: Rob Clark <[email protected]>
Cc: Sean Paul <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- drivers/gpu/drm/msm/msm_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_kms.c +3 -1
@@ -332,5 +332,7 @@ int msm_drm_kms_init(struct device *dev, const struct drm_driver *drv) } -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) + goto err_msm_uninit;return 0 ;
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 29/83 drm/lcdif: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Stefan Agner <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/mxsfb/lcdif_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/mxsfb/lcdif_drv.c +3 -1
@@ -196,5 +196,7 @@ static int lcdif_load(struct drm_device *drm) drm->mode_config.helper_private = &lcdif_mode_config_helpers; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =platform_get_irq (pdev,0 );
Signature · 1 line
2.55.0
Re: [PATCH RESEND 29/83] drm/lcdif: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 29 lines
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Stefan Agner <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/mxsfb/lcdif_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/mxsfb/lcdif_drv.c +3
-1@@ -196,5 +196,7 @@ static int lcdif_load(struct drm_device *drm) drm->mode_config.helper_private = &lcdif_mode_config_helpers; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =platform_get_irq (pdev,0 );Signature · 2 lines
-- 2.55.0
Signature · 2 lines
Thanks, Laurentiu
Maxime Ripard
maintainerPATCH RESEND 30/83 drm/mxsfb: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Stefan Agner <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +3 -1
@@ -323,5 +323,7 @@ static int mxsfb_load(struct drm_device *drm, drm->mode_config.helper_private = &mxsfb_mode_config_helpers; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_vblank; ret =platform_get_irq (pdev,0 );
Signature · 1 line
2.55.0
Re: [PATCH RESEND 30/83] drm/mxsfb: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 29 lines
---
Cc: Fabio Estevam <[email protected]>
Cc: Frank Li <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Stefan Agner <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/mxsfb/mxsfb_drv.c +3
-1@@ -323,5 +323,7 @@ static int mxsfb_load(struct drm_device *drm, drm->mode_config.helper_private = &mxsfb_mode_config_helpers; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_vblank; ret =platform_get_irq (pdev,0 );Signature · 2 lines
-- 2.55.0
Signature · 2 lines
Thanks, Laurentiu
Maxime Ripard
maintainerPATCH RESEND 31/83 drm/nouveau: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Danilo Krummrich <[email protected]>
Cc: Lyude Paul <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/nouveau/nouveau_display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_display.c +3 -1
@@ -711,5 +711,7 @@ nouveau_display_create(struct drm_device *dev) goto disp_create_err; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto vblank_err;if (dev->mode_config.num_crtc) {
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 32/83 drm/omap: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Tomi Valkeinen <[email protected]>
--- drivers/gpu/drm/omapdrm/omap_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_drv.c +3 -1
@@ -536,5 +536,7 @@ static int omap_modeset_init(struct drm_device *dev) dev->mode_config.helper_private = &omap_mode_config_helper_funcs; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;omap_drm_irq_install (dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 33/83 drm/pl111: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Linus Walleij <[email protected]>
--- drivers/gpu/drm/pl111/pl111_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/pl111/pl111_drv.c +3 -1
@@ -182,5 +182,7 @@ static int pl111_modeset_init(struct drm_device *dev) } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto out_bridge;drm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 33/83] drm/pl111: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Yours,
Linus Walleij
Maxime Ripard
maintainerPATCH RESEND 34/83 drm/qxl: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]
Cc: [email protected]
--- drivers/gpu/drm/qxl/qxl_display.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/qxl/qxl_display.c +1 -2
@@ -1313,6 +1313,5 @@ int qxl_modeset_init(struct qxl_device *qdev)return ret; -drm_mode_config_reset (&qdev->ddev); -return 0 ; +return drm_mode_config_create_initial_state (&qdev->ddev); }
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 34/83] drm/qxl: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/qxl: missing monitors object cleanup and UAF in qxl_modeset_init() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/qxl: missing monitors object cleanup and UAF in qxl_modeset_init() --
commit c9a17dafeda120436479a0975b3829acefce4188
Author: Maxime Ripard <[email protected]>
drm/qxl: Switch to drm_mode_config_create_initial_state
This commit replaces drm_mode_config_reset() with drm_mode_config_create_initial_state() in qxl_modeset_init() to handle initial KMS state creation at probe time.
drivers/gpu/drm/qxl/qxl_display.c int qxl_modeset_init(struct qxl_device *qdev) · line 1316
Quoted 12 lines
drivers/gpu/drm/qxl/qxl_display.c +1
-2@@ -1312,8 +1312,7 @@ int qxl_modeset_init(struct qxl_device *qdev)if (ret)return ret; -drm_mode_config_reset (&qdev->ddev); -return 0 ; +return drm_mode_config_create_initial_state (&qdev->ddev); }
[Severity: High]
If drm_mode_config_create_initial_state() fails and returns an error here, can this cause a use-after-free of qdev->monitors_config_bo and an unmapped MMIO write to qdev->ram_header->monitors_config during probe teardown?
Earlier in qxl_modeset_init(), qxl_create_monitors_object() allocates, pins, and vmaps qdev->monitors_config_bo, sets qdev->ram_header->monitors_config, and allocates qdev->dumb_heads.
When qxl_modeset_init() returns an error to qxl_pci_probe(), the error path jumps past qxl_modeset_fini() directly to the unload label:
drivers/gpu/drm/qxl/qxl_drv.c:qxl_pci_probe() {
...
ret = qxl_modeset_init(qdev);
if (ret)
goto unload;
...
poll_fini:
drm_kms_helper_poll_fini(&qdev->ddev);
qxl_modeset_fini(qdev);
unload:
qxl_device_fini(qdev);
}In qxl_device_fini(), qxl_gem_fini() -> qxl_bo_force_delete() force-frees qdev->monitors_config_bo while it is still pinned and vmapped (triggering WARN_ON_ONCE(bo->map_count > 0) in qxl_ttm_bo_destroy() and leaving the qdev->monitors_config_bo pointer non-NULL), and iounmap() unmaps qdev->ram_header.
When qxl_pci_probe() then returns the error code, devres cleanup for devm_drm_dev_alloc() runs qxl_drm_release() -> qxl_modeset_fini() -> qxl_destroy_monitors_object():
drivers/gpu/drm/qxl/qxl_display.c:qxl_destroy_monitors_object() {
if (!qdev->monitors_config_bo)
return 0;
...
qdev->ram_header->monitors_config = 0;
ret = qxl_bo_vunmap_and_unpin(qdev->monitors_config_bo);
if (ret)
return ret;
qxl_bo_unref(&qdev->monitors_config_bo);
return 0;
}Because qdev->monitors_config_bo is still non-NULL, should qxl_modeset_init() call qxl_destroy_monitors_object(qdev) on failure before returning?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=34
Maxime Ripard
maintainerPATCH RESEND 35/83 drm/rcar-du: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Geert Uytterhoeven <[email protected]>
Cc: Kieran Bingham <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c +3 -1
@@ -1003,5 +1003,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) rcdu->dpad0_source =ffs (dpad0_sources) -1 ; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 36/83 drm/rz-du: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Biju Das <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/renesas/rz-du/rzg2l_du_kms.c +3 -1
@@ -472,5 +472,7 @@ int rzg2l_du_modeset_init(struct rzg2l_du_device *rcdu) } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 37/83 drm/shmobile: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Geert Uytterhoeven <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c +3 -1
@@ -176,5 +176,7 @@ int shmob_drm_modeset_init(struct shmob_drm_device *sdev)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 38/83 drm/rockchip: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: "Heiko Stübner" <[email protected]>
Cc: Andy Yan <[email protected]>
Cc: Sandy Huang <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +3 -1
@@ -191,5 +191,7 @@ static int rockchip_drm_bind(struct device *dev) goto err_iommu_cleanup; -drm_mode_config_reset (drm_dev); + ret =drm_mode_config_create_initial_state (drm_dev); +if (ret) + goto err_iommu_cleanup;/* init kms poll for handling hpd */
Signature · 1 line
2.55.0
Re: [PATCH RESEND 38/83] drm/rockchip: Switch to drm_mode_config_create_initial_state
Am Donnerstag, 5. November 2026, 16:29:47 Mitteleuropäische Normalzeit schrieb Maxime Ripard:
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Maxime Ripard
maintainerPATCH RESEND 39/83 drm/st7571: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Marcus Folkesson <[email protected]>
--- drivers/gpu/drm/sitronix/st7571.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sitronix/st7571.c +3 -1
@@ -868,5 +868,7 @@ struct st7571_device *st7571_probe(struct device *dev, } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret); ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 40/83 drm/st7586: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: David Lechner <[email protected]>
--- drivers/gpu/drm/sitronix/st7586.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sitronix/st7586.c +3 -1
@@ -456,5 +456,7 @@ static int st7586_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 41/83 drm/st7735r: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: David Lechner <[email protected]>
--- drivers/gpu/drm/sitronix/st7735r.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sitronix/st7735r.c +3 -1
@@ -336,5 +336,7 @@ static int st7735r_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 42/83 drm/st7920: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Iker Pedrosa <[email protected]>
--- drivers/gpu/drm/sitronix/st7920.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/sitronix/st7920.c +1 -3
@@ -785,7 +785,5 @@ static int st7920_init_modeset(struct st7920_device *st7920) } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); }
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 43/83 drm/ssd130x: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Javier Martinez Canillas <[email protected]>
--- drivers/gpu/drm/solomon/ssd130x.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/solomon/ssd130x.c +1 -3
@@ -2218,7 +2218,5 @@ static int ssd130x_init_modeset(struct ssd130x_device *ssd130x) } -drm_mode_config_reset (drm); - -return 0 ; +return drm_mode_config_create_initial_state (drm); }
Signature · 1 line
2.55.0
Re: [PATCH RESEND 43/83] drm/ssd130x: Switch to drm_mode_config_create_initial_state
Quoted 9 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.
Quoted 4 lines
Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Maxime Ripard
maintainerPATCH RESEND 44/83 drm/sprd: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Baolin Wang <[email protected]>
Cc: Chunyan Zhang <[email protected]>
Cc: Orson Zhai <[email protected]>
--- drivers/gpu/drm/sprd/sprd_drm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/sprd/sprd_drm.c +4 -2
@@ -96,6 +96,8 @@ static int sprd_drm_bind(struct device *dev) } -/* reset all the states of crtc/plane/encoder/connector */ -drm_mode_config_reset (drm); +/* Create the states of crtc/plane/encoder/connector */ + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_unbind_all;/* init kms poll for handling hpd */
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 45/83 drm/sti: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alain Volmat <[email protected]>
Cc: Raphael Gallais-Pou <[email protected]>
--- drivers/gpu/drm/sti/sti_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/sti/sti_drv.c +5 -1
@@ -203,5 +203,7 @@ static int sti_bind(struct device *dev) goto err_cleanup; -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) + goto err_unregister;drm_client_setup (ddev,NULL );
@@ -209,4 +211,6 @@ static int sti_bind(struct device *dev)return 0 ; +err_unregister: +drm_dev_unregister (ddev); err_cleanup:sti_cleanup (ddev);
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 45/83] drm/sti: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/sti: late initial state creation and broken error unwind in sti_bind() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/sti: late initial state creation and broken error unwind in sti_bind() --
commit 90a65d66556bc446b84f7842f4301480a5997e74
Author: Maxime Ripard <[email protected]>
drm/sti: Switch to drm_mode_config_create_initial_state
This commit replaces the call to drm_mode_config_reset() in sti_bind() with drm_mode_config_create_initial_state() and adds an error path to unregister the DRM device if initial state creation fails.
Quoted 11 lines
drivers/gpu/drm/sti/sti_drv.c +2
-1@@ -202,12 +202,16 @@ static int sti_bind(struct device *dev)if (ret) goto err_cleanup; -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret)
drivers/gpu/drm/sti/sti_drv.c static int sti_bind(struct device *dev) · line 216
Quoted 10 lines
drivers/gpu/drm/sti/sti_drv.c +3
-0+ goto err_unregister;drm_client_setup (ddev,NULL );return 0 ; +err_unregister: +drm_dev_unregister (ddev); err_cleanup:sti_cleanup (ddev);
[Severity: High]
If drm_mode_config_create_initial_state() fails in sti_bind() (for example, when plane or CRTC state allocation fails with -ENOMEM), jumping to err_unregister and falling through to err_cleanup calls sti_cleanup():
drivers/gpu/drm/sti/sti_drv.c:sti_cleanup() {
...
drm_kms_helper_poll_fini(ddev);
drm_atomic_helper_shutdown(ddev);
drm_mode_config_cleanup(ddev);
...
}Because crtc->state is still NULL when initial state creation fails before allocating CRTC states (or when drm_dev_register() fails before initial state creation is reached), does callingsti_cleanup() -> drm_atomic_helper_shutdown() -> drm_atomic_helper_disable_all() -> drm_atomic_get_crtc_state() -> drm_atomic_helper_crtc_duplicate_state() trigger a WARN_ON(!crtc->state) and cause drm_atomic_helper_shutdown() to fail?
In addition, in sti_bind(), drm_dev_register() is called right before drm_mode_config_create_initial_state():
drivers/gpu/drm/sti/sti_drv.c:sti_bind() {
...
ret = drm_dev_register(ddev, 0);
if (ret)
goto err_cleanup;
ret = drm_mode_config_create_initial_state(ddev);
if (ret)
goto err_unregister;
...
}Since drm_dev_register() exposes the DRM device nodes and connector sysfs attributes to userspace while plane->state, crtc->state, and connector->state are still NULL, and drm_mode_config_create_initial_state() subsequently populates those state pointers without holding modeset locks, can a userspace process opening the device right after registration trigger a NULL pointer dereference in drm_mode_object_get_properties() -> drm_atomic_get_property()?
Should drm_mode_config_create_initial_state() be called before drm_dev_register(), and should drm_atomic_helper_shutdown() be avoided on error paths where initial modeset state has not been fully created?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=45
Maxime Ripard
maintainerPATCH RESEND 46/83 drm/stm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alexandre Torgue <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Philippe Cornu <[email protected]>
Cc: Raphael Gallais-Pou <[email protected]>
Cc: Yannick Fertre <[email protected]>
--- drivers/gpu/drm/stm/drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/stm/drv.c +3 -1
@@ -105,5 +105,7 @@ static int drv_load(struct drm_device *ddev)return ret; -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) +return ret;drm_kms_helper_poll_init (ddev);
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 46/83] drm/stm: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/stm: missing ltdc_unload() on initial state failure in drv_load() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/stm: missing ltdc_unload() on initial state failure in drv_load() --
commit 98591c9473b768ebdd97e226182eb80066137927
Author: Maxime Ripard <[email protected]>
drm/stm: Switch to drm_mode_config_create_initial_state
This commit replaces the probe-time drm_mode_config_reset() call in drv_load() with drm_mode_config_create_initial_state() and propagates any error returned during initial KMS state creation.
drivers/gpu/drm/stm/drv.c static int drv_load(struct drm_device *ddev) · line 109
Quoted 12 lines
drivers/gpu/drm/stm/drv.c +3
-1@@ -104,7 +104,9 @@ static int drv_load(struct drm_device *ddev)if (ret)return ret; -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) +return ret;
[Severity: Medium]
If drm_mode_config_create_initial_state() fails in drv_load() after ltdc_load() has already succeeded, does this leave runtime PM enabled on ddev->dev without calling ltdc_unload()?
In drivers/gpu/drm/stm/ltdc.c, ltdc_load() enables runtime PM via an unmanaged call before returning:
ltdc_load()
pm_runtime_enable(ddev->dev); return 0;
When drv_load() returns an error, stm_drm_platform_probe() in drivers/gpu/drm/stm/drv.c jumps to err_put, bypassing drv_unload() and ltdc_unload():
stm_drm_platform_probe()
ret = drv_load(ddev); if (ret) goto err_put; ret = drm_dev_register(ddev, 0); if (ret) goto err_unload; ... err_unload: drv_unload(ddev); err_put: drm_dev_put(ddev);
Because platform_set_drvdata() is not reached in drv_load() on this failure path and runtime PM remains enabled while ddev is freed, a runtime PM callback running before unbind completes could also see a NULL ddev from dev_get_drvdata(dev) in drv_runtime_suspend() or drv_runtime_resume().
Should drv_load() call ltdc_unload(ddev) on error if drm_mode_config_create_initial_state() fails?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=46
Maxime Ripard
maintainerPATCH RESEND 47/83 drm/sun4i: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Chen-Yu Tsai <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun4i_framebuffer.c +3 -1
@@ -11,4 +11,5 @@#include <drm/drm_blend.h> #include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_print.h> #include "sun4i_drv.h"
@@ -27,5 +28,6 @@ static const struct drm_mode_config_helper_funcs sun4i_de_mode_config_helpers =void sun4i_framebuffer_init (struct drm_device *drm) { -drm_mode_config_reset (drm); +drm_WARN (drm,drm_mode_config_create_initial_state (drm), +"Failed to create state\n" ); drm->mode_config.max_width =8192 ;
Signature · 1 line
2.55.0
Re: [PATCH RESEND 47/83] drm/sun4i: Switch to drm_mode_config_create_initial_state
Quoted 5 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
[email protected]
AI reviewRe: [PATCH RESEND 47/83] drm/sun4i: Switch to drm_mode_config_create_initial_state
In reply to Maxime RipardThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/sun4i: sun4i_framebuffer_init() ignores state creation failure --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/sun4i: sun4i_framebuffer_init() ignores state creation failure --
commit 9bfddf90d8dccabe2d26ebb9b512f7adbc95c198
Author: Maxime Ripard <[email protected]>
drm/sun4i: Switch to drm_mode_config_create_initial_state
This commit replaces the probe-time drm_mode_config_reset() call in sun4i_framebuffer_init() with drm_mode_config_create_initial_state() to create the initial KMS state.
Quoted 13 lines
drivers/gpu/drm/sun4i/sun4i_framebuffer.c +1
-0@@ -10,6 +10,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_blend.h> #include <drm/drm_gem_framebuffer_helper.h> +#include <drm/drm_print.h> #include "sun4i_drv.h" #include "sun4i_framebuffer.h"
drivers/gpu/drm/sun4i/sun4i_framebuffer.c static const struct drm_mode_config_helper_funcs sun4i_de_mode_config_helpers = · line 31
Quoted 6 lines
drivers/gpu/drm/sun4i/sun4i_framebuffer.c +2
-1@@ -26,7 +27,8 @@ static const struct drm_mode_config_helper_funcs sun4i_de_mode_config_helpers =void sun4i_framebuffer_init (struct drm_device *drm) { -drm_mode_config_reset (drm); +drm_WARN (drm,drm_mode_config_create_initial_state (drm), +"Failed to create state\n" );
[Severity: High]
Should sun4i_framebuffer_init() return an int and propagate errors from drm_mode_config_create_initial_state(drm) back to sun4i_drv_bind()?
When drm_mode_config_create_initial_state(drm) fails to allocate state for a private object, colorop, plane, CRTC, or connector, it returns early with a negative errno, leaving that object and all subsequent KMS objects with a NULL state pointer.
Because sun4i_framebuffer_init() only warns and returns void, its caller sun4i_drv_bind() in drivers/gpu/drm/sun4i/sun4i_drv.c continues execution:
sun4i_framebuffer_init(drm); /* Enable connectors polling */ drm_kms_helper_poll_init(drm); ret = drm_dev_register(drm, 0); if (ret) goto finish_poll; drm_client_setup(drm, NULL);
When drm_client_setup(), a userspace atomic commit, or drm_atomic_helper_shutdown() duplicates plane state via sun4i_backend_layer_duplicate_state() in drivers/gpu/drm/sun4i/sun4i_layer.c, plane->state is dereferenced without a NULL check:
struct sun4i_layer_state *orig = state_to_sun4i_layer_state(plane->state); struct sun4i_layer_state *copy; copy = kzalloc_obj(*copy); if (!copy) return NULL; __drm_atomic_helper_plane_duplicate_state(plane, ©->state); copy->uses_frontend = orig->uses_frontend;
Could this cause a NULL pointer dereference in __drm_atomic_helper_plane_duplicate_state(), orig->uses_frontend, or during userspace property queries via drm_atomic_get_property() if sun4i_drv_bind() does not abort and jump to unbind_all on state creation failure?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=47
Maxime Ripard
maintainerPATCH RESEND 48/83 drm/corebootdrm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Javier Martinez Canillas <[email protected]>
--- drivers/gpu/drm/sysfb/corebootdrm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sysfb/corebootdrm.c +3 -1
@@ -422,5 +422,7 @@ static int corebootdrm_probe(struct platform_device *pdev)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret; ret =drm_dev_register (dev,0 );
Signature · 1 line
2.55.0
Re: [PATCH RESEND 48/83] drm/corebootdrm: Switch to drm_mode_config_create_initial_state
Quoted 9 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.
Quoted 4 lines
Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Maxime Ripard
maintainerPATCH RESEND 49/83 drm/efidrm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Javier Martinez Canillas <[email protected]>
--- drivers/gpu/drm/sysfb/efidrm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sysfb/efidrm.c +3 -1
@@ -364,5 +364,7 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv,return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);return efi;
Signature · 1 line
2.55.0
Re: [PATCH RESEND 49/83] drm/efidrm: Switch to drm_mode_config_create_initial_state
Quoted 9 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.
Quoted 4 lines
Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Maxime Ripard
maintainerPATCH RESEND 50/83 drm/ofdrm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Javier Martinez Canillas <[email protected]>
--- drivers/gpu/drm/sysfb/ofdrm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sysfb/ofdrm.c +3 -1
@@ -1092,5 +1092,7 @@ static struct ofdrm_device *ofdrm_device_create(struct drm_driver *drv,return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);return odev;
Signature · 1 line
2.55.0
Re: [PATCH RESEND 50/83] drm/ofdrm: Switch to drm_mode_config_create_initial_state
Quoted 9 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.
Quoted 9 lines
Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Javier Martinez Canillas <[email protected]>--- drivers/gpu/drm/sysfb/ofdrm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Maxime Ripard
maintainerPATCH RESEND 51/83 drm/simpledrm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Javier Martinez Canillas <[email protected]>
--- drivers/gpu/drm/sysfb/simpledrm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sysfb/simpledrm.c +3 -1
@@ -877,5 +877,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);return sdev;
Signature · 1 line
2.55.0
Re: [PATCH RESEND 51/83] drm/simpledrm: Switch to drm_mode_config_create_initial_state
Quoted 9 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.
Quoted 9 lines
Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Javier Martinez Canillas <[email protected]>--- drivers/gpu/drm/sysfb/simpledrm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Maxime Ripard
maintainerPATCH RESEND 52/83 drm/vesadrm: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Javier Martinez Canillas <[email protected]>
--- drivers/gpu/drm/sysfb/vesadrm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/sysfb/vesadrm.c +3 -1
@@ -610,5 +610,7 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv,return ERR_PTR (ret); -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ERR_PTR (ret);return vesa;
Signature · 1 line
2.55.0
Re: [PATCH RESEND 52/83] drm/vesadrm: Switch to drm_mode_config_create_initial_state
Quoted 9 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.
Quoted 9 lines
Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Javier Martinez Canillas <[email protected]>--- drivers/gpu/drm/sysfb/vesadrm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Maxime Ripard
maintainerPATCH RESEND 53/83 drm/tegra: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Jonathan Hunter <[email protected]>
Cc: Mikko Perttunen <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/tegra/drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/drm.c +3 -1
@@ -1246,5 +1246,7 @@ static int host1x_drm_probe(struct host1x_device *dev) goto hub; -drm_mode_config_reset (drm); + err =drm_mode_config_create_initial_state (drm); +if (err) + goto hub;/*
Signature · 1 line
2.55.0
Thierry Reding
maintainerRe: [PATCH RESEND 53/83] drm/tegra: Switch to drm_mode_config_create_initial_state
Quoted 12 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 8 lines
---
Cc: Jonathan Hunter <[email protected]>
Cc: Mikko Perttunen <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/tegra/drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
I'd have to check more closely since it's been a while, but I think we might depend on the reset hooks getting called during probe.
Looking at the implementation of drm_mode_config_create_initial_state(), it ends up calling drm_mode_config_connector_create_state(), which silently exists if the connector doesn't implement atomic_create_state, which none of the Tegra connectors do, so wouldn't that lead to a NULL pointer dereference at some point?
Thierry
Maxime Ripard
maintainerRe: [PATCH RESEND 53/83] drm/tegra: Switch to drm_mode_config_create_initial_state
Hi Thierry,
Quoted 22 lines · Thierry Reding
Quoted 12 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>Quoted 8 lines
---
Cc: Jonathan Hunter <[email protected]>
Cc: Mikko Perttunen <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: [email protected]--- drivers/gpu/drm/tegra/drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 8 lines
I'd have to check more closely since it's been a while, but I think we might depend on the reset hooks getting called during probe.
Looking at the implementation of
drm_mode_config_create_initial_state(), it ends up callingdrm_mode_config_connector_create_state(), which silently exists if the connector doesn't implementatomic_create_state, which none of the Tegra connectors do, so wouldn't that lead to a NULL pointer dereference at some point?
AFAIK, all tegra connectors have now been converted to atomic_create_state instead of reset (commits c5c0e4821938 and f808d9f8e5a3 in drm-misc-next) so it shouldn't have any reset specific behaviour at all and the transition to drm_mode_config_create_initial_state().
Am I missing something?
Maxime
Maxime Ripard
maintainerPATCH RESEND 54/83 drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tests/drm_atomic_commit_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tests/drm_atomic_commit_test.c +3 -1
@@ -135,5 +135,7 @@ drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors) done: -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv;
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 54/83] drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/tests: error pointer dereference in drm_atomic_commit_test callers --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/tests: error pointer dereference in drm_atomic_commit_test callers --
commit bf780a2e8e49270edd5c0a0b1f92ae2a80dbb4a2
Author: Maxime Ripard <[email protected]>
drm/tests: drm_atomic_state_test: Switch to drm_mode_config_create_initial_state
This commit replaces the call to drm_mode_config_reset() in drm_atomic_test_init_drm_components() with drm_mode_config_create_initial_state() to initialize KMS state for the atomic commit KUnit tests.
Quoted 5 lines
drivers/gpu/drm/tests/drm_atomic_commit_test.c +0
-0
drivers/gpu/drm/tests/drm_atomic_commit_test.c drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors) · line 142
Quoted 10 lines
drivers/gpu/drm/tests/drm_atomic_commit_test.c +3
-1@@ -134,7 +134,9 @@ drm_atomic_test_init_drm_components(struct kunit *test, bool has_connectors) } done: -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv; }
[Severity: Medium]
Can returning ERR_PTR(ret) here lead to an error pointer dereference in the callers of drm_atomic_test_init_drm_components()?
Both drm_test_check_connector_changed_modeset() and drm_test_check_valid_clones() only check the returned pointer with KUNIT_ASSERT_NOT_NULL():
priv = drm_atomic_test_init_drm_components(test, true); KUNIT_ASSERT_NOT_NULL(test, priv);
If drm_mode_config_create_initial_state() returns a negative error code, ERR_PTR(ret) will pass the KUNIT_ASSERT_NOT_NULL() check and be dereferenced in set_up_atomic_state().
Every other failure check in drm_atomic_test_init_drm_components() uses KUNIT_ASSERT_NOT_ERR_OR_NULL() or KUNIT_ASSERT_EQ(test, ret, 0) to abort the test immediately. Should this check use KUNIT_ASSERT_EQ(test, ret, 0) as well, or should the callers be updated to use KUNIT_ASSERT_NOT_ERR_OR_NULL()?
Also, this isn't a bug, but the commit subject prefix says drm_atomic_state_test while the modified file is drm_atomic_commit_test.c.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=54
Maxime Ripard
maintainerPATCH RESEND 55/83 drm/tests: drm_atomic_test: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tests/drm_atomic_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tests/drm_atomic_test.c +3 -1
@@ -87,5 +87,7 @@ static struct drm_atomic_test_priv *create_device(struct kunit *test)drm_connector_attach_encoder (connector, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv;
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 56/83 drm/tests: drm_bridge_test: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tests/drm_bridge_test.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/tests/drm_bridge_test.c +9 -3
@@ -423,5 +423,7 @@ drm_test_bridge_init(struct kunit *test, const struct drm_bridge_funcs *funcs)return ERR_CAST (priv->connector); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv;
@@ -521,5 +523,7 @@ drm_test_bridge_chain_init(struct kunit *test, unsigned int num_bridges,drm_connector_attach_encoder (priv->connector, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);if (!has_hdmi)
@@ -613,5 +617,7 @@ drm_test_bridge_hdmi_init(struct kunit *test, const struct drm_bridge_funcs *fundrm_connector_attach_encoder (priv->connector, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);return priv;
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 57/83 drm/tests: drm_hdmi_state_helper_test: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +3 -1
@@ -298,5 +298,7 @@ __connector_hdmi_init(struct kunit *test,drm_connector_attach_encoder (conn, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);if (edid_data && edid_len) {
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 57/83] drm/tests: drm_hdmi_state_helper_test: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/tests: error pointer dereference on __connector_hdmi_init() failure --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/tests: error pointer dereference on __connector_hdmi_init() failure --
commit f0f9a8e1f22f0d1c095eb10619c56e34cb056f4b
Author: Maxime Ripard <[email protected]>
drm/tests: drm_hdmi_state_helper_test: Switch to drm_mode_config_create_initial_state
This commit replaces the call to drm_mode_config_reset() in __connector_hdmi_init() with drm_mode_config_create_initial_state() to initialize the KMS state for the HDMI connector state helper KUnit tests.
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c __connector_hdmi_init(struct kunit *test, · line 302
Quoted 12 lines
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +3
-1@@ -297,7 +297,9 @@ __connector_hdmi_init(struct kunit *test,drm_connector_helper_add (conn, &dummy_connector_helper_funcs);drm_connector_attach_encoder (conn, enc); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ERR_PTR (ret);
[Severity: Medium]
If drm_mode_config_create_initial_state() fails here in __connector_hdmi_init(), won't returning ERR_PTR(ret) cause the callers to dereference an error pointer?
All the other initialization checks in __connector_hdmi_init() abort the test immediately via KUNIT_ASSERT_*() macros rather than returning an error pointer:
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c:__connector_hdmi_init() {
...
ret = drmm_connector_hdmi_ini2(drm, conn,
"Vendor", "Product",
&dummy_connector_funcs,
hdmi_funcs,
DRM_MODE_CONNECTOR_HDMIA,
NULL,
formats,
max_bpc);
KUNIT_ASSERT_EQ(test, ret, 0);
...
}Because __connector_hdmi_init() previously never returned an ERR_PTR, the test cases calling drm_kunit_helper_connector_hdmi_init() and drm_kunit_helper_connector_hdmi_init_with_edid_funcs() (such as drm_test_check_broadcast_rgb_crtc_mode_changed()) only check for NULL before dereferencing priv:
priv = drm_kunit_helper_connector_hdmi_init(test, BIT(DRM_OUTPUT_COLOR_FORMAT_RGB444), 8); KUNIT_ASSERT_NOT_NULL(test, priv); drm = &priv->drm; crtc = priv->crtc;
Should __connector_hdmi_init() use KUNIT_ASSERT_EQ(test, ret, 0) instead of returning ERR_PTR(ret)?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=57
Maxime Ripard
maintainerPATCH RESEND 58/83 drm/tidss: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Jyri Sarha <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
--- drivers/gpu/drm/tidss/tidss_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_drv.c +5 -1
@@ -167,5 +167,9 @@ static int tidss_probe(struct platform_device *pdev)drm_kms_helper_poll_init (ddev); -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) { +dev_err (dev,"failed to create initial state: %d\n" , ret); + goto err_irq_uninstall; + } ret =drm_dev_register (ddev,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 59/83 drm/tilcdc: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Jyri Sarha <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
--- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +3 -1
@@ -423,5 +423,7 @@ static int tilcdc_pdev_probe(struct platform_device *pdev) } -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) + goto stop_poll;drm_kms_helper_poll_init (ddev);
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 59/83] drm/tilcdc: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] drm/tilcdc: skipped tilcdc_crtc_hw_reset() in tilcdc_pdev_probe() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/tilcdc: skipped tilcdc_crtc_hw_reset() in tilcdc_pdev_probe() --
commit a7aa194e686d4c29674928aee2622cefc3bf4547
Author: Maxime Ripard <[email protected]>
drm/tilcdc: Switch to drm_mode_config_create_initial_state
This commit replaces drm_mode_config_reset() with drm_mode_config_create_initial_state() in tilcdc_pdev_probe() to separate initial KMS state creation at probe time from suspend/resume resets.
drivers/gpu/drm/tilcdc/tilcdc_drv.c static int tilcdc_pdev_probe(struct platform_device *pdev) · line 427
Quoted 12 lines
drivers/gpu/drm/tilcdc/tilcdc_drv.c +3
-1@@ -422,7 +422,9 @@ static int tilcdc_pdev_probe(struct platform_device *pdev) goto unregister_cpufreq_notif; } -drm_mode_config_reset (ddev); + ret =drm_mode_config_create_initial_state (ddev); +if (ret) + goto stop_poll;
[Severity: High]
Does replacing drm_mode_config_reset() with drm_mode_config_create_initial_state() in tilcdc_pdev_probe() skip calling tilcdc_crtc_hw_reset() at probe time?
In drivers/gpu/drm/tilcdc/tilcdc_crtc.c, tilcdc_crtc_hw_reset() is registered as the drm_crtc_helper_funcs.hw_reset callback to turn off the LCDC raster if the bootloader left it enabled, synchronizing the hardware with the initial disabled software CRTC state:
drivers/gpu/drm/tilcdc/tilcdc_crtc.c:tilcdc_crtc_hw_reset() {
/* Turn the raster off if it for some reason is on. */
pm_runtime_get_sync(dev->dev);
if (tilcdc_read(dev, LCDC_RASTER_CTRL_REG) & LCDC_RASTER_ENABLE) {
/* Enable DMA Frame Done Interrupt */
tilcdc_write(dev, LCDC_INT_ENABLE_SET_REG, LCDC_FRAME_DONE);
tilcdc_clear_irqstatus(dev, 0xffffffff);
tilcdc_crtc->frame_done = false;
tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE);
...
}
pm_runtime_put_sync(dev->dev);
}This logic was added in commit 46a956ab3c5b ("drm/tilcdc: Turn raster off in crtc reset, if it was on in the HW") and moved to the hw_reset hook in commit 6e531fda1d6b ("drm/tilcdc: Move hardware reset to hw_reset hook").
Previously, tilcdc_pdev_probe() called drm_mode_config_reset() right after tilcdc_irq_install(), which ran drm_mode_config_crtc_reset_with_create_state() -> helper_funcs->hw_reset(crtc).
However, drm_mode_config_create_initial_state() calls drm_mode_config_crtc_create_state() directly without invoking helper_funcs->hw_reset(crtc).
If the bootloader leaves LCDC_RASTER_ENABLE active at boot, won't the hardware raster remain running while crtc->state->active and tilcdc_crtc->enabled are initialized to false, causing the first modeset in tilcdc_crtc_atomic_enable() -> tilcdc_crtc_enable() -> tilcdc_crtc_set_mode() -> tilcdc_crtc_load_palette() to reprogram timings and palette DMA while the raster is still active?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=59
Maxime Ripard
maintainerPATCH RESEND 60/83 drm/arcpgu: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alexey Brodkin <[email protected]>
--- drivers/gpu/drm/tiny/arcpgu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/arcpgu.c +3 -1
@@ -417,5 +417,7 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) } -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret;drm_kms_helper_poll_init (drm);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 61/83 drm/bochs: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/tiny/bochs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/tiny/bochs.c +1 -3
@@ -684,7 +684,5 @@ static int bochs_kms_init(struct bochs_device *bochs)return ret; -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 61/83] drm/bochs: Switch to drm_mode_config_create_initial_state
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=61
Maxime Ripard
maintainerPATCH RESEND 62/83 drm/cirrus-qemu: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/tiny/cirrus-qemu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/cirrus-qemu.c +3 -1
@@ -624,5 +624,7 @@ static int cirrus_pci_probe(struct pci_dev *pdev,return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;pci_set_drvdata (pdev, dev);
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 62/83] drm/cirrus-qemu: Switch to drm_mode_config_create_initial_state
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=62
Maxime Ripard
maintainerPATCH RESEND 63/83 drm/gm12u320: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Hans de Goede <[email protected]>
--- drivers/gpu/drm/tiny/gm12u320.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/gm12u320.c +3 -1
@@ -773,5 +773,7 @@ static int gm12u320_usb_probe(struct usb_interface *interface,return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;usb_set_intfdata (interface, dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 64/83 drm/hx8357d: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tiny/hx8357d.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/hx8357d.c +3 -1
@@ -361,5 +361,7 @@ static int hx8357d_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 65/83 drm/ili9163: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tiny/ili9163.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/ili9163.c +3 -1
@@ -292,5 +292,7 @@ static int ili9163_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 66/83 drm/ili9225: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: David Lechner <[email protected]>
--- drivers/gpu/drm/tiny/ili9225.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/ili9225.c +3 -1
@@ -519,5 +519,7 @@ static int ili9225_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 67/83 drm/ili9341: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tiny/ili9341.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/ili9341.c +3 -1
@@ -323,5 +323,7 @@ static int ili9341_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 68/83 drm/ili9486: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Kamlesh Gurudasani <[email protected]>
--- drivers/gpu/drm/tiny/ili9486.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/ili9486.c +3 -1
@@ -351,5 +351,7 @@ static int ili9486_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 69/83 drm/mi0283qt: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alex Lanzano <[email protected]>
--- drivers/gpu/drm/tiny/mi0283qt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/mi0283qt.c +3 -1
@@ -331,5 +331,7 @@ static int mi0283qt_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 70/83 drm/panel-mipi-dbi: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
--- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/panel-mipi-dbi.c +3 -1
@@ -491,5 +491,7 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 71/83 drm/pixpaper: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: LiangCheng Wang <[email protected]>
--- drivers/gpu/drm/tiny/pixpaper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/pixpaper.c +3 -1
@@ -1119,5 +1119,7 @@ static int pixpaper_probe(struct spi_device *spi)drm_connector_attach_encoder (&panel->connector, &panel->encoder); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 72/83 drm/repaper: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alex Lanzano <[email protected]>
--- drivers/gpu/drm/tiny/repaper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/repaper.c +3 -1
@@ -1191,5 +1191,7 @@ static int repaper_probe(struct spi_device *spi)return ret; -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 73/83 drm/sharp-memory: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Alex Lanzano <[email protected]>
--- drivers/gpu/drm/tiny/sharp-memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tiny/sharp-memory.c +3 -1
@@ -621,5 +621,7 @@ static int sharp_memory_probe(struct spi_device *spi)drm_plane_enable_fb_damage_clips (&smd->plane); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) +return ret; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 74/83 drm/tve200: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Linus Walleij <[email protected]>
--- drivers/gpu/drm/tve200/tve200_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tve200/tve200_drv.c +3 -1
@@ -119,5 +119,7 @@ static int tve200_modeset_init(struct drm_device *dev) } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto out_bridge;drm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 74/83] drm/tve200: Switch to drm_mode_config_create_initial_state
Quoted 4 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Yours,
Linus Walleij
Maxime Ripard
maintainerPATCH RESEND 75/83 drm/udl: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Dave Airlie <[email protected]>
Cc: Sean Paul <[email protected]>
--- drivers/gpu/drm/udl/udl_modeset.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_modeset.c +3 -1
@@ -541,5 +541,7 @@ int udl_modeset_init(struct udl_device *udl)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drmm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 76/83 drm/vboxvideo: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Hans de Goede <[email protected]>
--- drivers/gpu/drm/vboxvideo/vbox_mode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vboxvideo/vbox_mode.c +4 -1
@@ -878,5 +878,8 @@ int vbox_mode_init(struct vbox_private *vbox) } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_drm_mode_cleanup; +return 0 ;
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 77/83 drm/vc4: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: "Maíra Canal" <[email protected]>
Cc: Dave Stevenson <[email protected]>
Cc: Raspberry Pi Kernel Maintenance <[email protected]>
--- drivers/gpu/drm/vc4/vc4_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_kms.c +3 -1
@@ -1187,5 +1187,7 @@ int vc4_kms_load(struct drm_device *dev)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drmm_kms_helper_poll_init (dev);
Signature · 1 line
2.55.0
Re: [PATCH RESEND 77/83] drm/vc4: Switch to drm_mode_config_create_initial_state
Quoted 5 lines · Maxime Ripard' via kernel-list
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Quoted 25 lines
---
Cc: "Maíra Canal" <[email protected]>
Cc: Dave Stevenson <[email protected]>
Cc: Raspberry Pi Kernel Maintenance <[email protected]>--- drivers/gpu/drm/vc4/vc4_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/vc4/vc4_kms.c +3
-2@@ -1187,5 +1187,7 @@ int vc4_kms_load(struct drm_device *dev)return ret; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drmm_kms_helper_poll_init (dev); --2.55.0
Maxime Ripard
maintainerPATCH RESEND 78/83 drm/verisilicon: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Icenowy Zheng <[email protected]>
--- drivers/gpu/drm/verisilicon/vs_drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/verisilicon/vs_drm.c +3 -1
@@ -131,5 +131,7 @@ int vs_drm_initialize(struct vs_dc *dc, struct platform_device *pdev)drm_kms_helper_poll_init (drm); -drm_mode_config_reset (drm); + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_fini_poll; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 79/83 drm/virtio: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Chia-I Wu <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Dmitry Osipenko <[email protected]>
Cc: Gerd Hoffmann <[email protected]>
Cc: Gurchetan Singh <[email protected]>
Cc: [email protected]
--- drivers/gpu/drm/virtio/virtgpu_display.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_display.c +1 -2
@@ -397,6 +397,5 @@ int virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev)return ret; -drm_mode_config_reset (vgdev->ddev); -return 0 ; +return drm_mode_config_create_initial_state (vgdev->ddev); }
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 79/83] drm/virtio: Switch to drm_mode_config_create_initial_state
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Quoted 8 lines
Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=79
Maxime Ripard
maintainerPATCH RESEND 80/83 drm/vkms: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Haneen Mohammed <[email protected]>
Cc: Louis Chauvet <[email protected]>
Cc: Melissa Wen <[email protected]>
--- drivers/gpu/drm/vkms/vkms_output.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/vkms/vkms_output.c +1 -3
@@ -116,6 +116,4 @@ int vkms_output_init(struct vkms_device *vkmsdev) } -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }
Signature · 1 line
2.55.0
Re: [PATCH RESEND 80/83] drm/vkms: Switch to drm_mode_config_create_initial_state
Thank you,
Oarora Etimis
Maxime Ripard
maintainerPATCH RESEND 81/83 drm/vmwgfx: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Broadcom internal kernel review list <[email protected]>
Cc: Zack Rusin <[email protected]>
--- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 4 +++- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 +--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +3 -1
@@ -568,5 +568,7 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv) dev_priv->active_display_unit = vmw_du_legacy; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_free;return 0 ;
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +1 -3
@@ -940,7 +940,5 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv) dev_priv->active_display_unit = vmw_du_screen_object; -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +1 -3
@@ -1709,6 +1709,4 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) } -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH RESEND 81/83] drm/vmwgfx: Switch to drm_mode_config_create_initial_state
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/vmwgfx: state creation error in display init triggers broken fallback --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/vmwgfx: state creation error in display init triggers broken fallback --
commit 4961d66508852dc07ab5238728474ad461cb6c65
Author: Maxime Ripard <[email protected]>
drm/vmwgfx: Switch to drm_mode_config_create_initial_state
This commit replaces calls to drm_mode_config_reset() with drm_mode_config_create_initial_state() during KMS display unit initialization in vmwgfx_ldu.c, vmwgfx_scrn.c, and vmwgfx_stdu.c.
Quoted 20 lines
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +1
-3@@ -939,9 +939,7 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv) dev_priv->active_display_unit = vmw_du_screen_object; -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); } static int do_bo_define_gmrfb(struct vmw_private *dev_priv,drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +0
-0
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) · line 1712
Quoted 8 lines
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +1
-3@@ -1708,7 +1708,5 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) } } -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }
[Severity: Medium]
What happens in vmw_kms_init() if drm_mode_config_create_initial_state() fails at the end of vmw_kms_stdu_init_display() or vmw_kms_sou_init_display()?
Previously, drm_mode_config_reset() returned void, so neither function returned an error after registering all VMWGFX_NUM_DISPLAY_UNITS (8) display units on dev->mode_config (and vmw_kms_sou_init_display() only ever returned -ENOSYS before initializing any display units).
In drivers/gpu/drm/vmwgfx/vmwgfx_kms.c, vmw_kms_init() treats any non-zero return value as a fallback trigger:
ret = vmw_kms_stdu_init_display(dev_priv);
if (ret) {
ret = vmw_kms_sou_init_display(dev_priv);
if (ret) /* Fallback */
ret = vmw_kms_ldu_init_display(dev_priv);
}If drm_mode_config_create_initial_state() fails after the display units are initialized, those 8 CRTCs, planes, encoders, and connectors remain on dev->mode_config while vmw_kms_init() proceeds to initialize the next display backend on the same drm_device.
When the fallback backend registers another set of CRTCs, dev->mode_config.num_crtc grows past VMWGFX_NUM_DISPLAY_UNITS (8). If dev_priv->vkms_enabled is set, vmw_vkms_init() only allocated dev->vblank for VMWGFX_NUM_DISPLAY_UNITS CRTCs via drm_vblank_init(), so the subsequent drm_mode_config_create_initial_state() -> drm_mode_config_crtc_create_state() -> drm_crtc_vblank_reset() call will index dev->vblank out of bounds. Even when vkms is disabled, if the fallback succeeds, dev->mode_config is left with duplicate mixed-backend KMS objects and more than VMWGFX_NUM_DISPLAY_UNITS CRTCs (which can also overflow fixed-size stack arrays such as units[VMWGFX_NUM_DISPLAY_UNITS] in vmw_kms_helper_dirty()).
Could drm_mode_config_create_initial_state(dev) be called once in vmw_kms_init() after the display unit fallback chain succeeds instead of inside each backend initializer?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=81
Zack Rusin
maintainerRe: [PATCH RESEND 81/83] drm/vmwgfx: Switch to drm_mode_config_create_initial_state
In reply to Maxime RipardQuoted 62 lines · Maxime Ripard
drm_mode_config_reset()has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.Since the two roles need different behaviors (notably for objects like
drm_private_objthat must persist across suspend/resume),drm_mode_config_create_initial_state()was introduced to handle only the initial state creation at probe time.Switch to
drm_mode_config_create_initial_state().Signed-off-by Maxime Ripard <[email protected]>---
Cc: Broadcom internal kernel review list <[email protected]>
Cc: Zack Rusin <[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 4 +++- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 4 +--- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +3
-1@@ -568,5 +568,7 @@ int vmw_kms_ldu_init_display(struct vmw_private *dev_priv) dev_priv->active_display_unit = vmw_du_legacy; -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) + goto err_free;return 0 ;drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +1
-3@@ -940,7 +940,5 @@ int vmw_kms_sou_init_display(struct vmw_private *dev_priv) dev_priv->active_display_unit = vmw_du_screen_object; -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); }drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +1
-4@@ -1709,6 +1709,4 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv) } -drm_mode_config_reset (dev); - -return 0 ; +return drm_mode_config_create_initial_state (dev); } --
Quoted 2 lines
2.55.0
Hi, Maxime.
Sashiko is right that this is not ideal. To be fair that code just doesn't have recovery paths so if you'd like to just add a /* FIXME:
recover in case of an error */ for the code in vmwgfx_scrn.c and vmwgfx_stdu.c then we can handle the rest.
z
Maxime Ripard
maintainerPATCH RESEND 82/83 drm/xen: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Oleksandr Andrushchenko <[email protected]>
--- drivers/gpu/drm/xen/xen_drm_front_kms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/xen/xen_drm_front_kms.c +3 -1
@@ -452,5 +452,7 @@ int xen_drm_front_kms_init(struct xen_drm_front_drm_info *drm_info) } -drm_mode_config_reset (dev); + ret =drm_mode_config_create_initial_state (dev); +if (ret) +return ret;drm_kms_helper_poll_init (dev);return 0 ;
Signature · 1 line
2.55.0
Maxime Ripard
maintainerPATCH RESEND 83/83 drm/xlnx: Switch to drm_mode_config_create_initial_state
In reply to Maxime Riparddrm_mode_config_reset() has a dual role: it creates the initial KMS state at probe time, and resets hardware and software state during suspend/resume cycles.
Since the two roles need different behaviors (notably for objects like drm_private_obj that must persist across suspend/resume), drm_mode_config_create_initial_state() was introduced to handle only the initial state creation at probe time.
Switch to drm_mode_config_create_initial_state().
---
Cc: Michal Simek <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
--- drivers/gpu/drm/xlnx/zynqmp_kms.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/xlnx/zynqmp_kms.c +4 -2
@@ -525,6 +525,8 @@ int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)drm_kms_helper_poll_init (drm); -/* Reset all components and register the DRM device. */ -drm_mode_config_reset (drm); +/* Create the initial state and register the DRM device. */ + ret =drm_mode_config_create_initial_state (drm); +if (ret) + goto err_poll_fini; ret =drm_dev_register (drm,0 );
Signature · 1 line
2.55.0