[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090307024006.GE3596@kroah.com>
Date: Fri, 6 Mar 2009 18:40:06 -0800
From: Greg KH <greg@...ah.com>
To: Matthew Wilcox <matthew@....cx>
Cc: Yu Zhao <yu.zhao@...el.com>, jbarnes@...tuousgeek.org,
linux-pci@...r.kernel.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, "Randy.Dunlap" <rdunlap@...otime.net>
Subject: Re: [PATCH v10 4/7] PCI: add SR-IOV API for Physical Function
driver
On Fri, Mar 06, 2009 at 01:37:18PM -0700, Matthew Wilcox wrote:
> On Fri, Feb 20, 2009 at 02:54:45PM +0800, Yu Zhao wrote:
> > + virtfn->sysdata = dev->bus->sysdata;
> > + virtfn->dev.parent = dev->dev.parent;
> > + virtfn->dev.bus = dev->dev.bus;
> > + virtfn->devfn = devfn;
> > + virtfn->hdr_type = PCI_HEADER_TYPE_NORMAL;
> > + virtfn->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
> > + virtfn->error_state = pci_channel_io_normal;
> > + virtfn->current_state = PCI_UNKNOWN;
> > + virtfn->is_pcie = 1;
> > + virtfn->pcie_type = PCI_EXP_TYPE_ENDPOINT;
> > + virtfn->dma_mask = 0xffffffff;
> > + virtfn->vendor = dev->vendor;
> > + virtfn->subsystem_vendor = dev->subsystem_vendor;
> > + virtfn->class = dev->class;
>
> There seems to be a certain amount of commonality between this and
> pci_scan_device(). Have you considered trying to make a common helper
> function, or does it not work out well?
>
> > + pci_device_add(virtfn, virtfn->bus);
>
> Greg is probably going to ding you here for adding the device, then
> creating the symlinks. I believe it's now best practice to create the
> symlinks first, so there's no window where userspace can get confused.
If the uevent gets sent before the symlinks are created, it's a bug.
thanks,
greg k-h
--
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