From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>, devel@edk2.groups.io
Cc: Jordan Justen <jordan.l.justen@intel.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Pawel Polawski <ppolawsk@redhat.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>
Subject: Re: [PATCH v3 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg
Date: Mon, 13 Dec 2021 10:33:55 +0100 [thread overview]
Message-ID: <8f133fbe-34ae-bd0a-3dd0-b249b3ce215b@redhat.com> (raw)
In-Reply-To: <20211213081658.3535809-3-kraxel@redhat.com>
On 12/13/21 09:16, Gerd Hoffmann wrote:
> Needed for hardware detection: virtio-mmio devices for now,
> later also pcie root bridge.
>
> Depends on patched qemu which actually provides an fdt:
> https://gitlab.com/kraxel/qemu/-/commits/sirius/microvm-device-tree
Link returns 404.
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=3689
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> OvmfPkg/PlatformPei/PlatformPei.inf | 1 +
> OvmfPkg/PlatformPei/Platform.c | 45 +++++++++++++++++++++++++++++
> 2 files changed, 46 insertions(+)
>
> diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf
> index 1c56ba275835..8ef404168c45 100644
> --- a/OvmfPkg/PlatformPei/PlatformPei.inf
> +++ b/OvmfPkg/PlatformPei/PlatformPei.inf
> @@ -44,6 +44,7 @@ [Packages]
>
> [Guids]
> gEfiMemoryTypeInformationGuid
> + gFdtHobGuid
>
> [LibraryClasses]
> BaseLib
> diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
> index 906f64615de7..c9ec1d7e99fb 100644
> --- a/OvmfPkg/PlatformPei/Platform.c
> +++ b/OvmfPkg/PlatformPei/Platform.c
> @@ -321,6 +321,50 @@ PciExBarInitialization (
> );
> }
>
> +VOID
> +MicrovmInitialization (
> + VOID
> + )
> +{
> + FIRMWARE_CONFIG_ITEM FdtItem;
> + UINTN FdtSize;
> + UINTN FdtPages;
> + EFI_STATUS Status;
> + UINT64 *FdtHobData;
> + VOID *NewBase;
> +
> + Status = QemuFwCfgFindFile ("etc/fdt", &FdtItem, &FdtSize);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_INFO, "%a: no etc/fdt found in fw_cfg\n", __FUNCTION__));
> + return;
> + }
> +
> + FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
> + NewBase = AllocatePages (FdtPages);
> + if (NewBase == NULL) {
> + DEBUG ((DEBUG_INFO, "%a: AllocatePages failed\n", __FUNCTION__));
> + return;
> + }
> +
> + QemuFwCfgSelectItem (FdtItem);
> + QemuFwCfgReadBytes (FdtSize, NewBase);
> +
> + FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData));
> + if (FdtHobData == NULL) {
> + DEBUG ((DEBUG_INFO, "%a: BuildGuidHob failed\n", __FUNCTION__));
FreePages (NewBase)?
Otherwise:
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
> + return;
> + }
> +
> + DEBUG ((
> + DEBUG_INFO,
> + "%a: fdt at 0x%x (size %d)\n",
> + __FUNCTION__,
> + NewBase,
> + FdtSize
> + ));
> + *FdtHobData = (UINTN)NewBase;
> +}
> +
> VOID
> MiscInitialization (
> VOID
> @@ -368,6 +412,7 @@ MiscInitialization (
> break;
> case 0xffff: /* microvm */
> DEBUG ((DEBUG_INFO, "%a: microvm\n", __FUNCTION__));
> + MicrovmInitialization ();
> PcdStatus = PcdSet16S (
> PcdOvmfHostBridgePciDevId,
> MICROVM_PSEUDO_DEVICE_ID
>
next prev parent reply other threads:[~2021-12-13 9:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 8:16 [PATCH v3 0/5] OvmfPkg/Microvm: second batch of microvm patches Gerd Hoffmann
2021-12-13 8:16 ` [PATCH v3 1/5] OvmfPkg/Microvm/fdt: add device tree support Gerd Hoffmann
2021-12-13 9:38 ` Philippe Mathieu-Daudé
2021-12-13 8:16 ` [PATCH v3 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg Gerd Hoffmann
2021-12-13 9:33 ` Philippe Mathieu-Daudé [this message]
2021-12-13 11:21 ` Gerd Hoffmann
2021-12-13 9:43 ` [edk2-devel] " Ard Biesheuvel
2021-12-13 11:26 ` Gerd Hoffmann
2021-12-13 11:30 ` Ard Biesheuvel
2021-12-13 8:16 ` [PATCH v3 3/5] OvmfPkg/Microvm/fdt: add empty fdt Gerd Hoffmann
2021-12-13 9:35 ` Philippe Mathieu-Daudé
2021-12-13 8:16 ` [PATCH v3 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support Gerd Hoffmann
2021-12-13 9:38 ` Philippe Mathieu-Daudé
2021-12-13 8:16 ` [PATCH v3 5/5] OvmfPkg/Microvm: add README Gerd Hoffmann
2021-12-13 9:37 ` Philippe Mathieu-Daudé
2021-12-13 12:18 ` [PATCH v3 0/5] OvmfPkg/Microvm: second batch of microvm patches Ard Biesheuvel
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=8f133fbe-34ae-bd0a-3dd0-b249b3ce215b@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