Re: [PATCH v10 5/7] PCI: handle SR-IOV Virtual Function Migration
From: Matthew Wilcox
Date: Fri Mar 06 2009 - 16:14:17 EST
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/