Skip to contentSkip to conversation

drm/ast: Add an option to disable Write-Combine

PATCH In review Thomas Zimmermann 2 participants 3 messages Nov 20 – Nov 23

Subsystems (4)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 drm/ast: Add an option to disable Write-Combine

WC-mapped video memory presumably has PCI I/O bursts that interfere with real-time tasks. Seen on AST2600 hardware.

Add an Kconfig option to ast for vmapping the video memory uncached if CONFIG_RT=y. If set, video-memory access is slower, but avoids I/O bursts on the PCI us. Mirrors a similar change to mgag200 in commit b593ea940623 ("drm/mgag200: Add an option to disable Write-Combine").

Fixes f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
Cc <[email protected]> # v6.2+
---
 drivers/gpu/drm/ast/Kconfig  |  9 +++++++++
 drivers/gpu/drm/ast/ast_mm.c | 13 +++++++++++++
 2 files changed, 22 insertions(+)
drivers/gpu/drm/ast/Kconfig +9 -0
index 242fbccdf844..f2c99e99b5b4 100644
@@ -14,3 +14,12 @@ config DRM_AST
 	 is bound to the driver. These GPUs are commonly found
 	 in server chipsets.
 
+config DRM_AST_DISABLE_WRITECOMBINE
+	bool "Disable Write Combine mapping of VRAM"
+	depends on DRM_AST && (PREEMPT_RT || COMPILE_TEST)
+	help
+	  The VRAM of AST GPUs is mapped with Write-Combine to improve
+	  performances. This can interfere with real-time tasks; even if they
+	  are running on other CPU cores than the graphics output.
+	  Enable this option only if you run real-time tasks on a server with
+	  Aspeed graphics.
drivers/gpu/drm/ast/ast_mm.c +13 -0
index 0bc140319464..cc882d2c172d 100644
@@ -74,6 +74,18 @@ int ast_mm_init(struct ast_device *ast)
 {
 	struct drm_device *dev = &ast->base;
 	struct pci_dev *pdev = to_pci_dev(dev->dev);
+#if defined(CONFIG_DRM_AST_DISABLE_WRITECOMBINE)
+	resource_size_t base;
+	u32 vram_size;
+
+	base = pci_resource_start(pdev, 0);
+
+	vram_size = ast_get_vram_size(ast);
+
+	ast->vram = devm_ioremap(dev->dev, base, vram_size);
+	if (!ast->vram)
+		return -ENOMEM;
+#else
 	resource_size_t base, size;
 	u32 vram_size;
 
@@ -89,6 +101,7 @@ int ast_mm_init(struct ast_device *ast)
 	ast->vram = devm_ioremap_wc(dev->dev, base, vram_size);
 	if (!ast->vram)
 		return -ENOMEM;
+#endif
 
 	ast->vram_base = base;
 	ast->vram_size = vram_size;

base-commit: 7d502136b31169f6b5575f7f89c3da60cdf7891d

Signature · 1 line
2.56.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Thomas Zimmermann

WC-mapped video memory presumably has PCI I/O bursts that interfere with real-time tasks. Seen on AST2600 hardware.

Add an Kconfig option to ast for vmapping the video memory uncached if CONFIG_RT=y. If set, video-memory access is slower, but avoids I/O bursts on the PCI us. Mirrors a similar change to mgag200 in commit b593ea940623 ("drm/mgag200: Add an option to disable Write-Combine").

Ok, so ast also is affected by this issue.

Signature · 1 line
Jocelyn
Quoted 59 lines
Fixes f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
Cc <[email protected]> # v6.2+
---
  drivers/gpu/drm/ast/Kconfig  |  9 +++++++++
  drivers/gpu/drm/ast/ast_mm.c | 13 +++++++++++++
  2 files changed, 22 insertions(+)
drivers/gpu/drm/ast/Kconfig +9 -0
index 242fbccdf844..f2c99e99b5b4 100644
@@ -14,3 +14,12 @@ config DRM_AST
  	 is bound to the driver. These GPUs are commonly found
  	 in server chipsets.
 
+config DRM_AST_DISABLE_WRITECOMBINE
+	bool "Disable Write Combine mapping of VRAM"
+	depends on DRM_AST && (PREEMPT_RT || COMPILE_TEST)
+	help
+	  The VRAM of AST GPUs is mapped with Write-Combine to improve
+	  performances. This can interfere with real-time tasks; even if they
+	  are running on other CPU cores than the graphics output.
+	  Enable this option only if you run real-time tasks on a server with
+	  Aspeed graphics.
drivers/gpu/drm/ast/ast_mm.c +13 -0
index 0bc140319464..cc882d2c172d 100644
@@ -74,6 +74,18 @@ int ast_mm_init(struct ast_device *ast)
  {
  	struct drm_device *dev = &ast->base;
  	struct pci_dev *pdev = to_pci_dev(dev->dev);
+#if defined(CONFIG_DRM_AST_DISABLE_WRITECOMBINE)
+	resource_size_t base;
+	u32 vram_size;
+
+	base = pci_resource_start(pdev, 0);
+
+	vram_size = ast_get_vram_size(ast);
+
+	ast->vram = devm_ioremap(dev->dev, base, vram_size);
+	if (!ast->vram)
+		return -ENOMEM;
+#else
  	resource_size_t base, size;
  	u32 vram_size;
 
@@ -89,6 +101,7 @@ int ast_mm_init(struct ast_device *ast)
  	ast->vram = devm_ioremap_wc(dev->dev, base, vram_size);
  	if (!ast->vram)
  		return -ENOMEM;
+#endif
 
  	ast->vram_base = base;
  	ast->vram_size = vram_size;

base-commit: 7d502136b31169f6b5575f7f89c3da60cdf7891d

author maintainer
#2 lore raw

Hi

Am 23.11.26 um 14:30 schrieb Jocelyn Falempe:

Quoted 11 lines · Thomas Zimmermann
Quoted 8 lines

WC-mapped video memory presumably has PCI I/O bursts that interfere with real-time tasks. Seen on AST2600 hardware.

Add an Kconfig option to ast for vmapping the video memory uncached if CONFIG_RT=y. If set, video-memory access is slower, but avoids I/O bursts on the PCI us. Mirrors a similar change to mgag200 in commit b593ea940623 ("drm/mgag200: Add an option to disable Write-Combine").

Ok, so ast also is affected by this issue.

Yeah, seen in the wild by one of our customers. I would assume that this is the case for all these simple drivers if pushed hard enough.

Quoted 2 lines

Thanks a lot.

Best regards
Thomas

Signature · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)