[SeaBIOS] [PATCH] Preserve Xen DebugOutputPort
xen_preinit() runs early and changes DebugOutputPort. qemu_preinit() runs soon after. inb on DebugOutputPort doesn't work on Xen, so the check will always fail and DebugOutputPort will be cleared to 0 disabling output. Quick exit the function when running on Xen to preserve the modified DebugOutputPort. Signed-off-by: Jason Andryuk --- src/hw/serialio.c | 4 1 file changed, 4 insertions(+) diff --git a/src/hw/serialio.c b/src/hw/serialio.c index 3163344..c6297bc 100644 --- a/src/hw/serialio.c +++ b/src/hw/serialio.c @@ -106,6 +106,10 @@ u16 DebugOutputPort VARFSEG = 0x402; void qemu_debug_preinit(void) { +/* Xen already overrode DebugOutputPort in xen_preinit(). */ +if (runningOnXen()) +return; + /* Check if the QEMU debug output port is active */ if (CONFIG_DEBUG_IO && inb(GET_GLOBAL(DebugOutputPort)) != QEMU_DEBUGCON_READBACK) -- 2.25.1 ___ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-le...@seabios.org
[SeaBIOS] Re: [PATCH] Preserve Xen DebugOutputPort
On Mon, Jun 22, 2020 at 8:40 PM Kevin O'Connor wrote: > > On Tue, Jun 16, 2020 at 10:31:17PM -0400, Jason Andryuk wrote: > > xen_preinit() runs early and changes DebugOutputPort. qemu_preinit() runs > > soon after. inb on DebugOutputPort doesn't work on Xen, so the check > > will always fail and DebugOutputPort will be cleared to 0 disabling > > output. > > > > Quick exit the function when running on Xen to preserve the modified > > DebugOutputPort. > > > > Signed-off-by: Jason Andryuk > > --- > > src/hw/serialio.c | 4 > > 1 file changed, 4 insertions(+) > > > > diff --git a/src/hw/serialio.c b/src/hw/serialio.c > > index 3163344..c6297bc 100644 > > --- a/src/hw/serialio.c > > +++ b/src/hw/serialio.c > > @@ -106,6 +106,10 @@ u16 DebugOutputPort VARFSEG = 0x402; > > void > > qemu_debug_preinit(void) > > { > > +/* Xen already overrode DebugOutputPort in xen_preinit(). */ > > +if (runningOnXen()) > > +return; > > Thanks. The code looks fine to me. However, I find the comment > confusing as this function only checks if output is enabled - it > doesn't check the validity of the port itself. Perhaps a comment like > "Xen doesn't support checking if debug output is active". Sure, I can change it. The other part I was trying to convey is that even though Xen uses QEMU, and this function is prefixed with qemu_, DebugOutputPort is different and cannot be checked. Since DebugOutputPort is set right above this function, a reader may not expect it to have changed. Having said that, your wording clearly explains why Xen is leaving this function early. Thanks, Jason ___ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-le...@seabios.org
[SeaBIOS] Re: [PATCH v2] Preserve Xen DebugOutputPort
On Wed, Jun 24, 2020 at 11:46 AM Kevin O'Connor wrote: > > On Wed, Jun 24, 2020 at 10:25:13AM -0400, Jason Andryuk wrote: > > xen_preinit() runs early and changes DebugOutputPort. qemu_preinit() runs > > soon after. inb on DebugOutputPort doesn't work on Xen, so the check > > will always fail and DebugOutputPort will be cleared to 0 disabling > > output. > > > > Quick exit the function when running on Xen to preserve the modified > > DebugOutputPort. > > Thanks - I committed this change. Thank you! -Jason ___ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-le...@seabios.org
[SeaBIOS] [PATCH v2] Preserve Xen DebugOutputPort
xen_preinit() runs early and changes DebugOutputPort. qemu_preinit() runs soon after. inb on DebugOutputPort doesn't work on Xen, so the check will always fail and DebugOutputPort will be cleared to 0 disabling output. Quick exit the function when running on Xen to preserve the modified DebugOutputPort. Signed-off-by: Jason Andryuk v2 Re-word comment --- src/hw/serialio.c | 4 1 file changed, 4 insertions(+) diff --git a/src/hw/serialio.c b/src/hw/serialio.c index 3163344..fa663b9 100644 --- a/src/hw/serialio.c +++ b/src/hw/serialio.c @@ -106,6 +106,10 @@ u16 DebugOutputPort VARFSEG = 0x402; void qemu_debug_preinit(void) { +/* Xen doesn't support checking if debug output is active. */ +if (runningOnXen()) +return; + /* Check if the QEMU debug output port is active */ if (CONFIG_DEBUG_IO && inb(GET_GLOBAL(DebugOutputPort)) != QEMU_DEBUGCON_READBACK) -- 2.25.1 ___ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-le...@seabios.org
[SeaBIOS] Seabios Xen TPM check
Hi, SeaBIOS commit 67643955c746 (make SeaBios compatible with Xen vTPM.) made tpm_start() exit before calling tpm_startup(). The commit message has no explanation why this change was made. Does anyone remember why it was made? The code today means SeaBIOS will not populate PCRs when running on Xen. If I revert the patch, SeaBIOS populates PCRs as one would expect. This is with a QEMU-emulated TPM backed by swtpm in TPM 1.2 mode (qemu & swtpm running in a linux stubdom). Any insight is appreciated. Thanks, Jason ___ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-le...@seabios.org
[SeaBIOS] Re: Seabios Xen TPM check
On Thu, Jun 11, 2020 at 10:32 AM Stefan Berger wrote: > > On 6/11/20 8:36 AM, Jason Andryuk wrote: > > Hi, > > > > SeaBIOS commit 67643955c746 (make SeaBios compatible with Xen vTPM.) > > made tpm_start() exit before calling tpm_startup(). The commit > > message has no explanation why this change was made. Does anyone > > remember why it was made? > > > > The code today means SeaBIOS will not populate PCRs when running on > > Xen. If I revert the patch, SeaBIOS populates PCRs as one would > > expect. This is with a QEMU-emulated TPM backed by swtpm in TPM 1.2 > > mode (qemu & swtpm running in a linux stubdom). > > > > Any insight is appreciated. > > My guess would be that for some reason the TPM 1.2 was already started > up through other means and didn't need the SeaBIOS tpm_startup() to run. Hmmm, yes. Thanks, Stefan. The mini-os vtpm stubdom calls TPM_Startup and it looks like the Berlios tpm_emulator returns an error when called twice. >From a little bit of googling, Quan and Emil (added to CC) were working on an interface from QEMU to the vtpm stubdom, but it looks like it didn't get merged into upstream QEMU? It doesn't seem to be there now. Anyway, the mini-os vtpm stubdom calls TPM_Startup since a PV guest doesn't have firmware to make the call. SeaBIOS could make a tpm_startup error non-fatal for Xen. Or better - detect a vtpm stubdom and only then skip initialization. vtpm stubdom could also be changed to skip TPM_Startup for HVM - not sure if that would be problematic. That would let SeaBIOS drop the Xen condition. Regards, Jason ___ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-le...@seabios.org