public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v3 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
@ 2024-01-29 12:29 Gerd Hoffmann
  2024-01-29 18:37 ` Ard Biesheuvel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2024-01-29 12:29 UTC (permalink / raw)
  To: devel
  Cc: Laszlo Ersek, Erdem Aktas, Tom Lendacky, Jiewen Yao,
	Gerd Hoffmann, Ard Biesheuvel, Michael Roth, Min Xu,
	Oliver Steffen

Neat when doing ResetVector coding.
Incompatible with TDX and SEV, therefore not enabled by default.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Erdem Aktas <erdemaktas@google.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/ResetVector/QemuDebugCon.asm  | 36 +++++++++++++++++++++++++++
 OvmfPkg/ResetVector/ResetVector.nasmb |  4 +++
 2 files changed, 40 insertions(+)
 create mode 100644 OvmfPkg/ResetVector/QemuDebugCon.asm

diff --git a/OvmfPkg/ResetVector/QemuDebugCon.asm b/OvmfPkg/ResetVector/QemuDebugCon.asm
new file mode 100644
index 000000000000..8729fc2ffc0a
--- /dev/null
+++ b/OvmfPkg/ResetVector/QemuDebugCon.asm
@@ -0,0 +1,36 @@
+;------------------------------------------------------------------------------
+; @file
+; qemu debug console support macros (based on serial port macros)
+;
+; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2024, Red Hat, Inc.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+;------------------------------------------------------------------------------
+
+%macro  debugShowCharacter 1
+    mov     dx, 0x402
+    mov     al, %1
+    out     dx, al
+%endmacro
+
+%macro  debugShowHexDigit 1
+  %if (%1 < 0xa)
+    debugShowCharacter BYTE ('0' + (%1))
+  %else
+    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
+  %endif
+%endmacro
+
+%macro  debugShowPostCode 1
+    debugShowHexDigit (((%1) >> 4) & 0xf)
+    debugShowHexDigit ((%1) & 0xf)
+    debugShowCharacter `\r`
+    debugShowCharacter `\n`
+%endmacro
+
+BITS    16
+
+%macro  debugInitialize 0
+    ; not required
+%endmacro
diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
index 5832aaa8abf7..69ce43ef6a96 100644
--- a/OvmfPkg/ResetVector/ResetVector.nasmb
+++ b/OvmfPkg/ResetVector/ResetVector.nasmb
@@ -40,6 +40,10 @@
   %include "Port80Debug.asm"
 %elifdef DEBUG_SERIAL
   %include "SerialDebug.asm"
+%elif 0
+; Set ^ this to 1 to enable postcodes on the qemu debug console.
+; Disabled by default because it is incompatible with SEV and TDX.
+  %include "QemuDebugCon.asm"
 %else
   %include "DebugDisabled.asm"
 %endif
-- 
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114698): https://edk2.groups.io/g/devel/message/114698
Mute This Topic: https://groups.io/mt/104029937/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [PATCH v3 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-29 12:29 [edk2-devel] [PATCH v3 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console Gerd Hoffmann
@ 2024-01-29 18:37 ` Ard Biesheuvel
  2024-01-29 20:22 ` Laszlo Ersek
  2024-01-29 21:06 ` Laszlo Ersek
  2 siblings, 0 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2024-01-29 18:37 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: devel, Laszlo Ersek, Erdem Aktas, Tom Lendacky, Jiewen Yao,
	Michael Roth, Min Xu, Oliver Steffen

On Mon, 29 Jan 2024 at 13:29, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> Neat when doing ResetVector coding.
> Incompatible with TDX and SEV, therefore not enabled by default.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
> Acked-by: Erdem Aktas <erdemaktas@google.com>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
>  OvmfPkg/ResetVector/QemuDebugCon.asm  | 36 +++++++++++++++++++++++++++
>  OvmfPkg/ResetVector/ResetVector.nasmb |  4 +++
>  2 files changed, 40 insertions(+)
>  create mode 100644 OvmfPkg/ResetVector/QemuDebugCon.asm
>
> diff --git a/OvmfPkg/ResetVector/QemuDebugCon.asm b/OvmfPkg/ResetVector/QemuDebugCon.asm
> new file mode 100644
> index 000000000000..8729fc2ffc0a
> --- /dev/null
> +++ b/OvmfPkg/ResetVector/QemuDebugCon.asm
> @@ -0,0 +1,36 @@
> +;------------------------------------------------------------------------------
> +; @file
> +; qemu debug console support macros (based on serial port macros)
> +;
> +; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
> +; Copyright (c) 2024, Red Hat, Inc.<BR>
> +; SPDX-License-Identifier: BSD-2-Clause-Patent
> +;
> +;------------------------------------------------------------------------------
> +
> +%macro  debugShowCharacter 1
> +    mov     dx, 0x402
> +    mov     al, %1
> +    out     dx, al
> +%endmacro
> +
> +%macro  debugShowHexDigit 1
> +  %if (%1 < 0xa)
> +    debugShowCharacter BYTE ('0' + (%1))
> +  %else
> +    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
> +  %endif
> +%endmacro
> +
> +%macro  debugShowPostCode 1
> +    debugShowHexDigit (((%1) >> 4) & 0xf)
> +    debugShowHexDigit ((%1) & 0xf)
> +    debugShowCharacter `\r`
> +    debugShowCharacter `\n`
> +%endmacro
> +
> +BITS    16
> +
> +%macro  debugInitialize 0
> +    ; not required
> +%endmacro
> diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
> index 5832aaa8abf7..69ce43ef6a96 100644
> --- a/OvmfPkg/ResetVector/ResetVector.nasmb
> +++ b/OvmfPkg/ResetVector/ResetVector.nasmb
> @@ -40,6 +40,10 @@
>    %include "Port80Debug.asm"
>  %elifdef DEBUG_SERIAL
>    %include "SerialDebug.asm"
> +%elif 0
> +; Set ^ this to 1 to enable postcodes on the qemu debug console.
> +; Disabled by default because it is incompatible with SEV and TDX.
> +  %include "QemuDebugCon.asm"
>  %else
>    %include "DebugDisabled.asm"
>  %endif
> --
> 2.43.0
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114730): https://edk2.groups.io/g/devel/message/114730
Mute This Topic: https://groups.io/mt/104029937/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [PATCH v3 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-29 12:29 [edk2-devel] [PATCH v3 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console Gerd Hoffmann
  2024-01-29 18:37 ` Ard Biesheuvel
@ 2024-01-29 20:22 ` Laszlo Ersek
  2024-01-29 21:06 ` Laszlo Ersek
  2 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2024-01-29 20:22 UTC (permalink / raw)
  To: devel, kraxel
  Cc: Erdem Aktas, Tom Lendacky, Jiewen Yao, Ard Biesheuvel,
	Michael Roth, Min Xu, Oliver Steffen

On 1/29/24 13:29, Gerd Hoffmann wrote:
> Neat when doing ResetVector coding.
> Incompatible with TDX and SEV, therefore not enabled by default.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
> Acked-by: Erdem Aktas <erdemaktas@google.com>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/ResetVector/QemuDebugCon.asm  | 36 +++++++++++++++++++++++++++
>  OvmfPkg/ResetVector/ResetVector.nasmb |  4 +++
>  2 files changed, 40 insertions(+)
>  create mode 100644 OvmfPkg/ResetVector/QemuDebugCon.asm
> 
> diff --git a/OvmfPkg/ResetVector/QemuDebugCon.asm b/OvmfPkg/ResetVector/QemuDebugCon.asm
> new file mode 100644
> index 000000000000..8729fc2ffc0a
> --- /dev/null
> +++ b/OvmfPkg/ResetVector/QemuDebugCon.asm
> @@ -0,0 +1,36 @@
> +;------------------------------------------------------------------------------
> +; @file
> +; qemu debug console support macros (based on serial port macros)
> +;
> +; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
> +; Copyright (c) 2024, Red Hat, Inc.<BR>
> +; SPDX-License-Identifier: BSD-2-Clause-Patent
> +;
> +;------------------------------------------------------------------------------
> +
> +%macro  debugShowCharacter 1
> +    mov     dx, 0x402
> +    mov     al, %1
> +    out     dx, al
> +%endmacro
> +
> +%macro  debugShowHexDigit 1
> +  %if (%1 < 0xa)
> +    debugShowCharacter BYTE ('0' + (%1))
> +  %else
> +    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
> +  %endif
> +%endmacro
> +
> +%macro  debugShowPostCode 1
> +    debugShowHexDigit (((%1) >> 4) & 0xf)
> +    debugShowHexDigit ((%1) & 0xf)
> +    debugShowCharacter `\r`
> +    debugShowCharacter `\n`
> +%endmacro
> +
> +BITS    16
> +
> +%macro  debugInitialize 0
> +    ; not required
> +%endmacro
> diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
> index 5832aaa8abf7..69ce43ef6a96 100644
> --- a/OvmfPkg/ResetVector/ResetVector.nasmb
> +++ b/OvmfPkg/ResetVector/ResetVector.nasmb
> @@ -40,6 +40,10 @@
>    %include "Port80Debug.asm"
>  %elifdef DEBUG_SERIAL
>    %include "SerialDebug.asm"
> +%elif 0
> +; Set ^ this to 1 to enable postcodes on the qemu debug console.
> +; Disabled by default because it is incompatible with SEV and TDX.

I'm about to merge this, just a minor nit: as Tom stated originally in
<https://edk2.groups.io/g/devel/message/114350>, this should be
"SEV-ES/SEV-SNP", not SEV. There should be no problem under base SEV.

Sorry for not noticing this earlier; my days are chaos.

Laszlo

> +  %include "QemuDebugCon.asm"
>  %else
>    %include "DebugDisabled.asm"
>  %endif



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114744): https://edk2.groups.io/g/devel/message/114744
Mute This Topic: https://groups.io/mt/104029937/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [PATCH v3 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-29 12:29 [edk2-devel] [PATCH v3 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console Gerd Hoffmann
  2024-01-29 18:37 ` Ard Biesheuvel
  2024-01-29 20:22 ` Laszlo Ersek
@ 2024-01-29 21:06 ` Laszlo Ersek
  2 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2024-01-29 21:06 UTC (permalink / raw)
  To: devel, kraxel
  Cc: Erdem Aktas, Tom Lendacky, Jiewen Yao, Ard Biesheuvel,
	Michael Roth, Min Xu, Oliver Steffen

On 1/29/24 13:29, Gerd Hoffmann wrote:
> Neat when doing ResetVector coding.
> Incompatible with TDX and SEV, therefore not enabled by default.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
> Acked-by: Erdem Aktas <erdemaktas@google.com>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/ResetVector/QemuDebugCon.asm  | 36 +++++++++++++++++++++++++++
>  OvmfPkg/ResetVector/ResetVector.nasmb |  4 +++
>  2 files changed, 40 insertions(+)
>  create mode 100644 OvmfPkg/ResetVector/QemuDebugCon.asm
> 
> diff --git a/OvmfPkg/ResetVector/QemuDebugCon.asm b/OvmfPkg/ResetVector/QemuDebugCon.asm
> new file mode 100644
> index 000000000000..8729fc2ffc0a
> --- /dev/null
> +++ b/OvmfPkg/ResetVector/QemuDebugCon.asm
> @@ -0,0 +1,36 @@
> +;------------------------------------------------------------------------------
> +; @file
> +; qemu debug console support macros (based on serial port macros)
> +;
> +; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
> +; Copyright (c) 2024, Red Hat, Inc.<BR>
> +; SPDX-License-Identifier: BSD-2-Clause-Patent
> +;
> +;------------------------------------------------------------------------------
> +
> +%macro  debugShowCharacter 1
> +    mov     dx, 0x402
> +    mov     al, %1
> +    out     dx, al
> +%endmacro
> +
> +%macro  debugShowHexDigit 1
> +  %if (%1 < 0xa)
> +    debugShowCharacter BYTE ('0' + (%1))
> +  %else
> +    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
> +  %endif
> +%endmacro
> +
> +%macro  debugShowPostCode 1
> +    debugShowHexDigit (((%1) >> 4) & 0xf)
> +    debugShowHexDigit ((%1) & 0xf)
> +    debugShowCharacter `\r`
> +    debugShowCharacter `\n`
> +%endmacro
> +
> +BITS    16
> +
> +%macro  debugInitialize 0
> +    ; not required
> +%endmacro
> diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
> index 5832aaa8abf7..69ce43ef6a96 100644
> --- a/OvmfPkg/ResetVector/ResetVector.nasmb
> +++ b/OvmfPkg/ResetVector/ResetVector.nasmb
> @@ -40,6 +40,10 @@
>    %include "Port80Debug.asm"
>  %elifdef DEBUG_SERIAL
>    %include "SerialDebug.asm"
> +%elif 0
> +; Set ^ this to 1 to enable postcodes on the qemu debug console.
> +; Disabled by default because it is incompatible with SEV and TDX.
> +  %include "QemuDebugCon.asm"
>  %else
>    %include "DebugDisabled.asm"
>  %endif

https://github.com/tianocore/edk2/pull/5319; commit 98c7cb3be73d.

I replaced the "SEV" reference with "SEV-ES/SEV-SNP" in the comment.

Thanks!
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114746): https://edk2.groups.io/g/devel/message/114746
Mute This Topic: https://groups.io/mt/104029937/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

end of thread, other threads:[~2024-01-29 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29 12:29 [edk2-devel] [PATCH v3 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console Gerd Hoffmann
2024-01-29 18:37 ` Ard Biesheuvel
2024-01-29 20:22 ` Laszlo Ersek
2024-01-29 21:06 ` Laszlo Ersek

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