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-changelog

[Xen-changelog] [xen-unstable] minios: PIRQ and MSI/MSI-X support

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] minios: PIRQ and MSI/MSI-X support
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 03 Jul 2008 06:30:17 -0700
Delivery-date: Thu, 03 Jul 2008 06:30:47 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1215016002 -3600
# Node ID 97b4c5c511f04dc91ae2637e076d325ed91d01e7
# Parent  f2148e532c81b7591eb67e6880a08e60d8a9ff7e
minios: PIRQ and MSI/MSI-X support

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/events.c           |   17 +++++++
 extras/mini-os/include/events.h   |    1 
 extras/mini-os/include/pcifront.h |   17 ++++++-
 extras/mini-os/pcifront.c         |   88 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 121 insertions(+), 2 deletions(-)

diff -r f2148e532c81 -r 97b4c5c511f0 extras/mini-os/events.c
--- a/extras/mini-os/events.c   Wed Jul 02 17:25:05 2008 +0100
+++ b/extras/mini-os/events.c   Wed Jul 02 17:26:42 2008 +0100
@@ -136,6 +136,23 @@ evtchn_port_t bind_virq(uint32_t virq, e
        return op.port;
 }
 
+evtchn_port_t bind_pirq(uint32_t pirq, int will_share, evtchn_handler_t 
handler, void *data)
+{
+       evtchn_bind_pirq_t op;
+
+       /* Try to bind the pirq to a port */
+       op.pirq = pirq;
+       op.flags = will_share ? BIND_PIRQ__WILL_SHARE : 0;
+
+       if ( HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &op) != 0 )
+       {
+               printk("Failed to bind physical IRQ %d\n", pirq);
+               return -1;
+       }
+       bind_evtchn(op.port, handler, data);
+       return op.port;
+}
+
 #if defined(__x86_64__)
 char irqstack[2 * STACK_SIZE];
 
diff -r f2148e532c81 -r 97b4c5c511f0 extras/mini-os/include/events.h
--- a/extras/mini-os/include/events.h   Wed Jul 02 17:25:05 2008 +0100
+++ b/extras/mini-os/include/events.h   Wed Jul 02 17:26:42 2008 +0100
@@ -27,6 +27,7 @@ typedef void (*evtchn_handler_t)(evtchn_
 /* prototypes */
 int do_event(evtchn_port_t port, struct pt_regs *regs);
 evtchn_port_t bind_virq(uint32_t virq, evtchn_handler_t handler, void *data);
+evtchn_port_t bind_pirq(uint32_t pirq, int will_share, evtchn_handler_t 
handler, void *data);
 evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
                                                  void *data);
 void unbind_evtchn(evtchn_port_t port);
diff -r f2148e532c81 -r 97b4c5c511f0 extras/mini-os/include/pcifront.h
--- a/extras/mini-os/include/pcifront.h Wed Jul 02 17:25:05 2008 +0100
+++ b/extras/mini-os/include/pcifront.h Wed Jul 02 17:26:42 2008 +0100
@@ -2,9 +2,8 @@
 #include <xen/io/pciif.h>
 struct pcifront_dev;
 struct pcifront_dev *init_pcifront(char *nodename);
+void pcifront_op(struct pcifront_dev *dev, struct xen_pci_op *op);
 void pcifront_scan(struct pcifront_dev *dev, void (*fun)(unsigned int domain, 
unsigned int bus, unsigned slot, unsigned int fun));
-void pcifront_op(struct pcifront_dev *dev, struct xen_pci_op *op);
-void shutdown_pcifront(struct pcifront_dev *dev);
 int pcifront_conf_read(struct pcifront_dev *dev,
                        unsigned int dom,
                        unsigned int bus, unsigned int slot, unsigned long fun,
@@ -13,3 +12,17 @@ int pcifront_conf_write(struct pcifront_
                         unsigned int dom,
                         unsigned int bus, unsigned int slot, unsigned long fun,
                         unsigned int off, unsigned int size, unsigned int val);
+int pcifront_enable_msi(struct pcifront_dev *dev,
+                        unsigned int dom,
+                        unsigned int bus, unsigned int slot, unsigned long 
fun);
+int pcifront_disable_msi(struct pcifront_dev *dev,
+                         unsigned int dom,
+                         unsigned int bus, unsigned int slot, unsigned long 
fun);
+int pcifront_enable_msix(struct pcifront_dev *dev,
+                         unsigned int dom,
+                         unsigned int bus, unsigned int slot, unsigned long 
fun,
+                         struct xen_msix_entry *entries, int n);
+int pcifront_disable_msix(struct pcifront_dev *dev,
+                          unsigned int dom,
+                          unsigned int bus, unsigned int slot, unsigned long 
fun);
+void shutdown_pcifront(struct pcifront_dev *dev);
diff -r f2148e532c81 -r 97b4c5c511f0 extras/mini-os/pcifront.c
--- a/extras/mini-os/pcifront.c Wed Jul 02 17:25:05 2008 +0100
+++ b/extras/mini-os/pcifront.c Wed Jul 02 17:26:42 2008 +0100
@@ -276,3 +276,91 @@ int pcifront_conf_write(struct pcifront_
 
     return op.err;
 }
+
+int pcifront_enable_msi(struct pcifront_dev *dev,
+                        unsigned int dom,
+                        unsigned int bus, unsigned int slot, unsigned long fun)
+{
+    struct xen_pci_op op;
+
+    memset(&op, 0, sizeof(op));
+
+    op.cmd = XEN_PCI_OP_enable_msi;
+    op.domain = dom;
+    op.bus = bus;
+    op.devfn = PCI_DEVFN(slot, fun);
+
+    pcifront_op(dev, &op);
+    
+    if (op.err)
+        return op.err;
+    else
+        return op.value;
+}
+
+int pcifront_disable_msi(struct pcifront_dev *dev,
+                         unsigned int dom,
+                         unsigned int bus, unsigned int slot, unsigned long 
fun)
+{
+    struct xen_pci_op op;
+
+    memset(&op, 0, sizeof(op));
+
+    op.cmd = XEN_PCI_OP_disable_msi;
+    op.domain = dom;
+    op.bus = bus;
+    op.devfn = PCI_DEVFN(slot, fun);
+
+    pcifront_op(dev, &op);
+    
+    return op.err;
+}
+
+int pcifront_enable_msix(struct pcifront_dev *dev,
+                         unsigned int dom,
+                         unsigned int bus, unsigned int slot, unsigned long 
fun,
+                         struct xen_msix_entry *entries, int n)
+{
+    struct xen_pci_op op;
+
+    if (n > SH_INFO_MAX_VEC)
+        return XEN_PCI_ERR_op_failed;
+
+    memset(&op, 0, sizeof(op));
+
+    op.cmd = XEN_PCI_OP_enable_msix;
+    op.domain = dom;
+    op.bus = bus;
+    op.devfn = PCI_DEVFN(slot, fun);
+    op.value = n;
+
+    memcpy(op.msix_entries, entries, n * sizeof(*entries));
+
+    pcifront_op(dev, &op);
+    
+    if (op.err)
+        return op.err;
+
+    memcpy(entries, op.msix_entries, n * sizeof(*entries));
+
+    return 0;
+}
+
+
+int pcifront_disable_msix(struct pcifront_dev *dev,
+                          unsigned int dom,
+                          unsigned int bus, unsigned int slot, unsigned long 
fun)
+{
+    struct xen_pci_op op;
+
+    memset(&op, 0, sizeof(op));
+
+    op.cmd = XEN_PCI_OP_disable_msix;
+    op.domain = dom;
+    op.bus = bus;
+    op.devfn = PCI_DEVFN(slot, fun);
+
+    pcifront_op(dev, &op);
+    
+    return op.err;
+}

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] minios: PIRQ and MSI/MSI-X support, Xen patchbot-unstable <=