From: "Yang, Sheng" <sheng.yang@intel.com>
To: kvm@vger.kernel.org
Cc: Amit Shah <amit.shah@redhat.com>,
"avi@redhat.com" <avi@redhat.com>,
"muli@il.ibm.com" <muli@il.ibm.com>,
"anthony@codemonkey.ws" <anthony@codemonkey.ws>,
"benami@il.ibm.com" <benami@il.ibm.com>,
"Han, Weidong" <weidong.han@intel.com>,
"Kay, Allen M" <allen.m.kay@intel.com>
Subject: Re: [PATCH 5/7] KVM/userspace: Device Assignment: Support for assigning PCI devices to guests
Date: Fri, 26 Sep 2008 09:34:24 +0800 [thread overview]
Message-ID: <200809260934.25202.sheng.yang@intel.com> (raw)
In-Reply-To: <1222181695-23418-6-git-send-email-amit.shah@redhat.com>
On Tuesday 23 September 2008 22:54:53 Amit Shah wrote:
> +static uint32_t assigned_dev_pci_read_config(PCIDevice *d, uint32_t
> address, + int len)
> +{
> + uint32_t val = 0;
> + int fd, r;
> +
> + if ((address >= 0x10 && address <= 0x24) || address == 0x34 ||
> + address == 0x3c || address == 0x3d) {
> + val = pci_default_read_config(d, address, len);
> + DEBUG("(%x.%x): address=%04x val=0x%08x len=%d\n",
> + (d->devfn >> 3) & 0x1F, (d->devfn & 0x7), address,
> val, + len);
> + return val;
> + }
> +
> + /* vga specific, remove later */
> + if (address == 0xFC)
> + goto do_log;
> +
> + fd = ((AssignedDevice *)d)->real_device.config_fd;
> + r = lseek(fd, address, SEEK_SET);
> + if (r < 0) {
> + fprintf(stderr, "%s: bad seek, errno = %d\n",
> + __func__, errno);
> + return val;
> + }
This read from configuration space method got a little trouble: vender id and
device id read from configuration space directly rather than "vender"
and "device" file in the sysfs. That's cause trouble with some device that
configuration space inconsistent with "vender" and "device" file, e.g. some
fix up by host PCI subsystem in kernel.
Maybe it can be delay a little for a following patch, but we should address
this issue... Maybe we can use libpci? There are more fields than vender and
device got this problem, like "irq".
--
regards
Yang, Sheng
next prev parent reply other threads:[~2008-09-26 1:33 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-23 14:54 [V6] Userspace patches for PCI device assignment Amit Shah
2008-09-23 14:54 ` [PATCH 1/7] KVM/userspace: Device Assignment: Add ioctl wrappers needed for assigning devices Amit Shah
2008-09-23 14:54 ` [PATCH 2/7] qemu: Introduce pci_map_irq to get irq nr from pin number for a PCI device Amit Shah
2008-09-23 14:54 ` [PATCH 3/7] qemu: piix: Introduce functions to get pin number from irq and vice versa Amit Shah
2008-09-23 14:54 ` [PATCH 4/7] qemu: Include hw.h in qemu/hw/isa.h to fix compile issues Amit Shah
2008-09-23 14:54 ` [PATCH 5/7] KVM/userspace: Device Assignment: Support for assigning PCI devices to guests Amit Shah
2008-09-23 14:54 ` [PATCH 6/7] KVM/userspace: Build vtd.c for Intel IOMMU support Amit Shah
2008-09-23 14:54 ` [PATCH 7/7] KVM/userspace: Device Assignment: Support for hot plugging PCI devices Amit Shah
2008-09-23 16:32 ` Anthony Liguori
2008-09-24 4:24 ` Amit Shah
2008-09-23 16:31 ` [PATCH 6/7] KVM/userspace: Build vtd.c for Intel IOMMU support Anthony Liguori
2008-09-24 4:25 ` Amit Shah
2008-09-24 15:08 ` Anthony Liguori
2008-09-23 16:30 ` [PATCH 5/7] KVM/userspace: Device Assignment: Support for assigning PCI devices to guests Anthony Liguori
2008-09-23 18:32 ` Muli Ben-Yehuda
2008-09-23 19:18 ` Anthony Liguori
2008-09-23 19:43 ` Muli Ben-Yehuda
2008-09-23 19:58 ` Anthony Liguori
2008-09-24 4:58 ` Amit Shah
2008-09-24 15:07 ` Anthony Liguori
2008-09-24 17:10 ` Amit Shah
2008-09-25 4:54 ` Yang, Sheng
2008-09-25 5:20 ` Yang, Sheng
2008-09-26 1:34 ` Yang, Sheng [this message]
2008-09-23 16:13 ` [PATCH 4/7] qemu: Include hw.h in qemu/hw/isa.h to fix compile issues Anthony Liguori
2008-09-24 4:27 ` Amit Shah
2008-09-24 11:35 ` Amit Shah
2008-09-24 14:59 ` Anthony Liguori
2008-09-23 16:13 ` [PATCH 3/7] qemu: piix: Introduce functions to get pin number from irq and vice versa Anthony Liguori
2008-09-24 4:28 ` Amit Shah
2008-09-23 16:12 ` [PATCH 2/7] qemu: Introduce pci_map_irq to get irq nr from pin number for a PCI device Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200809260934.25202.sheng.yang@intel.com \
--to=sheng.yang@intel.com \
--cc=allen.m.kay@intel.com \
--cc=amit.shah@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=benami@il.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=muli@il.ibm.com \
--cc=weidong.han@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).