Bug 860418

Summary: create_userspace_phys_mem & assigned_dev_iomem_map - when device passed through
Product: Red Hat Enterprise Linux 6 Reporter: lejeczek <peljasz>
Component: qemu-kvmAssignee: Alex Williamson <alex.williamson>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, areis, armbru, bsarathy, cchen, chayang, dyasny, juzhang, mkenneth, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-27 00:28:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description lejeczek 2012-09-25 19:12:54 UTC
Description of problem:

/usr/libexec/qemu-kvm -rtc base=localtime -m 4g -smp cores=4 -nographic -drive file=work5-win7_64.img,index=0,media=disk -vnc 192.168.2.103:10 -monitor tcp::5911,server,nowait,nodelay -net tap,name=tap,vlan=0,ifname=tap0,script=no,downscript=no -net nic,macaddr=52:54:00:12:34:81,model=e1000 -device pci-assign,host=25:00.0

fails with:

create_userspace_phys_mem: File exists
assigned_dev_iomem_map: Error: create new mapping failed

works if device is passed later with:
device_add


Version-Release number of selected component (if applicable):

qemu-kvm-tools-0.12.1.2-2.295.el6_3.2.x86_64
qemu-kvm-0.12.1.2-2.295.el6_3.2.x86_64
qemu-img-0.12.1.2-2.295.el6_3.2.x86_64
gpxe-roms-qemu-0.9.7-6.9.el6.noarch

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 2 lejeczek 2012-09-26 10:02:36 UTC
seems that seabios-0.6.2-3.el6.x86_64(which is not in repositories at this moment) helps, but! how to passtrhough VGA on 6.3 Santiago?
does it even work?

Comment 3 Alex Williamson 2012-09-27 00:28:10 UTC
Assignment of VGA devices is not currently supported.

Comment 4 lejeczek 2012-09-27 14:08:05 UTC
understand that it may never be officially supported,
however I fidlle with it all with some success, but becase I'am a newbie and cannot read the code I can't figure out how to get hold of values for:

pci-assign.host=pci-hostaddr
pci-assign.iommu=uint32
pci-assign.bootindex=int32
pci-assign.configfd=string
pci-assign.addr=pci-devfn
pci-assign.romfile=string
pci-assign.rombar=uint32
pci-assign.multifunction=on/off

any user-friendly docs on it?

Comment 5 Markus Armbruster 2012-10-02 14:10:58 UTC
Context: the "equations" in comment#4 are output of "-device pci-assign,\?", which lists the properties of device model "pci-assign".

Unfortunately, upstream QEMU documentation on device properties is very, very sparse in general.  For RHEL, the recommended way to configure guests is libvirt.  Deficiencies of upstream QEMU documents don't apply there.

If you want to play with unsupported functionality of qemu-kvm, you're on your own.  But nice questions deserve nice answers, so here goes.

Three properties are common to all device models, and not listed: id, driver, bus.  Properties addr, romfile, rombar, multifunction are common to all PCI device models.  The rest are specific to pci-assign. Here's how I understand them:

* id lets you give the device a unique name, for use with device_del and so forth.

* driver is the name of the device model.  "-device pci-assign" is actually shorthand for "-device driver=pci-assign".

* bus lets you pick a non-default bus for the device.  Not relevant for PCI devices, because there's just one PCI bus, called pci.0.

* addr is the device's PCI address as it appears in the guest.

* romfile and rombar let you set up an option ROM.  The former names a file containing the ROM image.  If the latter is zero, the ROM is created the old-fashioned way, for backward compatibility.

* multifunction lets you define PCI devices consisting of multiple functions.  If the physical device you want to assign has multiple functions, you need to assign all functions to the same guest, with multifunction=on (as far as I know).

* host is the PCI address of the host device to assign.

* iommu=0 permits assignment without use of an IOMMU.  This can compromise isolation, if I remember correctly.

* bootindex controls bootorder.  Not applicable to VGA.

* configfd lets you pass in sysfs config file as a file descriptor, so you can run qemu-kvm with fewer privileges.  No need to worry about when exploring stuff.