Skip to contentSkip to conversation

drm/ast: Support reading configuration values

PATCH In review Benjamin Herrenschmidt 1 participant 1 message Feb 16, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/ast: Support reading configuration values

From: Russell Currey <[email protected]>

The ast driver configures a window to enable access into BMC memory space in order to read some configuration registers. If this window is disabled, which it can be from the BMC side, the ast driver can't function. Closing this window is a necessity for security if a machine's host side and BMC side are controlled by different parties; i.e. a cloud provider offering machines "bare metal".

A recent patch from Aspeed tries to detect whether that window is enabled and uses default values if not. Unfortunately this won't work on systems such as POWER machines that have strong PCIe error handling as the attempt at detection will cause a PCIe abort if the window is closed.

To work around this, enable reading these configuration values from the device tree instead of through the window into BMC memory if the corresponding DT properties are available. If not, the driver defaults to the existing test which i cleaned up a little bit.

--
v2. [BenH]
- Reworked on top of Aspeed P2A patch
- Cleanup overall detection via a "config_mode" and log the selected mode for diagnostics purposes
- Add a property for the SCU straps

---
 drivers/gpu/drm/ast/ast_drv.h  |   6 +-
 drivers/gpu/drm/ast/ast_main.c | 208 ++++++++++++++++++++++++-----------------
 drivers/gpu/drm/ast/ast_post.c |   7 +-
 3 files changed, 127 insertions(+), 94 deletions(-)
drivers/gpu/drm/ast/ast_drv.h +5 -1
index 7abda94..3bedcf7 100644
@@ -113,7 +113,11 @@ struct ast_private {
 	struct ttm_bo_kmap_obj cache_kmap;
 	int next_cursor;
 	bool support_wide_screen;
-	bool DisableP2A;
+	enum {
+		ast_use_p2a,
+		ast_use_dt,
+		ast_use_defaults
+	} config_mode;
 
 	enum ast_tx_chip tx_chip_type;
 	u8 dp501_maxclk;
drivers/gpu/drm/ast/ast_main.c +120 -88

256 lines not on this page · raw message

drivers/gpu/drm/ast/ast_post.c +2 -5
index 5331ee1..7197635 100644
@@ -379,17 +379,14 @@ void ast_post_gpu(struct drm_device *dev)
 	ast_open_key(ast);
 	ast_set_def_ext_reg(dev);
 
-	if (ast->DisableP2A == false)
-	{
+	if (ast->config_mode == ast_use_p2a) {
 		if (ast->chip == AST2300 || ast->chip == AST2400)
 			ast_init_dram_2300(dev);
 		else
 			ast_init_dram_reg(dev);
 
 		ast_init_3rdtx(dev);
-	}
-	else
-	{
+	} else {
 		if (ast->tx_chip_type != AST_TX_NONE)
 			ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xa3, 0xcf, 0x80);	/* Enable DVO */
 	}

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