device-assignment: add configfd_name qdev property
commitafe03f7a839698683bb810b6e821d8cb21d0224a
authorChris Wright <chrisw@redhat.com>
Mon, 24 May 2010 16:53:49 +0000 (24 10:53 -0600)
committerMarcelo Tosatti <mtosatti@redhat.com>
Mon, 31 May 2010 20:18:41 +0000 (31 17:18 -0300)
treeb7cad2d9d4a2f3513bce9d14cfba8bf107803c7a
parent92b9dd0ea79bd5f7b1e2544b6b78eacb24d0da45
device-assignment: add configfd_name qdev property

When libvirt launches a guest it first chowns the relevenat
/sys/bus/pci/.../config file for an assigned device then drops privileges.

This causes an issue for device assignment because despite being file
owner, the sysfs config space file checks for CAP_SYS_ADMIN before
allowing access to device dependent config space.

This adds a new qdev configfd property which allows libvirt to open the
sysfs config space file and give qemu an already opened file descriptor.
Along with a change pending for the 2.6.35 kernel, this allows the
capability check to compare against privileges from when the file was
opened.

[alex.williamson: make configfd be a string option so that we can pass a
descriptor from libvirt for the hotplug case]

Signed-off-by: Chris Wright <chrisw@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
hw/device-assignment.c
hw/device-assignment.h