mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Jammy Huang <jammy_huang@aspeedtech.com>,
	airlied@redhat.com, airlied@gmail.com, daniel@ffwll.ch
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3] drm/ast: Fix modeset failed on DisplayPort
Date: Thu, 1 Jun 2023 11:04:40 +0200	[thread overview]
Message-ID: <2ddf5210-a130-d496-53d9-29b7a068c182@suse.de> (raw)
In-Reply-To: <20230601004847.1115-1-jammy_huang@aspeedtech.com>


[-- Attachment #1.1: Type: text/plain, Size: 2511 bytes --]

Hi

Am 01.06.23 um 02:48 schrieb Jammy Huang:
> If we switch display and update cursor together, it could lead to
> modeset failed because of concurrent access to IO registers.
> 
> Add lock protection in DP's edid access to avoid this problem.

Merged into drm-misc-fixes. Thanks for the patch.

Best regards
Thomas

> 
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
> ---
>   v3 changes:
>    - Update label name after mutex added.
>   v2 changes:
>    - Fix build error since new struct ast_device is used.
> ---
>   drivers/gpu/drm/ast/ast_mode.c | 15 +++++++++++++--
>   1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 36374828f6c8..b3c670af6ef2 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -1647,6 +1647,8 @@ static int ast_dp501_output_init(struct ast_device *ast)
>   static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)
>   {
>   	void *edid;
> +	struct drm_device *dev = connector->dev;
> +	struct ast_device *ast = to_ast_device(dev);
>   
>   	int succ;
>   	int count;
> @@ -1655,9 +1657,17 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)
>   	if (!edid)
>   		goto err_drm_connector_update_edid_property;
>   
> +	/*
> +	 * Protect access to I/O registers from concurrent modesetting
> +	 * by acquiring the I/O-register lock.
> +	 */
> +	mutex_lock(&ast->ioregs_lock);
> +
>   	succ = ast_astdp_read_edid(connector->dev, edid);
>   	if (succ < 0)
> -		goto err_kfree;
> +		goto err_mutex_unlock;
> +
> +	mutex_unlock(&ast->ioregs_lock);
>   
>   	drm_connector_update_edid_property(connector, edid);
>   	count = drm_add_edid_modes(connector, edid);
> @@ -1665,7 +1675,8 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)
>   
>   	return count;
>   
> -err_kfree:
> +err_mutex_unlock:
> +	mutex_unlock(&ast->ioregs_lock);
>   	kfree(edid);
>   err_drm_connector_update_edid_property:
>   	drm_connector_update_edid_property(connector, NULL);
> 
> base-commit: e338142b39cf40155054f95daa28d210d2ee1b2d

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

      reply	other threads:[~2023-06-01  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01  0:48 Jammy Huang
2023-06-01  9:04 ` Thomas Zimmermann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2ddf5210-a130-d496-53d9-29b7a068c182@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jammy_huang@aspeedtech.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®