Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753895AbZCII14 (ORCPT ); Mon, 9 Mar 2009 04:27:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752194AbZCII1p (ORCPT ); Mon, 9 Mar 2009 04:27:45 -0400 Received: from mga02.intel.com ([134.134.136.20]:47635 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751939AbZCII1o (ORCPT ); Mon, 9 Mar 2009 04:27:44 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.38,328,1233561600"; d="scan'208";a="392797271" Date: Mon, 9 Mar 2009 16:28:47 +0800 From: Yu Zhao To: Matthew Wilcox Cc: "jbarnes@virtuousgeek.org" , "linux-pci@vger.kernel.org" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v10 5/7] PCI: handle SR-IOV Virtual Function Migration Message-ID: <20090309082847.GD4638@yzhao-otc.sh.intel.com> References: <1235112888-9524-1-git-send-email-yu.zhao@intel.com> <1235112888-9524-6-git-send-email-yu.zhao@intel.com> <20090306211341.GH25995@parisc-linux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090306211341.GH25995@parisc-linux.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2121 Lines: 66 On Sat, Mar 07, 2009 at 05:13:41AM +0800, Matthew Wilcox wrote: > On Fri, Feb 20, 2009 at 02:54:46PM +0800, Yu Zhao wrote: > > +static int sriov_migration(struct pci_dev *dev) > > +{ > > + u16 status; > > + struct pci_sriov *iov = dev->sriov; > > + > > + if (!iov->nr_virtfn) > > + return 0; > > + > > + if (!(iov->cap & PCI_SRIOV_CAP_VFM)) > > + return 0; > > + > > + pci_read_config_word(iov->self, iov->pos + PCI_SRIOV_STATUS, &status); > > You passed in dev here, you don't need to use iov->self, right? Will do. > > + if (!(status & PCI_SRIOV_STATUS_VFM)) > > + return 0; > > + > > + schedule_work(&iov->mtask); > > + > > + return 1; > > +} > > > +/** > > + * pci_sriov_migration - notify SR-IOV core of Virtual Function Migration > > + * @dev: the PCI device > > + * > > + * Returns IRQ_HANDLED if the IRQ is handled, or IRQ_NONE if not. > > + * > > + * Physical Function driver is responsible to register IRQ handler using > > + * VF Migration Interrupt Message Number, and call this function when the > > + * interrupt is generated by the hardware. > > + */ > > +irqreturn_t pci_sriov_migration(struct pci_dev *dev) > > +{ > > + if (!dev->sriov) > > + return IRQ_NONE; > > + > > + return sriov_migration(dev) ? IRQ_HANDLED : IRQ_NONE; > > +} > > +EXPORT_SYMBOL_GPL(pci_sriov_migration); > > OK, I think I get it -- you've basically written an interrupt handler > for the driver to call from its interrupt handler. Am I right in > thinking that the reason the driver needs to do the interrupt handler > here is because we don't currently have an interface that looks like: > > int pci_get_msix_interrupt(struct pci_dev *dev, unsigned vector); > > ? If so, we should probably add it; I want it for my MSI-X rewrite > anyway. Right, we really need this function. But I guess we still have to keep the handler in case the PF only has MSI, right? Thanks, Yu -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/