[PATCH 4/4] drivers:pci:hv: New paravirtual PCI front-end for Hyper-V VMs

Jake Oshins jakeo at microsoft.com
Mon Aug 3 19:19:56 UTC 2015


> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx at linutronix.de]
> Sent: Sunday, August 2, 2015 1:47 AM
> To: Jake Oshins <jakeo at microsoft.com>
> Cc: gregkh at linuxfoundation.org; KY Srinivasan <kys at microsoft.com>; LKML
> <linux-kernel at vger.kernel.org>; devel at linuxdriverproject.org;
> olaf at aepfle.de; apw at canonical.com; vkuznets at redhat.com; linux-
> pci at vger.kernel.org; bhelgaas at google.com; x86 at kernel.org; Jiang Liu
> <jiang.liu at linux.intel.com>
> Subject: Re: [PATCH 4/4] drivers:pci:hv: New paravirtual PCI front-end for
> Hyper-V VMs
> 

<snip>

> > +static int hv_msi_domain_ops_prepare(struct irq_domain *domain,
> > +				     struct device *dev, int nvec,
> > +				     msi_alloc_info_t *arg)
> > +{
> > +	struct pci_dev *pdev = to_pci_dev(dev);
> > +	struct msi_desc *desc = first_pci_msi_entry(pdev);
> > +
> > +	memset(arg, 0, sizeof(*arg));
> > +	arg->msi_dev = pdev;
> > +	if (desc->msi_attrib.is_msix) {
> > +		arg->type = X86_IRQ_ALLOC_TYPE_MSIX;
> > +	} else {
> > +		arg->type = X86_IRQ_ALLOC_TYPE_MSI;
> > +		arg->flags |= X86_IRQ_ALLOC_CONTIGUOUS_VECTORS;
> > +	}
> > +
> > +	return 0;
> > +}
> 
> Pretty much a copy of the x86 code, right?
> 
> I wonder whether this MSI infrastructure code would be better
> seperated out and moved to arch/x86/hyperv/msi.c or
> arch/x86/kernel/apic/hvmsi.c. It's small enough to be built in. So all
> you'd need to export is hv_pcie_init_irq_domain and
> hv_pcie_free_irq_domain.
> 
> Thanks,
> 
> 	tglx

Thanks for your review.  I'll respond to all of your feedback and resend.

I do have a question about your last point, though.  If I build this into the kernel, it will need to depend on sending and receiving messages through the hv_vmbus driver, which isn't built in.  It seemed like the indirection and glue code necessary to make that work would be almost as big as this entire implementation (which admittedly isn't very big.)  If you prefer that, I'll do it.  But it would make more sense to me to refactor this a bit more so that functions like the one above are exported rather than putting hv_pcie_init_irq_domain and hv_pcie_free_irq_domain into the kernel itself.  Would that work?

Thanks,
Jake Oshins



More information about the devel mailing list