Page MenuHomeFreeBSD

INTRNG: Rework handling with resources, partially revert r301453.
ClosedPublic

Authored by mmel on Aug 13 2016, 6:16 AM.

Details

Summary
  • Read interrupt properties at bus enumeration time and store it into global mapping table.
  • At bus_activate_resource() time, the given mapping entry is resolved and connected to real interrupt source.
  • At bus_setup_intr() time, the mapping entry is used for delivery requested interrupt configuration.
  • For MSI/MSIX interrupts, the corresponding mapping entry is created within pci _alloc_msi()/pci _alloc_msix() call.
  • For legacy PCI interrupts, the corresponding mapping entry must be created within pcib_route_interrupt() by pcib driver itself.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mmel retitled this revision from to INTRNG: Rework handling with resources, partially revert r301453. .
mmel updated this object.
mmel edited the test plan for this revision. (Show Details)
mmel added reviewers: nwhitehorn, andrew, adrian.
mmel set the repository for this revision to rS FreeBSD src repository - subversion.
mmel added subscribers: ARM, arm64, MIPS.

Fix arm64 and mips build.

Looks perfect, aside from the one #include issue noted in the inline comments. Thanks so much for putting this together quickly.

sys/arm/nvidia/tegra_lic.c
96 ↗(On Diff #19251)

As a general comment, I don't think these routines are necessary. Cascaded interrupt domains don't have to know about each other for any reason (and, on PowerPC, in fact do not). Note that this is not an issue for this patch, but is something that should be thought about longer-term.

sys/dev/ofw/ofw_bus_subr.h
35 ↗(On Diff #19251)

This should be gated on #ifdef INTRNG. I think none of the things in sys/intr.h actually conflict with powerpc/intr_machdep.h, but that's only by chance.

sys/sys/intr.h
32 ↗(On Diff #19251)

Is it worth having a block like this here? This might fix accidental includes like I noticed above.
#ifndef INTRNG
#error Need INTRNG for this file
#endif

60 ↗(On Diff #19251)

Thanks for moving this to intr.h!

mmel edited edge metadata.

Gate all '#include <sys/intr.h>' by #ifdef INTRNG.
Report error if<sys/intr.h> is included without INTRNG.

mmel marked 2 inline comments as done.Aug 14 2016, 1:14 PM
mmel added inline comments.
sys/arm/nvidia/tegra_lic.c
96 ↗(On Diff #19251)

Tegra LIC is something special. It's not a cascaded (aka N: 1) but 'pass-through' (N:N) interrupt controller. Under normal circumstances, it simply pass N-th input to corresponding N-tn input of his parent GIC. It can be used for generation of wake-up events.

nwhitehorn edited edge metadata.

Thanks for changing the includes. This looks great now and I believe can be merged. (I have one note about nested PICs inline that is not related to this patch but should be discussed more later.)

This revision is now accepted and ready to land.Aug 14 2016, 4:27 PM
sys/arm/nvidia/tegra_lic.c
96 ↗(On Diff #19251)

My earlier inline comment didn't work, apparently.

Anyway, there's no need for special methods even in the fully general case of N:M routing with multiple parents. N:N shims are actually a particularly easy case that IBM likes putting in its POWER servers. This issue is unrelated to this diff, but it would be good to discuss this later in some better forum.

andrew added a subscriber: bz.

Add @bz so he can test this on "hardware" INTRNG has broken

I downloaded the raw diff in the best way I could and applying it to HEAD I get:

[/FreeBSD/head-r304209.svn]$ patch -C -p0 -s < ../PATCHES/D7493.diff
1 out of 4 hunks failed while patching sys/arm/arm/nexus.c
2 out of 3 hunks failed while patching sys/arm/nvidia/tegra_lic.c
2 out of 3 hunks failed while patching sys/arm/ti/omap4/omap4_wugen.c
2 out of 4 hunks failed while patching sys/arm64/arm64/nexus.c
1 out of 1 hunks failed while patching sys/dev/fdt/simplebus.c
2 out of 2 hunks failed while patching sys/dev/gpio/gpiobus.c
1 out of 1 hunks failed while patching sys/dev/gpio/ofw_gpiobus.c
1 out of 1 hunks failed while patching sys/dev/iicbus/ofw_iicbus.c
1 out of 3 hunks failed while patching sys/dev/ofw/ofw_bus_subr.h
1 out of 3 hunks failed while patching sys/dev/ofw/ofwbus.c
1 out of 1 hunks failed while patching sys/dev/pci/pci_host_generic.c
1 out of 1 hunks failed while patching sys/dev/vnic/mrml_bridge.c
1 out of 1 hunks failed while patching sys/dev/vnic/thunder_mdio_fdt.c
Reversed (or previously applied) patch detected! Assume -R? [y] ^C

Which revision of FreeBSD is this supposed to be applied to?

mmel edited edge metadata.

Regenerate patch for r304209.

This revision now requires review to proceed.Aug 16 2016, 10:53 AM

I did not review the change but for arm64 things seem to be working again:

virtio_pci0: <VirtIO PCI Block adapter> irq 11 at device 2.0 on pci0
pcib0: rman_reserve_resource: start=0, end=0xffffffffffffffff, count=0x4
virtio_pci0: Lazy allocation of 0x4 bytes rid 0x10 type 4 at 0x1000
vtblk0: <VirtIO Block Adapter> on virtio_pci0
virtio_pci0: host features: 0
virtio_pci0: negotiated features: 0
virtio_pci0: virtqueue 0 (vtblk0 request) requested indirect descriptors but not negotiated
gic0: unsupported trigger/polarity configuration 0x03
gic0: unsupported trigger/polarity configuration 0x03
virtio_pci0: using legacy interrupt
vtblk0: vtblk_poll_request: IO error: 45
vtblk0: error getting device identifier: 45
vtblk0: 1024MB (2097168 512 byte sectors)

andrew edited edge metadata.
andrew added inline comments.
sys/arm64/arm64/nexus.c
401 ↗(On Diff #19331)

Extra newline

This revision is now accepted and ready to land.Aug 18 2016, 7:00 PM
This revision was automatically updated to reflect the committed changes.