public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: stefano.stabellini@eu.citrix.com
Cc: linux-kernel@vger.kernel.org,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
	Qing He <qing.he@intel.com>,
	Yunhong Jiang <yunhong.jiang@intel.com>,
	xen-devel@lists.xensource.com
Subject: Re: [Xen-devel] [PATCH v4 03/10] xen: remap MSIs into pirqs when running as initial domain
Date: Tue, 19 Oct 2010 16:15:18 -0400	[thread overview]
Message-ID: <20101019201518.GA9727@dumpdata.com> (raw)
In-Reply-To: <1287487038-6643-3-git-send-email-stefano.stabellini@eu.citrix.com>

> +int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
> +{
> +	int irq = -1;
> +	struct physdev_map_pirq map_irq;
> +	int rc;
> +	int pos;
> +	u32 table_offset, bir;
> +
> +	memset(&map_irq, 0, sizeof(map_irq));
> +	map_irq.domid = DOMID_SELF;
> +	map_irq.type = MAP_PIRQ_TYPE_MSI;
> +	map_irq.index = -1;
> +	map_irq.pirq = -1;
> +	map_irq.bus = dev->bus->number;
> +	map_irq.devfn = dev->devfn;
> +
> +	if (type == PCI_CAP_ID_MSIX) {
> +		pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
> +
> +		pci_read_config_dword(dev, msix_table_offset_reg(pos),
> +					&table_offset);
> +		bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
> +
> +		map_irq.table_base = pci_resource_start(dev, bir);
> +		map_irq.entry_nr = msidesc->msi_attrib.entry_nr;
> +	}
> +
> +	spin_lock(&irq_mapping_update_lock);
> +
> +	irq = find_unbound_irq();
> +
> +	if (irq == -1)
> +		goto out;
> +
> +	rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
> +	if (rc) {
> +		printk(KERN_WARNING "xen map irq failed %d\n", rc);
> +
> +		dynamic_irq_cleanup(irq);

Looking at include/linux/irq.h, I see this commment:
 /*
330  * Dynamic irq helper functions. Obsolete. Use irq_alloc_desc* and
331  * irq_free_desc instead.
332  */

So we should use irq_free_desc instead of dynamic_irq_cleanup.
(fyi, I didn't realize this until I started pulling in the sparse_irq
patchset).
> +
> +		irq = -1;
> +		goto out;
> +	}
> +	irq_info[irq] = mk_pirq_info(0, map_irq.pirq, 0, map_irq.index);
> +
> +	set_irq_chip_and_handler_name(irq, &xen_pirq_chip,
> +			handle_level_irq,
> +			(type == PCI_CAP_ID_MSIX) ? "msi-x":"msi");
> +
> +out:
> +	spin_unlock(&irq_mapping_update_lock);
> +	return irq;
> +}
> +#endif
> +

  reply	other threads:[~2010-10-19 20:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19 11:16 [PATCH v4 00/10] xen: initial domain support Stefano Stabellini
2010-10-19 11:17 ` [PATCH v4 01/10] xen: introduce XEN_DOM0 as a silent option stefano.stabellini
2010-10-19 11:17 ` [PATCH v4 02/10] xen: remap GSIs as pirqs when running as initial domain stefano.stabellini
2010-10-19 11:17 ` [PATCH v4 03/10] xen: remap MSIs into " stefano.stabellini
2010-10-19 20:15   ` Konrad Rzeszutek Wilk [this message]
2010-10-19 20:24     ` [Xen-devel] " Konrad Rzeszutek Wilk
2010-10-19 11:17 ` [PATCH v4 04/10] xen: map a dummy page for local apic and ioapic in xen_set_fixmap stefano.stabellini
2010-10-19 11:17 ` [PATCH v4 05/10] xen: use vcpu_ops to setup cpu masks stefano.stabellini
2010-10-19 11:17 ` [PATCH v4 06/10] xen: Initialize xenbus for dom0 stefano.stabellini
2010-10-19 11:17 ` [PATCH v4 07/10] xen: add the direct mapping area for ISA bus access stefano.stabellini
2010-10-19 11:17 ` [PATCH v4 08/10] xen: use host E820 map for dom0 stefano.stabellini
2010-10-19 11:17 ` [PATCH v4 09/10] xen: make hvc_xen console work " stefano.stabellini
2010-10-19 11:17 ` [PATCH v4 10/10] xen: mask the MTRR feature from the cpuid stefano.stabellini
2010-10-19 21:14 ` [PATCH v4 00/10] xen: initial domain support Greg KH
2010-10-19 21:54   ` [Xen-devel] " Jeremy Fitzhardinge
2010-10-19 23:01     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101019201518.GA9727@dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qing.he@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=yunhong.jiang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox