lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <47335DC6.7090603@us.ibm.com>
Date:	Thu, 08 Nov 2007 13:04:38 -0600
From:	Anthony Liguori <aliguori@...ibm.com>
To:	Arnd Bergmann <arnd@...db.de>
CC:	kvm-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
	Rusty Russell <rusty@...tcorp.com.au>,
	virtualization@...ts.osdl.org
Subject: Re: [kvm-devel] [PATCH 3/3] virtio PCI device

Arnd Bergmann wrote:
> On Thursday 08 November 2007, Anthony Liguori wrote:
>   
>> +/* A PCI device has it's own struct device and so does a virtio device so
>> + * we create a place for the virtio devices to show up in sysfs.  I think it
>> + * would make more sense for virtio to not insist on having it's own device. */
>> +static struct device virtio_pci_root = {
>> +       .parent         = NULL,
>> +       .bus_id         = "virtio-pci",
>> +};
>> +
>> +/* Unique numbering for devices under the kvm root */
>> +static unsigned int dev_index;
>> +
>>     
>
> ...
>
>   
>> +/* the PCI probing function */
>> +static int __devinit virtio_pci_probe(struct pci_dev *pci_dev,
>> +                                     const struct pci_device_id *id)
>> +{
>> +       struct virtio_pci_device *vp_dev;
>> +       int err;
>> +
>> +       /* allocate our structure and fill it out */
>> +       vp_dev = kzalloc(sizeof(struct virtio_pci_device), GFP_KERNEL);
>> +       if (vp_dev == NULL)
>> +               return -ENOMEM;
>> +
>> +       vp_dev->pci_dev = pci_dev;
>> +       vp_dev->vdev.dev.parent = &virtio_pci_root;
>>     
>
> If you use 
>
> 	vp_dev->vdev.dev.parent = &pci_dev->dev;
>
> Then there is no need for the special kvm root device, and the actual
> virtio device shows up in a more logical place, under where it is
> really (virtually) attached.
>   

They already show up underneath of the PCI bus.  The issue is that there 
are two separate 'struct device's for each virtio device.  There's the 
PCI device (that's part of the pci_dev structure) and then there's the 
virtio_device one.  I thought that setting the dev.parent of the 
virtio_device struct device would result in having two separate entries 
under the PCI bus directory which would be pretty confusing :-)

Regards,

Anthony Liguori

> 	Arnd <><
>   

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ