All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuo-Hsiang Chou <kuohsiang_chou@aspeedtech.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "airlied@redhat.com" <airlied@redhat.com>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	"Jenmin Yuan" <jenmin_yuan@aspeedtech.com>,
	"Arc Sung" <arc_sung@aspeedtech.com>,
	"Luke Chen" <luke_chen@aspeedtech.com>,
	"清水修(o-shimizu)-台灣NEC" <o-shimizu@nec.com.tw>
Subject: RE: [PATCH] drm/ast: Atomic CR/SR reg R/W
Date: Thu, 30 Sep 2021 07:19:26 +0000	[thread overview]
Message-ID: <HK2PR06MB3300C768B6A3C390A7D1BBC28CAA9@HK2PR06MB3300.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <7c128e03-842a-57b3-0c11-24fed9d4d126@suse.de>



-----Original Message-----
From: Thomas Zimmermann [mailto:tzimmermann@suse.de] 
Sent: Monday, September 20, 2021 4:17 PM
To: Kuo-Hsiang Chou <kuohsiang_chou@aspeedtech.com>; dri-devel@lists.freedesktop.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/ast: Atomic CR/SR reg R/W

Hi

Am 17.09.21 um 09:22 schrieb KuoHsiang Chou:
> 1. Avoid IO-index racing
> 2. IO-index racing happened on resolustion switching
>     and mouse moving at the same time
> 3. System hung while IO-index racing occurred.

I'd say that there's something else going one here. Mode setting and cursor movement should be protected against each other by DRM locking. 
Changing these low-level functions would not solve the issues. I'll try to reproduce the problem ASAP.

Hi Thomas,

Sorry to interrupt you again!
May I understand the review's situation? Thanks!

Best Regards,
 	Kuo-Hsiang Chou

Best regards
Thomas

> 
> Signed-off-by: KuoHsiang Chou <kuohsiang_chou@aspeedtech.com>
> ---
>   drivers/gpu/drm/ast/ast_main.c | 48 +++++++++++++++++++++++++---------
>   1 file changed, 36 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_main.c 
> b/drivers/gpu/drm/ast/ast_main.c index 79a361867..1d8fa70c5 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -41,28 +41,52 @@ void ast_set_index_reg_mask(struct ast_private *ast,
>   			    uint32_t base, uint8_t index,
>   			    uint8_t mask, uint8_t val)
>   {
> -	u8 tmp;
> -	ast_io_write8(ast, base, index);
> -	tmp = (ast_io_read8(ast, base + 1) & mask) | val;
> -	ast_set_index_reg(ast, base, index, tmp);
> +	uint16_t volatile usData;
> +	uint8_t  volatile jData;
> +
> +	do {
> +		ast_io_write8(ast, base, index);
> +		usData = ast_io_read16(ast, base);
> +	} while ((uint8_t)(usData) != index);
> +
> +	jData  = (uint8_t)(usData >> 8);
> +	jData &= mask;
> +	jData |= val;
> +	usData = ((uint16_t) jData << 8) | (uint16_t) index;
> +	ast_io_write16(ast, base, usData);
>   }
> 
>   uint8_t ast_get_index_reg(struct ast_private *ast,
>   			  uint32_t base, uint8_t index)
>   {
> -	uint8_t ret;
> -	ast_io_write8(ast, base, index);
> -	ret = ast_io_read8(ast, base + 1);
> -	return ret;
> +	uint16_t volatile usData;
> +	uint8_t  volatile jData;
> +
> +	do {
> +		ast_io_write8(ast, base, index);
> +		usData = ast_io_read16(ast, base);
> +	} while ((uint8_t)(usData) != index);
> +
> +	jData  = (uint8_t)(usData >> 8);
> +
> +	return jData;
>   }
> 
>   uint8_t ast_get_index_reg_mask(struct ast_private *ast,
>   			       uint32_t base, uint8_t index, uint8_t mask)
>   {
> -	uint8_t ret;
> -	ast_io_write8(ast, base, index);
> -	ret = ast_io_read8(ast, base + 1) & mask;
> -	return ret;
> +	uint16_t volatile usData;
> +	uint8_t  volatile jData;
> +
> +	do {
> +		ast_io_write8(ast, base, index);
> +		usData = ast_io_read16(ast, base);
> +	} while ((uint8_t)(usData) != index);
> +
> +	jData  = (uint8_t)(usData >> 8);
> +	jData &= mask;
> +
> +	return jData;
>   }
> 
>   static void ast_detect_config_mode(struct drm_device *dev, u32 
> *scu_rev)
> --
> 2.18.4
> 

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

  reply	other threads:[~2021-09-30  7:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  7:22 [PATCH] drm/ast: Atomic CR/SR reg R/W KuoHsiang Chou
2021-09-20  8:17 ` Thomas Zimmermann
2021-09-30  7:19   ` Kuo-Hsiang Chou [this message]
2021-12-03  1:23     ` Kuo-Hsiang Chou
2021-12-03  1:23       ` Kuo-Hsiang Chou
2021-12-03  8:46       ` Thomas Zimmermann
2021-12-06  1:38         ` Kuo-Hsiang Chou
2022-05-02 14:32           ` Thomas Zimmermann
2022-05-03  0:38             ` Kuo-Hsiang Chou

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=HK2PR06MB3300C768B6A3C390A7D1BBC28CAA9@HK2PR06MB3300.apcprd06.prod.outlook.com \
    --to=kuohsiang_chou@aspeedtech.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=arc_sung@aspeedtech.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jenmin_yuan@aspeedtech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke_chen@aspeedtech.com \
    --cc=o-shimizu@nec.com.tw \
    --cc=tzimmermann@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.