[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/5 rumpkernel] pci-userspace: Add acpi lookup of irqs
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 5/5 rumpkernel] pci-userspace: Add acpi lookup of irqs |
Date: |
Tue, 6 Sep 2022 01:08:24 +0200 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Damien Zammit, le dim. 04 sept. 2022 03:47:38 +0000, a ecrit:
> This depends on having <hurd/acpi.defs> installed.
>
> It will now fail to run if acpi translator is not running as it needs
> the actual pci irq.
>
> ---
> debian/patches/acpi.diff | 74 ++++++++++++++++++++++++++++++++++++++++
> debian/patches/series | 1 +
> 2 files changed, 75 insertions(+)
> create mode 100644 debian/patches/acpi.diff
>
> diff --git a/debian/patches/acpi.diff b/debian/patches/acpi.diff
> new file mode 100644
> index 000000000..2f2dc84d1
> --- /dev/null
> +++ b/debian/patches/acpi.diff
> @@ -0,0 +1,74 @@
> +--- a/pci-userspace/src-gnu/Makefile.inc
> ++++ b/pci-userspace/src-gnu/Makefile.inc
> +@@ -3,7 +3,7 @@
> + PCIDIR:= ${.PARSEDIR}
> + .PATH: ${PCIDIR}
> +
> +-RUMPCOMP_USER_SRCS= pci_user-gnu.c mach_debugUser.c
> ++RUMPCOMP_USER_SRCS= pci_user-gnu.c mach_debugUser.c acpiUser.c
> + RUMPCOMP_USER_CPPFLAGS+=-I${PCIDIR} -I${DESTDIR}/usr/include
> + RUMPCOMP_CPPFLAGS+= -I${PCIDIR} -I${DESTDIR}/usr/include
> + CPPFLAGS+= -I${PCIDIR}
> +@@ -16,3 +16,11 @@
> + -user mach_debugUser.c \
> + -server /dev/null \
> + -header mach_debug_U.h
> ++
> ++acpiUser.c:
> ++ echo '#include <hurd/acpi.defs>' \
> ++ | ${CC} -E -x c - -o - \
> ++ | mig -cc cat - /dev/null -subrprefix __ \
> ++ -user acpiUser.c \
> ++ -server /dev/null \
> ++ -header acpi_U.h
Please take it into a separate patch. Once glibc will be rebuilt against
acpi.defs, the RPCs will be available in libhurduser.so
> +--- a/pci-userspace/src-gnu/pci_user-gnu.c
> ++++ b/pci-userspace/src-gnu/pci_user-gnu.c
> +@@ -67,6 +67,7 @@
> + #include <device/device.h>
> + #include <mach/gnumach.h>
> + #include "mach_debug_U.h"
> ++#include "acpi_U.h"
> + #include <mach/vm_param.h>
> + #include <mach.h>
> +
> +@@ -90,6 +91,7 @@
> + static mach_port_t master_host;
> + static mach_port_t master_device;
> + static device_t irq_dev;
> ++static device_t acpi_dev;
> +
> + #define PCI_CFG1_START 0xcf8
> + #define PCI_CFG1_END 0xcff
> +@@ -130,6 +132,9 @@
> + if (device_open (master_device, D_READ, "irq", &irq_dev))
> + err(2, "device_open irq");
> +
> ++ if (device_open (master_device, D_READ, "acpi", &acpi_dev))
> ++ err(2, "device_open acpi");
Perhaps allow acpi not to be available (or fail), in which case revert
to using intrline?
> + pci_system_init ();
> + struct pci_device_iterator *dev_iter;
> + struct pci_device *pci_dev;
> +@@ -363,6 +368,7 @@
> + rumpcomp_pci_irq_map(unsigned bus, unsigned dev, unsigned fun,
> + int intrline, unsigned cookie)
> + {
> ++ int ret;
> + struct irq *irq;
> + irq = malloc(sizeof(*irq));
> + if (irq == NULL)
> +@@ -372,7 +378,13 @@
> + irq->bus = bus;
> + irq->dev = dev;
> + irq->fun = fun;
> +- irq->intrline = intrline;
> ++
> ++ /* Ignore intrline, it could be wrong
> ++ if it reads it from the pci config space.
> ++ We can do better by reading it from acpi device */
> ++ ret = acpi_get_pci_irq (acpi_dev, bus, dev, fun, &irq->intrline);
> ++ if (ret)
> ++ err(ret, "acpi_get_pci_irq");
> +
> + pthread_mutex_lock(&genericmtx);
> + LIST_INSERT_HEAD(&irqs, irq, entries);
> diff --git a/debian/patches/series b/debian/patches/series
> index f3725e1e7..456b9a5bd 100644
> --- a/debian/patches/series
> +++ b/debian/patches/series
> @@ -13,3 +13,4 @@ no-virtio-rump.diff
> pci-userspace-rump.diff
> rumpuser-evcnt.diff
> ps-comm.diff
> +acpi.diff
> --
> 2.34.1
- Re: [PATCH 1/5] acpi: Link translator to libacpica and provide RPCs, (continued)
[PATCH 4/5] acpi: Remove references to /dev/mem, Damien Zammit, 2022/09/03
[PATCH 5/5 rumpkernel] pci-userspace: Add acpi lookup of irqs, Damien Zammit, 2022/09/03
- Re: [PATCH 5/5 rumpkernel] pci-userspace: Add acpi lookup of irqs,
Samuel Thibault <=
Re: Introduction of libacpica to get pci irqs and shutdown, Damien Zammit, 2022/09/04