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

Neat when doing ResetVector coding.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 OvmfPkg/ResetVector/DebugCon.asm      | 43 +++++++++++++++++++++++++++
 OvmfPkg/ResetVector/ResetVector.nasmb |  2 +-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 OvmfPkg/ResetVector/DebugCon.asm

diff --git a/OvmfPkg/ResetVector/DebugCon.asm b/OvmfPkg/ResetVector/DebugCon.asm
new file mode 100644
index 000000000000..9c57d1a52c75
--- /dev/null
+++ b/OvmfPkg/ResetVector/DebugCon.asm
@@ -0,0 +1,43 @@
+;------------------------------------------------------------------------------
+; @file
+; qemu debug console support macros (based on serial port macros)
+;
+; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
+; SPDX-License-Identifier: BSD-2-Clause-Patent
+;
+;------------------------------------------------------------------------------
+
+%macro  outToDebugPort 1
+    mov     dx, 0x402
+    mov     al, %1
+    out     dx, al
+%endmacro
+
+%macro  debugShowCharacter 1
+    outToDebugPort %1
+%endmacro
+
+%macro  debugShowHexDigit 1
+  %if (%1 < 0xa)
+    debugShowCharacter BYTE ('0' + (%1))
+  %else
+    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
+  %endif
+%endmacro
+
+%macro  debugNewline 0
+    debugShowCharacter `\r`
+    debugShowCharacter `\n`
+%endmacro
+
+%macro  debugShowPostCode 1
+    debugShowHexDigit (((%1) >> 4) & 0xf)
+    debugShowHexDigit ((%1) & 0xf)
+    debugNewline
+%endmacro
+
+BITS    16
+
+%macro  debugInitialize 0
+    ; not required
+%endmacro
diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
index 5832aaa8abf7..f1655ddfcde3 100644
--- a/OvmfPkg/ResetVector/ResetVector.nasmb
+++ b/OvmfPkg/ResetVector/ResetVector.nasmb
@@ -41,7 +41,7 @@
 %elifdef DEBUG_SERIAL
   %include "SerialDebug.asm"
 %else
-  %include "DebugDisabled.asm"
+  %include "DebugCon.asm"
 %endif
 
 %include "Ia32/SearchForBfvBase.asm"
-- 
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114312): https://edk2.groups.io/g/devel/message/114312
Mute This Topic: https://groups.io/mt/103933942/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] 9+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-24 15:31 [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console Gerd Hoffmann
@ 2024-01-24 16:47 ` Laszlo Ersek
  2024-01-24 19:24   ` Lendacky, Thomas via groups.io
  0 siblings, 1 reply; 9+ messages in thread
From: Laszlo Ersek @ 2024-01-24 16:47 UTC (permalink / raw)
  To: devel, kraxel
  Cc: Jiewen Yao, Erdem Aktas, Ard Biesheuvel, Michael Roth, Min Xu,
	Tom Lendacky, Oliver Steffen

On 1/24/24 16:31, Gerd Hoffmann wrote:
> Neat when doing ResetVector coding.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  OvmfPkg/ResetVector/DebugCon.asm      | 43 +++++++++++++++++++++++++++
>  OvmfPkg/ResetVector/ResetVector.nasmb |  2 +-
>  2 files changed, 44 insertions(+), 1 deletion(-)
>  create mode 100644 OvmfPkg/ResetVector/DebugCon.asm
> 
> diff --git a/OvmfPkg/ResetVector/DebugCon.asm b/OvmfPkg/ResetVector/DebugCon.asm
> new file mode 100644
> index 000000000000..9c57d1a52c75
> --- /dev/null
> +++ b/OvmfPkg/ResetVector/DebugCon.asm
> @@ -0,0 +1,43 @@
> +;------------------------------------------------------------------------------
> +; @file
> +; qemu debug console support macros (based on serial port macros)
> +;
> +; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
> +; SPDX-License-Identifier: BSD-2-Clause-Patent
> +;
> +;------------------------------------------------------------------------------
> +
> +%macro  outToDebugPort 1
> +    mov     dx, 0x402
> +    mov     al, %1
> +    out     dx, al
> +%endmacro
> +
> +%macro  debugShowCharacter 1
> +    outToDebugPort %1
> +%endmacro
> +
> +%macro  debugShowHexDigit 1
> +  %if (%1 < 0xa)
> +    debugShowCharacter BYTE ('0' + (%1))
> +  %else
> +    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
> +  %endif
> +%endmacro
> +
> +%macro  debugNewline 0
> +    debugShowCharacter `\r`
> +    debugShowCharacter `\n`
> +%endmacro
> +
> +%macro  debugShowPostCode 1
> +    debugShowHexDigit (((%1) >> 4) & 0xf)
> +    debugShowHexDigit ((%1) & 0xf)
> +    debugNewline
> +%endmacro
> +
> +BITS    16
> +
> +%macro  debugInitialize 0
> +    ; not required
> +%endmacro
> diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
> index 5832aaa8abf7..f1655ddfcde3 100644
> --- a/OvmfPkg/ResetVector/ResetVector.nasmb
> +++ b/OvmfPkg/ResetVector/ResetVector.nasmb
> @@ -41,7 +41,7 @@
>  %elifdef DEBUG_SERIAL
>    %include "SerialDebug.asm"
>  %else
> -  %include "DebugDisabled.asm"
> +  %include "DebugCon.asm"
>  %endif
>  
>  %include "Ia32/SearchForBfvBase.asm"

(1) How much output does this produce? Trapping to QEMU for every single
character written to the debug console is very slow. If it only produces
a few bytes, that should be OK.

(2) debugInitialize could actually be put to use; the presence of the
QEMU debug console is detectable. We'd need to allocate a single byte
somewhere, detect the console in debugInitialize, save the result in
that byte, then check the byte in debugShowPostCode. Eliminates even
those few (?) traps if there is no debug console configured.

(3) I'm already hating myself for asking about this, but... is there a
way for only customizing debugInitialize and debugShowCharacter? The
rest is common with "SerialDebug.asm", and I wish I hadn't had to review
those (unchanged) macros, they make my eyes bleed :/

Anyway, if you think any of these (or all of these!) means too much
work, I'm OK with the patch going-in as is.

I'm a bit concerned about (1), TBH.

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114331): https://edk2.groups.io/g/devel/message/114331
Mute This Topic: https://groups.io/mt/103933942/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] 9+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-24 16:47 ` Laszlo Ersek
@ 2024-01-24 19:24   ` Lendacky, Thomas via groups.io
  2024-01-24 19:55     ` Lendacky, Thomas via groups.io
  0 siblings, 1 reply; 9+ messages in thread
From: Lendacky, Thomas via groups.io @ 2024-01-24 19:24 UTC (permalink / raw)
  To: Laszlo Ersek, devel, kraxel
  Cc: Jiewen Yao, Erdem Aktas, Ard Biesheuvel, Michael Roth, Min Xu,
	Oliver Steffen

On 1/24/24 10:47, Laszlo Ersek wrote:
> On 1/24/24 16:31, Gerd Hoffmann wrote:
>> Neat when doing ResetVector coding.
>>
>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>> ---
>>   OvmfPkg/ResetVector/DebugCon.asm      | 43 +++++++++++++++++++++++++++
>>   OvmfPkg/ResetVector/ResetVector.nasmb |  2 +-
>>   2 files changed, 44 insertions(+), 1 deletion(-)
>>   create mode 100644 OvmfPkg/ResetVector/DebugCon.asm
>>
>> diff --git a/OvmfPkg/ResetVector/DebugCon.asm b/OvmfPkg/ResetVector/DebugCon.asm
>> new file mode 100644
>> index 000000000000..9c57d1a52c75
>> --- /dev/null
>> +++ b/OvmfPkg/ResetVector/DebugCon.asm
>> @@ -0,0 +1,43 @@
>> +;------------------------------------------------------------------------------
>> +; @file
>> +; qemu debug console support macros (based on serial port macros)
>> +;
>> +; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
>> +; SPDX-License-Identifier: BSD-2-Clause-Patent
>> +;
>> +;------------------------------------------------------------------------------
>> +
>> +%macro  outToDebugPort 1
>> +    mov     dx, 0x402
>> +    mov     al, %1
>> +    out     dx, al
>> +%endmacro
>> +
>> +%macro  debugShowCharacter 1
>> +    outToDebugPort %1
>> +%endmacro
>> +
>> +%macro  debugShowHexDigit 1
>> +  %if (%1 < 0xa)
>> +    debugShowCharacter BYTE ('0' + (%1))
>> +  %else
>> +    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
>> +  %endif
>> +%endmacro
>> +
>> +%macro  debugNewline 0
>> +    debugShowCharacter `\r`
>> +    debugShowCharacter `\n`
>> +%endmacro
>> +
>> +%macro  debugShowPostCode 1
>> +    debugShowHexDigit (((%1) >> 4) & 0xf)
>> +    debugShowHexDigit ((%1) & 0xf)
>> +    debugNewline
>> +%endmacro
>> +
>> +BITS    16
>> +
>> +%macro  debugInitialize 0
>> +    ; not required
>> +%endmacro
>> diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb b/OvmfPkg/ResetVector/ResetVector.nasmb
>> index 5832aaa8abf7..f1655ddfcde3 100644
>> --- a/OvmfPkg/ResetVector/ResetVector.nasmb
>> +++ b/OvmfPkg/ResetVector/ResetVector.nasmb
>> @@ -41,7 +41,7 @@
>>   %elifdef DEBUG_SERIAL
>>     %include "SerialDebug.asm"
>>   %else
>> -  %include "DebugDisabled.asm"
>> +  %include "DebugCon.asm"
>>   %endif
>>   
>>   %include "Ia32/SearchForBfvBase.asm"
> 
> (1) How much output does this produce? Trapping to QEMU for every single
> character written to the debug console is very slow. If it only produces
> a few bytes, that should be OK.
> 
> (2) debugInitialize could actually be put to use; the presence of the
> QEMU debug console is detectable. We'd need to allocate a single byte
> somewhere, detect the console in debugInitialize, save the result in
> that byte, then check the byte in debugShowPostCode. Eliminates even
> those few (?) traps if there is no debug console configured.
> 
> (3) I'm already hating myself for asking about this, but... is there a
> way for only customizing debugInitialize and debugShowCharacter? The
> rest is common with "SerialDebug.asm", and I wish I hadn't had to review
> those (unchanged) macros, they make my eyes bleed :/
> 
> Anyway, if you think any of these (or all of these!) means too much
> work, I'm OK with the patch going-in as is.

My concern would be around SEV-ES/SEV-SNP guest usage. The in and out 
instruction will generate a #VC and would require a #VC handler to be in 
place.

I'm pretty sure this will cause issues for those types of guests, but it 
might be a few days before I can get to it to verify. @Gerd, were you able 
to test this with those types of guests?

Thanks,
Tom

> 
> I'm a bit concerned about (1), TBH.
> 
> Laszlo
> 


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



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

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-24 19:24   ` Lendacky, Thomas via groups.io
@ 2024-01-24 19:55     ` Lendacky, Thomas via groups.io
  2024-01-25  1:43       ` Erdem Aktas via groups.io
  0 siblings, 1 reply; 9+ messages in thread
From: Lendacky, Thomas via groups.io @ 2024-01-24 19:55 UTC (permalink / raw)
  To: Laszlo Ersek, devel, kraxel
  Cc: Jiewen Yao, Erdem Aktas, Ard Biesheuvel, Michael Roth, Min Xu,
	Oliver Steffen

On 1/24/24 13:24, Tom Lendacky wrote:
> On 1/24/24 10:47, Laszlo Ersek wrote:
>> On 1/24/24 16:31, Gerd Hoffmann wrote:
>>> Neat when doing ResetVector coding.
>>>
>>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>>> ---
>>>   OvmfPkg/ResetVector/DebugCon.asm      | 43 +++++++++++++++++++++++++++
>>>   OvmfPkg/ResetVector/ResetVector.nasmb |  2 +-
>>>   2 files changed, 44 insertions(+), 1 deletion(-)
>>>   create mode 100644 OvmfPkg/ResetVector/DebugCon.asm
>>>
>>> diff --git a/OvmfPkg/ResetVector/DebugCon.asm 
>>> b/OvmfPkg/ResetVector/DebugCon.asm
>>> new file mode 100644
>>> index 000000000000..9c57d1a52c75
>>> --- /dev/null
>>> +++ b/OvmfPkg/ResetVector/DebugCon.asm
>>> @@ -0,0 +1,43 @@
>>> +;------------------------------------------------------------------------------
>>> +; @file
>>> +; qemu debug console support macros (based on serial port macros)
>>> +;
>>> +; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
>>> +; SPDX-License-Identifier: BSD-2-Clause-Patent
>>> +;
>>> +;------------------------------------------------------------------------------
>>> +
>>> +%macro  outToDebugPort 1
>>> +    mov     dx, 0x402
>>> +    mov     al, %1
>>> +    out     dx, al
>>> +%endmacro
>>> +
>>> +%macro  debugShowCharacter 1
>>> +    outToDebugPort %1
>>> +%endmacro
>>> +
>>> +%macro  debugShowHexDigit 1
>>> +  %if (%1 < 0xa)
>>> +    debugShowCharacter BYTE ('0' + (%1))
>>> +  %else
>>> +    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
>>> +  %endif
>>> +%endmacro
>>> +
>>> +%macro  debugNewline 0
>>> +    debugShowCharacter `\r`
>>> +    debugShowCharacter `\n`
>>> +%endmacro
>>> +
>>> +%macro  debugShowPostCode 1
>>> +    debugShowHexDigit (((%1) >> 4) & 0xf)
>>> +    debugShowHexDigit ((%1) & 0xf)
>>> +    debugNewline
>>> +%endmacro
>>> +
>>> +BITS    16
>>> +
>>> +%macro  debugInitialize 0
>>> +    ; not required
>>> +%endmacro
>>> diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb 
>>> b/OvmfPkg/ResetVector/ResetVector.nasmb
>>> index 5832aaa8abf7..f1655ddfcde3 100644
>>> --- a/OvmfPkg/ResetVector/ResetVector.nasmb
>>> +++ b/OvmfPkg/ResetVector/ResetVector.nasmb
>>> @@ -41,7 +41,7 @@
>>>   %elifdef DEBUG_SERIAL
>>>     %include "SerialDebug.asm"
>>>   %else
>>> -  %include "DebugDisabled.asm"
>>> +  %include "DebugCon.asm"
>>>   %endif
>>>   %include "Ia32/SearchForBfvBase.asm"
>>
>> (1) How much output does this produce? Trapping to QEMU for every single
>> character written to the debug console is very slow. If it only produces
>> a few bytes, that should be OK.
>>
>> (2) debugInitialize could actually be put to use; the presence of the
>> QEMU debug console is detectable. We'd need to allocate a single byte
>> somewhere, detect the console in debugInitialize, save the result in
>> that byte, then check the byte in debugShowPostCode. Eliminates even
>> those few (?) traps if there is no debug console configured.
>>
>> (3) I'm already hating myself for asking about this, but... is there a
>> way for only customizing debugInitialize and debugShowCharacter? The
>> rest is common with "SerialDebug.asm", and I wish I hadn't had to review
>> those (unchanged) macros, they make my eyes bleed :/
>>
>> Anyway, if you think any of these (or all of these!) means too much
>> work, I'm OK with the patch going-in as is.
> 
> My concern would be around SEV-ES/SEV-SNP guest usage. The in and out 
> instruction will generate a #VC and would require a #VC handler to be in 
> place.
> 
> I'm pretty sure this will cause issues for those types of guests, but it 
> might be a few days before I can get to it to verify. @Gerd, were you able 
> to test this with those types of guests?

Had a meeting get canceled and so got a chance to test this. As I thought, 
this causes SEV-ES/SEV-SNP guest failures.

Thanks,
Tom

> 
> Thanks,
> Tom
> 
>>
>> I'm a bit concerned about (1), TBH.
>>
>> Laszlo
>>


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



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

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-24 19:55     ` Lendacky, Thomas via groups.io
@ 2024-01-25  1:43       ` Erdem Aktas via groups.io
  2024-01-25  7:50         ` Gerd Hoffmann
  0 siblings, 1 reply; 9+ messages in thread
From: Erdem Aktas via groups.io @ 2024-01-25  1:43 UTC (permalink / raw)
  To: Tom Lendacky
  Cc: Laszlo Ersek, devel, kraxel, Jiewen Yao, Ard Biesheuvel,
	Michael Roth, Min Xu, Oliver Steffen

[-- Attachment #1: Type: text/plain, Size: 4871 bytes --]

Same for TDX, I did not run it but it should cause failure
as debugShowPostCode is called OvmfPkg/ResetVector/Ia32/IntelTdx.asm before
actually the #VE handlers are installed.

-Erdem

On Wed, Jan 24, 2024 at 11:55 AM Tom Lendacky <thomas.lendacky@amd.com>
wrote:

> On 1/24/24 13:24, Tom Lendacky wrote:
> > On 1/24/24 10:47, Laszlo Ersek wrote:
> >> On 1/24/24 16:31, Gerd Hoffmann wrote:
> >>> Neat when doing ResetVector coding.
> >>>
> >>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> >>> ---
> >>>   OvmfPkg/ResetVector/DebugCon.asm      | 43
> +++++++++++++++++++++++++++
> >>>   OvmfPkg/ResetVector/ResetVector.nasmb |  2 +-
> >>>   2 files changed, 44 insertions(+), 1 deletion(-)
> >>>   create mode 100644 OvmfPkg/ResetVector/DebugCon.asm
> >>>
> >>> diff --git a/OvmfPkg/ResetVector/DebugCon.asm
> >>> b/OvmfPkg/ResetVector/DebugCon.asm
> >>> new file mode 100644
> >>> index 000000000000..9c57d1a52c75
> >>> --- /dev/null
> >>> +++ b/OvmfPkg/ResetVector/DebugCon.asm
> >>> @@ -0,0 +1,43 @@
> >>>
> +;------------------------------------------------------------------------------
> >>> +; @file
> >>> +; qemu debug console support macros (based on serial port macros)
> >>> +;
> >>> +; Copyright (c) 2008 - 2018, Intel Corporation. All rights
> reserved.<BR>
> >>> +; SPDX-License-Identifier: BSD-2-Clause-Patent
> >>> +;
> >>>
> +;------------------------------------------------------------------------------
> >>> +
> >>> +%macro  outToDebugPort 1
> >>> +    mov     dx, 0x402
> >>> +    mov     al, %1
> >>> +    out     dx, al
> >>> +%endmacro
> >>> +
> >>> +%macro  debugShowCharacter 1
> >>> +    outToDebugPort %1
> >>> +%endmacro
> >>> +
> >>> +%macro  debugShowHexDigit 1
> >>> +  %if (%1 < 0xa)
> >>> +    debugShowCharacter BYTE ('0' + (%1))
> >>> +  %else
> >>> +    debugShowCharacter BYTE ('a' + ((%1) - 0xa))
> >>> +  %endif
> >>> +%endmacro
> >>> +
> >>> +%macro  debugNewline 0
> >>> +    debugShowCharacter `\r`
> >>> +    debugShowCharacter `\n`
> >>> +%endmacro
> >>> +
> >>> +%macro  debugShowPostCode 1
> >>> +    debugShowHexDigit (((%1) >> 4) & 0xf)
> >>> +    debugShowHexDigit ((%1) & 0xf)
> >>> +    debugNewline
> >>> +%endmacro
> >>> +
> >>> +BITS    16
> >>> +
> >>> +%macro  debugInitialize 0
> >>> +    ; not required
> >>> +%endmacro
> >>> diff --git a/OvmfPkg/ResetVector/ResetVector.nasmb
> >>> b/OvmfPkg/ResetVector/ResetVector.nasmb
> >>> index 5832aaa8abf7..f1655ddfcde3 100644
> >>> --- a/OvmfPkg/ResetVector/ResetVector.nasmb
> >>> +++ b/OvmfPkg/ResetVector/ResetVector.nasmb
> >>> @@ -41,7 +41,7 @@
> >>>   %elifdef DEBUG_SERIAL
> >>>     %include "SerialDebug.asm"
> >>>   %else
> >>> -  %include "DebugDisabled.asm"
> >>> +  %include "DebugCon.asm"
> >>>   %endif
> >>>   %include "Ia32/SearchForBfvBase.asm"
> >>
> >> (1) How much output does this produce? Trapping to QEMU for every single
> >> character written to the debug console is very slow. If it only produces
> >> a few bytes, that should be OK.
> >>
> >> (2) debugInitialize could actually be put to use; the presence of the
> >> QEMU debug console is detectable. We'd need to allocate a single byte
> >> somewhere, detect the console in debugInitialize, save the result in
> >> that byte, then check the byte in debugShowPostCode. Eliminates even
> >> those few (?) traps if there is no debug console configured.
> >>
> >> (3) I'm already hating myself for asking about this, but... is there a
> >> way for only customizing debugInitialize and debugShowCharacter? The
> >> rest is common with "SerialDebug.asm", and I wish I hadn't had to review
> >> those (unchanged) macros, they make my eyes bleed :/
> >>
> >> Anyway, if you think any of these (or all of these!) means too much
> >> work, I'm OK with the patch going-in as is.
> >
> > My concern would be around SEV-ES/SEV-SNP guest usage. The in and out
> > instruction will generate a #VC and would require a #VC handler to be in
> > place.
> >
> > I'm pretty sure this will cause issues for those types of guests, but it
> > might be a few days before I can get to it to verify. @Gerd, were you
> able
> > to test this with those types of guests?
>
> Had a meeting get canceled and so got a chance to test this. As I thought,
> this causes SEV-ES/SEV-SNP guest failures.
>
> Thanks,
> Tom
>
> >
> > Thanks,
> > Tom
> >
> >>
> >> I'm a bit concerned about (1), TBH.
> >>
> >> Laszlo
> >>
>


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



[-- Attachment #2: Type: text/html, Size: 6897 bytes --]

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

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-25  1:43       ` Erdem Aktas via groups.io
@ 2024-01-25  7:50         ` Gerd Hoffmann
  2024-01-25 19:47           ` Laszlo Ersek
  0 siblings, 1 reply; 9+ messages in thread
From: Gerd Hoffmann @ 2024-01-25  7:50 UTC (permalink / raw)
  To: Erdem Aktas
  Cc: Tom Lendacky, Laszlo Ersek, devel, Jiewen Yao, Ard Biesheuvel,
	Michael Roth, Min Xu, Oliver Steffen

On Wed, Jan 24, 2024 at 05:43:29PM -0800, Erdem Aktas wrote:
> Same for TDX, I did not run it but it should cause failure
> as debugShowPostCode is called OvmfPkg/ResetVector/Ia32/IntelTdx.asm before
> actually the #VE handlers are installed.
> 
> > Had a meeting get canceled and so got a chance to test this. As I thought,
> > this causes SEV-ES/SEV-SNP guest failures.

Hmm, I guess that pretty much kills the idea.  The first post code is
sent before probing for TDX/SEV happens ...

take care,
  Gerd



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



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

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-25  7:50         ` Gerd Hoffmann
@ 2024-01-25 19:47           ` Laszlo Ersek
  2024-01-26 13:25             ` Gerd Hoffmann
  0 siblings, 1 reply; 9+ messages in thread
From: Laszlo Ersek @ 2024-01-25 19:47 UTC (permalink / raw)
  To: Gerd Hoffmann, Erdem Aktas
  Cc: Tom Lendacky, devel, Jiewen Yao, Ard Biesheuvel, Michael Roth,
	Min Xu, Oliver Steffen

On 1/25/24 08:50, Gerd Hoffmann wrote:
> On Wed, Jan 24, 2024 at 05:43:29PM -0800, Erdem Aktas wrote:
>> Same for TDX, I did not run it but it should cause failure
>> as debugShowPostCode is called OvmfPkg/ResetVector/Ia32/IntelTdx.asm before
>> actually the #VE handlers are installed.
>>
>>> Had a meeting get canceled and so got a chance to test this. As I thought,
>>> this causes SEV-ES/SEV-SNP guest failures.
> 
> Hmm, I guess that pretty much kills the idea.  The first post code is
> sent before probing for TDX/SEV happens ...

Can we salvage it, but make it depend on a minimal source code tweak
(ungating)? Changing a single line for debugging (non-TDX / non-SEV-ES
guests, anyway) is much easier than coming up with this patch from zero,
whenever needed.

Can we add "DebugCon.asm" to the tree, plus a *comment* near

%include "DebugDisabled.asm"

about "DebugCon.asm"?

Thanks!
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114460): https://edk2.groups.io/g/devel/message/114460
Mute This Topic: https://groups.io/mt/103933942/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] 9+ messages in thread

* Re: [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console
  2024-01-25 19:47           ` Laszlo Ersek
@ 2024-01-26 13:25             ` Gerd Hoffmann
  2024-01-29 11:22               ` Laszlo Ersek
  0 siblings, 1 reply; 9+ messages in thread
From: Gerd Hoffmann @ 2024-01-26 13:25 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: Erdem Aktas, Tom Lendacky, devel, Jiewen Yao, Ard Biesheuvel,
	Michael Roth, Min Xu, Oliver Steffen

On Thu, Jan 25, 2024 at 08:47:56PM +0100, Laszlo Ersek wrote:
> On 1/25/24 08:50, Gerd Hoffmann wrote:
> > On Wed, Jan 24, 2024 at 05:43:29PM -0800, Erdem Aktas wrote:
> >> Same for TDX, I did not run it but it should cause failure
> >> as debugShowPostCode is called OvmfPkg/ResetVector/Ia32/IntelTdx.asm before
> >> actually the #VE handlers are installed.
> >>
> >>> Had a meeting get canceled and so got a chance to test this. As I thought,
> >>> this causes SEV-ES/SEV-SNP guest failures.
> > 
> > Hmm, I guess that pretty much kills the idea.  The first post code is
> > sent before probing for TDX/SEV happens ...
> 
> Can we salvage it, but make it depend on a minimal source code tweak
> (ungating)? Changing a single line for debugging (non-TDX / non-SEV-ES
> guests, anyway) is much easier than coming up with this patch from zero,
> whenever needed.
> 
> Can we add "DebugCon.asm" to the tree, plus a *comment* near
> 
> %include "DebugDisabled.asm"
> 
> about "DebugCon.asm"?

Sure, can do that.  I assume the concern about the slowdown is moot if
this requires an source code patch to be enabled?

take care,
  Gerd



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



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

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

On 1/26/24 14:25, Gerd Hoffmann wrote:
> On Thu, Jan 25, 2024 at 08:47:56PM +0100, Laszlo Ersek wrote:
>> On 1/25/24 08:50, Gerd Hoffmann wrote:
>>> On Wed, Jan 24, 2024 at 05:43:29PM -0800, Erdem Aktas wrote:
>>>> Same for TDX, I did not run it but it should cause failure
>>>> as debugShowPostCode is called OvmfPkg/ResetVector/Ia32/IntelTdx.asm before
>>>> actually the #VE handlers are installed.
>>>>
>>>>> Had a meeting get canceled and so got a chance to test this. As I thought,
>>>>> this causes SEV-ES/SEV-SNP guest failures.
>>>
>>> Hmm, I guess that pretty much kills the idea.  The first post code is
>>> sent before probing for TDX/SEV happens ...
>>
>> Can we salvage it, but make it depend on a minimal source code tweak
>> (ungating)? Changing a single line for debugging (non-TDX / non-SEV-ES
>> guests, anyway) is much easier than coming up with this patch from zero,
>> whenever needed.
>>
>> Can we add "DebugCon.asm" to the tree, plus a *comment* near
>>
>> %include "DebugDisabled.asm"
>>
>> about "DebugCon.asm"?
> 
> Sure, can do that.  I assume the concern about the slowdown is moot if
> this requires an source code patch to be enabled?

Yes, absolutely! Since it's not enabled by default, only for dedicated
debugging sessions, the perf hit (if any) should be fine, IMO.

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114684): https://edk2.groups.io/g/devel/message/114684
Mute This Topic: https://groups.io/mt/103933942/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] 9+ messages in thread

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-24 15:31 [edk2-devel] [PATCH 1/1] OvmfPkg/ResetVector: send post codes to qemu debug console Gerd Hoffmann
2024-01-24 16:47 ` Laszlo Ersek
2024-01-24 19:24   ` Lendacky, Thomas via groups.io
2024-01-24 19:55     ` Lendacky, Thomas via groups.io
2024-01-25  1:43       ` Erdem Aktas via groups.io
2024-01-25  7:50         ` Gerd Hoffmann
2024-01-25 19:47           ` Laszlo Ersek
2024-01-26 13:25             ` Gerd Hoffmann
2024-01-29 11:22               ` Laszlo Ersek

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