mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64
@ 2026-09-27 14:55 Imre Kaloz
  2026-09-27 14:55 ` [PATCH v2 1/2] drm/radeon: Read the VRAM VBIOS signature with readb() Imre Kaloz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Imre Kaloz @ 2026-09-27 14:55 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: David Airlie, Simona Vetter, amd-gfx, dri-devel, linux-kernel

These two patches get radeon KMS working on the Sun XVR-300, a
FireMV 2200 PCIe (RV370) board, in sparc64 hosts.

Patch 1 fixes an Oops that any posted radeon card on sparc64 hits in
igp_read_bios_from_vram(), which dereferences an ioremap() cookie to
check the VBIOS signature. It is tagged for stable.

Patch 2 adds a legacy connector table for the XVR-300, which has no
COMBIOS for the driver to parse, so both DVI-I outputs are found.
The XVR-300 needs both.

Tested on a Sun Ultra 45 with an XVR-300.

Changes in v2:
- Read the signature with readb() before the allocation instead of
  checking the RAM copy, as radeon_read_bios() does (patch 1).

Imre Kaloz (2):
  drm/radeon: Read the VRAM VBIOS signature with readb()
  drm/radeon: add a connector table for the Sun XVR-300

 drivers/gpu/drm/radeon/radeon_bios.c    |  6 ++-
 drivers/gpu/drm/radeon/radeon_combios.c | 51 +++++++++++++++++++++++++
 drivers/gpu/drm/radeon/radeon_mode.h    |  3 +-
 3 files changed, 58 insertions(+), 2 deletions(-)


base-commit: fe2ec83746e501645709761605c2464a44fd2929
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] drm/radeon: Read the VRAM VBIOS signature with readb()
  2026-09-27 14:55 [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64 Imre Kaloz
@ 2026-09-27 14:55 ` Imre Kaloz
  2026-09-27 14:55 ` [PATCH v2 2/2] drm/radeon: add a connector table for the Sun XVR-300 Imre Kaloz
  2026-09-27 19:26 ` [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64 Alex Deucher
  2 siblings, 0 replies; 4+ messages in thread
From: Imre Kaloz @ 2026-09-27 14:55 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: David Airlie, Simona Vetter, amd-gfx, dri-devel, linux-kernel, stable

igp_read_bios_from_vram() checked bios[0]/bios[1] with a plain
__iomem load, which faults on sparc64 before the copy runs at all.
radeon_read_bios() already reads its two signature bytes with
readb() ahead of its own copy; use the same accessor here, keeping
the check before the allocation.

Fixes: b442962a9e82 ("drm/radeon/kms: add support for "Surround View"")
Cc: stable@vger.kernel.org
Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
Changes in v2:
- Read the signature with readb() before the allocation instead of
  checking the RAM copy, as radeon_read_bios() does.

 drivers/gpu/drm/radeon/radeon_bios.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 8595f4c6e2e5..1da6bf1c17ff 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -49,6 +49,7 @@
 static bool igp_read_bios_from_vram(struct radeon_device *rdev)
 {
 	uint8_t __iomem *bios;
+	uint8_t val1, val2;
 	resource_size_t vram_base;
 	resource_size_t size = 256 * 1024; /* ??? */
 
@@ -63,7 +64,10 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)
 		return false;
 	}
 
-	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
+	val1 = readb(&bios[0]);
+	val2 = readb(&bios[1]);
+
+	if (size == 0 || val1 != 0x55 || val2 != 0xaa) {
 		iounmap(bios);
 		return false;
 	}
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] drm/radeon: add a connector table for the Sun XVR-300
  2026-09-27 14:55 [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64 Imre Kaloz
  2026-09-27 14:55 ` [PATCH v2 1/2] drm/radeon: Read the VRAM VBIOS signature with readb() Imre Kaloz
@ 2026-09-27 14:55 ` Imre Kaloz
  2026-09-27 19:26 ` [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64 Alex Deucher
  2 siblings, 0 replies; 4+ messages in thread
From: Imre Kaloz @ 2026-09-27 14:55 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: David Airlie, Simona Vetter, amd-gfx, dri-devel, linux-kernel

The Sun XVR-300 is a FireMV 2200 PCIe (RV370) board with an
FCode-only Open Firmware ROM and no COMBIOS to parse, so the
generic connector table leaves both DVI-I outputs undetected. Both
XVR-300 SKUs report device ID 5b64 with an ATI subsystem ID rather
than Sun's, so match the OF node name prefix instead. The table
comes from the board's FCode.

Signed-off-by: Imre Kaloz <kaloz@kernel.org>
---
 drivers/gpu/drm/radeon/radeon_combios.c | 51 +++++++++++++++++++++++++
 drivers/gpu/drm/radeon/radeon_mode.h    |  3 +-
 2 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index b3e7a747f11e..096f953c67be 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -25,6 +25,7 @@
  *          Alex Deucher
  */
 
+#include <linux/of.h>
 #include <linux/pci.h>
 
 #include <drm/drm_device.h>
@@ -1512,6 +1513,14 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
 			rdev->mode_info.connector_table = CT_RN50_POWER;
 		else
 #endif
+		if (of_node_name_prefix(rdev->pdev->dev.of_node, "SUNW,XVR-300"))
+			/* FireMV 2200 PCIe with FCode-only ROM, no COMBIOS
+			 * to parse; both XVR-300 SKUs share device ID 5b64
+			 * with an ATI subsystem ID, so match the OF node
+			 * name instead.
+			 */
+			rdev->mode_info.connector_table = CT_SUN_XVR300;
+		else
 			rdev->mode_info.connector_table = CT_GENERIC;
 	}
 
@@ -2187,6 +2196,48 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
 					    CONNECTOR_OBJECT_ID_SVIDEO,
 					    &hpd);
 		break;
+	case CT_SUN_XVR300:
+		DRM_INFO("Connector Table: %d (sun xvr-300)\n",
+			 rdev->mode_info.connector_table);
+		/* DVI-I - internal tmds, tv dac */
+		ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0);
+		hpd.hpd = RADEON_HPD_1;
+		radeon_add_legacy_encoder(dev,
+					  radeon_get_encoder_enum(dev,
+								ATOM_DEVICE_DFP1_SUPPORT,
+								0),
+					  ATOM_DEVICE_DFP1_SUPPORT);
+		radeon_add_legacy_encoder(dev,
+					  radeon_get_encoder_enum(dev,
+								ATOM_DEVICE_CRT2_SUPPORT,
+								2),
+					  ATOM_DEVICE_CRT2_SUPPORT);
+		radeon_add_legacy_connector(dev, 0,
+					    ATOM_DEVICE_DFP1_SUPPORT |
+					    ATOM_DEVICE_CRT2_SUPPORT,
+					    DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
+					    CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
+					    &hpd);
+		/* DVI-I - sil164 dvo, primary dac */
+		ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0);
+		hpd.hpd = RADEON_HPD_2;
+		radeon_add_legacy_encoder(dev,
+					  radeon_get_encoder_enum(dev,
+								ATOM_DEVICE_DFP2_SUPPORT,
+								0),
+					  ATOM_DEVICE_DFP2_SUPPORT);
+		radeon_add_legacy_encoder(dev,
+					  radeon_get_encoder_enum(dev,
+								ATOM_DEVICE_CRT1_SUPPORT,
+								1),
+					  ATOM_DEVICE_CRT1_SUPPORT);
+		radeon_add_legacy_connector(dev, 1,
+					    ATOM_DEVICE_DFP2_SUPPORT |
+					    ATOM_DEVICE_CRT1_SUPPORT,
+					    DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
+					    CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
+					    &hpd);
+		break;
 	default:
 		DRM_INFO("Connector table: %d (invalid)\n",
 			 rdev->mode_info.connector_table);
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 031a3bf6fe0a..6a16d821915d 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -226,7 +226,8 @@ enum radeon_connector_table {
 	CT_MAC_X800,
 	CT_MAC_G5_9600,
 	CT_SAM440EP,
-	CT_MAC_G4_SILVER
+	CT_MAC_G4_SILVER,
+	CT_SUN_XVR300
 };
 
 enum radeon_dvo_chip {
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64
  2026-09-27 14:55 [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64 Imre Kaloz
  2026-09-27 14:55 ` [PATCH v2 1/2] drm/radeon: Read the VRAM VBIOS signature with readb() Imre Kaloz
  2026-09-27 14:55 ` [PATCH v2 2/2] drm/radeon: add a connector table for the Sun XVR-300 Imre Kaloz
@ 2026-09-27 19:26 ` Alex Deucher
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2026-09-27 19:26 UTC (permalink / raw)
  To: Imre Kaloz
  Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	amd-gfx, dri-devel, linux-kernel

On Sun, Sep 27, 2026 at 11:06 AM Imre Kaloz <kaloz@kernel.org> wrote:
>
> These two patches get radeon KMS working on the Sun XVR-300, a
> FireMV 2200 PCIe (RV370) board, in sparc64 hosts.
>
> Patch 1 fixes an Oops that any posted radeon card on sparc64 hits in
> igp_read_bios_from_vram(), which dereferences an ioremap() cookie to
> check the VBIOS signature. It is tagged for stable.
>
> Patch 2 adds a legacy connector table for the XVR-300, which has no
> COMBIOS for the driver to parse, so both DVI-I outputs are found.
> The XVR-300 needs both.
>
> Tested on a Sun Ultra 45 with an XVR-300.
>
> Changes in v2:
> - Read the signature with readb() before the allocation instead of
>   checking the RAM copy, as radeon_read_bios() does (patch 1).
>
> Imre Kaloz (2):
>   drm/radeon: Read the VRAM VBIOS signature with readb()
>   drm/radeon: add a connector table for the Sun XVR-300

Applied the series.  Thanks!

Alex

>
>  drivers/gpu/drm/radeon/radeon_bios.c    |  6 ++-
>  drivers/gpu/drm/radeon/radeon_combios.c | 51 +++++++++++++++++++++++++
>  drivers/gpu/drm/radeon/radeon_mode.h    |  3 +-
>  3 files changed, 58 insertions(+), 2 deletions(-)
>
>
> base-commit: fe2ec83746e501645709761605c2464a44fd2929
> --
> 2.47.3
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-27 19:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 14:55 [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64 Imre Kaloz
2026-09-27 14:55 ` [PATCH v2 1/2] drm/radeon: Read the VRAM VBIOS signature with readb() Imre Kaloz
2026-09-27 14:55 ` [PATCH v2 2/2] drm/radeon: add a connector table for the Sun XVR-300 Imre Kaloz
2026-09-27 19:26 ` [PATCH v2 0/2] drm/radeon: Sun XVR-300 support on sparc64 Alex Deucher

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®