public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Anthony PERARD <anthony.perard@citrix.com>, devel@edk2.groups.io
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Julien Grall <julien@xen.org>
Subject: Re: [PATCH 2/2] OvmfPkg/OvmfXen: Introduce XenDebugLibIoPort
Date: Tue, 21 Apr 2020 15:54:26 +0200	[thread overview]
Message-ID: <fb0fc9ed-eb03-8b30-57a7-fde17f7e20f6@redhat.com> (raw)
In-Reply-To: <20200420162918.2312514-3-anthony.perard@citrix.com>

On 04/20/20 18:29, Anthony PERARD wrote:
> Introduce XenDebugLibIoPort which is enabled with
> DEBUG_ON_HYPERVISOR_CONSOLE which send the debug output to Xen's
> console.
> 
> It's a copy PlatformDebugLibIoPort which always write to the IO port.
> It works with both Xen HVM guest and Xen PVH guest whereas the default
> PlatformDebugLibIoPort works only in HVM when QEMU is present.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> 
> Notes:
>     Do you think it would be better to introduce a PCD to
>     PlatformDebugLibIoPort where we can disable the check
>     for the debug port and simply always write to it?
> 
>  OvmfPkg/OvmfXen.dsc                           | 13 ++++++++++++
>  .../PlatformDebugLibIoPort.inf                |  6 +++---
>  .../DebugLibDetect.h                          | 20 -------------------
>  .../DebugLib.c                                | 16 ---------------
>  .../DebugLibDetect.c                          | 20 ++-----------------
>  5 files changed, 18 insertions(+), 57 deletions(-)
>  copy OvmfPkg/Library/{PlatformDebugLibIoPort => XenDebugLibIoPort}/PlatformDebugLibIoPort.inf (76%)
>  copy OvmfPkg/Library/{PlatformDebugLibIoPort => XenDebugLibIoPort}/DebugLibDetect.h (57%)
>  copy OvmfPkg/Library/{PlatformDebugLibIoPort => XenDebugLibIoPort}/DebugLib.c (94%)
>  copy OvmfPkg/Library/{PlatformDebugLibIoPort => XenDebugLibIoPort}/DebugLibDetect.c (61%)

I think this approach is a good first approximation, but I think we can
refine it.

Rather than introducing a new directory, we should operate within
"OvmfPkg/Library/PlatformDebugLibIoPort".

(1) Please write a patch that replaces all instances of the string
"QEMU" with "hypervisor" in the following files:
- DebugLib.c
- DebugLibDetect.c
- DebugLibDetect.h
- DebugLibDetectRom.c

(2) Please write a patch for the following:

- move the PlatformDebugLibIoPortDetect() function definition to a
separate file called "DebugIoPortQemu.c",

- add the new C file to both existent INF files:
  - PlatformDebugLibIoPort.inf
  - PlatformRomDebugLibIoPort.inf
  (keep the source file lists alphabetically sorted)

- from "DebugLibDetect.h", move the BOCHS_DEBUG_PORT_MAGIC macro
definition to "DebugIoPortQemu.c".


I think this patch can be called:

  OvmfPkg/PlatformDebugLibIoPort: factor out debug port detection


After this patch, we well have two independent dimensions, for any
particular INF file:

- in PlatformDebugLibIoPortFound(), the library instance may or may not
cache the result of debug port checking

- in PlatformDebugLibIoPortDetect(), the library instance may abstract
the debug port detection method


(3) Please write another patch:
- introduce "DebugIoPortNocheck.c",
- implement PlatformDebugLibIoPortDetect() as "return TRUE",
- introduce a new INF file "PlatformRomDebugLibIoPortNocheck.inf", for
linking together:
  - DebugIoPortNocheck.c
  - DebugLib.c
  - DebugLibDetectRom.c

This library instance will not cache the result of the detection, and
the detection will return constant TRUE.

(4) Then, this library instance can be put to use in OvmfXen.dsc
(together with setting the proper PCD value). The library instance can
be used in all firmware phases / module types.

Thanks,
Laszlo


  reply	other threads:[~2020-04-21 13:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 16:29 [PATCH 0/2] OvmfXen: Cleanup debug options Anthony PERARD
2020-04-20 16:29 ` [PATCH 1/2] OvmfPkg/OvmfXen: Remove DEBUG_ON_SERIAL_PORT Anthony PERARD
2020-04-21 13:22   ` Laszlo Ersek
2020-04-20 16:29 ` [PATCH 2/2] OvmfPkg/OvmfXen: Introduce XenDebugLibIoPort Anthony PERARD
2020-04-21 13:54   ` Laszlo Ersek [this message]
2020-04-22 10:18     ` Anthony PERARD
2020-04-22 16:10       ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb0fc9ed-eb03-8b30-57a7-fde17f7e20f6@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox