Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753500AbZCFVOR (ORCPT ); Fri, 6 Mar 2009 16:14:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754288AbZCFVN7 (ORCPT ); Fri, 6 Mar 2009 16:13:59 -0500 Received: from palinux.external.hp.com ([192.25.206.14]:52351 "EHLO mail.parisc-linux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751272AbZCFVN6 (ORCPT ); Fri, 6 Mar 2009 16:13:58 -0500 Date: Fri, 6 Mar 2009 14:13:41 -0700 From: Matthew Wilcox To: Yu Zhao 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: <20090306211341.GH25995@parisc-linux.org> References: <1235112888-9524-1-git-send-email-yu.zhao@intel.com> <1235112888-9524-6-git-send-email-yu.zhao@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1235112888-9524-6-git-send-email-yu.zhao@intel.com> User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2032 Lines: 63 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? > + 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. -- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step." -- 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/