diff options
author | Damien Zammit <damien@zamaudio.com> | 2020-07-24 23:22:21 +1000 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2023-06-23 23:53:32 +1000 |
commit | 831bafa5c8f39549a1825bfaf32d9d3419280a6b (patch) | |
tree | c857270996d47cb63565103d763f7a526f35f1a5 | |
parent | 0905c66483a188425cad85634c8d7f1ce0c3e5f5 (diff) |
pci-userspace: Use new mach IRQ device RPC interfaces
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/control | 5 | ||||
-rw-r--r-- | debian/patches/machirqdev.diff | 173 | ||||
-rw-r--r-- | debian/patches/series | 1 |
4 files changed, 179 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index b1f3919f..46e1aef2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ rumpkernel (0~20191130-2) UNRELEASED; urgency=medium * patches/Wno-error.diff: Add -Wno-sign-compare for now (until device RPC is fixed) * rules: Use -fcommon in HOST_CFLAGS for GCC 10 compat + * pci-userspace: Use new mach IRQ device RPC interfaces + * control: Add correct build-deps. -- Samuel Thibault <sthibault@debian.org> Sat, 18 Jul 2020 17:40:08 +0200 diff --git a/debian/control b/debian/control index ea63d25c..3cce3aac 100644 --- a/debian/control +++ b/debian/control @@ -5,8 +5,9 @@ Build-Depends: debhelper (>= 8.0.0), autotools-dev, zlib1g-dev, - libpciaccess-dev [hurd-any], - gnumach-dev (>= 2:1.5+git20150827-1~) [hurd-any], + libc0.3 (>= 2.31-2) [hurd-any], + libpciaccess-dev (>= 0.16-1+hurd.4~) [hurd-any], + gnumach-dev (>= 2:1.8+git20200710-3~) [hurd-any], mig [hurd-any], Standards-Version: 3.9.6 Section: libs diff --git a/debian/patches/machirqdev.diff b/debian/patches/machirqdev.diff new file mode 100644 index 00000000..2f74ca61 --- /dev/null +++ b/debian/patches/machirqdev.diff @@ -0,0 +1,173 @@ +--- a/pci-userspace/src-gnu/Makefile.inc ++++ b/pci-userspace/src-gnu/Makefile.inc +@@ -3,19 +3,11 @@ + PCIDIR:= ${.PARSEDIR} + .PATH: ${PCIDIR} + +-RUMPCOMP_USER_SRCS= pci_user-gnu.c experimentalUser.c mach_debugUser.c ++RUMPCOMP_USER_SRCS= pci_user-gnu.c mach_debugUser.c + RUMPCOMP_USER_CPPFLAGS+=-I${PCIDIR} + RUMPCOMP_CPPFLAGS+= -I${PCIDIR} + CPPFLAGS+= -I${PCIDIR} +-LDFLAGS+= -Wl,--no-as-needed -lpciaccess -Wl,--as-needed +- +-experimentalUser.c: +- echo '#include <mach/experimental.defs>' \ +- | ${CC} -E -x c - -o - \ +- | mig -cc cat - /dev/null -subrprefix __ \ +- -user experimentalUser.c \ +- -server /dev/null \ +- -header experimental_U.h ++LDFLAGS+= -lmachuser -Wl,--no-as-needed -lpciaccess -Wl,--as-needed + + mach_debugUser.c: + echo '#include <mach_debug/mach_debug.defs>' \ +--- a/pci-userspace/src-gnu/pci_user-gnu.c ++++ b/pci-userspace/src-gnu/pci_user-gnu.c +@@ -59,13 +59,13 @@ + #include <rump/rumpuser_component.h> + + #include <hurd.h> +-#include <device/device.h> + + #include <pciaccess.h> + + #include "pci_user.h" +-#include "experimental_U.h" + #include <device/notify.h> ++#include <device/device.h> ++#include <mach/gnumach.h> + #include "mach_debug_U.h" + #include <mach/vm_param.h> + #include <mach.h> +@@ -89,6 +89,7 @@ + + static mach_port_t master_host; + static mach_port_t master_device; ++static device_t irq_dev; + + #define PCI_CFG1_START 0xcf8 + #define PCI_CFG1_END 0xcff +@@ -131,6 +132,9 @@ + if (get_privileged_ports (&master_host, &master_device)) + err(1, "get_privileged_ports"); + ++ if (device_open (master_device, D_READ, "irq", &irq_dev)) ++ err(2, "device_open irq"); ++ + pci_system_init (); + struct pci_device_iterator *dev_iter; + struct pci_device *pci_dev; +@@ -255,6 +259,7 @@ + int (*handler)(void *); + void *data; + int intrline; ++ mach_port_t irqport; + sem_t sema; + + LIST_ENTRY(irq) entries; +@@ -280,6 +285,9 @@ + MACH_PRINT("mach_port_allocate\n"); + return 0; + } ++ ++ irq->irqport = delivery_port; ++ + ret = thread_get_assignment (mach_thread_self (), &pset); + if (ret) { + MACH_PRINT("thread_get_assignment\n"); +@@ -296,11 +304,12 @@ + MACH_PRINT("thread_priority\n"); + return 0; + } +- ret = device_intr_register(master_device, irq->intrline, +- 0, 0x04000000, delivery_port, +- MACH_MSG_TYPE_MAKE_SEND); ++ ++ ret = device_intr_register(irq_dev, irq->intrline, ++ 0, irq->irqport, ++ MACH_MSG_TYPE_MAKE_SEND); + if (ret) { +- MACH_PRINT("device_intr_register"); ++ MACH_PRINT("device_intr_register\n"); + return 0; + } + +@@ -316,12 +325,13 @@ + } + + /* It's an interrupt not for us. It shouldn't happen. */ +- if (n->line != irq->intrline) { ++ /* FIXME: id <-> line now has an indirection, assuming 1:1 */ ++ if (n->id != irq->intrline) { + MACH_PRINT("interrupt not for us\n"); + return 0; + } + +- sprintf(interrupt, "%d\n", n->line); ++ sprintf(interrupt, "%d\n", n->id); + MACH_PRINT("irq fired: "); + MACH_PRINT(interrupt); + +@@ -338,13 +348,11 @@ + rumpuser_component_unschedule(); + MACH_PRINT("k_done\n"); + +- device_intr_enable (master_device, irq->intrline, TRUE); ++ device_intr_ack (irq_dev, irq->irqport, MACH_MSG_TYPE_MAKE_SEND); + + return 1; + } + +- device_intr_enable (master_device, irq->intrline, TRUE); +- + sem_post(&irq->sema); + MACH_PRINT("done init\n"); + +@@ -426,20 +434,20 @@ + rumpcomp_pci_dmalloc(size_t size, size_t align, + unsigned long *pap, unsigned long *vap) + { +- const size_t pagesize = getpagesize(); +- +- if (align > pagesize) { +- warnx("requested alignment (%x) is larger than page size (%x)", align, pagesize); +- return 1; +- } ++ vm_address_t vma = 0; ++ rpc_phys_addr_t phys = 0; + + pci_userspace_init(); + +- if (vm_allocate_contiguous (master_host, mach_task_self(), vap, pap, size)) { +- warn("vm_allocate_contiguous"); ++ if (vm_allocate_contiguous (master_host, mach_task_self(), &vma, &phys, ++ size, 0, 0x100000000, align)) { ++ MACH_PRINT("vm_allocate_contiguous\n"); + return 1; + } + ++ *vap = (unsigned long)(vma); ++ *pap = (unsigned long)(phys); ++ + assert(*pap); + + return 0; +@@ -463,7 +471,7 @@ + size_t totlen, void **vap) + { + if (nseg > 1) { +- printf("dmamem_map for >1 seg currently not supported"); ++ MACH_PRINT("dmamem_map for >1 seg currently not supported\n"); + return ENOTSUP; + } + +@@ -514,7 +522,7 @@ + err(ret, "vm_deallocate"); + + if (paddr == 0){ +- warn("rumpcomp_pci_virt_to_mach"); ++ MACH_PRINT("rumpcomp_pci_virt_to_mach\n"); + printf("Cannot find a physical address for vaddr %p, returning 0\n", virt); + } + diff --git a/debian/patches/series b/debian/patches/series index 0a134063..bd25f6a8 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,3 +7,4 @@ busspaceunmap-rump.diff memory-range.diff gnumach-update rumpuser-rng-debug.diff +machirqdev.diff |