opnsense-src/sys
Jessica Clarke 8ee90cc8d3 pci_pci: Support growing windows in bus_adjust_resource for NEW_PCIB
If we allocate a new window for a bridge rather than reusing an existing
one set up by firmware to cover all the devices then the new window only
includes the range needed for the first device to allocate the resource.
If a request comes in to adjust this resource in order to extend a
downstream window for another device then this will fail as the rman
doesn't have any space, so we must first grow the bridge's own window.

This is needed to support successfully attaching more than one PCI
device on SiFive's HiFive Unmatched, which has the following topology:

  Root Port <---> Bridge <---> Bridge <-+-> Bridge <---> (Unused)
   (pcib0)        (pcib1)      (pcib2)  |   (pcib3)
                                        +-> Bridge <---> xHCI
                                        |   (pcib4)
                                        +-> Bridge <---> M.2 E-key
                                        |   (pcib5)
                                        +-> Bridge <---> M.2 M-key
                                        |   (pcib6)
                                        +-> Bridge <---> x16 slot
                                            (pcib7)

Without this, the xHCI endpoint successfully attaches but NVMe M.2 M-key
endpoint fails to attach as, when its adjacent bridge (pcib6) attempts
to allocate a window from its parent (pcib2) on the other side of the
switch, its parent attempts to grow its own window by calling
bus_adjust_resource on its own parent (pcib1) which fails to call the
root port device (pcib0) to request more memory to grow its own window.
Had the root port been directly connected to the switch without the
bridge in the middle then the existing code would have worked, but the
extra hop broke it.

Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31035
2021-09-01 16:55:13 -04:00
..
amd64 pmap: Micro-optimize pmap_remove_pages() on amd64 and arm64 2021-09-01 09:29:01 -04:00
arm Fix some common typos in source code comments 2021-08-31 08:13:15 +02:00
arm64 pmap: Micro-optimize pmap_remove_pages() on amd64 and arm64 2021-09-01 09:29:01 -04:00
bsm Add aio_writev and aio_readv 2021-01-02 19:57:58 -07:00
cam cam(4): Mark all sysctls as CTLFLAG_MPSAFE. 2021-08-24 21:53:17 -04:00
cddl fbt: Remove some handling for multiple CTF containers 2021-04-15 21:27:24 -04:00
compat linuxkpi: remove global atomic counter of the task allocations 2021-08-03 12:56:02 +03:00
conf arm: enable stack-smashing protection 2021-08-30 12:53:59 -03:00
contrib ipfilter: remove doubled semicolons 2021-08-18 20:23:50 -04:00
crypto armv8crypto: note derivation in armv8_crypto_wrap.c 2021-03-22 13:14:51 -03:00
ddb ddb: reliably fail with ambiguous commands 2021-07-02 14:13:24 -07:00
dev pci_pci: Support growing windows in bus_adjust_resource for NEW_PCIB 2021-09-01 16:55:13 -04:00
dts arm: allwinner: dtb: Add overlays to disable SD/MMC node 2021-07-22 19:29:21 +02:00
fs ext2fs(5): Correct a typo in an error message 2021-08-29 08:12:08 +02:00
gdb gdb: report specific stop reason for watchpoints 2021-04-21 10:20:33 -03:00
geom Fix some common typos in source code comments 2021-08-31 08:13:15 +02:00
gnu Remove the old dts imported tree. 2021-01-15 20:09:55 +01:00
i386 Fix some common typos in source code comments 2021-08-31 08:13:15 +02:00
isa Remove more remnants of sio(4) 2021-04-14 09:19:49 -04:00
kern fsetown: Avoid process group lock recursion 2021-09-01 09:07:39 -04:00
kgssapi State kgssapi dependency on xdr. 2020-09-17 22:29:38 +00:00
libkern Switch to an ifunc in the kernel for crc32c 2021-08-30 12:22:21 +01:00
mips Add pmap_vm_page_alloc_check() 2021-08-24 02:21:13 +03:00
modules MFC 517904de5c: igc(4): Introduce new driver for the Intel I225 Ethernet controller. 2021-08-15 20:33:54 +10:00
net if_bridge: add ALTQ support 2021-09-01 15:27:01 +02:00
net80211 net80211/LinuxKPI: add more radiotap definitions 2021-07-18 00:35:03 +00:00
netgraph ng_bridge: Use M_NOWAIT when allocating memory in the newhook routine 2021-08-20 08:42:43 -04:00
netinet inet(3): Fix a few common typos in source code comments 2021-08-31 08:11:48 +02:00
netinet6 inet6(4): Fix a few common typos in source code comments 2021-08-31 08:11:24 +02:00
netipsec netipsec/key.c: Use ANSI C definition for key_random() 2021-08-13 12:34:42 +03:00
netpfil ipfw: use unsigned int for dummynet bandwidth 2021-08-26 14:05:26 +02:00
netsmb netsmb: Avoid a read-after-free in smb_t2_request_int() 2021-06-02 09:34:47 -04:00
nfs nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsclient nfs: clean up empty lines in .c and .h files 2020-09-01 21:25:39 +00:00
nfsserver nfs: Mark unused statistics variable as reserved 2020-11-18 04:35:49 +00:00
nlm nlm: clean up empty lines in .c and .h files 2020-09-01 22:14:52 +00:00
ofed Fix mismerge in OFED update 2021-07-26 18:12:35 +02:00
opencrypto cryptodev: Fix some input validation bugs 2021-05-14 09:58:54 -04:00
powerpc Add pmap_vm_page_alloc_check() 2021-08-24 02:21:13 +03:00
riscv Add pmap_vm_page_alloc_check() 2021-08-24 02:21:13 +03:00
rpc rpc: Make function tables const 2021-08-21 12:10:31 -04:00
security mac: cheaper check for ifnet_create_mbuf and ifnet_check_transmit 2021-07-05 11:32:14 +00:00
sys pci: Add an ioctl to perform I/O to BARs 2021-08-29 12:39:42 -04:00
teken loader: implement framebuffer console 2021-01-02 21:41:36 +02:00
tests tests: Revise FIB lookups per second benchmarking routines 2021-06-20 13:27:17 +02:00
tools makesyscalls.lua: improve generated file style(9) compliance 2021-05-19 20:31:54 -04:00
ufs ufs_dirhash: Correct a typo in a comment 2021-08-23 08:32:50 +02:00
vm Add pmap_vm_page_alloc_check() 2021-08-24 02:21:13 +03:00
x86 amd64: stop doing special allocation for the AP startup trampoline 2021-08-24 02:21:13 +03:00
xdr xdr: clean up empty lines in .c and .h files 2020-09-01 22:13:28 +00:00
xen xen: remove .swp file from public headers 2021-01-11 18:14:11 +01:00
Makefile