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
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to