Skip to contentSkip to conversation

drm/ast: Fixed reboot test may cause system hanged

PATCH In review Y.C. Chen 1 participant 2 messages Apr 11, 2018 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Y.C. Chen

author
#0 lore raw

PATCH 1/1 drm/ast: Fixed reboot test may cause system hanged

From: "Y.C. Chen" <[email protected]>

There is another thread still access standard VGA I/O while loading drm driver. Disable standard VGA I/O decode to avoid this issue.

---
 drivers/gpu/drm/ast/ast_main.c | 5 ++++-
 drivers/gpu/drm/ast/ast_mode.c | 2 +-
 drivers/gpu/drm/ast/ast_post.c | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/ast/ast_main.c +4 -1
index dac3558..82a2687 100644
@@ -131,8 +131,8 @@ static int ast_detect_chip(struct drm_device *dev, bool *need_post)
 
 
 	/* Enable extended register access */
-	ast_enable_mmio(dev);
 	ast_open_key(ast);
+	ast_enable_mmio(dev);
 
 	/* Find out whether P2A works or whether to use device-tree */
 	ast_detect_config_mode(dev, &scu_rev);
@@ -576,6 +576,9 @@ void ast_driver_unload(struct drm_device *dev)
 {
 	struct ast_private *ast = dev->dev_private;
 
+	/* enable standard VGA decode */
+	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
+
 	ast_release_firmware(dev);
 	kfree(ast->dp501_fw_addr);
 	ast_mode_fini(dev);
drivers/gpu/drm/ast/ast_mode.c +1 -1
index 831b733..9d637b4 100644
@@ -599,7 +599,7 @@ static int ast_crtc_mode_set(struct drm_crtc *crtc,
 		return -EINVAL;
 	ast_open_key(ast);
 
-	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04);
+	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
 
 	ast_set_std_reg(crtc, adjusted_mode, &vbios_mode);
 	ast_set_crtc_reg(crtc, adjusted_mode, &vbios_mode);
drivers/gpu/drm/ast/ast_post.c +1 -1
index f7d4213..c1d1ac5 100644
@@ -46,7 +46,7 @@ void ast_enable_mmio(struct drm_device *dev)
 {
 	struct ast_private *ast = dev->dev_private;
 
-	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa1, 0xff, 0x04);
+	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06);
 }
 
 
Signature · 6 lines
1.8.3.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

Hi Ben,
Thanks for your reply. You need to open password register before modify extended CRT registers. Extended CRT registers cannot be modified if the read back value of password register is 0.
Allow me to describe this issue more. This issue only happen on Intel x86/x86_64 system actually. We found there is a another thread still access VGA cursor registers when loading "ast" drm driver. VGA register is index I/O register, if two threads access it alternately, it may cause the un-expected settings. "ast" drm driver is using related IO or MMIO to access register, and the thread is using standard VGA IO(0x3d4) to access cursor register, so our solution is disabling standard VGA decoding(Set VGACRA1 D[1] to 1) at the entry of "ast" driver load to avoid this issue.

Regards,

Y.C. Chen

-----Original Message-----
From: Benjamin Herrenschmidt [mailto:[email protected]]
Sent: Wednesday, April 11, 2018 9:54 AM
To: YC Chen <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] drm/ast: Fixed reboot test may cause system hanged

drivers/gpu/drm/ast/ast_main.c static int ast_detect_chip(struct drm_device *dev, · line 136

Quoted 11 lines · Y.C. Chen

index dac3558..82a2687 100644

drivers/gpu/drm/ast/ast_main.c +1 -1
@@ -131,8 +131,8 @@ static int ast_detect_chip(struct drm_device *dev, 
 bool *need_post)
 
 
        /* Enable extended register access */
-       ast_enable_mmio(dev);
        ast_open_key(ast);
+       ast_enable_mmio(dev);

Why that change ? The documentation doesn't really specify what the "password" register is about. What does it "open" ?

I'm being a bit paranoid because we had issues with earlier drivers (before some of the latest changes to that code) where occasionally on boot, the chip wouldn't respond to an MMIO to one of the VGA registers, causing an EEH error which crashes on boot.

So I want to make sure I understand what the changes precisely do.

Cheers,
Ben.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel