Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My problem is that networking devices in my device tree are not very stable so I thought the best way to share a folder between qemu and the host system is mount the same img without cache on both sides but the -hda option on qemu does not make the hd available in /dev/.

Here is the command I run.

./qemu-xilinx/arm-softmmu/qemu-system-arm -M xilinx-zynq-a9 -m 1024 -serial null -serial mon:stdio -dtb resources/devicetree.dtb -kernel resources/zImage -initrd resources.qemu/ramdisk.img -nographic -s

So the question is: is there a way to avoid networking and yet have a shared directory between qemu and the host?

EDIT: I compiled with

./configure --target-list="arm-softmmu,microblazeel-softmmu" --enable-fdt --disable-kvm --enable-virtfs

which should enable anything needed. However when I run

./qemu-xilinx/arm-softmmu/qemu-system-arm -M xilinx-zynq-a9 -m 1024 -serial null -serial mon:stdio -dtb /homes/cperivol/Sandbox/xilinx-zynq-bootstrap/resources/devicetree.dtb -kernel /homes/cperivol/Sandbox/xilinx-zynq-bootstrap/resources/zImage -initrd /homes/cperivol/Sandbox/xilinx-zynq-bootstrap/resources.qemu/ramdisk.img -nographic -s -fsdev local,path=/homes/cperivol/Sandbox/xilinx-zynq-bootstrap/qemu-sandbox/,security_model=passthrough,id=host0 -device virtio-9p-pci,fsdev=host0,mount_tag=host_tag0

or

./qemu-xilinx/arm-softmmu/qemu-system-arm -M xilinx-zynq-a9 -m 1024 -serial null -serial mon:stdio -dtb resources/devicetree.dtb -kernel resources/zImage -initrd resources.qemu/ramdisk.img -nographic -s -virtfs local,path=/homes/cperivol/Sandbox/xilinx-zynq-bootstrap/qemu-sandbox/,mount_tag=host0,security_model=passthrough,id=host0

I get

No 'PCI' bus found for device 'virtio-9p-pci'

Maybe I should also mention that in arm-softmmu/config-devices.mak there is CONFIG_PCI=y, and sure enough the object files of the pci are there in hw/pci.

EDIT2: Looking at the device tree as dumped by qemu the emulated system does not include a PCI bus.

(qemu) info qtree
bus: main-system-bus
  type System
  dev: xlnx.ps7-dev-cfg, id ""
    irq 1
    mmio 00000000f8007000/000000000000011c
  dev: pl330, id ""
    gpio-in 32
    num_chnls = 8
    num_periph_req = 4
    num_events = 16
    mgr_ns_at_rst = 0
    i-cache_len = 4
    num_i-cache_lines = 8
    boot_addr = 0
    INS = 0
    PNS = 0
    data_width = 64
    wr_cap = 8
    wr_q_dep = 16
    rd_cap = 8
    rd_q_dep = 16
    data_buffer_dep = 256
    irq 17
    mmio 00000000f8003000/0000000000001000
  dev: generic-sdhci, id ""
    capareg = 0x5780080
    maxcurr = 0x0
    irq 1
    mmio 00000000e0101000/0000000000000100
  dev: generic-sdhci, id ""
    capareg = 0x5780080
    maxcurr = 0x0
    irq 1
    mmio 00000000e0100000/0000000000000100
  dev: cadence_gem, id ""
    mac = 52:54:00:12:34:56
    vlan = 0
    netdev = hub0port0
    bootindex = -1
    irq 1
    mmio 00000000e000b000/0000000000000640
  dev: cadence_ttc, id ""
    irq 3
    mmio 00000000f8002000/0000000000001000
  dev: cadence_ttc, id ""
    irq 3
    mmio 00000000f8001000/0000000000001000
  dev: cadence_uart, id ""
    irq 1
    mmio 00000000e0001000/0000000000001000
  dev: cadence_uart, id ""
    irq 1
    mmio 00000000e0000000/0000000000001000
  dev: xlnx.ps7-qspi, id ""
    num-busses = 2
    num-ss-bits = 1
    num-txrx-bytes = 4
    irq 3
    mmio 00000000e000d000/0000000000000100
    mmio 00000000fc000000/0000000002000000
    bus: spi1
      type SSI
      dev: n25q128, id ""
        gpio-in 1
    bus: spi0
      type SSI
      dev: n25q128, id ""
        gpio-in 1
  dev: xlnx.ps7-spi, id ""
    num-busses = 1
    num-ss-bits = 4
    num-txrx-bytes = 1
    irq 5
    mmio 00000000e0007000/0000000000000100
    bus: spi0
      type SSI
      dev: n25q128, id ""
        gpio-in 1
      dev: n25q128, id ""
        gpio-in 1
      dev: n25q128, id ""
        gpio-in 1
      dev: n25q128, id ""
        gpio-in 1
  dev: xlnx.ps7-spi, id ""
    num-busses = 1
    num-ss-bits = 4
    num-txrx-bytes = 1
    irq 5
    mmio 00000000e0006000/0000000000000100
    bus: spi0
      type SSI
      dev: n25q128, id ""
        gpio-in 1
      dev: n25q128, id ""
        gpio-in 1
      dev: n25q128, id ""
        gpio-in 1
      dev: n25q128, id ""
        gpio-in 1
  dev: xlnx,ps7-usb, id "zynq-usb-1"
    maxframes = 128
    irq 1
    mmio 00000000e0003000/0000000000001000
    bus: zynq-usb-1.0
      type usb-bus
  dev: xlnx,ps7-usb, id "zynq-usb-0"
    maxframes = 128
    irq 1
    mmio 00000000e0002000/0000000000001000
    bus: zynq-usb-0.0
      type usb-bus
  dev: xlnx.ps7-i2c, id ""
    irq 1
    mmio 00000000e0005000/000000000000002c
    bus: i2c
      type i2c-bus
      dev: pca9548, id ""
        chip-enable = 0
        address = 0
        address-range = 128
        reg = 0
        bus: i2c@7
          type i2c-bus
        bus: i2c@6
          type i2c-bus
        bus: i2c@5
          type i2c-bus
        bus: i2c@4
          type i2c-bus
        bus: i2c@3
          type i2c-bus
          dev: at.24c08, id ""
            size = 1024
            address = 84
            address-range = 4
            reg = 84
          dev: at.24c08, id ""
            size = 1024
            address = 80
            address-range = 4
            reg = 80
        bus: i2c@2
          type i2c-bus
          dev: at.24c08, id ""
            size = 1024
            address = 84
            address-range = 4
            reg = 84
          dev: at.24c08, id ""
            size = 1024
            address = 80
            address-range = 4
            reg = 80
        bus: i2c@1
          type i2c-bus
        bus: i2c@0
          type i2c-bus
  dev: xlnx.ps7-i2c, id ""
    irq 1
    mmio 00000000e0004000/000000000000002c
    bus: i2c
      type i2c-bus
      dev: pca9548, id ""
        chip-enable = 0
        address = 0
        address-range = 128
        reg = 0
        bus: i2c@7
          type i2c-bus
        bus: i2c@6
          type i2c-bus
        bus: i2c@5
          type i2c-bus
        bus: i2c@4
          type i2c-bus
        bus: i2c@3
          type i2c-bus
          dev: at.24c08, id ""
            size = 1024
            address = 84
            address-range = 4
            reg = 84
          dev: at.24c08, id ""
            size = 1024
            address = 80
            address-range = 4
            reg = 80
        bus: i2c@2
          type i2c-bus
          dev: at.24c08, id ""
            size = 1024
            address = 84
            address-range = 4
            reg = 84
          dev: at.24c08, id ""
            size = 1024
            address = 80
            address-range = 4
            reg = 80
        bus: i2c@1
          type i2c-bus
        bus: i2c@0
          type i2c-bus
  dev: arm_mptimer, id ""
    num-cpu = 1
    irq 1
    mmio ffffffffffffffff/0000000000000020
    mmio ffffffffffffffff/0000000000000020
  dev: arm_mptimer, id ""
    num-cpu = 1
    irq 1
    mmio ffffffffffffffff/0000000000000020
    mmio ffffffffffffffff/0000000000000020
  dev: a9-scu, id ""
    num-cpu = 1
    irq 0
    mmio ffffffffffffffff/0000000000000100
  dev: arm_gic, id ""
    gpio-in 96
    num-cpu = 1
    num-irq = 96
    revision = 1
    irq 1
    mmio ffffffffffffffff/0000000000001000
    mmio ffffffffffffffff/0000000000000100
    mmio ffffffffffffffff/0000000000000100
  dev: a9mpcore_priv, id ""
    gpio-in 64
    num-cpu = 1
    num-irq = 96
    irq 1
    mmio 00000000f8f00000/0000000000002000
  dev: xilinx,zynq_slcr, id ""
    irq 0
    mmio 00000000f8000000/0000000000001000
  dev: nand, id ""
    manufacturer_id = 32
    chip_id = 170
    drive = <null>
    irq 0
  dev: cfi.pflash02, id ""
    drive = <null>
    num-blocks = 512
    sector-length = 131072
    width = 1
    mappings = 1
    big-endian = 0
    id0 = 102
    id1 = 34
    id2 = 0
    id3 = 0
    unlock-addr0 = 2730
    unlock-addr1 = 1365
    name = "pl353.pflash"
    irq 0
    mmio ffffffffffffffff/0000000004000000
  dev: arm.pl35x, id ""
    x = 3
    irq 0
    mmio 00000000e000e000/0000000000001000
    mmio 00000000e2000000/0000000001000000
    mmio 00000000e1000000/0000000001000000
share|improve this question
add comment

1 Answer

If the guest has 9p support (like Linux, or of course, Plan 9) and virtio, try adding the following switch.

-virtfs local,path=/path/to/share,mount_tag=host0,security_model=passthrough,id=host0

You may want to change the security_model parameter. See man page, qemu(1) for that. If I recall correctly, mount_tag is what the guest sees, leaving id as a dummy.

Make sure that the path is under the chroot if you are chrooting. It's a path to the directory on the host.

The fstab entry on the guest should look like this.

host0   /wherever    9p      trans=virtio,version=9p2000.L   0 0

Either add that to your fstab, or invoke the appropriate command manually or using your init system, whatever it may be.

share|improve this answer
    
Is the /path/to/share a path to a directory or the image? Also I think it is unrelated: i get qemu-system-arm: -virtfs local,path=/path/to/share,mount_tag=host0,security_model=passthrough,id=host0: Parameter 'driver' expects device type –  fakedrake Aug 6 '13 at 9:10
1  
it's to the directory you want to share. –  pilona Aug 6 '13 at 13:15
    
Also, can you confirm that the version of qemu that you're using has been built with 9p/virtfs support please? See this. –  pilona Aug 6 '13 at 13:19
    
good question, how do I check that? –  fakedrake Aug 6 '13 at 16:35
    
At runtime, from your qemu binary, I wouldn't know. You'd have to check your distribution's build scripts. That is distro-specific. For example, on Arch Linux, it's the flags present and not present, passed to configure, in the PKGBUILD. –  pilona Aug 7 '13 at 4:15
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.