Received: from eggs.gnu.org ([2001:4830:134:3::10]:44461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFXH7-0003us-92 for qemu-devel@nongnu.org; Wed, 15 Jul 2015 20:43:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFXGw-0002Lm-Lw for qemu-devel@nongnu.org; Wed, 15 Jul 2015 20:43:45 -0400 Received: from mail-qk0-x22d.google.com ([2607:f8b0:400d:c09::22d]:34572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFXGw-0002Lf-H9 for qemu-devel@nongnu.org; Wed, 15 Jul 2015 20:43:34 -0400 Received: by qkcl188 with SMTP id l188so40645678qkc.1 for ; Wed, 15 Jul 2015 17:43:33 -0700 (PDT) Date: Wed, 15 Jul 2015 20:43:23 -0400 From: "Gabriel L. Somlo" Message-ID: <20150716004322.GA15850@GLSMBP.INI.CMU.EDU> References: <20150713200936.GK1606@HEDWIG.INI.CMU.EDU> <20150714094346.GR29283@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150714094346.GR29283@redhat.com> Subject: Re: [Qemu-devel] RFC: guest-side retrieval of fw_cfg file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" Cc: matt.fleming@intel.com, mdroth@linux.vnet.ibm.com, jordan.l.justen@intel.com, "Gabriel L. Somlo" , qemu-devel@nongnu.org, gleb@cloudius-systems.com, kraxel@redhat.com, pbonzini@redhat.com, Laszlo Ersek On Tue, Jul 14, 2015 at 10:43:46AM +0100, Richard W.M. Jones wrote: > On Mon, Jul 13, 2015 at 04:09:37PM -0400, Gabriel L. Somlo wrote: > > 3. I'm currently only handling x86 and I/O ports. I could drop the > > fw_cfg_dmi_whitelist and just check the signature, using mmio where > > appropriate, but I don't have a handy-dandy set of VMs for those > > architectures on which I could test. Wondering if that's something > > we should have before I officially try to submit this to the kernel, > > or whether it could wait for a second iteration. > > $ virt-builder --arch armv7l fedora-22 > or: > $ virt-builder --arch aarch64 fedora-22 > then: > $ virt-builder --get-kernel fedora-22.img > > and then boot is using the right qemu command, probably something > like: > > $ qemu-system-arm \ > -M virt,accel=tcg \ > -cpu cortex-a15 \ > -kernel vmlinuz-4.0.4-301.fc22.armv7hl+lpae \ > -initrd initramfs-4.0.4-301.fc22.armv7hl+lpae.img \ > -append "console=ttyAMA0 root=/dev/vda3 ro" \ > -drive file=fedora-22.img,if=none,id=hd \ > -device virtio-blk-device,drive=hd \ > -serial stdio > > The root password is printed in virt-builder output. OK, so I replaced my port i/o with mmio equivalents: -#define FW_CFG_PORT_CTL 0x510 +#define FW_CFG_PORT_CTL (void *)0x09020008 -#define FW_CFG_PORT_DATA 0x511 +#define FW_CFG_PORT_DATA (void *)0x09020000 - outw(select, FW_CFG_PORT_CTL); + writew(select, FW_CFG_PORT_CTL); - inb(FW_CFG_PORT_DATA); + readb(FW_CFG_PORT_DATA); - insb(FW_CFG_PORT_DATA, buf, count); + readsb(FW_CFG_PORT_DATA, buf, count); and managed to build the module for 4.0.4-301.fc22.armv7hl+lpae, but when I attempt to insmod the resulting .ko, I get an oops: "Unable to handle kernel paging request at virtual address 09020008" I grabbed the control and data addresses from qemu's hw/arm/virt.c: a15memmap[VIRT_FW_CFG] is { 0x09020000, 0x0000000a } and used the "fw_cfg_init_mem_wide(base + 8, base, 8)" call to guess that CTL should be DATA + 8 :) I'm probably missing something that'll turn out to be really obvious in retrospect... :) TIA for any clue, --Gabriel