Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Exporting PCI devices to unpriviledged domains.



On Sun, Aug 14, 2005 at 10:16:20PM +0100, Ceri Storey wrote:
> Hi.
> 
> I'm currently attempting to export my wireless network card (suppoted by 
> ral(4)) to an unpriviledged Xen domain running under NetBSD, with Linux as 
> Domain 0. 

Well, some small amount of hacking later, I've gotten this to work, and
have been able to successfully use my wireless lan card from a domU.

The isa code could probably do with a simiar refactoring, too, perhaps.

Cheers.
-- 
Ceri Storey <cez%necrofish.org.uk@localhost>
'What I really want is "apt-get smite"' 
    --Rob Partington <http://rjp.frottage.org>
Index: conf/files.xen
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/conf/files.xen,v
retrieving revision 1.26
diff -u -r1.26 files.xen
--- conf/files.xen      15 Jul 2005 07:56:22 -0000      1.26
+++ conf/files.xen      16 Aug 2005 22:04:22 -0000
@@ -265,7 +265,7 @@
 file   arch/xen/i386/xen_shm_machdep.c dom0ops
 file   arch/xen/xen/xbdback.c          dom0ops
 file   arch/xen/xen/xennetback.c       dom0ops
-file   arch/xen/xen/pci_machdep.c      hypervisor & dom0ops
+file   arch/xen/xen/pci_machdep.c      hypervisor & pci
 file   arch/xen/xen/isa_machdep.c      hypervisor & dom0ops
 file   arch/xen/xen/xenevt.c           xenevt & dom0ops
 
Index: xen/hypervisor.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/hypervisor.c,v
retrieving revision 1.14
diff -u -r1.14 hypervisor.c
--- xen/hypervisor.c    18 Apr 2005 21:33:21 -0000      1.14
+++ xen/hypervisor.c    16 Aug 2005 22:04:23 -0000
@@ -182,9 +182,11 @@
        struct device *parent, *self;
        void *aux;
 {
-#ifdef DOM0OPS
+#if NPCI > 0
        struct pcibus_attach_args pba;
        struct isabus_attach_args iba;
+       physdev_op_t physdev_op;
+       int i, j, busnum;
 #endif
        union hypervisor_attach_cookie hac;
 
@@ -208,15 +210,12 @@
        hac.hac_xennpx.xa_device = "npx";
        config_found(self, &hac.hac_xennpx, hypervisor_print);
 #endif
-#ifdef DOM0OPS
-       if (xen_start_info.flags & SIF_PRIVILEGED) {
-               physdev_op_t physdev_op;
-               int i, j, busnum;
+#if NPCI > 0
 
-               physdev_op.cmd = PHYSDEVOP_PCI_PROBE_ROOT_BUSES;
-               if (HYPERVISOR_physdev_op(&physdev_op) < 0) {
-                       printf("hypervisor: PHYSDEVOP_PCI_PROBE_ROOT_BUSES 
failed\n");
-               }
+       physdev_op.cmd = PHYSDEVOP_PCI_PROBE_ROOT_BUSES;
+       if ((i = HYPERVISOR_physdev_op(&physdev_op)) < 0) {
+               printf("hypervisor: PHYSDEVOP_PCI_PROBE_ROOT_BUSES failed with 
status %d\n", i);
+       } else {
 #ifdef DEBUG
                printf("PCI_PROBE_ROOT_BUSES: ");
                for (i = 0; i < 256/32; i++)
@@ -246,16 +245,20 @@
                                config_found_ia(self, "pcibus", &pba,
                                    pcibusprint);
                        }
-               }
-               if (isa_has_been_seen == 0) {
-                       iba._iba_busname = "isa";
-                       iba.iba_iot = X86_BUS_SPACE_IO;
-                       iba.iba_memt = X86_BUS_SPACE_MEM;
-                       iba.iba_dmat = &isa_bus_dma_tag;
-                       iba.iba_ic = NULL; /* No isa DMA yet */
-                       config_found_ia(self, "isabus", &iba, isabusprint);
-               }
+               } 
+       }
+       if (isa_has_been_seen == 0) {
+               iba._iba_busname = "isa";
+               iba.iba_iot = X86_BUS_SPACE_IO;
+               iba.iba_memt = X86_BUS_SPACE_MEM;
+               iba.iba_dmat = &isa_bus_dma_tag;
+               iba.iba_ic = NULL; /* No isa DMA yet */
+               config_found_ia(self, "isabus", &iba, isabusprint);
+       }
+#endif
 
+#ifdef DOM0OPS
+       if (xen_start_info.flags & SIF_PRIVILEGED) {
                xenkernfs_init();
                xenprivcmd_init();
                xen_shm_init();


Home | Main Index | Thread Index | Old Index