drm: Try to fix encoder possible_clones/crtc
Subsystems (8)
v3 cover drm: Try to fix encoder possible_clones/crtc
From: Ville Syrjälä <[email protected]>
Another respin of the possible_clones/crtcs fixing.
Changes based on v2 review:
- introduce drm_mode_config_validate()
- WARN for possible_clones!=0 when the encoder
itself isn't in the mask
- update the documentation to match the code
Other changes:
- sligth refactoring of the code to make it more consistent
- add a patch to fixup possible_crtcs too (might not be needed but included it just in case).
Ville Syrjälä (7):
drm: Include the encoder itself in possible_clones drm/gma500: Sanitize possible_clones drm/exynos: Use drm_encoder_mask()
drm/imx: Remove the bogus possible_clones setup
drm: Validate encoder->possible_clones
drm: Validate encoder->possible_crtcs
drm: Allow drivers to leave encoder->possible_crtcs==0
drivers/gpu/drm/drm_crtc_internal.h | 1 + drivers/gpu/drm/drm_drv.c | 3 + drivers/gpu/drm/drm_mode_config.c | 97 +++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 +- drivers/gpu/drm/gma500/framebuffer.c | 16 ++-- drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 4 +- drivers/gpu/drm/imx/imx-drm-core.c | 4 +- include/drm/drm_encoder.h | 12 ++- 8 files changed, 125 insertions(+), 17 deletions(-)
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 1/7 drm: Include the encoder itself in possible_clones
From: Ville Syrjälä <[email protected]>
The docs say possible_clones should always include the encoder itself. Since most drivers don't want to deal with the complexities of cloning let's allow them to set possible_clones=0 and instead we'll fix that up in the core.
We can't put this special case into drm_encoder_init() because drivers will have to fill up possible_clones after adding all the relevant encoders. Otherwise they wouldn't know the proper encoder indexes to use. So we'll just do it just before registering the device.
v2: Don't set the bit if possible_clones!=0 so that the
validation (coming soon) will WARN (Thomas)
Fix up the docs to allow possible_clones==0 (Daniel) .late_register() is too late, introduce drm_mode_config_validate() which gets called _before_ we register the char device (Daniel)
--- drivers/gpu/drm/drm_crtc_internal.h | 1 + drivers/gpu/drm/drm_drv.c | 3 +++ drivers/gpu/drm/drm_mode_config.c | 19 +++++++++++++++++++ include/drm/drm_encoder.h | 4 +++- 4 files changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_crtc_internal.h +1 -0
@@ -82,6 +82,7 @@ int drm_mode_setcrtc(struct drm_device *dev,/* drm_mode_config.c */ int drm_modeset_register_all (struct drm_device *dev);void drm_modeset_unregister_all (struct drm_device *dev); +void drm_mode_config_validate (struct drm_device *dev);/* drm_modes.c */ const char *drm_get_mode_status_name (enum drm_mode_status status);
drivers/gpu/drm/drm_drv.c +3 -0
@@ -946,6 +946,9 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)struct drm_driver *driver = dev->driver;int ret; +if (!driver->load) +drm_mode_config_validate (dev); +if (drm_dev_needs_global_mutex (dev))mutex_lock (&drm_global_mutex);
drivers/gpu/drm/drm_mode_config.c +19 -0
@@ -532,3 +532,22 @@ void drm_mode_config_cleanup(struct drm_device *dev)drm_modeset_lock_fini (&dev->mode_config.connection_mutex); }EXPORT_SYMBOL (drm_mode_config_cleanup); + +/* +* For some reason we want the encoder itself included in +* possible_clones. Make life easy for drivers by allowing them +* to leave possible_clones unset if no cloning is possible. +*/ +static void fixup_encoder_possible_clones (struct drm_encoder *encoder) +{ +if (encoder->possible_clones ==0 ) + encoder->possible_clones =drm_encoder_mask (encoder); +} + +void drm_mode_config_validate (struct drm_device *dev) +{ +struct drm_encoder *encoder; + +drm_for_each_encoder (encoder, dev) +fixup_encoder_possible_clones (encoder); +}
include/drm/drm_encoder.h +3 -1
@@ -159,7 +159,9 @@ struct drm_encoder {* encoders can be used in a cloned configuration, they both should have * each another bits set. * -* In reality almost every driver gets this wrong. +* As an exception to the above rule if the driver doesn't implement +* any cloning it can leave @possible_clones set to 0. The core will +* automagically fix this up by setting the bit for the encoder itself. * * Note that since encoder objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects.
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 1/7] drm: Include the encoder itself in possible_clones
Quoted 12 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
The docs say
possible_clonesshould always include the encoder itself. Since most drivers don't want to deal with the complexities of cloning let's allow them to set possible_clones=0 and instead we'll fix that up in the core.We can't put this special case into
drm_encoder_init()because drivers will have to fill uppossible_clonesafter adding all the relevant encoders. Otherwise they wouldn't know the proper encoder indexes to use. So we'll just do it just before registering the device.
Quoted 5 lines
v2: Don't set the bit if possible_clones!=0 so that the
validation (coming soon) will WARN (Thomas)
Fix up the docs to allow possible_clones==0 (Daniel) .late_register() is too late, introducedrm_mode_config_validate()which gets called _before_ we register the char device (Daniel)
Looks solid.
Quoted 82 lines
Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_crtc_internal.h | 1 + drivers/gpu/drm/drm_drv.c | 3 +++ drivers/gpu/drm/drm_mode_config.c | 19 +++++++++++++++++++ include/drm/drm_encoder.h | 4 +++- 4 files changed, 26 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_crtc_internal.h +1
-0@@ -82,6 +82,7 @@ int drm_mode_setcrtc(struct drm_device *dev,/* drm_mode_config.c */ int drm_modeset_register_all (struct drm_device *dev);void drm_modeset_unregister_all (struct drm_device *dev); +void drm_mode_config_validate (struct drm_device *dev);/* drm_modes.c */ const char *drm_get_mode_status_name (enum drm_mode_status status);drivers/gpu/drm/drm_drv.c +3
-0@@ -946,6 +946,9 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)struct drm_driver *driver = dev->driver;int ret; +if (!driver->load) +drm_mode_config_validate (dev); +if (drm_dev_needs_global_mutex (dev))mutex_lock (&drm_global_mutex);drivers/gpu/drm/drm_mode_config.c +19
-0@@ -532,3 +532,22 @@ void drm_mode_config_cleanup(struct drm_device *dev)drm_modeset_lock_fini (&dev->mode_config.connection_mutex); }EXPORT_SYMBOL (drm_mode_config_cleanup); + +/* +* For some reason we want the encoder itself included in +* possible_clones. Make life easy for drivers by allowing them +* to leave possible_clones unset if no cloning is possible. +*/ +static void fixup_encoder_possible_clones (struct drm_encoder *encoder) +{ +if (encoder->possible_clones ==0 ) + encoder->possible_clones =drm_encoder_mask (encoder); +} + +void drm_mode_config_validate (struct drm_device *dev) +{ +struct drm_encoder *encoder; + +drm_for_each_encoder (encoder, dev) +fixup_encoder_possible_clones (encoder); +}include/drm/drm_encoder.h +3
-1@@ -159,7 +159,9 @@ struct drm_encoder {* encoders can be used in a cloned configuration, they both should have * each another bits set. * -* In reality almost every driver gets this wrong. +* As an exception to the above rule if the driver doesn't implement +* any cloning it can leave @possible_clones set to 0. The core will +* automagically fix this up by setting the bit for the encoder itself. * * Note that since encoder objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. Signature · 1 line
2.24.1
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 2/7 drm/gma500: Sanitize possible_clones
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
I doubt the DP+DP and SDVO+SDVO cloning works for this driver. i915 at least doesn't do those. Truthfully there could be some very specific circumstances where some of them would do doable, but genereally it's too much pain to deal with so we've chose not to bother. Let's use the same approach for gma500.
Also the LVDS+LVDS and DSI+DSI cases probably don't really exist as there is one of each at most.
This does mean we'll now leave possible_clones at 0 for these encoder types whereas previosuly we included the encoder itself in the bitmask. But that's fine as the core now treaks 0 as a special case and adds the encoder itself into the final bitmask reported to userspace.
--- drivers/gpu/drm/gma500/framebuffer.c | 16 ++++++++-------- drivers/gpu/drm/gma500/mdfld_dsi_dpi.c | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +8 -8
@@ -581,31 +581,31 @@ static void psb_setup_outputs(struct drm_device *dev)break ;case INTEL_OUTPUT_SDVO : crtc_mask = dev_priv->ops->sdvo_mask; - clone_mask = (1 <<INTEL_OUTPUT_SDVO ); + clone_mask =0 ;break ;case INTEL_OUTPUT_LVDS : - crtc_mask = dev_priv->ops->lvds_mask; - clone_mask = (1 <<INTEL_OUTPUT_LVDS ); + crtc_mask = dev_priv->ops->lvds_mask; + clone_mask =0 ;break ;case INTEL_OUTPUT_MIPI : crtc_mask = (1 <<0 ); - clone_mask = (1 <<INTEL_OUTPUT_MIPI ); + clone_mask =0 ;break ;case INTEL_OUTPUT_MIPI2 : crtc_mask = (1 <<2 ); - clone_mask = (1 <<INTEL_OUTPUT_MIPI2 ); + clone_mask =0 ;break ;case INTEL_OUTPUT_HDMI : - crtc_mask = dev_priv->ops->hdmi_mask; + crtc_mask = dev_priv->ops->hdmi_mask; clone_mask = (1 <<INTEL_OUTPUT_HDMI );break ;case INTEL_OUTPUT_DISPLAYPORT : crtc_mask = (1 <<0 ) | (1 <<1 ); - clone_mask = (1 <<INTEL_OUTPUT_DISPLAYPORT ); + clone_mask =0 ;break ;case INTEL_OUTPUT_EDP : crtc_mask = (1 <<1 ); - clone_mask = (1 <<INTEL_OUTPUT_EDP ); + clone_mask =0 ; } encoder->possible_crtcs = crtc_mask; encoder->possible_clones =
drivers/gpu/drm/gma500/mdfld_dsi_dpi.c +2 -2
@@ -1006,10 +1006,10 @@ struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev,/*set possible crtcs and clones*/ if (dsi_connector->pipe) { encoder->possible_crtcs = (1 <<2 ); - encoder->possible_clones = (1 <<1 ); + encoder->possible_clones =0 ; }else { encoder->possible_crtcs = (1 <<0 ); - encoder->possible_clones = (1 <<0 ); + encoder->possible_clones =0 ; } dsi_connector->base.encoder = &dpi_output->base.base;
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 3/7 drm/exynos: Use drm_encoder_mask()
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Replace the hand rolled encoder bitmask thing with drm_encoder_mask()
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -3
@@ -270,7 +270,7 @@ static int exynos_drm_bind(struct device *dev)struct drm_encoder *encoder;struct drm_device *drm;unsigned int clone_mask; -int cnt, ret; +int ret; drm =drm_dev_alloc (&exynos_drm_driver, dev);if (IS_ERR (drm))
@@ -293,10 +293,9 @@ static int exynos_drm_bind(struct device *dev)exynos_drm_mode_config_init (drm);/* setup possible_clones. */ - cnt =0 ; clone_mask =0 ;list_for_each_entry (encoder, &drm->mode_config.encoder_list, head) - clone_mask |= (1 << (cnt++)); + clone_mask |=drm_encoder_mask (encoder);list_for_each_entry (encoder, &drm->mode_config.encoder_list, head) encoder->possible_clones = clone_mask;
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 3/7] drm/exynos: Use drm_encoder_mask()
20. 2. 12. 오전 1:22에 Ville Syrjala 이(가) 쓴 글:
Quoted 10 lines
From: Ville Syrjälä <[email protected]>
Replace the hand rolled encoder bitmask thing with
drm_encoder_mask()Cc Inki Dae <[email protected]>Cc Joonyoung Shim <[email protected]>Cc Seung-Woo Kim <[email protected]>Cc Kyungmin Park <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
THanks,
Inki Dae
Quoted 20 lines
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/exynos/exynos_drm_drv.c +1
-1@@ -270,7 +270,7 @@ static int exynos_drm_bind(struct device *dev)struct drm_encoder *encoder;struct drm_device *drm;unsigned int clone_mask; -int cnt, ret; +int ret; drm =drm_dev_alloc (&exynos_drm_driver, dev);if (IS_ERR (drm))@@ -293,10 +293,9 @@ static int exynos_drm_bind(struct device *dev)exynos_drm_mode_config_init (drm);
drivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_bind(struct device *dev) · line 301
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1
-2/* setup possible_clones. */ - cnt =0 ; clone_mask =0 ;list_for_each_entry (encoder, &drm->mode_config.encoder_list, head) - clone_mask |= (1 << (cnt++)); + clone_mask |=drm_encoder_mask (encoder);list_for_each_entry (encoder, &drm->mode_config.encoder_list, head) encoder->possible_clones = clone_mask;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Inki Dae
maintainerRe: [PATCH v3 3/7] drm/exynos: Use drm_encoder_mask()
20. 2. 17. 오전 11:27에 Inki Dae 이(가) 쓴 글:
Quoted 7 lines
20. 2. 12. 오전 1:22에 Ville Syrjala 이(가) 쓴 글:
Quoted 4 lines
From: Ville Syrjälä <[email protected]>
Replace the hand rolled encoder bitmask thing with
drm_encoder_mask()
Quoted 8 lines
Quoted 6 lines
Cc Inki Dae <[email protected]>Cc Joonyoung Shim <[email protected]>Cc Seung-Woo Kim <[email protected]>Cc Kyungmin Park <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Acked-by Inki Dae <[email protected]>
Seems no any dependency of other patch so I will pick it up.
Thanks,
Inki Dae
Quoted 31 lines
THanks,
Inki DaeQuoted 27 lines
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/exynos/exynos_drm_drv.c +2
-3@@ -270,7 +270,7 @@ static int exynos_drm_bind(struct device *dev)struct drm_encoder *encoder;struct drm_device *drm;unsigned int clone_mask; -int cnt, ret; +int ret; drm =drm_dev_alloc (&exynos_drm_driver, dev);if (IS_ERR (drm))@@ -293,10 +293,9 @@ static int exynos_drm_bind(struct device *dev)exynos_drm_mode_config_init (drm);/* setup possible_clones. */ - cnt =0 ; clone_mask =0 ;list_for_each_entry (encoder, &drm->mode_config.encoder_list, head) - clone_mask |= (1 << (cnt++)); + clone_mask |=drm_encoder_mask (encoder);
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_bind(struct device *dev) · line 301
Quoted 3 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +0
-0list_for_each_entry (encoder, &drm->mode_config.encoder_list, head) encoder->possible_clones = clone_mask;_______________________________________________
dri-devel mailing list
[email protected]
https://protect2.fireeye.com/url?k=1d1d091a-40c9b572-1d1c8255-0cc47a3356b2-9a4d0e5ded7f6cb8&u=https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 4/7 drm/imx: Remove the bogus possible_clones setup
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
It's not at all clear what cloning options this driver supports. So let's just clear possible_clones instead of setting it to some bogus value.
v2: Adjust the FIXME (Daniel)
--- drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/imx/imx-drm-core.c +2 -2
@@ -139,8 +139,8 @@ int imx_drm_encoder_parse_of(struct drm_device *drm, encoder->possible_crtcs = crtc_mask; -/* FIXME: this is the mask of outputs which can clone this output. */ - encoder->possible_clones = ~0 ; +/* FIXME: cloning support not clear, disable it all for now */ + encoder->possible_clones =0 ;return 0 ; }
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 5/7 drm: Validate encoder->possible_clones
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Many drivers are populating encoder->possible_clones wrong. Let's persuade them to get it right by adding some loud WARNs.
We'll cross check the bits between any two encoders. So either both encoders can clone with the other, or neither can.
We'll also complain about effectively empty possible_clones, and possible_clones containing bits for encoders that don't exist.
v2: encoder->possible_clones now includes the encoder itelf
v3: Move to drm_mode_config_validate() (Daniel)
Document that you get a WARN when this is wrong (Daniel) Extract full_encoder_mask()
--- drivers/gpu/drm/drm_mode_config.c | 40 +++++++++++++++++++++++++++++++ include/drm/drm_encoder.h | 2 ++ 2 files changed, 42 insertions(+)
drivers/gpu/drm/drm_mode_config.c +40 -0
@@ -533,6 +533,17 @@ void drm_mode_config_cleanup(struct drm_device *dev) }EXPORT_SYMBOL (drm_mode_config_cleanup); +static u32 full_encoder_mask (struct drm_device *dev) +{ +struct drm_encoder *encoder; +u32 encoder_mask =0 ; + +drm_for_each_encoder (encoder, dev) + encoder_mask |=drm_encoder_mask (encoder); + +return encoder_mask; +} +/* * For some reason we want the encoder itself included in * possible_clones. Make life easy for drivers by allowing them
@@ -544,10 +555,39 @@ static void fixup_encoder_possible_clones(struct drm_encoder *encoder) encoder->possible_clones =drm_encoder_mask (encoder); } +static void validate_encoder_possible_clones (struct drm_encoder *encoder) +{ +struct drm_device *dev = encoder->dev; +u32 encoder_mask =full_encoder_mask (dev); +struct drm_encoder *other; + +drm_for_each_encoder (other, dev) { +WARN (!(encoder->possible_clones &drm_encoder_mask (other)) != + !(other->possible_clones &drm_encoder_mask (encoder)), +"possible_clones mismatch: " +"[ENCODER:%d:%s] mask=0x%x possible_clones=0x%x vs. " +"[ENCODER:%d:%s] mask=0x%x possible_clones=0x%x\n" , + encoder->base.id, encoder->name, +drm_encoder_mask (encoder), encoder->possible_clones, + other->base.id, other->name, +drm_encoder_mask (other), other->possible_clones); + } + +WARN ((encoder->possible_clones &drm_encoder_mask (encoder)) ==0 || + (encoder->possible_clones & ~encoder_mask) !=0 , +"Bogus possible_clones: " +"[ENCODER:%d:%s] possible_clones=0x%x (full encoder mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_clones, encoder_mask); +} +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); + +drm_for_each_encoder (encoder, dev) +validate_encoder_possible_clones (encoder); }
include/drm/drm_encoder.h +2 -0
@@ -163,6 +163,8 @@ struct drm_encoder {* any cloning it can leave @possible_clones set to 0. The core will * automagically fix this up by setting the bit for the encoder itself. * +* You will get a WARN if you get this wrong in the driver. +* * Note that since encoder objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. */
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 5/7] drm: Validate encoder->possible_clones
Quoted 11 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Many drivers are populating
encoder->possible_cloneswrong. Let's persuade them to get it right by adding some loud WARNs.We'll cross check the bits between any two encoders. So either both encoders can clone with the other, or neither can.
We'll also complain about effectively empty
possible_clones, andpossible_clonescontaining bits for encoders that don't exist.
Quoted 8 lines
v2:
encoder->possible_clonesnow includes the encoder itelf
v3: Move todrm_mode_config_validate()(Daniel)
Document that you get a WARN when this is wrong (Daniel) Extractfull_encoder_mask()Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
I wonder whether we should start to have some unit tests for stuff like this, like set up broken driver, make sure we have a WARN in dmesg. But ideally we'd do that with the mocking stuff Kunit hopefully has soon.
</idle musings>
Quoted 30 lines
--- drivers/gpu/drm/drm_mode_config.c | 40 +++++++++++++++++++++++++++++++ include/drm/drm_encoder.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/drm_mode_config.c +11
-0@@ -533,6 +533,17 @@ void drm_mode_config_cleanup(struct drm_device *dev) }EXPORT_SYMBOL (drm_mode_config_cleanup); +static u32 full_encoder_mask (struct drm_device *dev) +{ +struct drm_encoder *encoder; +u32 encoder_mask =0 ; + +drm_for_each_encoder (encoder, dev) + encoder_mask |=drm_encoder_mask (encoder); + +return encoder_mask; +} +/* * For some reason we want the encoder itself included in * possible_clones. Make life easy for drivers by allowing them @@ -544,10 +555,39 @@ static void fixup_encoder_possible_clones(struct drm_encoder *encoder) encoder->possible_clones =drm_encoder_mask (encoder); }
drivers/gpu/drm/drm_mode_config.c static void fixup_encoder_possible_clones(struct drm_encoder *encoder) · line 566
Quoted 10 lines
drivers/gpu/drm/drm_mode_config.c +9
-0+static void validate_encoder_possible_clones (struct drm_encoder *encoder) +{ +struct drm_device *dev = encoder->dev; +u32 encoder_mask =full_encoder_mask (dev); +struct drm_encoder *other; + +drm_for_each_encoder (other, dev) { + WARN(!(encoder->possible_clones & drm_encoder_mask(other)) != + !(other->possible_clones & drm_encoder_mask(encoder)),
Bikeshed: !! as canonical "make this a bool value" might be slightly clearer, but whatever.
Quoted 6 lines
drivers/gpu/drm/drm_mode_config.c +6
-0+"possible_clones mismatch: " +"[ENCODER:%d:%s] mask=0x%x possible_clones=0x%x vs. " +"[ENCODER:%d:%s] mask=0x%x possible_clones=0x%x\n" , + encoder->base.id, encoder->name, +drm_encoder_mask (encoder), encoder->possible_clones, + other->base.id, other->name,
drivers/gpu/drm/drm_mode_config.c static void fixup_encoder_possible_clones(struct drm_encoder *encoder) · line 582
Quoted 10 lines
drivers/gpu/drm/drm_mode_config.c +10
-0+ drm_encoder_mask(other), other->possible_clones); + } + +WARN ((encoder->possible_clones &drm_encoder_mask (encoder)) ==0 || + (encoder->possible_clones & ~encoder_mask) !=0 , +"Bogus possible_clones: " +"[ENCODER:%d:%s] possible_clones=0x%x (full encoder mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_clones, encoder_mask); +}
Since it's next to each another double-checking that the fixup did add the self-clone is probably too much :-)
Quoted 17 lines
drivers/gpu/drm/drm_mode_config.c +4
-0+void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); + +drm_for_each_encoder (encoder, dev) +validate_encoder_possible_clones (encoder);}
include/drm/drm_encoder.h +0
-0
include/drm/drm_encoder.h struct drm_encoder { · line 166
Quoted 4 lines
include/drm/drm_encoder.h +1
-0@@ -163,6 +163,8 @@ struct drm_encoder {* any cloning it can leave @possible_clones set to 0. The core will * automagically fix this up by setting the bit for the encoder itself. * +* You will get a WARN if you get this wrong in the driver.
Nice.
Quoted 7 lines
include/drm/drm_encoder.h +1
-0+* * Note that since encoder objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. */ Signature · 1 line
2.24.1
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 5/7] drm: Validate encoder->possible_clones
Quoted 59 lines · Daniel Vetter
Quoted 11 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Many drivers are populating
encoder->possible_cloneswrong. Let's persuade them to get it right by adding some loud WARNs.We'll cross check the bits between any two encoders. So either both encoders can clone with the other, or neither can.
We'll also complain about effectively empty
possible_clones, andpossible_clonescontaining bits for encoders that don't exist.Quoted 8 lines
v2:
encoder->possible_clonesnow includes the encoder itelf
v3: Move todrm_mode_config_validate()(Daniel)
Document that you get a WARN when this is wrong (Daniel) Extractfull_encoder_mask()Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>I wonder whether we should start to have some unit tests for stuff like this, like set up broken driver, make sure we have a WARN in dmesg. But ideally we'd do that with the mocking stuff Kunit hopefully has soon.
</idle musings>
Quoted 31 lines
--- drivers/gpu/drm/drm_mode_config.c | 40 +++++++++++++++++++++++++++++++ include/drm/drm_encoder.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/drm_mode_config.c +11
-0@@ -533,6 +533,17 @@ void drm_mode_config_cleanup(struct drm_device *dev) }EXPORT_SYMBOL (drm_mode_config_cleanup); +static u32 full_encoder_mask (struct drm_device *dev) +{ +struct drm_encoder *encoder; +u32 encoder_mask =0 ; + +drm_for_each_encoder (encoder, dev) + encoder_mask |=drm_encoder_mask (encoder); + +return encoder_mask; +} +/* * For some reason we want the encoder itself included in * possible_clones. Make life easy for drivers by allowing them @@ -544,10 +555,39 @@ static void fixup_encoder_possible_clones(struct drm_encoder *encoder) encoder->possible_clones =drm_encoder_mask (encoder); }
Quoted 12 lines
drivers/gpu/drm/drm_mode_config.c static void fixup_encoder_possible_clones(struct drm_encoder *encoder) · line 566
Quoted 9 lines
drivers/gpu/drm/drm_mode_config.c +9
-0+static void validate_encoder_possible_clones (struct drm_encoder *encoder) +{ +struct drm_device *dev = encoder->dev; +u32 encoder_mask =full_encoder_mask (dev); +struct drm_encoder *other; + +drm_for_each_encoder (other, dev) { + WARN(!(encoder->possible_clones & drm_encoder_mask(other)) != + !(other->possible_clones & drm_encoder_mask(encoder)),Bikeshed: !! as canonical "make this a bool value" might be slightly clearer, but whatever.
Can repaint.
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/drm_mode_config.c +11
-0+"possible_clones mismatch: " +"[ENCODER:%d:%s] mask=0x%x possible_clones=0x%x vs. " +"[ENCODER:%d:%s] mask=0x%x possible_clones=0x%x\n" , + encoder->base.id, encoder->name, +drm_encoder_mask (encoder), encoder->possible_clones, + other->base.id, other->name, + drm_encoder_mask(other), other->possible_clones); + } + + WARN((encoder->possible_clones & drm_encoder_mask(encoder)) == 0 || + (encoder->possible_clones & ~encoder_mask) != 0,
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c static void fixup_encoder_possible_clones(struct drm_encoder *encoder) · line 582
Quoted 5 lines
drivers/gpu/drm/drm_mode_config.c +5
-0+"Bogus possible_clones: " +"[ENCODER:%d:%s] possible_clones=0x%x (full encoder mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_clones, encoder_mask); +}Since it's next to each another double-checking that the fixup did add the self-clone is probably too much :-)
I changed the fixup to be just
if (possible_clones == 0)
possible_clones = drm_encoder_mask();
So if the driver tries to set it up but fails and forgets the encoder itself this WARN will still trip.
Quoted 39 lines
Quoted 18 lines
drivers/gpu/drm/drm_mode_config.c +4
-0+void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); + +drm_for_each_encoder (encoder, dev) +validate_encoder_possible_clones (encoder);}
include/drm/drm_encoder.h +0
-0include/drm/drm_encoder.h struct drm_encoder { · line 166
Quoted 4 lines
include/drm/drm_encoder.h +1
-0@@ -163,6 +163,8 @@ struct drm_encoder {* any cloning it can leave @possible_clones set to 0. The core will * automagically fix this up by setting the bit for the encoder itself. * +* You will get a WARN if you get this wrong in the driver. Nice.
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
include/drm/drm_encoder.h +1
-0+* * Note that since encoder objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. */ Signature · 1 line
2.24.1Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 5/7] drm: Validate encoder->possible_clones
Quoted 96 lines · Ville Syrjälä
Quoted 59 lines · Daniel Vetter
Quoted 11 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Many drivers are populating
encoder->possible_cloneswrong. Let's persuade them to get it right by adding some loud WARNs.We'll cross check the bits between any two encoders. So either both encoders can clone with the other, or neither can.
We'll also complain about effectively empty
possible_clones, andpossible_clonescontaining bits for encoders that don't exist.Quoted 8 lines
v2:
encoder->possible_clonesnow includes the encoder itelf
v3: Move todrm_mode_config_validate()(Daniel)
Document that you get a WARN when this is wrong (Daniel) Extractfull_encoder_mask()Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>I wonder whether we should start to have some unit tests for stuff like this, like set up broken driver, make sure we have a WARN in dmesg. But ideally we'd do that with the mocking stuff Kunit hopefully has soon.
</idle musings>
Quoted 31 lines
--- drivers/gpu/drm/drm_mode_config.c | 40 +++++++++++++++++++++++++++++++ include/drm/drm_encoder.h | 2 ++ 2 files changed, 42 insertions(+)drivers/gpu/drm/drm_mode_config.c +11
-0@@ -533,6 +533,17 @@ void drm_mode_config_cleanup(struct drm_device *dev) }EXPORT_SYMBOL (drm_mode_config_cleanup); +static u32 full_encoder_mask (struct drm_device *dev) +{ +struct drm_encoder *encoder; +u32 encoder_mask =0 ; + +drm_for_each_encoder (encoder, dev) + encoder_mask |=drm_encoder_mask (encoder); + +return encoder_mask; +} +/* * For some reason we want the encoder itself included in * possible_clones. Make life easy for drivers by allowing them @@ -544,10 +555,39 @@ static void fixup_encoder_possible_clones(struct drm_encoder *encoder) encoder->possible_clones =drm_encoder_mask (encoder); }Quoted 12 lines
drivers/gpu/drm/drm_mode_config.c static void fixup_encoder_possible_clones(struct drm_encoder *encoder) · line 566
Quoted 9 lines
drivers/gpu/drm/drm_mode_config.c +9
-0+static void validate_encoder_possible_clones (struct drm_encoder *encoder) +{ +struct drm_device *dev = encoder->dev; +u32 encoder_mask =full_encoder_mask (dev); +struct drm_encoder *other; + +drm_for_each_encoder (other, dev) { + WARN(!(encoder->possible_clones & drm_encoder_mask(other)) != + !(other->possible_clones & drm_encoder_mask(encoder)),Bikeshed: !! as canonical "make this a bool value" might be slightly clearer, but whatever.
Can repaint.
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/drm_mode_config.c +11
-0+"possible_clones mismatch: " +"[ENCODER:%d:%s] mask=0x%x possible_clones=0x%x vs. " +"[ENCODER:%d:%s] mask=0x%x possible_clones=0x%x\n" , + encoder->base.id, encoder->name, +drm_encoder_mask (encoder), encoder->possible_clones, + other->base.id, other->name, + drm_encoder_mask(other), other->possible_clones); + } + + WARN((encoder->possible_clones & drm_encoder_mask(encoder)) == 0 || + (encoder->possible_clones & ~encoder_mask) != 0,Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c static void fixup_encoder_possible_clones(struct drm_encoder *encoder) · line 582
Quoted 5 lines
drivers/gpu/drm/drm_mode_config.c +5
-0+"Bogus possible_clones: " +"[ENCODER:%d:%s] possible_clones=0x%x (full encoder mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_clones, encoder_mask); +}Since it's next to each another double-checking that the fixup did add the self-clone is probably too much :-)
Quoted 6 lines
I changed the fixup to be just
if (possible_clones== 0)possible_clones = drm_encoder_mask();So if the driver tries to set it up but fails and forgets the encoder itself this WARN will still trip.
Duh, I was just blind, everything is looking good. -Daniel
Quoted 44 lines
Quoted 40 lines
Quoted 19 lines
drivers/gpu/drm/drm_mode_config.c +4
-0+void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); + +drm_for_each_encoder (encoder, dev) +validate_encoder_possible_clones (encoder);}
include/drm/drm_encoder.h +0
-0include/drm/drm_encoder.h struct drm_encoder { · line 166
Quoted 4 lines
include/drm/drm_encoder.h +1
-0@@ -163,6 +163,8 @@ struct drm_encoder {* any cloning it can leave @possible_clones set to 0. The core will * automagically fix this up by setting the bit for the encoder itself. * +* You will get a WARN if you get this wrong in the driver. Nice.
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
include/drm/drm_encoder.h +1
-0+* * Note that since encoder objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. */ Signature · 1 line
2.24.1Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.chSignature · 2 lines
Ville Syrjälä Intel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 6/7 drm: Validate encoder->possible_crtcs
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
WARN if the encoder possible_crtcs is effectively empty or contains bits for non-existing crtcs.
v2: Move to drm_mode_config_validate() (Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extract full_crtc_mask()
--- drivers/gpu/drm/drm_mode_config.c | 27 ++++++++++++++++++++++++++- include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_mode_config.c +26 -1
@@ -581,6 +581,29 @@ static void validate_encoder_possible_clones(struct drm_encoder *encoder) encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) +{ +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +u32 crtc_mask =full_crtc_mask (encoder->dev); + +WARN ((encoder->possible_crtcs & crtc_mask) ==0 || + (encoder->possible_crtcs & ~crtc_mask) !=0 , +"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); +} +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;
@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct drm_device *dev)drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }
include/drm/drm_encoder.h +1 -1
@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * -* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects.
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.
Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-Daniel
Quoted 65 lines
--- drivers/gpu/drm/drm_mode_config.c | 27 ++++++++++++++++++++++++++- include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +26
-1@@ -581,6 +581,29 @@ static void validate_encoder_possible_clones(struct drm_encoder *encoder) encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) +{ +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +u32 crtc_mask =full_crtc_mask (encoder->dev); + +WARN ((encoder->possible_crtcs & crtc_mask) ==0 || + (encoder->possible_crtcs & ~crtc_mask) !=0 , +"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); +} +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct drm_device *dev)drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +1
-1@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * -* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. Signature · 1 line
2.24.1
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
Quoted 81 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
Reviewed-by Daniel Vetter <[email protected]>I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-DanielQuoted 57 lines
--- drivers/gpu/drm/drm_mode_config.c | 27 ++++++++++++++++++++++++++- include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +26
-1@@ -581,6 +581,29 @@ static void validate_encoder_possible_clones(struct drm_encoder *encoder) encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) +{ +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +u32 crtc_mask =full_crtc_mask (encoder->dev); + +WARN ((encoder->possible_crtcs & crtc_mask) ==0 || + (encoder->possible_crtcs & ~crtc_mask) !=0 , +"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); +} +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct drm_device *dev)drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +0
-0@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). *
Quoted 9 lines
Quoted 8 lines
include/drm/drm_encoder.h +1
-1-* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. Signature · 1 line
2.24.1
Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
[ 14.033246] ------------[ cut here ]------------ [ 14.033248] Bogus possible_crtcs: [ENCODER:65:TMDS-65] possible_crtcs=0xf (full crtc mask=0x7) [ 14.033279] WARNING: CPU: 0 PID: 282 at ../drivers/gpu/drm/drm_mode_config.c:622 drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033279] Modules linked in: amdgpu(E+) mfd_core(E) snd_hda_codec_realtek(E) kvm_amd(E) gpu_sched(E) i2c_algo_bit(E) ttm(E) snd_hda_codec_generic(E) kvm(E) ledtrig_audio(E) snd_hda_codec_hdmi(E) drm_kms_helper(E) snd_hda_intel(E) snd_intel_dspcfg(E) snd_hda_codec(E) cec(E) snd_hwdep(E) drm(E) irqbypass(E) snd_hda_core(E) crc32_pclmul(E) snd_pcm(E) ghash_clmulni_intel(E) snd_timer(E) sg(E) aesni_intel(E) snd(E) ccp(E) soundcore(E) rng_core(E) glue_helper(E) libaes(E) crypto_simd(E) k10temp(E) efi_pstore(E) sp5100_tco(E) evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E) acpi_cpufreq(E) w83627hf_wdt(E) watchdog(E) nct6775(E) hwmon_vid(E) efivarfs(E) ip_tables(E) x_tables(E) autofs4(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) sd_mod(E) t10_pi(E) crc_t10dif(E) crct10dif_generic(E) uas(E) usb_storage(E) ahci(E) libahci(E) xhci_pci(E) r8169(E) realtek(E) mdio_devres(E) xhci_hcd(E) libata(E) i2c_amd_mp2_pci(E) crct10dif_pclmul(E) crct10dif_common(E) scsi_mod(E) [ 14.033306] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033310] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G E 5.9.0-rc3+ #2 [ 14.033311] Hardware name: Default string Default string/Default string, BIOS 5.0.1.4 02/14/2020 [ 14.033324] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033327] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b 54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d [ 14.033328] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033329] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX: 0000000000000027 [ 14.033330] RDX: 0000000000000000 RSI: 0000000000000086 RDI: ffff9c6910a18ac8 [ 14.033331] RBP: 0000000000000001 R08: 0000000000000064 R09: ffffffff9784a724 [ 14.033331] R10: 0000000000000001 R11: 0000000000000000 R12: ffff9c690bf8b800 [ 14.033332] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15: 000000000000003f [ 14.033333] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000) knlGS:0000000000000000 [ 14.033334] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033335] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4: 00000000003506f0 [ 14.033335] Call Trace: [ 14.033350] drm_dev_register+0x117/0x1e0 [drm] [ 14.033423] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033428] local_pci_probe+0x42/0x90 [ 14.033430] pci_device_probe+0x108/0x1c0 [ 14.033433] really_probe+0xef/0x4a0 [ 14.033435] driver_probe_device+0xde/0x150 [ 14.033436] device_driver_attach+0x4f/0x60 [ 14.033438] __driver_attach+0x9a/0x140 [ 14.033439] ? device_driver_attach+0x60/0x60 [ 14.033441] bus_for_each_dev+0x76/0xc0 [ 14.033443] ? klist_add_tail+0x3b/0x70 [ 14.033445] bus_add_driver+0x144/0x220 [ 14.033446] ? 0xffffffffc0949000 [ 14.033447] driver_register+0x5b/0xf0 [ 14.033448] ? 0xffffffffc0949000 [ 14.033451] do_one_initcall+0x46/0x1f4 [ 14.033454] ? _cond_resched+0x15/0x40 [ 14.033456] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033459] ? do_init_module+0x22/0x213 [ 14.033460] do_init_module+0x5b/0x213 [ 14.033462] load_module+0x258c/0x2d30 [ 14.033465] ? __kernel_read+0xf5/0x160 [ 14.033467] ? __do_sys_finit_module+0xe9/0x110 [ 14.033468] __do_sys_finit_module+0xe9/0x110 [ 14.033471] do_syscall_64+0x33/0x80 [ 14.033473] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033474] RIP: 0033:0x7feacf1bef59 [ 14.033477] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48 [ 14.033477] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 14.033478] RAX: ffffffffffffffda RBX: 0000565489749410 RCX: 00007feacf1bef59 [ 14.033479] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI: 0000000000000015 [ 14.033479] RBP: 00007feacf0c3cad R08: 0000000000000000 R09: 0000000000000000 [ 14.033480] R10: 0000000000000015 R11: 0000000000000246 R12: 0000000000000000 [ 14.033480] R13: 00005654897472c0 R14: 0000000000020000 R15: 0000565489749410 [ 14.033482] ---[ end trace 16aeaa08847a13d8 ]--- [ 14.033483] ------------[ cut here ]------------ [ 14.033484] Bogus possible_crtcs: [ENCODER:69:TMDS-69] possible_crtcs=0xf (full crtc mask=0x7) [ 14.033507] WARNING: CPU: 0 PID: 282 at ../drivers/gpu/drm/drm_mode_config.c:622 drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033507] Modules linked in: amdgpu(E+) mfd_core(E) snd_hda_codec_realtek(E) kvm_amd(E) gpu_sched(E) i2c_algo_bit(E) ttm(E) snd_hda_codec_generic(E) kvm(E) ledtrig_audio(E) snd_hda_codec_hdmi(E) drm_kms_helper(E) snd_hda_intel(E) snd_intel_dspcfg(E) snd_hda_codec(E) cec(E) snd_hwdep(E) drm(E) irqbypass(E) snd_hda_core(E) crc32_pclmul(E) snd_pcm(E) ghash_clmulni_intel(E) snd_timer(E) sg(E) aesni_intel(E) snd(E) ccp(E) soundcore(E) rng_core(E) glue_helper(E) libaes(E) crypto_simd(E) k10temp(E) efi_pstore(E) sp5100_tco(E) evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E) acpi_cpufreq(E) w83627hf_wdt(E) watchdog(E) nct6775(E) hwmon_vid(E) efivarfs(E) ip_tables(E) x_tables(E) autofs4(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) sd_mod(E) t10_pi(E) crc_t10dif(E) crct10dif_generic(E) uas(E) usb_storage(E) ahci(E) libahci(E) xhci_pci(E) r8169(E) realtek(E) mdio_devres(E) xhci_hcd(E) libata(E) i2c_amd_mp2_pci(E) crct10dif_pclmul(E) crct10dif_common(E) scsi_mod(E) [ 14.033522] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033524] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G W E 5.9.0-rc3+ #2 [ 14.033525] Hardware name: Default string Default string/Default string, BIOS 5.0.1.4 02/14/2020 [ 14.033538] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033539] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b 54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d [ 14.033540] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033540] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX: 0000000000000027 [ 14.033541] RDX: 0000000000000000 RSI: 0000000000000086 RDI: ffff9c6910a18ac8 [ 14.033542] RBP: 0000000000000001 R08: 0000000000000064 R09: ffffffff9784a724 [ 14.033542] R10: 0000000000000001 R11: 0000000000000000 R12: ffff9c690bf89800 [ 14.033543] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15: 000000000000003f [ 14.033544] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000) knlGS:0000000000000000 [ 14.033544] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033545] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4: 00000000003506f0 [ 14.033545] Call Trace: [ 14.033557] drm_dev_register+0x117/0x1e0 [drm] [ 14.033625] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033627] local_pci_probe+0x42/0x90 [ 14.033629] pci_device_probe+0x108/0x1c0 [ 14.033630] really_probe+0xef/0x4a0 [ 14.033632] driver_probe_device+0xde/0x150 [ 14.033633] device_driver_attach+0x4f/0x60 [ 14.033634] __driver_attach+0x9a/0x140 [ 14.033635] ? device_driver_attach+0x60/0x60 [ 14.033636] bus_for_each_dev+0x76/0xc0 [ 14.033638] ? klist_add_tail+0x3b/0x70 [ 14.033639] bus_add_driver+0x144/0x220 [ 14.033640] ? 0xffffffffc0949000 [ 14.033641] driver_register+0x5b/0xf0 [ 14.033642] ? 0xffffffffc0949000 [ 14.033643] do_one_initcall+0x46/0x1f4 [ 14.033645] ? _cond_resched+0x15/0x40 [ 14.033646] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033648] ? do_init_module+0x22/0x213 [ 14.033649] do_init_module+0x5b/0x213 [ 14.033650] load_module+0x258c/0x2d30 [ 14.033652] ? __kernel_read+0xf5/0x160 [ 14.033654] ? __do_sys_finit_module+0xe9/0x110 [ 14.033655] __do_sys_finit_module+0xe9/0x110 [ 14.033657] do_syscall_64+0x33/0x80 [ 14.033659] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033660] RIP: 0033:0x7feacf1bef59 [ 14.033661] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48 [ 14.033662] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 14.033663] RAX: ffffffffffffffda RBX: 0000565489749410 RCX: 00007feacf1bef59 [ 14.033663] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI: 0000000000000015 [ 14.033664] RBP: 00007feacf0c3cad R08: 0000000000000000 R09: 0000000000000000 [ 14.033664] R10: 0000000000000015 R11: 0000000000000246 R12: 0000000000000000 [ 14.033665] R13: 00005654897472c0 R14: 0000000000020000 R15: 0000565489749410 [ 14.033666] ---[ end trace 16aeaa08847a13d9 ]--- [ 14.033667] ------------[ cut here ]------------ [ 14.033668] Bogus possible_crtcs: [ENCODER:73:TMDS-73] possible_crtcs=0xf (full crtc mask=0x7) [ 14.033690] WARNING: CPU: 0 PID: 282 at ../drivers/gpu/drm/drm_mode_config.c:622 drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033690] Modules linked in: amdgpu(E+) mfd_core(E) snd_hda_codec_realtek(E) kvm_amd(E) gpu_sched(E) i2c_algo_bit(E) ttm(E) snd_hda_codec_generic(E) kvm(E) ledtrig_audio(E) snd_hda_codec_hdmi(E) drm_kms_helper(E) snd_hda_intel(E) snd_intel_dspcfg(E) snd_hda_codec(E) cec(E) snd_hwdep(E) drm(E) irqbypass(E) snd_hda_core(E) crc32_pclmul(E) snd_pcm(E) ghash_clmulni_intel(E) snd_timer(E) sg(E) aesni_intel(E) snd(E) ccp(E) soundcore(E) rng_core(E) glue_helper(E) libaes(E) crypto_simd(E) k10temp(E) efi_pstore(E) sp5100_tco(E) evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E) acpi_cpufreq(E) w83627hf_wdt(E) watchdog(E) nct6775(E) hwmon_vid(E) efivarfs(E) ip_tables(E) x_tables(E) autofs4(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) sd_mod(E) t10_pi(E) crc_t10dif(E) crct10dif_generic(E) uas(E) usb_storage(E) ahci(E) libahci(E) xhci_pci(E) r8169(E) realtek(E) mdio_devres(E) xhci_hcd(E) libata(E) i2c_amd_mp2_pci(E) crct10dif_pclmul(E) crct10dif_common(E) scsi_mod(E) [ 14.033704] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033706] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G W E 5.9.0-rc3+ #2 [ 14.033707] Hardware name: Default string Default string/Default string, BIOS 5.0.1.4 02/14/2020 [ 14.033719] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033721] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b 54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d [ 14.033721] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033722] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX: 0000000000000027 [ 14.033723] RDX: 0000000000000000 RSI: 0000000000000086 RDI: ffff9c6910a18ac8 [ 14.033723] RBP: 0000000000000001 R08: 0000000000000064 R09: ffffffff9784a724 [ 14.033724] R10: 0000000000000001 R11: 0000000000000000 R12: ffff9c690bf7c000 [ 14.033724] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15: 000000000000003f [ 14.033725] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000) knlGS:0000000000000000 [ 14.033726] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033726] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4: 00000000003506f0 [ 14.033727] Call Trace: [ 14.033739] drm_dev_register+0x117/0x1e0 [drm] [ 14.033806] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033808] local_pci_probe+0x42/0x90 [ 14.033810] pci_device_probe+0x108/0x1c0 [ 14.033811] really_probe+0xef/0x4a0 [ 14.033813] driver_probe_device+0xde/0x150 [ 14.033814] device_driver_attach+0x4f/0x60 [ 14.033815] __driver_attach+0x9a/0x140 [ 14.033816] ? device_driver_attach+0x60/0x60 [ 14.033817] bus_for_each_dev+0x76/0xc0 [ 14.033818] ? klist_add_tail+0x3b/0x70 [ 14.033820] bus_add_driver+0x144/0x220 [ 14.033821] ? 0xffffffffc0949000 [ 14.033822] driver_register+0x5b/0xf0 [ 14.033823] ? 0xffffffffc0949000 [ 14.033824] do_one_initcall+0x46/0x1f4 [ 14.033825] ? _cond_resched+0x15/0x40 [ 14.033827] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033828] ? do_init_module+0x22/0x213 [ 14.033829] do_init_module+0x5b/0x213 [ 14.033831] load_module+0x258c/0x2d30 [ 14.033833] ? __kernel_read+0xf5/0x160 [ 14.033834] ? __do_sys_finit_module+0xe9/0x110 [ 14.033835] __do_sys_finit_module+0xe9/0x110 [ 14.033838] do_syscall_64+0x33/0x80 [ 14.033839] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033840] RIP: 0033:0x7feacf1bef59 [ 14.033841] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48 [ 14.033842] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 14.033843] RAX: ffffffffffffffda RBX: 0000565489749410 RCX: 00007feacf1bef59 [ 14.033843] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI: 0000000000000015 [ 14.033844] RBP: 00007feacf0c3cad R08: 0000000000000000 R09: 0000000000000000 [ 14.033844] R10: 0000000000000015 R11: 0000000000000246 R12: 0000000000000000 [ 14.033845] R13: 00005654897472c0 R14: 0000000000020000 R15: 0000565489749410 [ 14.033846] ---[ end trace 16aeaa08847a13da ]---
Probably the same issue as in
https://bugzilla.kernel.org/show_bug.cgi?id=209123. What does it practically mean? Can/should it be silenced in this setup?
Jan
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
Quoted 93 lines · Jan Kiszka
Quoted 81 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
Reviewed-by Daniel Vetter <[email protected]>I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-DanielQuoted 57 lines
--- drivers/gpu/drm/drm_mode_config.c | 27 ++++++++++++++++++++++++++- include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +26
-1@@ -581,6 +581,29 @@ static void validate_encoder_possible_clones(struct drm_encoder *encoder) encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) +{ +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +u32 crtc_mask =full_crtc_mask (encoder->dev); + +WARN ((encoder->possible_crtcs & crtc_mask) ==0 || + (encoder->possible_crtcs & ~crtc_mask) !=0 , +"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); +} +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct drm_device *dev)drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +0
-0@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * Quoted 9 lines
Quoted 8 lines
include/drm/drm_encoder.h +1
-2-* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices * are stable and hence known before registering all objects. -- 2.24.1
Quoted 1 line
Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
Adding amdgpu display folks.
-Daniel
Quoted 169 lines
[ 14.033246] ------------[ cut here ]------------ [ 14.033248] Bogus possible_crtcs: [ENCODER:65:TMDS-65] possible_crtcs=0xf (full crtc mask=0x7) [ 14.033279] WARNING: CPU: 0 PID: 282 at ../drivers/gpu/drm/drm_mode_config.c:622 drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033279] Modules linked in: amdgpu(E+) mfd_core(E) snd_hda_codec_realtek(E) kvm_amd(E) gpu_sched(E) i2c_algo_bit(E) ttm(E) snd_hda_codec_generic(E) kvm(E) ledtrig_audio(E) snd_hda_codec_hdmi(E) drm_kms_helper(E) snd_hda_intel(E) snd_intel_dspcfg(E) snd_hda_codec(E) cec(E) snd_hwdep(E) drm(E) irqbypass(E) snd_hda_core(E) crc32_pclmul(E) snd_pcm(E) ghash_clmulni_intel(E) snd_timer(E) sg(E) aesni_intel(E) snd(E) ccp(E) soundcore(E) rng_core(E) glue_helper(E) libaes(E) crypto_simd(E) k10temp(E) efi_pstore(E) sp5100_tco(E) evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E) acpi_cpufreq(E) w83627hf_wdt(E) watchdog(E) nct6775(E) hwmon_vid(E) efivarfs(E) ip_tables(E) x_tables(E) autofs4(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) sd_mod(E) t10_pi(E) crc_t10dif(E) crct10dif_generic(E) uas(E) usb_storage(E) ahci(E) libahci(E) xhci_pci(E) r8169(E) realtek(E) mdio_devres(E) xhci_hcd(E) libata(E) i2c_amd_mp2_pci(E) crct10dif_pclmul(E) crct10dif_common(E) scsi_mod(E) [ 14.033306] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033310] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G E 5.9.0-rc3+ #2 [ 14.033311] Hardware name: Default string Default string/Default string, BIOS 5.0.1.4 02/14/2020 [ 14.033324] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033327] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b 54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d [ 14.033328] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033329] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX: 0000000000000027 [ 14.033330] RDX: 0000000000000000 RSI: 0000000000000086 RDI: ffff9c6910a18ac8 [ 14.033331] RBP: 0000000000000001 R08: 0000000000000064 R09: ffffffff9784a724 [ 14.033331] R10: 0000000000000001 R11: 0000000000000000 R12: ffff9c690bf8b800 [ 14.033332] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15: 000000000000003f [ 14.033333] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000) knlGS:0000000000000000 [ 14.033334] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033335] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4: 00000000003506f0 [ 14.033335] Call Trace: [ 14.033350] drm_dev_register+0x117/0x1e0 [drm] [ 14.033423] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033428] local_pci_probe+0x42/0x90 [ 14.033430] pci_device_probe+0x108/0x1c0 [ 14.033433] really_probe+0xef/0x4a0 [ 14.033435] driver_probe_device+0xde/0x150 [ 14.033436] device_driver_attach+0x4f/0x60 [ 14.033438] __driver_attach+0x9a/0x140 [ 14.033439] ? device_driver_attach+0x60/0x60 [ 14.033441] bus_for_each_dev+0x76/0xc0 [ 14.033443] ? klist_add_tail+0x3b/0x70 [ 14.033445] bus_add_driver+0x144/0x220 [ 14.033446] ? 0xffffffffc0949000 [ 14.033447] driver_register+0x5b/0xf0 [ 14.033448] ? 0xffffffffc0949000 [ 14.033451] do_one_initcall+0x46/0x1f4 [ 14.033454] ? _cond_resched+0x15/0x40 [ 14.033456] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033459] ? do_init_module+0x22/0x213 [ 14.033460] do_init_module+0x5b/0x213 [ 14.033462] load_module+0x258c/0x2d30 [ 14.033465] ? __kernel_read+0xf5/0x160 [ 14.033467] ? __do_sys_finit_module+0xe9/0x110 [ 14.033468] __do_sys_finit_module+0xe9/0x110 [ 14.033471] do_syscall_64+0x33/0x80 [ 14.033473] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033474] RIP: 0033:0x7feacf1bef59 [ 14.033477] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48 [ 14.033477] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 14.033478] RAX: ffffffffffffffda RBX: 0000565489749410 RCX: 00007feacf1bef59 [ 14.033479] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI: 0000000000000015 [ 14.033479] RBP: 00007feacf0c3cad R08: 0000000000000000 R09: 0000000000000000 [ 14.033480] R10: 0000000000000015 R11: 0000000000000246 R12: 0000000000000000 [ 14.033480] R13: 00005654897472c0 R14: 0000000000020000 R15: 0000565489749410 [ 14.033482] ---[ end trace 16aeaa08847a13d8 ]--- [ 14.033483] ------------[ cut here ]------------ [ 14.033484] Bogus possible_crtcs: [ENCODER:69:TMDS-69] possible_crtcs=0xf (full crtc mask=0x7) [ 14.033507] WARNING: CPU: 0 PID: 282 at ../drivers/gpu/drm/drm_mode_config.c:622 drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033507] Modules linked in: amdgpu(E+) mfd_core(E) snd_hda_codec_realtek(E) kvm_amd(E) gpu_sched(E) i2c_algo_bit(E) ttm(E) snd_hda_codec_generic(E) kvm(E) ledtrig_audio(E) snd_hda_codec_hdmi(E) drm_kms_helper(E) snd_hda_intel(E) snd_intel_dspcfg(E) snd_hda_codec(E) cec(E) snd_hwdep(E) drm(E) irqbypass(E) snd_hda_core(E) crc32_pclmul(E) snd_pcm(E) ghash_clmulni_intel(E) snd_timer(E) sg(E) aesni_intel(E) snd(E) ccp(E) soundcore(E) rng_core(E) glue_helper(E) libaes(E) crypto_simd(E) k10temp(E) efi_pstore(E) sp5100_tco(E) evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E) acpi_cpufreq(E) w83627hf_wdt(E) watchdog(E) nct6775(E) hwmon_vid(E) efivarfs(E) ip_tables(E) x_tables(E) autofs4(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) sd_mod(E) t10_pi(E) crc_t10dif(E) crct10dif_generic(E) uas(E) usb_storage(E) ahci(E) libahci(E) xhci_pci(E) r8169(E) realtek(E) mdio_devres(E) xhci_hcd(E) libata(E) i2c_amd_mp2_pci(E) crct10dif_pclmul(E) crct10dif_common(E) scsi_mod(E) [ 14.033522] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033524] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G W E 5.9.0-rc3+ #2 [ 14.033525] Hardware name: Default string Default string/Default string, BIOS 5.0.1.4 02/14/2020 [ 14.033538] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033539] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b 54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d [ 14.033540] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033540] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX: 0000000000000027 [ 14.033541] RDX: 0000000000000000 RSI: 0000000000000086 RDI: ffff9c6910a18ac8 [ 14.033542] RBP: 0000000000000001 R08: 0000000000000064 R09: ffffffff9784a724 [ 14.033542] R10: 0000000000000001 R11: 0000000000000000 R12: ffff9c690bf89800 [ 14.033543] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15: 000000000000003f [ 14.033544] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000) knlGS:0000000000000000 [ 14.033544] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033545] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4: 00000000003506f0 [ 14.033545] Call Trace: [ 14.033557] drm_dev_register+0x117/0x1e0 [drm] [ 14.033625] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033627] local_pci_probe+0x42/0x90 [ 14.033629] pci_device_probe+0x108/0x1c0 [ 14.033630] really_probe+0xef/0x4a0 [ 14.033632] driver_probe_device+0xde/0x150 [ 14.033633] device_driver_attach+0x4f/0x60 [ 14.033634] __driver_attach+0x9a/0x140 [ 14.033635] ? device_driver_attach+0x60/0x60 [ 14.033636] bus_for_each_dev+0x76/0xc0 [ 14.033638] ? klist_add_tail+0x3b/0x70 [ 14.033639] bus_add_driver+0x144/0x220 [ 14.033640] ? 0xffffffffc0949000 [ 14.033641] driver_register+0x5b/0xf0 [ 14.033642] ? 0xffffffffc0949000 [ 14.033643] do_one_initcall+0x46/0x1f4 [ 14.033645] ? _cond_resched+0x15/0x40 [ 14.033646] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033648] ? do_init_module+0x22/0x213 [ 14.033649] do_init_module+0x5b/0x213 [ 14.033650] load_module+0x258c/0x2d30 [ 14.033652] ? __kernel_read+0xf5/0x160 [ 14.033654] ? __do_sys_finit_module+0xe9/0x110 [ 14.033655] __do_sys_finit_module+0xe9/0x110 [ 14.033657] do_syscall_64+0x33/0x80 [ 14.033659] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033660] RIP: 0033:0x7feacf1bef59 [ 14.033661] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48 [ 14.033662] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 14.033663] RAX: ffffffffffffffda RBX: 0000565489749410 RCX: 00007feacf1bef59 [ 14.033663] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI: 0000000000000015 [ 14.033664] RBP: 00007feacf0c3cad R08: 0000000000000000 R09: 0000000000000000 [ 14.033664] R10: 0000000000000015 R11: 0000000000000246 R12: 0000000000000000 [ 14.033665] R13: 00005654897472c0 R14: 0000000000020000 R15: 0000565489749410 [ 14.033666] ---[ end trace 16aeaa08847a13d9 ]--- [ 14.033667] ------------[ cut here ]------------ [ 14.033668] Bogus possible_crtcs: [ENCODER:73:TMDS-73] possible_crtcs=0xf (full crtc mask=0x7) [ 14.033690] WARNING: CPU: 0 PID: 282 at ../drivers/gpu/drm/drm_mode_config.c:622 drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033690] Modules linked in: amdgpu(E+) mfd_core(E) snd_hda_codec_realtek(E) kvm_amd(E) gpu_sched(E) i2c_algo_bit(E) ttm(E) snd_hda_codec_generic(E) kvm(E) ledtrig_audio(E) snd_hda_codec_hdmi(E) drm_kms_helper(E) snd_hda_intel(E) snd_intel_dspcfg(E) snd_hda_codec(E) cec(E) snd_hwdep(E) drm(E) irqbypass(E) snd_hda_core(E) crc32_pclmul(E) snd_pcm(E) ghash_clmulni_intel(E) snd_timer(E) sg(E) aesni_intel(E) snd(E) ccp(E) soundcore(E) rng_core(E) glue_helper(E) libaes(E) crypto_simd(E) k10temp(E) efi_pstore(E) sp5100_tco(E) evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E) acpi_cpufreq(E) w83627hf_wdt(E) watchdog(E) nct6775(E) hwmon_vid(E) efivarfs(E) ip_tables(E) x_tables(E) autofs4(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) sd_mod(E) t10_pi(E) crc_t10dif(E) crct10dif_generic(E) uas(E) usb_storage(E) ahci(E) libahci(E) xhci_pci(E) r8169(E) realtek(E) mdio_devres(E) xhci_hcd(E) libata(E) i2c_amd_mp2_pci(E) crct10dif_pclmul(E) crct10dif_common(E) scsi_mod(E) [ 14.033704] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033706] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G W E 5.9.0-rc3+ #2 [ 14.033707] Hardware name: Default string Default string/Default string, BIOS 5.0.1.4 02/14/2020 [ 14.033719] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033721] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b 54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d [ 14.033721] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033722] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX: 0000000000000027 [ 14.033723] RDX: 0000000000000000 RSI: 0000000000000086 RDI: ffff9c6910a18ac8 [ 14.033723] RBP: 0000000000000001 R08: 0000000000000064 R09: ffffffff9784a724 [ 14.033724] R10: 0000000000000001 R11: 0000000000000000 R12: ffff9c690bf7c000 [ 14.033724] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15: 000000000000003f [ 14.033725] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000) knlGS:0000000000000000 [ 14.033726] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033726] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4: 00000000003506f0 [ 14.033727] Call Trace: [ 14.033739] drm_dev_register+0x117/0x1e0 [drm] [ 14.033806] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033808] local_pci_probe+0x42/0x90 [ 14.033810] pci_device_probe+0x108/0x1c0 [ 14.033811] really_probe+0xef/0x4a0 [ 14.033813] driver_probe_device+0xde/0x150 [ 14.033814] device_driver_attach+0x4f/0x60 [ 14.033815] __driver_attach+0x9a/0x140 [ 14.033816] ? device_driver_attach+0x60/0x60 [ 14.033817] bus_for_each_dev+0x76/0xc0 [ 14.033818] ? klist_add_tail+0x3b/0x70 [ 14.033820] bus_add_driver+0x144/0x220 [ 14.033821] ? 0xffffffffc0949000 [ 14.033822] driver_register+0x5b/0xf0 [ 14.033823] ? 0xffffffffc0949000 [ 14.033824] do_one_initcall+0x46/0x1f4 [ 14.033825] ? _cond_resched+0x15/0x40 [ 14.033827] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033828] ? do_init_module+0x22/0x213 [ 14.033829] do_init_module+0x5b/0x213 [ 14.033831] load_module+0x258c/0x2d30 [ 14.033833] ? __kernel_read+0xf5/0x160 [ 14.033834] ? __do_sys_finit_module+0xe9/0x110 [ 14.033835] __do_sys_finit_module+0xe9/0x110 [ 14.033838] do_syscall_64+0x33/0x80 [ 14.033839] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033840] RIP: 0033:0x7feacf1bef59 [ 14.033841] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48 [ 14.033842] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 14.033843] RAX: ffffffffffffffda RBX: 0000565489749410 RCX: 00007feacf1bef59 [ 14.033843] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI: 0000000000000015 [ 14.033844] RBP: 00007feacf0c3cad R08: 0000000000000000 R09: 0000000000000000 [ 14.033844] R10: 0000000000000015 R11: 0000000000000246 R12: 0000000000000000 [ 14.033845] R13: 00005654897472c0 R14: 0000000000020000 R15: 0000565489749410 [ 14.033846] ---[ end trace 16aeaa08847a13da ]---Probably the same issue as in
https://bugzilla.kernel.org/show_bug.cgi?id=209123. What does it practically mean? Can/should it be silenced in this setup?Jan
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
maintainerRE: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
[AMD Public Use]
Quoted 107 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Daniel Vetter
Sent: Monday, September 7, 2020 3:15 AM
To: Jan Kiszka <[email protected]>; amd-gfx list <amd- [email protected]>; Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>
Cc: dri-devel <[email protected]>; intel-gfx <intel- [email protected]>; Thomas Zimmermann <[email protected]>; Ville Syrjala <[email protected]>
Subject: Re: [PATCH v3 6/7] drm: Validateencoder->possible_crtcsQuoted 21 lines · Jan Kiszka
Quoted 19 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
Quoted 7 lines
I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-DanielQuoted 2 lines
--- drivers/gpu/drm/drm_mode_config.c | 27++++++++++++++++++++++++++-
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_mode_config.c static void
Quoted 9 lines
include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +0
-0@@ -581,6 +581,29 @@ static void
validate_encoder_possible_clones(struct drm_encoder *encoder)Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_mode_config.c +16
-0encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) { +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder +*encoder) { +u32 crtc_mask =full_crtc_mask (encoder->dev); + + WARN((encoder->possible_crtcs & crtc_mask) == 0 || + (encoder->possible_crtcs & ~crtc_mask) != 0,Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c void drm_mode_config_validate(struct
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c +5
-0+"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); } +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct
drm_device*dev)Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_mode_config.c +3
-1drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +0
-0Quoted 8 lines
Quoted 8 lines
include/drm/drm_encoder.h struct drm_encoder { · line 147
Quoted 8 lines
include/drm/drm_encoder.h +1
-1@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * -* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
include/drm/drm_encoder.h +0
-1* are stable and hence known before registering all objects. --2.24.1
Quoted 3 lines
Quoted 1 line
Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
Adding amdgpu display folks.
I took a quick look at this and it looks like we limit the number of crtcs later in the mode init process if the number of physical displays can't actually use more crtcs. E.g., the physical board configuration would only allow for 3 active displays even if the hardware technically supports 4 crtcs. I presume that way we can just leave the additional hardware power gated all the time.
Alex
Quoted 298 lines
-Daniel
Quoted 3 lines
[ 14.033246] ------------[ cut here ]------------ [ 14.033248] Bogus possible_crtcs: [ENCODER:65:TMDS-65]possible_crtcs=0xf (full crtc mask=0x7)
Quoted 1 line
[ 14.033279] WARNING: CPU: 0 PID: 282 at
../drivers/gpu/drm/drm_mode_config.c:622drm_mode_config_validate+0x17d/0x200[drm]Quoted 1 line
[ 14.033279] Modules linked in: amdgpu(E+) mfd_core(E)
snd_hda_codec_realtek(E)kvm_amd(E)gpu_sched(E)i2c_algo_bit(E)ttm(E)snd_hda_codec_generic(E)kvm(E)ledtrig_audio(E)snd_hda_codec_hdmi(E)drm_kms_helper(E)snd_hda_intel(E)snd_intel_dspcfg(E)snd_hda_codec(E)cec(E)snd_hwdep(E)drm(E) irqbypass(E)snd_hda_core(E)crc32_pclmul(E)snd_pcm(E)ghash_clmulni_intel(E)snd_timer(E)sg(E)aesni_intel(E)snd(E) ccp(E) soundcore(E)rng_core(E)glue_helper(E)libaes(E)crypto_simd(E)k10temp(E)efi_pstore(E)sp5100_tco(E)evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E)acpi_cpufreq(E)w83627hf_wdt(E)watchdog(E) nct6775(E)hwmon_vid(E)efivarfs(E)ip_tables(E)x_tables(E)autofs4(E) ext4(E)crc32c_generic(E)crc16(E) mbcache(E) jbd2(E)sd_mod(E)t10_pi(E)crc_t10dif(E)crct10dif_generic(E)uas(E)usb_storage(E)ahci(E) libahci(E)xhci_pci(E)r8169(E) realtek(E)mdio_devres(E)xhci_hcd(E)libata(E)i2c_amd_mp2_pci(E)crct10dif_pclmul(E)crct10dif_common(E)scsi_mod(E)Quoted 2 lines
[ 14.033306] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033310] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G E5.9.0-rc3+ #2
Quoted 1 line
[ 14.033311] Hardware name: Default string Default string/Default string,BIOS 5.0.1.4 02/14/2020
Quoted 2 lines
[ 14.033324] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033327] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d
Quoted 2 lines
[ 14.033328] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033329] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX:0000000000000027
Quoted 1 line
[ 14.033330] RDX: 0000000000000000 RSI: 0000000000000086 RDI:
ffff9c6910a18ac8Quoted 1 line
[ 14.033331] RBP: 0000000000000001 R08: 0000000000000064 R09:
ffffffff9784a724Quoted 1 line
[ 14.033331] R10: 0000000000000001 R11: 0000000000000000 R12:
ffff9c690bf8b800Quoted 1 line
[ 14.033332] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15:
000000000000003fQuoted 1 line
[ 14.033333] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000)knlGS:0000000000000000
Quoted 2 lines
[ 14.033334] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033335] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4:
00000000003506f0Quoted 21 lines
[ 14.033335] Call Trace: [ 14.033350] drm_dev_register+0x117/0x1e0 [drm] [ 14.033423] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033428] local_pci_probe+0x42/0x90 [ 14.033430] pci_device_probe+0x108/0x1c0 [ 14.033433] really_probe+0xef/0x4a0 [ 14.033435] driver_probe_device+0xde/0x150 [ 14.033436] device_driver_attach+0x4f/0x60 [ 14.033438] __driver_attach+0x9a/0x140 [ 14.033439] ? device_driver_attach+0x60/0x60 [ 14.033441] bus_for_each_dev+0x76/0xc0 [ 14.033443] ? klist_add_tail+0x3b/0x70 [ 14.033445] bus_add_driver+0x144/0x220 [ 14.033446] ? 0xffffffffc0949000 [ 14.033447] driver_register+0x5b/0xf0 [ 14.033448] ? 0xffffffffc0949000 [ 14.033451] do_one_initcall+0x46/0x1f4 [ 14.033454] ? _cond_resched+0x15/0x40 [ 14.033456] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033459] ? do_init_module+0x22/0x213 [ 14.033460] do_init_module+0x5b/0x213Quoted 8 lines
[ 14.033462] load_module+0x258c/0x2d30 [ 14.033465] ? __kernel_read+0xf5/0x160 [ 14.033467] ? __do_sys_finit_module+0xe9/0x110 [ 14.033468] __do_sys_finit_module+0xe9/0x110 [ 14.033471] do_syscall_64+0x33/0x80 [ 14.033473] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033474] RIP: 0033:0x7feacf1bef59 [ 14.033477] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f848 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48
Quoted 1 line
[ 14.033477] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX:0000000000000139
Quoted 1 line
[ 14.033478] RAX: ffffffffffffffda RBX: 0000565489749410 RCX:
00007feacf1bef59Quoted 1 line
[ 14.033479] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI:0000000000000015
Quoted 1 line
[ 14.033479] RBP: 00007feacf0c3cad R08: 0000000000000000 R09:0000000000000000
Quoted 1 line
[ 14.033480] R10: 0000000000000015 R11: 0000000000000246 R12:0000000000000000
Quoted 1 line
[ 14.033480] R13: 00005654897472c0 R14: 0000000000020000 R15:0000565489749410
Quoted 3 lines
[ 14.033482] ---[ end trace 16aeaa08847a13d8 ]--- [ 14.033483] ------------[ cut here ]------------ [ 14.033484] Bogus possible_crtcs: [ENCODER:69:TMDS-69]possible_crtcs=0xf (full crtc mask=0x7)
Quoted 1 line
[ 14.033507] WARNING: CPU: 0 PID: 282 at
../drivers/gpu/drm/drm_mode_config.c:622drm_mode_config_validate+0x17d/0x200[drm]Quoted 1 line
[ 14.033507] Modules linked in: amdgpu(E+) mfd_core(E)
snd_hda_codec_realtek(E)kvm_amd(E)gpu_sched(E)i2c_algo_bit(E)ttm(E)snd_hda_codec_generic(E)kvm(E)ledtrig_audio(E)snd_hda_codec_hdmi(E)drm_kms_helper(E)snd_hda_intel(E)snd_intel_dspcfg(E)snd_hda_codec(E)cec(E)snd_hwdep(E)drm(E) irqbypass(E)snd_hda_core(E)crc32_pclmul(E)snd_pcm(E)ghash_clmulni_intel(E)snd_timer(E)sg(E)aesni_intel(E)snd(E) ccp(E) soundcore(E)rng_core(E)glue_helper(E)libaes(E)crypto_simd(E)k10temp(E)efi_pstore(E)sp5100_tco(E)evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E)acpi_cpufreq(E)w83627hf_wdt(E)watchdog(E) nct6775(E)hwmon_vid(E)efivarfs(E)ip_tables(E)x_tables(E)autofs4(E) ext4(E)crc32c_generic(E)crc16(E) mbcache(E) jbd2(E)sd_mod(E)t10_pi(E)crc_t10dif(E)crct10dif_generic(E)uas(E)usb_storage(E)ahci(E) libahci(E)xhci_pci(E)r8169(E) realtek(E)mdio_devres(E)xhci_hcd(E)libata(E)i2c_amd_mp2_pci(E)crct10dif_pclmul(E)crct10dif_common(E)scsi_mod(E)Quoted 2 lines
[ 14.033522] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033524] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G W E5.9.0-rc3+ #2
Quoted 1 line
[ 14.033525] Hardware name: Default string Default string/Default string,BIOS 5.0.1.4 02/14/2020
Quoted 2 lines
[ 14.033538] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033539] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d
Quoted 2 lines
[ 14.033540] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033540] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX:0000000000000027
Quoted 1 line
[ 14.033541] RDX: 0000000000000000 RSI: 0000000000000086 RDI:
ffff9c6910a18ac8Quoted 1 line
[ 14.033542] RBP: 0000000000000001 R08: 0000000000000064 R09:
ffffffff9784a724Quoted 1 line
[ 14.033542] R10: 0000000000000001 R11: 0000000000000000 R12:
ffff9c690bf89800Quoted 1 line
[ 14.033543] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15:
000000000000003fQuoted 1 line
[ 14.033544] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000)knlGS:0000000000000000
Quoted 2 lines
[ 14.033544] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033545] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4:
00000000003506f0Quoted 21 lines
[ 14.033545] Call Trace: [ 14.033557] drm_dev_register+0x117/0x1e0 [drm] [ 14.033625] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033627] local_pci_probe+0x42/0x90 [ 14.033629] pci_device_probe+0x108/0x1c0 [ 14.033630] really_probe+0xef/0x4a0 [ 14.033632] driver_probe_device+0xde/0x150 [ 14.033633] device_driver_attach+0x4f/0x60 [ 14.033634] __driver_attach+0x9a/0x140 [ 14.033635] ? device_driver_attach+0x60/0x60 [ 14.033636] bus_for_each_dev+0x76/0xc0 [ 14.033638] ? klist_add_tail+0x3b/0x70 [ 14.033639] bus_add_driver+0x144/0x220 [ 14.033640] ? 0xffffffffc0949000 [ 14.033641] driver_register+0x5b/0xf0 [ 14.033642] ? 0xffffffffc0949000 [ 14.033643] do_one_initcall+0x46/0x1f4 [ 14.033645] ? _cond_resched+0x15/0x40 [ 14.033646] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033648] ? do_init_module+0x22/0x213 [ 14.033649] do_init_module+0x5b/0x213Quoted 8 lines
[ 14.033650] load_module+0x258c/0x2d30 [ 14.033652] ? __kernel_read+0xf5/0x160 [ 14.033654] ? __do_sys_finit_module+0xe9/0x110 [ 14.033655] __do_sys_finit_module+0xe9/0x110 [ 14.033657] do_syscall_64+0x33/0x80 [ 14.033659] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033660] RIP: 0033:0x7feacf1bef59 [ 14.033661] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f848 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48
Quoted 1 line
[ 14.033662] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX:0000000000000139
Quoted 1 line
[ 14.033663] RAX: ffffffffffffffda RBX: 0000565489749410 RCX:
00007feacf1bef59Quoted 1 line
[ 14.033663] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI:0000000000000015
Quoted 1 line
[ 14.033664] RBP: 00007feacf0c3cad R08: 0000000000000000 R09:0000000000000000
Quoted 1 line
[ 14.033664] R10: 0000000000000015 R11: 0000000000000246 R12:0000000000000000
Quoted 1 line
[ 14.033665] R13: 00005654897472c0 R14: 0000000000020000 R15:0000565489749410
Quoted 3 lines
[ 14.033666] ---[ end trace 16aeaa08847a13d9 ]--- [ 14.033667] ------------[ cut here ]------------ [ 14.033668] Bogus possible_crtcs: [ENCODER:73:TMDS-73]possible_crtcs=0xf (full crtc mask=0x7)
Quoted 1 line
[ 14.033690] WARNING: CPU: 0 PID: 282 at
../drivers/gpu/drm/drm_mode_config.c:622drm_mode_config_validate+0x17d/0x200[drm]Quoted 1 line
[ 14.033690] Modules linked in: amdgpu(E+) mfd_core(E)
snd_hda_codec_realtek(E)kvm_amd(E)gpu_sched(E)i2c_algo_bit(E)ttm(E)snd_hda_codec_generic(E)kvm(E)ledtrig_audio(E)snd_hda_codec_hdmi(E)drm_kms_helper(E)snd_hda_intel(E)snd_intel_dspcfg(E)snd_hda_codec(E)cec(E)snd_hwdep(E)drm(E) irqbypass(E)snd_hda_core(E)crc32_pclmul(E)snd_pcm(E)ghash_clmulni_intel(E)snd_timer(E)sg(E)aesni_intel(E)snd(E) ccp(E) soundcore(E)rng_core(E)glue_helper(E)libaes(E)crypto_simd(E)k10temp(E)efi_pstore(E)sp5100_tco(E)evdev(E) cryptd(E) pcspkr(E) efivars(E) video(E) button(E)acpi_cpufreq(E)w83627hf_wdt(E)watchdog(E) nct6775(E)hwmon_vid(E)efivarfs(E)ip_tables(E)x_tables(E)autofs4(E) ext4(E)crc32c_generic(E)crc16(E) mbcache(E) jbd2(E)sd_mod(E)t10_pi(E)crc_t10dif(E)crct10dif_generic(E)uas(E)usb_storage(E)ahci(E) libahci(E)xhci_pci(E)r8169(E) realtek(E)mdio_devres(E)xhci_hcd(E)libata(E)i2c_amd_mp2_pci(E)crct10dif_pclmul(E)crct10dif_common(E)scsi_mod(E)Quoted 2 lines
[ 14.033704] crc32c_intel(E) i2c_piix4(E) usbcore(E) libphy(E) [ 14.033706] CPU: 0 PID: 282 Comm: systemd-udevd Tainted: G W E5.9.0-rc3+ #2
Quoted 1 line
[ 14.033707] Hardware name: Default string Default string/Default string,BIOS 5.0.1.4 02/14/2020
Quoted 2 lines
[ 14.033719] RIP: 0010:drm_mode_config_validate+0x17d/0x200 [drm] [ 14.033721] Code: 42 f0 75 e6 41 85 f8 74 09 44 89 c0 f7 d0 85 f8 74 1a 49 8b54 24 38 41 8b 74 24 18 89 f9 48 c7 c7 80 7d 70 c0 e8 13 66 9a d5 <0f> 0b 49 8b 44 24 08 49 39 c5 4c 8d 60 f8 0f 85 e9 fe ff ff 5b 5d
Quoted 2 lines
[ 14.033721] RSP: 0018:ffffae5f404b7a90 EFLAGS: 00010282 [ 14.033722] RAX: 0000000000000000 RBX: ffff9c6907bd0ad0 RCX:0000000000000027
Quoted 1 line
[ 14.033723] RDX: 0000000000000000 RSI: 0000000000000086 RDI:
ffff9c6910a18ac8Quoted 1 line
[ 14.033723] RBP: 0000000000000001 R08: 0000000000000064 R09:
ffffffff9784a724Quoted 1 line
[ 14.033724] R10: 0000000000000001 R11: 0000000000000000 R12:
ffff9c690bf7c000Quoted 1 line
[ 14.033724] R13: ffff9c6907bd0ad8 R14: ffff9c6907bd0ad8 R15:
000000000000003fQuoted 1 line
[ 14.033725] FS: 00007feace9d4d40(0000) GS:ffff9c6910a00000(0000)knlGS:0000000000000000
Quoted 2 lines
[ 14.033726] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 14.033726] CR2: 0000557a37b7e270 CR3: 000000038d5fa000 CR4:
00000000003506f0Quoted 21 lines
[ 14.033727] Call Trace: [ 14.033739] drm_dev_register+0x117/0x1e0 [drm] [ 14.033806] amdgpu_pci_probe+0x134/0x200 [amdgpu] [ 14.033808] local_pci_probe+0x42/0x90 [ 14.033810] pci_device_probe+0x108/0x1c0 [ 14.033811] really_probe+0xef/0x4a0 [ 14.033813] driver_probe_device+0xde/0x150 [ 14.033814] device_driver_attach+0x4f/0x60 [ 14.033815] __driver_attach+0x9a/0x140 [ 14.033816] ? device_driver_attach+0x60/0x60 [ 14.033817] bus_for_each_dev+0x76/0xc0 [ 14.033818] ? klist_add_tail+0x3b/0x70 [ 14.033820] bus_add_driver+0x144/0x220 [ 14.033821] ? 0xffffffffc0949000 [ 14.033822] driver_register+0x5b/0xf0 [ 14.033823] ? 0xffffffffc0949000 [ 14.033824] do_one_initcall+0x46/0x1f4 [ 14.033825] ? _cond_resched+0x15/0x40 [ 14.033827] ? kmem_cache_alloc_trace+0x40/0x440 [ 14.033828] ? do_init_module+0x22/0x213 [ 14.033829] do_init_module+0x5b/0x213Quoted 8 lines
[ 14.033831] load_module+0x258c/0x2d30 [ 14.033833] ? __kernel_read+0xf5/0x160 [ 14.033834] ? __do_sys_finit_module+0xe9/0x110 [ 14.033835] __do_sys_finit_module+0xe9/0x110 [ 14.033838] do_syscall_64+0x33/0x80 [ 14.033839] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 14.033840] RIP: 0033:0x7feacf1bef59 [ 14.033841] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f848 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 07 6f 0c 00 f7 d8 64 89 01 48
Quoted 1 line
[ 14.033842] RSP: 002b:00007ffd03534438 EFLAGS: 00000246 ORIG_RAX:0000000000000139
Quoted 1 line
[ 14.033843] RAX: ffffffffffffffda RBX: 0000565489749410 RCX:
00007feacf1bef59Quoted 1 line
[ 14.033843] RDX: 0000000000000000 RSI: 00007feacf0c3cad RDI:0000000000000015
Quoted 1 line
[ 14.033844] RBP: 00007feacf0c3cad R08: 0000000000000000 R09:0000000000000000
Quoted 1 line
[ 14.033844] R10: 0000000000000015 R11: 0000000000000246 R12:0000000000000000
Quoted 1 line
[ 14.033845] R13: 00005654897472c0 R14: 0000000000020000 R15:0000565489749410
Quoted 4 lines
[ 14.033846] ---[ end trace 16aeaa08847a13da ]---Probably the same issue as in
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugz
Quoted 1 line
illa.kernel.org%2Fshow_bug.cgi%3Fid%3D209123&data=02%7C01%7Cal exander.deucher%40amd.com%7C28e5e2e1aecd417e7dd608d852fdc391%7C 3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637350597170905726&a mp;sdata=z9smK6qFP6akCsGs4ToJNigPHke7SUfnb3i2F72u7S0%3D&res erved=0. What does it practically mean? Can/should it be silenced in this setup?
Quoted 2 lines
Jan
--
Daniel Vetter
Software Engineer, Intel Corporation
https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fblog.f
fwll.ch%2F&data=02%7C01%7Calexander.deucher%40amd.com%7C28e 5e2e1aecd417e7dd608d852fdc391%7C3dd8961fe4884e608e11a82d994e183d %7C0%7C0%7C637350597170905726&sdata=6fPvyO%2FFxcf7mu4j4l%2B OlwMe3BsaKY3zulTE3F%2BfeIw%3D&reserved=0
_______________________________________________
Quoted 8 lines
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
freedesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C28e5e2e1a ecd417e7dd608d852fdc391%7C3dd8961fe4884e608e11a82d994e183d%7C0% 7C0%7C637350597170905726&sdata=%2FV0U72P9e8Vu8NWON7lJdx7k3 TtMm9TjBz3D%2B7NtvOo%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
Quoted 111 lines · Alexander
[AMD Public Use]
Quoted 107 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Daniel Vetter
Sent: Monday, September 7, 2020 3:15 AM
To: Jan Kiszka <[email protected]>; amd-gfx list <amd- [email protected]>; Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>
Cc: dri-devel <[email protected]>; intel-gfx <intel- [email protected]>; Thomas Zimmermann <[email protected]>; Ville Syrjala <[email protected]>
Subject: Re: [PATCH v3 6/7] drm: Validateencoder->possible_crtcsQuoted 21 lines · Jan Kiszka
Quoted 19 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
Quoted 7 lines
I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-DanielQuoted 2 lines
--- drivers/gpu/drm/drm_mode_config.c | 27++++++++++++++++++++++++++-
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_mode_config.c static void
Quoted 9 lines
include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +0
-0@@ -581,6 +581,29 @@ static void
validate_encoder_possible_clones(struct drm_encoder *encoder)Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_mode_config.c +16
-0encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) { +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder +*encoder) { +u32 crtc_mask =full_crtc_mask (encoder->dev); + + WARN((encoder->possible_crtcs & crtc_mask) == 0 || + (encoder->possible_crtcs & ~crtc_mask) != 0,Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c void drm_mode_config_validate(struct
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c +5
-0+"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); } +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct
drm_device*dev)Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_mode_config.c +3
-1drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +0
-0Quoted 8 lines
Quoted 8 lines
include/drm/drm_encoder.h struct drm_encoder { · line 147
Quoted 8 lines
include/drm/drm_encoder.h +1
-1@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * -* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
include/drm/drm_encoder.h +0
-1* are stable and hence known before registering all objects. --2.24.1
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
Adding amdgpu display folks.
I took a quick look at this and it looks like we limit the number of crtcs later in the mode init process if the number of physical displays can't actually use more crtcs. E.g., the physical board configuration would only allow for 3 active displays even if the hardware technically supports 4 crtcs. I presume that way we can just leave the additional hardware power gated all the time.
So, will this be fixed any time soon? I don't feel qualified writing such a patch but I would obviously be happy to test one.
Jan
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
Quoted 115 lines · Jan Kiszka
Quoted 113 lines · Alexander
[AMD Public Use]
Quoted 109 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Daniel Vetter
Sent: Monday, September 7, 2020 3:15 AM
To: Jan Kiszka <[email protected]>; amd-gfx list <amd- [email protected]>; Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>
Cc: dri-devel <[email protected]>; intel-gfx <intel- [email protected]>; Thomas Zimmermann <[email protected]>; Ville Syrjala <[email protected]>
Subject: Re: [PATCH v3 6/7] drm: Validateencoder->possible_crtcsQuoted 21 lines · Jan Kiszka
Quoted 19 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
Quoted 7 lines
I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-DanielQuoted 2 lines
--- drivers/gpu/drm/drm_mode_config.c | 27++++++++++++++++++++++++++-
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_mode_config.c static void
Quoted 9 lines
include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +0
-0@@ -581,6 +581,29 @@ static void
validate_encoder_possible_clones(struct drm_encoder *encoder)Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_mode_config.c +16
-0encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) { +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder +*encoder) { +u32 crtc_mask =full_crtc_mask (encoder->dev); + + WARN((encoder->possible_crtcs & crtc_mask) == 0 || + (encoder->possible_crtcs & ~crtc_mask) != 0,Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c void drm_mode_config_validate(struct
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c +5
-0+"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); } +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct
drm_device*dev)Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_mode_config.c +3
-1drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +0
-0Quoted 8 lines
Quoted 8 lines
include/drm/drm_encoder.h struct drm_encoder { · line 147
Quoted 8 lines
include/drm/drm_encoder.h +1
-1@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * -* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
include/drm/drm_encoder.h +0
-1* are stable and hence known before registering all objects. --2.24.1
Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Adding amdgpu display folks.
I took a quick look at this and it looks like we limit the number of crtcs later in the mode init process if the number of physical displays can't actually use more crtcs. E.g., the physical board configuration would only allow for 3 active displays even if the hardware technically supports 4 crtcs. I presume that way we can just leave the additional hardware power gated all the time.
So, will this be fixed any time soon? I don't feel qualified writing such a patch but I would obviously be happy to test one.
It's harmless, but I'll send out a patch soon.
Alex
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
Quoted 119 lines · Alex Deucher
Quoted 117 lines · Jan Kiszka
Quoted 115 lines · Alexander
[AMD Public Use]
Quoted 110 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Daniel Vetter
Sent: Monday, September 7, 2020 3:15 AM
To: Jan Kiszka <[email protected]>; amd-gfx list <amd- [email protected]>; Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>
Cc: dri-devel <[email protected]>; intel-gfx <intel- [email protected]>; Thomas Zimmermann <[email protected]>; Ville Syrjala <[email protected]>
Subject: Re: [PATCH v3 6/7] drm: Validateencoder->possible_crtcsQuoted 21 lines · Jan Kiszka
Quoted 19 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
Quoted 7 lines
I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-DanielQuoted 2 lines
--- drivers/gpu/drm/drm_mode_config.c | 27++++++++++++++++++++++++++-
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_mode_config.c static void
Quoted 9 lines
include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +0
-0@@ -581,6 +581,29 @@ static void
validate_encoder_possible_clones(struct drm_encoder *encoder)Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_mode_config.c +16
-0encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) { +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder +*encoder) { +u32 crtc_mask =full_crtc_mask (encoder->dev); + + WARN((encoder->possible_crtcs & crtc_mask) == 0 || + (encoder->possible_crtcs & ~crtc_mask) != 0,Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c void drm_mode_config_validate(struct
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c +5
-0+"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); } +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct
drm_device*dev)Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_mode_config.c +3
-1drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +0
-0Quoted 8 lines
Quoted 8 lines
include/drm/drm_encoder.h struct drm_encoder { · line 147
Quoted 8 lines
include/drm/drm_encoder.h +1
-1@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * -* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
include/drm/drm_encoder.h +0
-1* are stable and hence known before registering all objects. --2.24.1
Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
Adding amdgpu display folks.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I took a quick look at this and it looks like we limit the number of crtcs later in the mode init process if the number of physical displays can't actually use more crtcs. E.g., the physical board configuration would only allow for 3 active displays even if the hardware technically supports 4 crtcs. I presume that way we can just leave the additional hardware power gated all the time.
So, will this be fixed any time soon? I don't feel qualified writing such a patch but I would obviously be happy to test one.
It's harmless, but I'll send out a patch soon.
I believe the attached patch should fix this.
Alex
From 441d23a9700ce2d03d8d89686a95a9a6500d866d Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Thu, 3 Dec 2020 16:06:26 -0500
Subject: [PATCH] drm/amdgpu/disply: set num_crtc earlier
To avoid a recently added warning:
Bogus possible_crtcs: [ENCODER:65:TMDS-65] possible_crtcs=0xf (full crtc mask=0x7)
WARNING: CPU: 3 PID: 439 at drivers/gpu/drm/drm_mode_config.c:617 drm_mode_config_validate+0x178/0x200 [drm]
In this case the warning is harmless, but confusing to users.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -5
@@ -1130,9 +1130,6 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) goto error; } -/* Update the actual used number of crtc */ - adev->mode_info.num_crtc = adev->dm.display_indexes_num; -/* create fake encoders for MST */ dm_dp_create_fake_mst_encoders (adev);
@@ -3364,6 +3361,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)enum dc_connection_type new_connection_type = dc_connection_none;const struct dc_plane_cap *plane; + dm->display_indexes_num = dm->dc->caps.max_streams; +/* Update the actual used number of crtc */ + adev->mode_info.num_crtc = adev->dm.display_indexes_num; + link_cnt = dm->dc->caps.max_links;if (amdgpu_dm_mode_config_init (dm->adev)) {DRM_ERROR ("DM: Failed to initialize mode config\n" );
@@ -3425,8 +3426,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) goto fail; } - dm->display_indexes_num = dm->dc->caps.max_streams; -/* loops over all connectors on the board */ for (i =0 ; i < link_cnt; i++) {struct dc_link *link =NULL ;
Signature · 1 line
2.25.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
Quoted 124 lines · Alex Deucher
Quoted 122 lines · Alex Deucher
Quoted 120 lines · Jan Kiszka
Quoted 117 lines · Alexander
[AMD Public Use]
Quoted 107 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Daniel Vetter
Sent: Monday, September 7, 2020 3:15 AM
To: Jan Kiszka <[email protected]>; amd-gfx list <amd- [email protected]>; Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>
Cc: dri-devel <[email protected]>; intel-gfx <intel- [email protected]>; Thomas Zimmermann <[email protected]>; Ville Syrjala <[email protected]>
Subject: Re: [PATCH v3 6/7] drm: Validateencoder->possible_crtcsQuoted 21 lines · Jan Kiszka
Quoted 19 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
Quoted 7 lines
I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-DanielQuoted 2 lines
--- drivers/gpu/drm/drm_mode_config.c | 27++++++++++++++++++++++++++-
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_mode_config.c static void
Quoted 9 lines
include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +0
-0@@ -581,6 +581,29 @@ static void
validate_encoder_possible_clones(struct drm_encoder *encoder)Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_mode_config.c +16
-0encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) { +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder +*encoder) { +u32 crtc_mask =full_crtc_mask (encoder->dev); + + WARN((encoder->possible_crtcs & crtc_mask) == 0 || + (encoder->possible_crtcs & ~crtc_mask) != 0,Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c void drm_mode_config_validate(struct
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c +5
-0+"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); } +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct
drm_device*dev)Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_mode_config.c +3
-1drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +0
-0Quoted 8 lines
Quoted 8 lines
include/drm/drm_encoder.h struct drm_encoder { · line 147
Quoted 8 lines
include/drm/drm_encoder.h +1
-1@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * -* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
include/drm/drm_encoder.h +0
-1* are stable and hence known before registering all objects. --2.24.1
Quoted 3 lines
Quoted 1 line
Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
Adding amdgpu display folks.
I took a quick look at this and it looks like we limit the number of crtcs later in the mode init process if the number of physical displays can't actually use more crtcs. E.g., the physical board configuration would only allow for 3 active displays even if the hardware technically supports 4 crtcs. I presume that way we can just leave the additional hardware power gated all the time.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
So, will this be fixed any time soon? I don't feel qualified writing such a patch but I would obviously be happy to test one.
It's harmless, but I'll send out a patch soon.
I believe the attached patch should fix this.
fwiw rb: me
Probably want to add the right Fixes: line too.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH v3 6/7] drm: Validate encoder->possible_crtcs
In reply to Alex DeucherQuoted 123 lines · Alex Deucher
Quoted 122 lines · Alex Deucher
Quoted 120 lines · Jan Kiszka
Quoted 117 lines · Alexander
[AMD Public Use]
Quoted 107 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Daniel Vetter
Sent: Monday, September 7, 2020 3:15 AM
To: Jan Kiszka <[email protected]>; amd-gfx list <amd- [email protected]>; Wentland, Harry <[email protected]>; Kazlauskas, Nicholas <[email protected]>
Cc: dri-devel <[email protected]>; intel-gfx <intel- [email protected]>; Thomas Zimmermann <[email protected]>; Ville Syrjala <[email protected]>
Subject: Re: [PATCH v3 6/7] drm: Validateencoder->possible_crtcsQuoted 21 lines · Jan Kiszka
Quoted 19 lines · Daniel Vetter
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
WARN if the encoder
possible_crtcsis effectively empty or contains bits for non-existing crtcs.Quoted 7 lines
v2: Move to
drm_mode_config_validate()(Daniel)
Make the docs say we WARN when this is wrong (Daniel) Extractfull_crtc_mask()Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>When pushing the fixup needs to be applied before the validation patch here, because we don't want to anger the bisect gods.
Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
Quoted 7 lines
I think with the fixup we should be good enough with the existing nonsense in drivers. Fingers crossed.
-DanielQuoted 2 lines
--- drivers/gpu/drm/drm_mode_config.c | 27++++++++++++++++++++++++++-
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_mode_config.c static void
Quoted 9 lines
include/drm/drm_encoder.h | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_mode_config.c +0
-0@@ -581,6 +581,29 @@ static void
validate_encoder_possible_clones(struct drm_encoder *encoder)Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/drm_mode_config.c +16
-0encoder->possible_clones, encoder_mask); } +static u32 full_crtc_mask (struct drm_device *dev) { +struct drm_crtc *crtc; +u32 crtc_mask =0 ; + +drm_for_each_crtc (crtc, dev) + crtc_mask |=drm_crtc_mask (crtc); + +return crtc_mask; +} + +static void validate_encoder_possible_crtcs (struct drm_encoder +*encoder) { +u32 crtc_mask =full_crtc_mask (encoder->dev); + + WARN((encoder->possible_crtcs & crtc_mask) == 0 || + (encoder->possible_crtcs & ~crtc_mask) != 0,Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c void drm_mode_config_validate(struct
Quoted 8 lines
drivers/gpu/drm/drm_mode_config.c +5
-0+"Bogus possible_crtcs: " +"[ENCODER:%d:%s] possible_crtcs=0x%x (full crtc mask=0x%x)\n" , + encoder->base.id, encoder->name, + encoder->possible_crtcs, crtc_mask); } +void drm_mode_config_validate (struct drm_device *dev) {struct drm_encoder *encoder;@@ -588,6 +611,8 @@ void drm_mode_config_validate(struct
drm_device*dev)Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/drm_mode_config.c +3
-1drm_for_each_encoder (encoder, dev)fixup_encoder_possible_clones (encoder); -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder); +validate_encoder_possible_crtcs (encoder); + } }include/drm/drm_encoder.h +0
-0Quoted 8 lines
Quoted 8 lines
include/drm/drm_encoder.h struct drm_encoder { · line 147
Quoted 8 lines
include/drm/drm_encoder.h +1
-1@@ -142,7 +142,7 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * -* In reality almost every driver gets this wrong. +* You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
include/drm/drm_encoder.h +0
-1* are stable and hence known before registering all objects. --2.24.1
Quoted 3 lines
Quoted 1 line
Triggers on an Advantech AIMB-228 (R1505G, 3 DP outputs):
Adding amdgpu display folks.
I took a quick look at this and it looks like we limit the number of crtcs later in the mode init process if the number of physical displays can't actually use more crtcs. E.g., the physical board configuration would only allow for 3 active displays even if the hardware technically supports 4 crtcs. I presume that way we can just leave the additional hardware power gated all the time.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
So, will this be fixed any time soon? I don't feel qualified writing such a patch but I would obviously be happy to test one.
It's harmless, but I'll send out a patch soon.
I believe the attached patch should fix this.
Yep, just booted 5.10, and the warning is gone.
Thanks,
Jan
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 7/7 drm: Allow drivers to leave encoder->possible_crtcs==0
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Let's simplify life of driver by allowing them to leave encoder->possible_crtcs unset if they have no restrictions in crtc<->encoder linkage. We'll just populate possible_crtcs with the full crtc mask when registering the encoder so that userspace doesn't have to deal with drivers not populating this correctly.
---
We might not actually need/want this, but included it here for future reference if that assumption turns out to be wrong.
--- drivers/gpu/drm/drm_mode_config.c | 15 ++++++++++++++- include/drm/drm_encoder.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_mode_config.c +14 -1
@@ -592,6 +592,17 @@ static u32 full_crtc_mask(struct drm_device *dev)return crtc_mask; } +/* +* Make life easy for drivers by allowing them to leave +* possible_crtcs unset if there are not crtc<->encoder +* restrictions. +*/ +static void fixup_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +if (encoder->possible_crtcs ==0 ) + encoder->possible_crtcs =full_crtc_mask (encoder->dev); +} +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) {u32 crtc_mask =full_crtc_mask (encoder->dev);
@@ -608,8 +619,10 @@ void drm_mode_config_validate(struct drm_device *dev) {struct drm_encoder *encoder; -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {fixup_encoder_possible_clones (encoder); +fixup_encoder_possible_crtcs (encoder); + }drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder);
include/drm/drm_encoder.h +4 -0
@@ -142,6 +142,10 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * +* As an exception to the above rule if any crtc can be connected to +* the encoder the driver can leave @possible_crtcs set to 0. The core +* will automagically fix this up by setting the bit for every crtc. +* * You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 7/7] drm: Allow drivers to leave encoder->possible_crtcs==0
Quoted 9 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's simplify life of driver by allowing them to leave
encoder->possible_crtcsunset if they have no restrictions in crtc<->encoder linkage. We'll just populatepossible_crtcswith the full crtc mask when registering the encoder so that userspace doesn't have to deal with drivers not populating this correctly.
Quoted 6 lines
Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>---
We might not actually need/want this, but included it here for future reference if that assumption turns out to be wrong.
I think this one is most definitely needed. _Lots_ of drivers get this toally wrong and just leave the value blank. It's encoded as official fallback in most userspace compositors.
Quoted 57 lines
--- drivers/gpu/drm/drm_mode_config.c | 15 ++++++++++++++- include/drm/drm_encoder.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_mode_config.c +14
-1@@ -592,6 +592,17 @@ static u32 full_crtc_mask(struct drm_device *dev)return crtc_mask; } +/* +* Make life easy for drivers by allowing them to leave +* possible_crtcs unset if there are not crtc<->encoder +* restrictions. +*/ +static void fixup_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +if (encoder->possible_crtcs ==0 ) + encoder->possible_crtcs =full_crtc_mask (encoder->dev); +} +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) {u32 crtc_mask =full_crtc_mask (encoder->dev);@@ -608,8 +619,10 @@ void drm_mode_config_validate(struct drm_device *dev) {struct drm_encoder *encoder; -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {fixup_encoder_possible_clones (encoder); +fixup_encoder_possible_crtcs (encoder); + }drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder);include/drm/drm_encoder.h +4
-0@@ -142,6 +142,10 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * +* As an exception to the above rule if any crtc can be connected to +* the encoder the driver can leave @possible_crtcs set to 0. The core +* will automagically fix this up by setting the bit for every crtc. +* * You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices Signature · 1 line
2.24.1
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 7/7] drm: Allow drivers to leave encoder->possible_crtcs==0
Quoted 17 lines · Daniel Vetter
Quoted 9 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's simplify life of driver by allowing them to leave
encoder->possible_crtcsunset if they have no restrictions in crtc<->encoder linkage. We'll just populatepossible_crtcswith the full crtc mask when registering the encoder so that userspace doesn't have to deal with drivers not populating this correctly.Quoted 6 lines
Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>---
We might not actually need/want this, but included it here for future reference if that assumption turns out to be wrong.
Quoted 3 lines
I think this one is most definitely needed. _Lots_ of drivers get this toally wrong and just leave the value blank. It's encoded as official fallback in most userspace compositors.
OK. It's been a while since I dug around so can't really remmber how this was being handled. I'll reorder before pushing.
Quoted 65 lines
Reviewed-by Daniel Vetter <[email protected]>Quoted 57 lines
--- drivers/gpu/drm/drm_mode_config.c | 15 ++++++++++++++- include/drm/drm_encoder.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_mode_config.c +14
-1@@ -592,6 +592,17 @@ static u32 full_crtc_mask(struct drm_device *dev)return crtc_mask; } +/* +* Make life easy for drivers by allowing them to leave +* possible_crtcs unset if there are not crtc<->encoder +* restrictions. +*/ +static void fixup_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +if (encoder->possible_crtcs ==0 ) + encoder->possible_crtcs =full_crtc_mask (encoder->dev); +} +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) {u32 crtc_mask =full_crtc_mask (encoder->dev);@@ -608,8 +619,10 @@ void drm_mode_config_validate(struct drm_device *dev) {struct drm_encoder *encoder; -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {fixup_encoder_possible_clones (encoder); +fixup_encoder_possible_crtcs (encoder); + }drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder);include/drm/drm_encoder.h +4
-0@@ -142,6 +142,10 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * +* As an exception to the above rule if any crtc can be connected to +* the encoder the driver can leave @possible_crtcs set to 0. The core +* will automagically fix this up by setting the bit for every crtc. +* * You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices Signature · 1 line
2.24.1Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v3 7/7] drm: Allow drivers to leave encoder->possible_crtcs==0
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Daniel Vetter
Quoted 15 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's simplify life of driver by allowing them to leave
encoder->possible_crtcsunset if they have no restrictions in crtc<->encoder linkage. We'll just populatepossible_crtcswith the full crtc mask when registering the encoder so that userspace doesn't have to deal with drivers not populating this correctly.Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>---
We might not actually need/want this, but included it here for future reference if that assumption turns out to be wrong.
Quoted 6 lines
Quoted 3 lines
I think this one is most definitely needed. _Lots_ of drivers get this toally wrong and just leave the value blank. It's encoded as official fallback in most userspace compositors.
OK. It's been a while since I dug around so can't really remmber how this was being handled. I'll reorder before pushing.
Hm otoh having "works with all crtcs" as default is a bit dangerous, whereas the "cannot be cloned" default for possible_clones is perfectly safe.
So now I'm kinda not sure whether this is a bright idea, and we shouldn't just eat the cost of fixing up all the various WARNING backtraces your previous patch triggers. I've done a full review and the following look suspect:
- tegara/sor.c Strangely it's the only one, the other output drivers do seem to set the possible_crtcs mask to something useful.
Everything else seems to be fine. I'd say let's drop this patch, and I'm adding Thierry to shed some light on what's going on in tegra/sor.c. -Daniel
Quoted 70 lines
Quoted 66 lines
Reviewed-by Daniel Vetter <[email protected]>Quoted 57 lines
--- drivers/gpu/drm/drm_mode_config.c | 15 ++++++++++++++- include/drm/drm_encoder.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_mode_config.c +14
-1@@ -592,6 +592,17 @@ static u32 full_crtc_mask(struct drm_device *dev)return crtc_mask; } +/* +* Make life easy for drivers by allowing them to leave +* possible_crtcs unset if there are not crtc<->encoder +* restrictions. +*/ +static void fixup_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +if (encoder->possible_crtcs ==0 ) + encoder->possible_crtcs =full_crtc_mask (encoder->dev); +} +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) {u32 crtc_mask =full_crtc_mask (encoder->dev);@@ -608,8 +619,10 @@ void drm_mode_config_validate(struct drm_device *dev) {struct drm_encoder *encoder; -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {fixup_encoder_possible_clones (encoder); +fixup_encoder_possible_crtcs (encoder); + }drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder);include/drm/drm_encoder.h +4
-0@@ -142,6 +142,10 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * +* As an exception to the above rule if any crtc can be connected to +* the encoder the driver can leave @possible_crtcs set to 0. The core +* will automagically fix this up by setting the bit for every crtc. +* * You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices Signature · 1 line
2.24.1Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.chSignature · 2 lines
Ville Syrjälä Intel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 7/7] drm: Allow drivers to leave encoder->possible_crtcs==0
Quoted 30 lines · Daniel Vetter
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Daniel Vetter
Quoted 15 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's simplify life of driver by allowing them to leave
encoder->possible_crtcsunset if they have no restrictions in crtc<->encoder linkage. We'll just populatepossible_crtcswith the full crtc mask when registering the encoder so that userspace doesn't have to deal with drivers not populating this correctly.Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>---
We might not actually need/want this, but included it here for future reference if that assumption turns out to be wrong.Quoted 6 lines
Quoted 3 lines
I think this one is most definitely needed. _Lots_ of drivers get this toally wrong and just leave the value blank. It's encoded as official fallback in most userspace compositors.
OK. It's been a while since I dug around so can't really remmber how this was being handled. I'll reorder before pushing.
Hm otoh having "works with all crtcs" as default is a bit dangerous, whereas the "cannot be cloned" default for
possible_clonesis perfectly safe.
Quoted 7 lines
So now I'm kinda not sure whether this is a bright idea, and we shouldn't just eat the cost of fixing up all the various WARNING backtraces your previous patch triggers. I've done a full review and the following look suspect:
-
tegara/sor.cStrangely it's the only one, the other output drivers do seem to set thepossible_crtcsmask to something useful.
Strike that, it sets it using tegra_output_find_possible_crtcs().
I think everything is good and we really don't need this patch here to fix up possible_crtcs.
-Daniel
Quoted 80 lines
Everything else seems to be fine. I'd say let's drop this patch, and I'm adding Thierry to shed some light on what's going on in
tegra/sor.c. -DanielQuoted 70 lines
Quoted 66 lines
Reviewed-by Daniel Vetter <[email protected]>Quoted 57 lines
--- drivers/gpu/drm/drm_mode_config.c | 15 ++++++++++++++- include/drm/drm_encoder.h | 4 ++++ 2 files changed, 18 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_mode_config.c +14
-1@@ -592,6 +592,17 @@ static u32 full_crtc_mask(struct drm_device *dev)return crtc_mask; } +/* +* Make life easy for drivers by allowing them to leave +* possible_crtcs unset if there are not crtc<->encoder +* restrictions. +*/ +static void fixup_encoder_possible_crtcs (struct drm_encoder *encoder) +{ +if (encoder->possible_crtcs ==0 ) + encoder->possible_crtcs =full_crtc_mask (encoder->dev); +} +static void validate_encoder_possible_crtcs (struct drm_encoder *encoder) {u32 crtc_mask =full_crtc_mask (encoder->dev);@@ -608,8 +619,10 @@ void drm_mode_config_validate(struct drm_device *dev) {struct drm_encoder *encoder; -drm_for_each_encoder (encoder, dev) +drm_for_each_encoder (encoder, dev) {fixup_encoder_possible_clones (encoder); +fixup_encoder_possible_crtcs (encoder); + }drm_for_each_encoder (encoder, dev) {validate_encoder_possible_clones (encoder);include/drm/drm_encoder.h +4
-0@@ -142,6 +142,10 @@ struct drm_encoder {* the bits for all &drm_crtc objects this encoder can be connected to * before calling drm_dev_register(). * +* As an exception to the above rule if any crtc can be connected to +* the encoder the driver can leave @possible_crtcs set to 0. The core +* will automagically fix this up by setting the bit for every crtc. +* * You will get a WARN if you get this wrong in the driver. * * Note that since CRTC objects can't be hotplugged the assigned indices Signature · 1 line
2.24.1Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.chSignature · 2 lines
Ville Syrjälä IntelSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 7/7] drm: Allow drivers to leave encoder->possible_crtcs==0
Quoted 36 lines · Daniel Vetter
Quoted 35 lines · Daniel Vetter
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Daniel Vetter
Quoted 15 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's simplify life of driver by allowing them to leave
encoder->possible_crtcsunset if they have no restrictions in crtc<->encoder linkage. We'll just populatepossible_crtcswith the full crtc mask when registering the encoder so that userspace doesn't have to deal with drivers not populating this correctly.Cc Thomas Zimmermann <[email protected]>Cc Daniel Vetter <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>---
We might not actually need/want this, but included it here for future reference if that assumption turns out to be wrong.Quoted 6 lines
Quoted 3 lines
I think this one is most definitely needed. _Lots_ of drivers get this toally wrong and just leave the value blank. It's encoded as official fallback in most userspace compositors.
OK. It's been a while since I dug around so can't really remmber how this was being handled. I'll reorder before pushing.
Hm otoh having "works with all crtcs" as default is a bit dangerous, whereas the "cannot be cloned" default for
possible_clonesis perfectly safe.So now I'm kinda not sure whether this is a bright idea, and we shouldn't just eat the cost of fixing up all the various WARNING backtraces your previous patch triggers. I've done a full review and the following look suspect:
Quoted 7 lines
Quoted 2 lines
-
tegara/sor.cStrangely it's the only one, the other output drivers do seem to set thepossible_crtcsmask to something useful.Strike that, it sets it using
tegra_output_find_possible_crtcs().I think everything is good and we really don't need this patch here to fix up
possible_crtcs.
Finally pushed the other patches from the series to drm-misc-next. Thanks for the reviews.
Should the new possible_{crtcs,clones} WARNs start to trigger for anyone despite our best efforts, please holler and I'll look into what needs fixing.
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm: Try to fix encoder possible_clones/crtc (rev4)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Try to fix encoder possible_clones/crtc (rev4)
URL : https://patchwork.freedesktop.org/series/63399/
State : failure
== Summary ==
Applying: drm: Include the encoder itself in possible_clones Using index info to reconstruct a base tree...
M drivers/gpu/drm/drm_crtc_internal.h
M drivers/gpu/drm/drm_drv.c
M drivers/gpu/drm/drm_mode_config.c
M include/drm/drm_encoder.h
Falling back to patching base and 3-way merge... Auto-merging include/drm/drm_encoder.h
CONFLICT (content): Merge conflict in include/drm/drm_encoder.h Auto-merging drivers/gpu/drm/drm_mode_config.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/drm_mode_config.c Auto-merging drivers/gpu/drm/drm_drv.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/drm_drv.c Auto-merging drivers/gpu/drm/drm_crtc_internal.h
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm: Include the encoder itself in possible_clones When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx