* [PATCH v3 1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook @ 2024-02-09 16:03 Imre Deak 2024-02-09 16:03 ` [PATCH v3 2/2] drm/i915: Prevent HW access during init from connector get_modes hooks Imre Deak 2024-02-09 17:23 ` ✗ Fi.CI.BUILD: failure for series starting with [v3,1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook Patchwork 0 siblings, 2 replies; 4+ messages in thread From: Imre Deak @ 2024-02-09 16:03 UTC (permalink / raw) To: intel-gfx; +Cc: Jouni Högander Prevent accessing the HW from the SDVO/TV get_modes connector hook. Returning 0 from the hook will make the caller - drm_helper_probe_single_connector_modes() - return a default/EDID override mode list to users. This matches the case where intel_sdvo_get_tv_modes() fails to retrieve the current mode list due to a HW access failure. v2: Clarify the commit message wrt. which modes get_modes() returns. (Jouni) Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Jouni Högander <jouni.hogander@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240208111838.1950411-1-imre.deak@intel.com --- drivers/gpu/drm/i915/display/intel_sdvo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c index 412c15d32f07e..c67605059aa3e 100644 --- a/drivers/gpu/drm/i915/display/intel_sdvo.c +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c @@ -2312,6 +2312,9 @@ static int intel_sdvo_get_tv_modes(struct drm_connector *connector) drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); + if (!intel_display_driver_check_access(i915)) + return 0; + /* * Read the list of supported input resolutions for the selected TV * format. -- 2.39.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/2] drm/i915: Prevent HW access during init from connector get_modes hooks 2024-02-09 16:03 [PATCH v3 1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook Imre Deak @ 2024-02-09 16:03 ` Imre Deak 2024-02-09 17:23 ` ✗ Fi.CI.BUILD: failure for series starting with [v3,1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook Patchwork 1 sibling, 0 replies; 4+ messages in thread From: Imre Deak @ 2024-02-09 16:03 UTC (permalink / raw) To: intel-gfx; +Cc: Jouni Högander Prevent accessing the HW from the get_modes hooks of connectors deriving the mode list from the display's EDID. drm_edid_connector_add_modes() will return the mode list based on the EDID which was cached during a previous detection/get_modes call. This also fixes the NULL deref problem (10085) which was introduced/revealed by commit bab87ef4db9a ("drm/i915: Disable hotplug detection handlers during driver init/shutdown") After the above change MST connectors will not change state during driver init/shutdown; thus some of these connectors with no I2C/DDC adapter registered for them (since the given MST port has no sink connected) may stay then in the 'unknown' connector status. The get_modes() hook should not try to use the I2C/DDC adapter in this state (which would lead to the above NULL deref) which this patch ensures. v2: - Remove the redundant check from intel_crt_ddc_get_modes(). - Rebase on latest drm-tip. - Add Fixes: line / related commit notes. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10085 Fixes: bab87ef4db9a ("drm/i915: Disable hotplug detection handlers during driver init/shutdown") Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Jouni Högander <jouni.hogander@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240206153910.1758057-3-imre.deak@intel.com --- drivers/gpu/drm/i915/display/intel_crt.c | 3 +++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 4 ++++ drivers/gpu/drm/i915/display/intel_dvo.c | 5 +++++ drivers/gpu/drm/i915/display/intel_sdvo.c | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_crt.c b/drivers/gpu/drm/i915/display/intel_crt.c index b9733a73e21d4..93479db0f89f6 100644 --- a/drivers/gpu/drm/i915/display/intel_crt.c +++ b/drivers/gpu/drm/i915/display/intel_crt.c @@ -933,6 +933,9 @@ static int intel_crt_get_modes(struct drm_connector *connector) struct i2c_adapter *ddc; int ret; + if (!intel_display_driver_check_access(dev_priv)) + return drm_edid_connector_add_modes(connector); + wakeref = intel_display_power_get(dev_priv, intel_encoder->power_domain); diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 5fa25a5a36b55..5307ddd4edcf5 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -1197,6 +1197,7 @@ static bool intel_dp_mst_initial_fastset_check(struct intel_encoder *encoder, static int intel_dp_mst_get_ddc_modes(struct drm_connector *connector) { struct intel_connector *intel_connector = to_intel_connector(connector); + struct drm_i915_private *i915 = to_i915(intel_connector->base.dev); struct intel_dp *intel_dp = intel_connector->mst_port; const struct drm_edid *drm_edid; int ret; @@ -1204,6 +1205,9 @@ static int intel_dp_mst_get_ddc_modes(struct drm_connector *connector) if (drm_connector_is_unregistered(connector)) return intel_connector_update_modes(connector, NULL); + if (!intel_display_driver_check_access(i915)) + return drm_edid_connector_add_modes(connector); + drm_edid = drm_dp_mst_edid_read(connector, &intel_dp->mst_mgr, intel_connector->port); ret = intel_connector_update_modes(connector, drm_edid); diff --git a/drivers/gpu/drm/i915/display/intel_dvo.c b/drivers/gpu/drm/i915/display/intel_dvo.c index 8ca9ae4798a89..c076da75b066e 100644 --- a/drivers/gpu/drm/i915/display/intel_dvo.c +++ b/drivers/gpu/drm/i915/display/intel_dvo.c @@ -30,6 +30,7 @@ #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> +#include <drm/drm_edid.h> #include "i915_drv.h" #include "i915_reg.h" @@ -338,8 +339,12 @@ intel_dvo_detect(struct drm_connector *_connector, bool force) static int intel_dvo_get_modes(struct drm_connector *_connector) { struct intel_connector *connector = to_intel_connector(_connector); + struct drm_i915_private *i915 = to_i915(connector->base.dev); int num_modes; + if (!intel_display_driver_check_access(i915)) + return drm_edid_connector_add_modes(&connector->base); + /* * We should probably have an i2c driver get_modes function for those * devices which will have a fixed set of modes determined by the chip diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c index c67605059aa3e..825638702ac1b 100644 --- a/drivers/gpu/drm/i915/display/intel_sdvo.c +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c @@ -2202,12 +2202,16 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) static int intel_sdvo_get_ddc_modes(struct drm_connector *connector) { + struct drm_i915_private *i915 = to_i915(connector->dev); int num_modes = 0; const struct drm_edid *drm_edid; drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); + if (!intel_display_driver_check_access(i915)) + return drm_edid_connector_add_modes(connector); + /* set the bus switch and get the modes */ drm_edid = intel_sdvo_get_edid(connector); -- 2.39.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* ✗ Fi.CI.BUILD: failure for series starting with [v3,1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook 2024-02-09 16:03 [PATCH v3 1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook Imre Deak 2024-02-09 16:03 ` [PATCH v3 2/2] drm/i915: Prevent HW access during init from connector get_modes hooks Imre Deak @ 2024-02-09 17:23 ` Patchwork 2024-02-09 17:48 ` Imre Deak 1 sibling, 1 reply; 4+ messages in thread From: Patchwork @ 2024-02-09 17:23 UTC (permalink / raw) To: Imre Deak; +Cc: intel-gfx == Series Details == Series: series starting with [v3,1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook URL : https://patchwork.freedesktop.org/series/129727/ State : failure == Summary == Error: make failed CALL scripts/checksyscalls.sh DESCEND objtool INSTALL libsubcmd_headers CC [M] drivers/gpu/drm/i915/display/intel_sdvo.o drivers/gpu/drm/i915/display/intel_sdvo.c: In function ‘intel_sdvo_get_tv_modes’: drivers/gpu/drm/i915/display/intel_sdvo.c:2305:41: error: ‘i915’ undeclared (first use in this function); did you mean ‘I915’? 2305 | if (!intel_display_driver_check_access(i915)) | ^~~~ | I915 drivers/gpu/drm/i915/display/intel_sdvo.c:2305:41: note: each undeclared identifier is reported only once for each function it appears in make[6]: *** [scripts/Makefile.build:243: drivers/gpu/drm/i915/display/intel_sdvo.o] Error 1 make[5]: *** [scripts/Makefile.build:481: drivers/gpu/drm/i915] Error 2 make[4]: *** [scripts/Makefile.build:481: drivers/gpu/drm] Error 2 make[3]: *** [scripts/Makefile.build:481: drivers/gpu] Error 2 make[2]: *** [scripts/Makefile.build:481: drivers] Error 2 make[1]: *** [/home/kbuild2/kernel/Makefile:1921: .] Error 2 make: *** [Makefile:240: __sub-make] Error 2 Build failed, no error log produced ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ✗ Fi.CI.BUILD: failure for series starting with [v3,1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook 2024-02-09 17:23 ` ✗ Fi.CI.BUILD: failure for series starting with [v3,1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook Patchwork @ 2024-02-09 17:48 ` Imre Deak 0 siblings, 0 replies; 4+ messages in thread From: Imre Deak @ 2024-02-09 17:48 UTC (permalink / raw) To: intel-gfx, I915-ci-infra On Fri, Feb 09, 2024 at 05:23:08PM +0000, Patchwork wrote: > == Series Details == > > Series: series starting with [v3,1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook > URL : https://patchwork.freedesktop.org/series/129727/ > State : failure > > == Summary == > > Error: make failed > CALL scripts/checksyscalls.sh > DESCEND objtool > INSTALL libsubcmd_headers > CC [M] drivers/gpu/drm/i915/display/intel_sdvo.o > drivers/gpu/drm/i915/display/intel_sdvo.c: In function ‘intel_sdvo_get_tv_modes’: > drivers/gpu/drm/i915/display/intel_sdvo.c:2305:41: error: ‘i915’ undeclared (first use in this function); did you mean ‘I915’? > 2305 | if (!intel_display_driver_check_access(i915)) > | ^~~~ > | I915 > drivers/gpu/drm/i915/display/intel_sdvo.c:2305:41: note: each undeclared identifier is reported only once for each function it appears in > make[6]: *** [scripts/Makefile.build:243: drivers/gpu/drm/i915/display/intel_sdvo.o] Error 1 > make[5]: *** [scripts/Makefile.build:481: drivers/gpu/drm/i915] Error 2 > make[4]: *** [scripts/Makefile.build:481: drivers/gpu/drm] Error 2 > make[3]: *** [scripts/Makefile.build:481: drivers/gpu] Error 2 > make[2]: *** [scripts/Makefile.build:481: drivers] Error 2 > make[1]: *** [/home/kbuild2/kernel/Makefile:1921: .] Error 2 > make: *** [Makefile:240: __sub-make] Error 2 > Build failed, no error log produced Not sure why this fails, on latest drm-tip I get a different result, see below. Looks like an old tree is used as the base, could someone from the CI team check this? $ git fetch drm-tip $ git reset --hard drm-tip/drm-tip HEAD is now at 2aceb3c0b9c8c drm-tip: 2024y-02m-09d-12h-48m-25s UTC integration manifest $ git am ~/imre.mbox Applying: drm/i915: Prevent HW access during init from SDVO TV get_modes hook Applying: drm/i915: Prevent HW access during init from connector get_modes hooks $ make CALL scripts/checksyscalls.sh DESCEND objtool INSTALL libsubcmd_headers CC [M] drivers/gpu/drm/i915/display/intel_crt.o CC [M] drivers/gpu/drm/i915/display/intel_dp_mst.o CC [M] drivers/gpu/drm/i915/display/intel_dvo.o CC [M] drivers/gpu/drm/i915/display/intel_sdvo.o LD [M] drivers/gpu/drm/i915/i915.o CC [M] drivers/gpu/drm/xe/i915-display/intel_dp_mst.o LD [M] drivers/gpu/drm/xe/xe.o MODPOST Module.symvers Kernel: arch/x86/boot/bzImage is ready (#1476) LD [M] drivers/gpu/drm/i915/i915.ko LD [M] drivers/gpu/drm/xe/xe.ko ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-09 17:48 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-02-09 16:03 [PATCH v3 1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook Imre Deak 2024-02-09 16:03 ` [PATCH v3 2/2] drm/i915: Prevent HW access during init from connector get_modes hooks Imre Deak 2024-02-09 17:23 ` ✗ Fi.CI.BUILD: failure for series starting with [v3,1/2] drm/i915: Prevent HW access during init from SDVO TV get_modes hook Patchwork 2024-02-09 17:48 ` Imre Deak
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox