bus_generic_activate_resource passes requests up to the parent device
and ultimately ACPI will do what we need for us.
This overrides gpiobus, which uses bus_generic_rman_activate_resource.
Sponsored by: Amazon
Differential D47252
acpi_gpiobus: Use non-rman resource activation cperciva on Oct 22 2024, 6:59 PM. Authored by Tags None Referenced Files
Details
Diff Detail
Event TimelineComment Actions @jhb You switched gpiobus from bus_generic_activate_resource to bus_generic_rman_activate_resource in https://reviews.freebsd.org/D43887 and that wasn't working for my GPIO _AEI driver. I *think* this commit is correct (that ACPI takes care of things for us with an ACPI GPIO device) but I'm not 100% sure. Comment Actions Eh, this doesn't seem correct on the surface. How are the resources being allocated? If they are being allocated via gpiobus_alloc_resource(), then it is wrong to pass those resources up to some random other device driver in the tree and ask it to activate a resource it didn't create and doesn't know how to manage. Do you have more details on "that wasn't working"? Do you get a panic? Comment Actions No panic, but bus_setup_intr fails. The IRQ is being initially assigned in gpio_alloc_intr_resource: res = bus_alloc_resource(consumer_dev, SYS_RES_IRQ, rid, irq, irq, 1, alloc_flags); Comment Actions The issue is we need to call into subr_intr.c to activate the interrupt. Currently this is done in nexus on arm, arm64, and riscv but this requires calling the parent bus_activate_resource in each bus driver. Comment Actions Presumably the gpiobus driver needs to call into subr_intr.c for those platforms then? (And that needs to happen in gpiobus.c, this is not ACPI specific) Comment Actions Is there a reason to not do it in bus_generic_rman_activate_resource on those archs? We could then replace nexus_activate_resource with bus_generic_rman_activate_resource on arm and riscv (it's missing non-posted memory support needed on arm64) Comment Actions Hmmm, if the logic is the same for all IRQ resources ever allocated on intrng architectures, then doing it in the wrapper might indeed be simplest. Comment Actions I honestly don't know enough about the resource activation and intrng code to understand the alternative you two are discussing -- can I leave it with you to figure out what needs to be done here in the upcoming week? I'd like to make sure the _AEI support lands in time for 14.2 since it's a major pain point for AWS. |