From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zd4nu-00076g-An for qemu-devel@nongnu.org; Fri, 18 Sep 2015 19:10:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zd4nr-0001Eq-5f for qemu-devel@nongnu.org; Fri, 18 Sep 2015 19:10:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zd4nq-0001Ee-Uf for qemu-devel@nongnu.org; Fri, 18 Sep 2015 19:10:51 -0400 References: <1442566703-5091-1-git-send-email-markmb@redhat.com> <1442566729-5133-1-git-send-email-markmb@redhat.com> <1442566729-5133-5-git-send-email-markmb@redhat.com> <55FC712E.2000306@redhat.com> <20150918222454.406f81ae@markmb_rh> From: Laszlo Ersek Message-ID: <55FC99F6.4050005@redhat.com> Date: Sat, 19 Sep 2015 01:10:46 +0200 MIME-Version: 1.0 In-Reply-To: <20150918222454.406f81ae@markmb_rh> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 4/5] Enable fw_cfg DMA interface for ARM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc_Mar=c3=ad?= Cc: Peter Maydell , Drew , Stefan Hajnoczi , qemu-devel@nongnu.org"Richard W.M. Jones" , Kevin O'Connor , Gerd Hoffmann On 09/18/15 22:24, Marc Mar=C3=AD wrote: > On Fri, 18 Sep 2015 22:16:46 +0200 > Laszlo Ersek wrote: >=20 >> On 09/18/15 10:58, Marc Mar=C3=AD wrote: >>> Enable the fw_cfg DMA interface for the ARM virt machine. >>> >>> Based on Gerd Hoffman's initial implementation. >>> >>> Signed-off-by: Marc Mar=C3=AD >>> --- >>> hw/arm/virt.c | 9 +++++---- >>> 1 file changed, 5 insertions(+), 4 deletions(-) >>> >>> diff --git a/hw/arm/virt.c b/hw/arm/virt.c >>> index 3568107..47f4ad3 100644 >>> --- a/hw/arm/virt.c >>> +++ b/hw/arm/virt.c >>> @@ -113,7 +113,7 @@ static const MemMapEntry a15memmap[] =3D { >>> [VIRT_GIC_V2M] =3D { 0x08020000, 0x00001000 }, >>> [VIRT_UART] =3D { 0x09000000, 0x00001000 }, >>> [VIRT_RTC] =3D { 0x09010000, 0x00001000 }, >>> - [VIRT_FW_CFG] =3D { 0x09020000, 0x0000000a }, >>> + [VIRT_FW_CFG] =3D { 0x09020000, 0x00000014 }, >> >> Okay, Laszlo is the hateful reviewer. Sorry about that. I'm late, yes. >> >> But: this says 0x00000014, ie 20 bytes in decimal. I don't think >> that's correct; it should be 0x18 -- 24 bytes in decimal. From patch >> #2: "DMA Address address: Base + 16 (8 bytes)". >=20 > It's not your problem if I don't know how to count. So don't > apologize :). >=20 > And it's better to catch this stupid little mistakes now. Got some good news: with those two fixups in place (register block size corrected, and dma_enabled set via device property), I could test the AAVMF / ArmVirtPkg / patches. On my APM Mustang, downloading a decompressed kernel (14,475,776 bytes), a decompressed initrd (18,177,264), and a cmdline (104 bytes :)), in total 32,653,144 bytes, takes approx. 24 seconds with the 8-byte wide MMIO data register. (Yeah, it's *really* slow.) Using the DMA interface, the same takes about 52 milliseconds, and that still includes one progress message per 1 MB downloaded :) It's a factor of approx. 450. Not bad. Not bad. :) Thanks Laszlo > Thanks > Marc >=20 >> Thanks (and I'm sorry about being late!) >> Laszlo >> >>> [VIRT_MMIO] =3D { 0x0a000000, 0x00000200 }, >>> /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of >>> that size */ [VIRT_PLATFORM_BUS] =3D { 0x0c000000, 0x02000000 }= , >>> @@ -651,13 +651,13 @@ static void create_flash(const VirtBoardInfo >>> *vbi) g_free(nodename); >>> } >>> =20 >>> -static void create_fw_cfg(const VirtBoardInfo *vbi) >>> +static void create_fw_cfg(const VirtBoardInfo *vbi, AddressSpace >>> *as) { >>> hwaddr base =3D vbi->memmap[VIRT_FW_CFG].base; >>> hwaddr size =3D vbi->memmap[VIRT_FW_CFG].size; >>> char *nodename; >>> =20 >>> - fw_cfg_init_mem_wide(base + 8, base, 8, 0, NULL); >>> + fw_cfg_init_mem_wide(base + 8, base, 8, base + 16, as); >>> =20 >>> nodename =3D g_strdup_printf("/fw-cfg@%" PRIx64, base); >>> qemu_fdt_add_subnode(vbi->fdt, nodename); >>> @@ -919,6 +919,7 @@ static void machvirt_init(MachineState *machine) >>> =20 >>> create_fdt(vbi); >>> =20 >>> + >>> for (n =3D 0; n < smp_cpus; n++) { >>> ObjectClass *oc =3D cpu_class_by_name(TYPE_ARM_CPU, >>> cpustr[0]); CPUClass *cc =3D CPU_CLASS(oc); >>> @@ -984,7 +985,7 @@ static void machvirt_init(MachineState *machine) >>> */ >>> create_virtio_devices(vbi, pic); >>> =20 >>> - create_fw_cfg(vbi); >>> + create_fw_cfg(vbi, &address_space_memory); >>> rom_set_fw(fw_cfg_find()); >>> =20 >>> guest_info->smp_cpus =3D smp_cpus; >>> >> >=20