git: c54bdf84d5fb - stable/14 - bus: Activate INTRNG interrupts in common code
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 03 Nov 2024 16:02:27 UTC
The branch stable/14 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=c54bdf84d5fb0b2c1923179fd30812ee68aaf423
commit c54bdf84d5fb0b2c1923179fd30812ee68aaf423
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-10-29 10:19:45 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-11-03 16:01:28 +0000
bus: Activate INTRNG interrupts in common code
[MFC note: This is not a direct cherry-pick due to API changes in HEAD
which are not present in stable/14.]
We need to call into INTRNG to activate all interrupts on platforms that
use it. Currently, interrupts are only activated in the nexus drivers for
INTRNG platforms, but this does not handle other bus devices such as
gpiobus that manage their own IRQ space.
Reported by: cperciva
Reviewed by: cperciva, jhb
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D47282
(cherry picked from commit c85855a72db9f9d7b4326b676241e1dffabf0fae)
---
sys/kern/subr_bus.c | 47 ++++++++++++++++++++++++++++++++++-------------
1 file changed, 34 insertions(+), 13 deletions(-)
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index f0831b30142b..f55a7210e825 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -53,6 +53,9 @@
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/cpuset.h>
+#ifdef INTRNG
+#include <sys/intr.h>
+#endif
#include <net/vnet.h>
@@ -4382,17 +4385,26 @@ bus_generic_rman_activate_resource(device_t dev, device_t child, int type,
if (error != 0)
return (error);
- if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
- (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
- error = BUS_MAP_RESOURCE(dev, child, type, r, NULL, &map);
- if (error != 0) {
- rman_deactivate_resource(r);
- return (error);
- }
+ switch (type) {
+ case SYS_RES_IOPORT:
+ case SYS_RES_MEMORY:
+ if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
+ error = BUS_MAP_RESOURCE(dev, child, type, r, NULL, &map);
+ if (error != 0)
+ break;
- rman_set_mapping(r, &map);
+ rman_set_mapping(r, &map);
+ }
+ break;
+#ifdef INTRNG
+ case SYS_RES_IRQ:
+ error = intr_activate_irq(child, r);
+ break;
+#endif
}
- return (0);
+ if (error != 0)
+ rman_deactivate_resource(r);
+ return (error);
}
/**
@@ -4421,10 +4433,19 @@ bus_generic_rman_deactivate_resource(device_t dev, device_t child, int type,
if (error != 0)
return (error);
- if ((rman_get_flags(r) & RF_UNMAPPED) == 0 &&
- (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) {
- rman_get_mapping(r, &map);
- BUS_UNMAP_RESOURCE(dev, child, type, r, &map);
+ switch (type) {
+ case SYS_RES_IOPORT:
+ case SYS_RES_MEMORY:
+ if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
+ rman_get_mapping(r, &map);
+ BUS_UNMAP_RESOURCE(dev, child, type, r, &map);
+ }
+ break;
+#ifdef INTRNG
+ case SYS_RES_IRQ:
+ intr_deactivate_irq(child, r);
+ break;
+#endif
}
return (0);
}