public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage
@ 2019-06-02 14:13 Rhys Kidd
  2019-06-02 14:13 ` [PATCH 1/2] drm/nouveau/bios/init: handle INIT_RESET_BEGUN devinit opcode Rhys Kidd
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rhys Kidd @ 2019-06-02 14:13 UTC (permalink / raw)
  To: Ben Skeggs, David Airlie, Daniel Vetter, dri-devel, nouveau,
	linux-kernel, Karol Herbst, Lyude Paul, Ilia Mirkin
  Cc: Rhys Kidd

NVIDIA GPUs include a common scripting language (devinit) that can be
interpreted by a number of "engines", e.g. within a kernel-mode software
driver, the VGA BIOS or an on-board small microcontroller which provides
certain security assertions (the 'PMU').

This system allows a GPU programming sequence to be shared by multiple
entities that would not otherwise be able to execute common code.

This series adds support to nouveau for two opcodes seen on VBIOSes prior
to the locked-down PMU taking over responsibility for executing devinit
scripts.

Documentation for these two opcodes can be found at:

  https://github.com/envytools/envytools/pull/189

Rhys Kidd (2):
  drm/nouveau/bios/init: handle INIT_RESET_BEGUN devinit opcode
  drm/nouveau/bios/init: handle INIT_RESET_END devinit opcode

 .../gpu/drm/nouveau/nvkm/subdev/bios/init.c   | 26 +++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

-- 
2.20.1


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

* [PATCH 1/2] drm/nouveau/bios/init: handle INIT_RESET_BEGUN devinit opcode
  2019-06-02 14:13 [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage Rhys Kidd
@ 2019-06-02 14:13 ` Rhys Kidd
  2019-06-02 14:13 ` [PATCH 2/2] drm/nouveau/bios/init: handle INIT_RESET_END " Rhys Kidd
  2019-06-04 18:07 ` [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage Lyude Paul
  2 siblings, 0 replies; 4+ messages in thread
From: Rhys Kidd @ 2019-06-02 14:13 UTC (permalink / raw)
  To: Ben Skeggs, David Airlie, Daniel Vetter, dri-devel, nouveau,
	linux-kernel, Karol Herbst, Lyude Paul, Ilia Mirkin
  Cc: Rhys Kidd

Signal that the reset sequence has begun.

This opcode signals that the software reset sequence has begun.
Ordinarily, no actual operations are performed by the opcode.
However it allows for possible software work arounds by devinit
engines in software agents other than the VBIOS, such as the resman,
FCODE, and EFI driver.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
index ec0e9f7224b5..a54b5e410dcd 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
@@ -1934,6 +1934,17 @@ init_ram_restrict_pll(struct nvbios_init *init)
 	}
 }
 
+/**
+ * INIT_RESET_BEGUN - opcode 0x8c
+ *
+ */
+static void
+init_reset_begun(struct nvbios_init *init)
+{
+	trace("RESET_BEGUN\n");
+	init->offset += 1;
+}
+
 /**
  * INIT_GPIO - opcode 0x8e
  *
@@ -2260,7 +2271,7 @@ static struct nvbios_init_opcode {
 	[0x79] = { init_pll },
 	[0x7a] = { init_zm_reg },
 	[0x87] = { init_ram_restrict_pll },
-	[0x8c] = { init_reserved },
+	[0x8c] = { init_reset_begun },
 	[0x8d] = { init_reserved },
 	[0x8e] = { init_gpio },
 	[0x8f] = { init_ram_restrict_zm_reg_group },
-- 
2.20.1


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

* [PATCH 2/2] drm/nouveau/bios/init: handle INIT_RESET_END devinit opcode
  2019-06-02 14:13 [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage Rhys Kidd
  2019-06-02 14:13 ` [PATCH 1/2] drm/nouveau/bios/init: handle INIT_RESET_BEGUN devinit opcode Rhys Kidd
@ 2019-06-02 14:13 ` Rhys Kidd
  2019-06-04 18:07 ` [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage Lyude Paul
  2 siblings, 0 replies; 4+ messages in thread
From: Rhys Kidd @ 2019-06-02 14:13 UTC (permalink / raw)
  To: Ben Skeggs, David Airlie, Daniel Vetter, dri-devel, nouveau,
	linux-kernel, Karol Herbst, Lyude Paul, Ilia Mirkin
  Cc: Rhys Kidd

Signal that the reset sequence has completed.

This opcode signals that the software reset sequence has completed.
Ordinarily, no actual operations are performed by the opcode.
However it allows for possible software work arounds by devinit
engines in software agents other than the VBIOS, such as the resman,
FCODE, and EFI driver.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
index a54b5e410dcd..49d09503cd31 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c
@@ -1945,6 +1945,17 @@ init_reset_begun(struct nvbios_init *init)
 	init->offset += 1;
 }
 
+/**
+ * INIT_RESET_END - opcode 0x8d
+ *
+ */
+static void
+init_reset_end(struct nvbios_init *init)
+{
+	trace("RESET_END\n");
+	init->offset += 1;
+}
+
 /**
  * INIT_GPIO - opcode 0x8e
  *
@@ -2272,7 +2283,7 @@ static struct nvbios_init_opcode {
 	[0x7a] = { init_zm_reg },
 	[0x87] = { init_ram_restrict_pll },
 	[0x8c] = { init_reset_begun },
-	[0x8d] = { init_reserved },
+	[0x8d] = { init_reset_end },
 	[0x8e] = { init_gpio },
 	[0x8f] = { init_ram_restrict_zm_reg_group },
 	[0x90] = { init_copy_zm_reg },
-- 
2.20.1


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

* Re: [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage
  2019-06-02 14:13 [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage Rhys Kidd
  2019-06-02 14:13 ` [PATCH 1/2] drm/nouveau/bios/init: handle INIT_RESET_BEGUN devinit opcode Rhys Kidd
  2019-06-02 14:13 ` [PATCH 2/2] drm/nouveau/bios/init: handle INIT_RESET_END " Rhys Kidd
@ 2019-06-04 18:07 ` Lyude Paul
  2 siblings, 0 replies; 4+ messages in thread
From: Lyude Paul @ 2019-06-04 18:07 UTC (permalink / raw)
  To: Rhys Kidd, Ben Skeggs, David Airlie, Daniel Vetter, dri-devel,
	nouveau, linux-kernel, Karol Herbst, Ilia Mirkin

For the whole series:

Reviewed-by: Lyude Paul <lyude@redhat.com>

Tested on a GK104 and GK110 (same ones as my vbios traces in our vbios repo)

On Mon, 2019-06-03 at 00:13 +1000, Rhys Kidd wrote:
> NVIDIA GPUs include a common scripting language (devinit) that can be
> interpreted by a number of "engines", e.g. within a kernel-mode software
> driver, the VGA BIOS or an on-board small microcontroller which provides
> certain security assertions (the 'PMU').
> 
> This system allows a GPU programming sequence to be shared by multiple
> entities that would not otherwise be able to execute common code.
> 
> This series adds support to nouveau for two opcodes seen on VBIOSes prior
> to the locked-down PMU taking over responsibility for executing devinit
> scripts.
> 
> Documentation for these two opcodes can be found at:
> 
>   https://github.com/envytools/envytools/pull/189
> 
> Rhys Kidd (2):
>   drm/nouveau/bios/init: handle INIT_RESET_BEGUN devinit opcode
>   drm/nouveau/bios/init: handle INIT_RESET_END devinit opcode
> 
>  .../gpu/drm/nouveau/nvkm/subdev/bios/init.c   | 26 +++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
-- 
Cheers,
	Lyude Paul


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

end of thread, other threads:[~2019-06-04 18:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-02 14:13 [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage Rhys Kidd
2019-06-02 14:13 ` [PATCH 1/2] drm/nouveau/bios/init: handle INIT_RESET_BEGUN devinit opcode Rhys Kidd
2019-06-02 14:13 ` [PATCH 2/2] drm/nouveau/bios/init: handle INIT_RESET_END " Rhys Kidd
2019-06-04 18:07 ` [PATCH 0/2] drm/nouveau/bios/init: Improve pre-PMU devinit opcode coverage Lyude Paul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox