From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 28/31] arm: add fw_cfg to "virt" board
Date: Tue, 23 Dec 2014 13:54:24 +0000 [thread overview]
Message-ID: <1419342867-15527-29-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1419342867-15527-1-git-send-email-peter.maydell@linaro.org>
From: Laszlo Ersek <lersek@redhat.com>
fw_cfg already supports exposure over MMIO (used in ppc/mac_newworld.c,
ppc/mac_oldworld.c, sparc/sun4m.c); we can easily add it to the "virt"
board.
Because MMIO access is slow on ARM KVM, we enable the guest, with
fw_cfg_init_mem_wide(), to transfer up to 8 bytes with a single access.
This has been measured to speed up transfers up to 7.5-fold, relative to
single byte data access, on both ARM KVM and x86_64 TCG.
The MMIO register block of fw_cfg is advertized in the device tree. As
base address we pick 0x09020000, which conforms to the comment preceding
"a15memmap": it falls in the miscellaneous device I/O range 128MB..256MB,
and it is aligned at 64KB. The DTB properties follow the documentation in
the Linux source file "Documentation/devicetree/bindings/arm/fw-cfg.txt".
fw_cfg automatically exports a number of files to the guest; for example,
"bootorder" (see fw_cfg_machine_reset()).
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1419250305-31062-9-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/virt.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a9e13ca..183bf20 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -68,6 +68,7 @@ enum {
VIRT_UART,
VIRT_MMIO,
VIRT_RTC,
+ VIRT_FW_CFG,
};
typedef struct MemMapEntry {
@@ -125,6 +126,7 @@ static const MemMapEntry a15memmap[] = {
[VIRT_GIC_CPU] = { 0x08010000, 0x00010000 },
[VIRT_UART] = { 0x09000000, 0x00001000 },
[VIRT_RTC] = { 0x09010000, 0x00001000 },
+ [VIRT_FW_CFG] = { 0x09020000, 0x0000000a },
[VIRT_MMIO] = { 0x0a000000, 0x00000200 },
/* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */
/* 0x10000000 .. 0x40000000 reserved for PCI */
@@ -537,6 +539,23 @@ static void create_flash(const VirtBoardInfo *vbi)
g_free(nodename);
}
+static void create_fw_cfg(const VirtBoardInfo *vbi)
+{
+ hwaddr base = vbi->memmap[VIRT_FW_CFG].base;
+ hwaddr size = vbi->memmap[VIRT_FW_CFG].size;
+ char *nodename;
+
+ fw_cfg_init_mem_wide(base + 8, base, 8);
+
+ nodename = g_strdup_printf("/fw-cfg@%" PRIx64, base);
+ qemu_fdt_add_subnode(vbi->fdt, nodename);
+ qemu_fdt_setprop_string(vbi->fdt, nodename,
+ "compatible", "qemu,fw-cfg-mmio");
+ qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg",
+ 2, base, 2, size);
+ g_free(nodename);
+}
+
static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
{
const VirtBoardInfo *board = (const VirtBoardInfo *)binfo;
@@ -627,6 +646,8 @@ static void machvirt_init(MachineState *machine)
*/
create_virtio_devices(vbi, pic);
+ create_fw_cfg(vbi);
+
vbi->bootinfo.ram_size = machine->ram_size;
vbi->bootinfo.kernel_filename = machine->kernel_filename;
vbi->bootinfo.kernel_cmdline = machine->kernel_cmdline;
--
1.9.1
next prev parent reply other threads:[~2014-12-23 13:54 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-23 13:53 [Qemu-devel] [PULL 00/31] target-arm queue Peter Maydell
2014-12-23 13:53 ` [Qemu-devel] [PULL 01/31] audio: Don't free hw resources until after hw backend is stopped Peter Maydell
2014-12-23 13:53 ` [Qemu-devel] [PULL 02/31] target-arm: Merge EL3 CP15 register lists Peter Maydell
2014-12-23 13:53 ` [Qemu-devel] [PULL 03/31] machine: remove qemu_machine_opts global list Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 04/31] vl.c: simplified machine_set_property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 05/31] vl.c: add HMP help to machine Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 06/31] target-arm: Add vexpress class and machine types Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 07/31] target-arm: Add vexpress a9 & a15 machine objects Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 08/31] target-arm: Switch to common vexpress machine init Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 09/31] target-arm: Add vexpress machine secure property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 10/31] target-arm: Change vexpress daughterboard init arg Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 11/31] target-arm: Add virt class and machine types Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 12/31] target-arm: Add virt machine secure property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 13/31] target-arm: Add feature unset function Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 14/31] target-arm: Add ARMCPU secure property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 15/31] target-arm: Add arm_boot_info secure_boot control Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 16/31] target-arm: Enable CPU has_el3 prop during VE init Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 17/31] target-arm: Set CPU has_el3 prop during virt init Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 18/31] target-arm: Breakout integratorcp and versatilepb cpu init Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 19/31] target-arm: Disable EL3 on unsupported machines Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 20/31] target-arm: add cpu feature EL3 to CPUs with Security Extensions Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 21/31] fw_cfg: hard separation between the MMIO and I/O port mappings Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 22/31] fw_cfg: move boards to fw_cfg_init_io() / fw_cfg_init_mem() Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 23/31] fw_cfg_mem: max access size and region size are the same for data register Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 24/31] fw_cfg_mem: flip ctl_mem_ops and data_mem_ops to DEVICE_BIG_ENDIAN Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 25/31] exec: allows 8-byte accesses in subpage_ops Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 26/31] fw_cfg_mem: introduce the "data_width" property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 27/31] fw_cfg_mem: expose the "data_width" property with fw_cfg_init_mem_wide() Peter Maydell
2014-12-23 13:54 ` Peter Maydell [this message]
2014-12-23 13:54 ` [Qemu-devel] [PULL 29/31] hw/loader: split out load_image_gzipped_buffer() Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 30/31] hw/arm: pass pristine kernel image to guest firmware over fw_cfg Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 31/31] hw/arm/virt: enable passing of EFI-stubbed kernel to guest UEFI firmware Peter Maydell
2014-12-23 17:46 ` [Qemu-devel] [PULL 00/31] target-arm queue Peter Maydell
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=1419342867-15527-29-git-send-email-peter.maydell@linaro.org \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).