WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Re: [PATCH 12/12] xen: events: remove dom0 specific xen_

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [PATCH 12/12] xen: events: remove dom0 specific xen_create_msi_irq
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Fri, 18 Feb 2011 17:06:55 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Fri, 18 Feb 2011 09:08:00 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1298048424.16356.3641.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <1298047386.16356.3620.camel@xxxxxxxxxxxxxxxxxxxxxx> <1298047417-7445-12-git-send-email-ian.campbell@xxxxxxxxxx> <1298048424.16356.3641.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, 2011-02-18 at 17:00 +0000, Ian Campbell wrote:
> On Fri, 2011-02-18 at 16:43 +0000, Ian Campbell wrote:
> > The function name does not distinguish it from xen_allocate_pirq_msi
> > (which operates on domU and pvhvm domains rather than dom0).
> > 
> > Hoist domain 0 specific functionality up into the only caller leaving
> > functionality common to all guest types in xen_bind_pirq_msi_to_irq.
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> 
> I missed a "guilt refresh" which added this small patch:
> diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
> index 513209a..1e72960 100644
> --- a/arch/x86/pci/xen.c
> +++ b/arch/x86/pci/xen.c
> @@ -223,6 +223,7 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev 
> *dev, int nvec, int type)
>               if (ret < 0)
>                       goto out;
>       }
> +     ret = 0;
>  out:
>       return ret;
>  }
> 
> Complete thing:

Forgot to refresh again ;-0

>From f06a411e497bd3310458e539a5144b937697f2ad Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 18 Feb 2011 17:06:18 +0000
Subject: [PATCH] xen: events: remove dom0 specific xen_create_msi_irq

The function name does not distinguish it from xen_allocate_pirq_msi
(which operates on domU and pvhvm domains rather than dom0).

Hoist domain 0 specific functionality up into the only caller leaving
functionality common to all guest types in xen_bind_pirq_msi_to_irq.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 arch/x86/pci/xen.c   |   45 ++++++++++++++++++++++++++++++++++++++++-----
 drivers/xen/events.c |   41 -----------------------------------------
 include/xen/events.h |    1 -
 3 files changed, 40 insertions(+), 47 deletions(-)

diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 1a8133a..1e72960 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -182,15 +182,50 @@ static void xen_teardown_msi_irq(unsigned int irq)
 #ifdef CONFIG_XEN_DOM0
 static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
-       int irq;
+       int ret = 0;
        struct msi_desc *msidesc;
 
        list_for_each_entry(msidesc, &dev->msi_list, list) {
-               irq = xen_create_msi_irq(dev, msidesc, type);
-               if (irq < 0)
-                       return -1;
+               struct physdev_map_pirq map_irq;
+
+               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) {
+                       int pos;
+                       u32 table_offset, bir;
+
+                       pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
+
+                       pci_read_config_dword(dev, pos + PCI_MSIX_TABLE,
+                                             &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;
+               }
+
+               ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
+               if (ret) {
+                       dev_warn(&dev->dev, "xen map irq failed %d\n", ret);
+                       goto out;
+               }
+
+               ret = xen_bind_pirq_msi_to_irq(dev, msidesc,
+                                              map_irq.pirq, map_irq.index,
+                                              (type == PCI_CAP_ID_MSIX) ?
+                                              "msi-x" : "msi");
+               if (ret < 0)
+                       goto out;
        }
-       return 0;
+       ret = 0;
+out:
+       return ret;
 }
 #endif
 #endif
diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index fd3580a..1a3e760 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -634,9 +634,6 @@ out:
 }
 
 #ifdef CONFIG_PCI_MSI
-#include <linux/msi.h>
-#include "../pci/msi.h"
-
 int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc)
 {
        int rc;
@@ -678,44 +675,6 @@ error_irq:
        xen_free_irq(irq);
        return -1;
 }
-
-int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type)
-{
-       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;
-       }
-
-       rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
-       if (rc) {
-               dev_warn(&dev->dev, "xen map irq failed %d\n", rc);
-               return -1;
-       }
-
-       return xen_bind_pirq_msi_to_irq(dev, msidesc,
-                                       map_irq.pirq, map_irq.index,
-                                       (type == PCI_CAP_ID_MSIX) ?
-                                       "msi-x" : "msi");
-}
 #endif
 
 int xen_destroy_irq(int irq)
diff --git a/include/xen/events.h b/include/xen/events.h
index 7151f36..d3b9010 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -84,7 +84,6 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int 
shareable, char *name);
 int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);
 int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
                             int pirq, int vector, const char *name);
-int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int 
type);
 #endif
 
 /* De-allocates the above mentioned physical interrupt. */
-- 
1.5.6.5




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>