From: Gerd Hoffmann <kraxel@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
qemu-devel@nongnu.org, mst@redhat.com, pbonzini@redhat.com,
ehabkost@redhat.com, peter.maydell@linaro.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [Qemu-devel] edk2 submodule + binaries (Re: [PATCH V5 2/7] tests/acpi: add pxb/pxb-pcie tests)
Date: Tue, 19 Jul 2016 14:46:32 +0200 [thread overview]
Message-ID: <1468932392.28378.124.camel@redhat.com> (raw)
In-Reply-To: <3d9e3ab4-86ae-40a9-3436-c04eb31dc9fa@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 560 bytes --]
Hi,
> > but not on arm.
> > So that should be fixable without too much effort.
>
> I guess so.
>
> I'll mention though that "just" for passing in the initrd, the DTB
> shouldn't be necessary, at least if the kernel is built with the EFI
> stub. Then "initrd=filename" can be passed on the kernel command line,
> and the EFI stub should load it, using UEFI services, from the same
> directory that the vmlinuz binary (= itself) came from.
Well, the kernel command line is passed via fdt too ...
Anyway, it's working.
cheers,
Gerd
[-- Attachment #2: 0001-arm-lookup-devicetree-via-efi.patch --]
[-- Type: text/x-patch, Size: 2324 bytes --]
From 91c1e9a92a75e34da3aad8184b298654b30cdf6f Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 14 Jul 2016 08:16:06 +0200
Subject: [PATCH 1/2] arm: lookup devicetree via efi
arm64 already does this, arm should support it too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
grub-core/loader/arm/linux.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c
index 5b39f02..106cfc3 100644
--- a/grub-core/loader/arm/linux.c
+++ b/grub-core/loader/arm/linux.c
@@ -221,6 +221,31 @@ failure:
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unable to prepare FDT");
}
+#ifdef GRUB_MACHINE_EFI
+/* from ../arm64/fdt.c */
+static void *
+get_firmware_fdt (void)
+{
+ grub_efi_configuration_table_t *tables;
+ grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
+ void *firmware_fdt = NULL;
+ unsigned int i;
+
+ /* Look for FDT in UEFI config tables. */
+ tables = grub_efi_system_table->configuration_table;
+
+ for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
+ if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_guid)) == 0)
+ {
+ firmware_fdt = tables[i].vendor_table;
+ grub_dprintf ("linux", "found registered FDT @ %p\n", firmware_fdt);
+ break;
+ }
+
+ return firmware_fdt;
+}
+#endif
+
static grub_err_t
linux_boot (void)
{
@@ -237,6 +262,23 @@ linux_boot (void)
(char *) fdt_addr,
(char *) fdt_addr + 1);
+#ifdef GRUB_MACHINE_EFI
+ if (!fdt_valid) {
+ void *ptr = get_firmware_fdt();
+ int size = ptr ? grub_fdt_get_totalsize(ptr) : 0;
+ int extra = grub_strlen (linux_args) + 0x100;
+ if (ptr && size) {
+ fdt_addr = grub_efi_allocate_loader_memory (LINUX_FDT_PHYS_OFFSET, size + extra);
+ if (fdt_addr) {
+ grub_memcpy (fdt_addr, ptr, size);
+ fdt_valid = (fdt_addr && grub_fdt_check_header_nosize (fdt_addr) == 0);
+ grub_dprintf ("loader", "firmware fdt: memcpy(%p, %p, %d)\n",
+ fdt_addr, ptr, size);
+ }
+ }
+ }
+#endif
+
if (!fdt_valid && machine_type == GRUB_ARM_MACHINE_TYPE_FDT)
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
N_("device tree must be supplied (see `devicetree' command)"));
--
1.8.3.1
[-- Attachment #3: 0002-arm-make-room-for-larger-devicetree.patch --]
[-- Type: text/x-patch, Size: 1855 bytes --]
From b311f8043c5718018c6d361092524d74208c458a Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 19 Jul 2016 14:14:26 +0200
Subject: [PATCH 2/2] arm: make room for larger devicetree
"qemu-system-arm -M virt" devicetree is > 64k.
Make sure we have enough space for it.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
grub-core/loader/arm/linux.c | 2 ++
include/grub/arm/linux.h | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/grub-core/loader/arm/linux.c b/grub-core/loader/arm/linux.c
index 106cfc3..5ac0014 100644
--- a/grub-core/loader/arm/linux.c
+++ b/grub-core/loader/arm/linux.c
@@ -49,9 +49,11 @@ typedef void (*kernel_entry_t) (int, unsigned long, void *);
#define LINUX_ZIMAGE_OFFSET 0x24
#define LINUX_ZIMAGE_MAGIC 0x016f2818
+#if 0 /* declared in include/grub/arm/linux.h */
#define LINUX_PHYS_OFFSET (0x00008000)
#define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
#define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
+#endif
static grub_size_t
get_atag_size (grub_uint32_t *atag)
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
index 059dbba..deb8a9c 100644
--- a/include/grub/arm/linux.h
+++ b/include/grub/arm/linux.h
@@ -37,9 +37,9 @@
# include <grub/machine/loader.h>
/* On UEFI platforms - load the images at the lowest available address not
less than *_PHYS_OFFSET from the first available memory location. */
-# define LINUX_PHYS_OFFSET (0x00008000)
+# define LINUX_PHYS_OFFSET (0x00020000)
# define LINUX_INITRD_PHYS_OFFSET (LINUX_PHYS_OFFSET + 0x02000000)
-# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x10000)
+# define LINUX_FDT_PHYS_OFFSET (LINUX_INITRD_PHYS_OFFSET - 0x20000)
static inline grub_addr_t
grub_arm_firmware_get_boot_data (void)
{
--
1.8.3.1
next prev parent reply other threads:[~2016-07-19 12:46 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-17 16:53 [Qemu-devel] [PATCH V5 0/7] pxb: fix 64-bit MMIO allocation Marcel Apfelbaum
2016-07-17 16:53 ` [Qemu-devel] [PATCH V5 1/7] hw/pcie-root-port: Fix PCIe root port initialization Marcel Apfelbaum
2016-07-17 16:53 ` [Qemu-devel] [PATCH V5 2/7] tests/acpi: add pxb/pxb-pcie tests Marcel Apfelbaum
2016-07-18 13:34 ` Igor Mammedov
2016-07-18 14:17 ` Marcel Apfelbaum
2016-07-18 14:54 ` Igor Mammedov
2016-07-18 19:27 ` Marcel Apfelbaum
2016-07-18 17:52 ` Laszlo Ersek
2016-07-18 19:32 ` Marcel Apfelbaum
2016-07-18 20:08 ` Laszlo Ersek
2016-07-19 9:06 ` [Qemu-devel] edk2 submodule + binaries (Re: [PATCH V5 2/7] tests/acpi: add pxb/pxb-pcie tests) Gerd Hoffmann
2016-07-19 9:30 ` Peter Maydell
2016-07-19 10:05 ` Gerd Hoffmann
2016-07-19 10:40 ` Laszlo Ersek
2016-07-19 9:59 ` Laszlo Ersek
2016-07-19 10:13 ` Laszlo Ersek
2016-07-19 10:48 ` Gerd Hoffmann
2016-07-19 11:42 ` Laszlo Ersek
2016-07-19 12:46 ` Gerd Hoffmann [this message]
2016-07-19 14:25 ` Marcel Apfelbaum
2016-07-19 7:34 ` [Qemu-devel] [PATCH V5 2/7] tests/acpi: add pxb/pxb-pcie tests Igor Mammedov
2016-07-19 8:10 ` Marcel Apfelbaum
2016-07-17 16:53 ` [Qemu-devel] [PATCH V5 3/7] hw/pxb: declare pxb devices as not hot-pluggable Marcel Apfelbaum
2016-07-17 16:53 ` [Qemu-devel] [PATCH V5 4/7] hw/acpi: fix a DSDT table issue when a pxb is present Marcel Apfelbaum
2016-07-17 16:53 ` [Qemu-devel] [PATCH V5 5/7] acpi: refactor pxb crs computation Marcel Apfelbaum
2016-07-17 16:53 ` [Qemu-devel] [PATCH V5 6/7] hw/apci: handle 64-bit MMIO regions correctly Marcel Apfelbaum
2016-07-17 16:53 ` [Qemu-devel] [PATCH V5 7/7] tests/acpi: Add pxb/pxb-pcie tests blobs Marcel Apfelbaum
2016-07-19 5:30 ` [Qemu-devel] [PATCH V5 0/7] pxb: fix 64-bit MMIO allocation Marcel Apfelbaum
2016-07-26 18:30 ` Michael S. Tsirkin
2016-07-27 4:27 ` Marcel Apfelbaum
2016-07-27 4:43 ` Michael S. Tsirkin
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-all 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=1468932392.28378.124.camel@redhat.com \
--to=kraxel@redhat.com \
--cc=ard.biesheuvel@linaro.org \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=lersek@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.