Page MenuHomeFreeBSD

pcib(4): write window after resource adjustment
ClosedPublic

Authored by mav on Aug 26 2021, 5:20 PM.
Tags
Referenced Files
Unknown Object (File)
Sat, Nov 16, 6:48 AM
Unknown Object (File)
Fri, Nov 15, 10:42 PM
Unknown Object (File)
Fri, Nov 15, 12:02 PM
Unknown Object (File)
Tue, Nov 12, 5:31 AM
Unknown Object (File)
Sun, Nov 10, 8:00 PM
Unknown Object (File)
Sun, Nov 10, 9:25 AM
Unknown Object (File)
Sun, Nov 10, 12:47 AM
Unknown Object (File)
Sun, Nov 10, 12:26 AM
Subscribers
None

Details

Summary

When adjusting resources we should write updated window base/limit into the registers. Without this newly added address range won't be routed through the bridge properly.

While there, make sure grown window remain aligned to the set granularity. It does not cause problems now, since adjust is mostly called by other PCI bridges, having the same alignment requirements, but I think it is right to have it in general case.

Test Plan

Without the patch topology with 3 layers of bridges allocating resources from scratch shows proper memory windows in devinfo -vr, but only the originally allocated base/limit in lspci -v for the bridge closest to the root. The patch fixes it, fixing access to the memory of NVMe SSDs connected to the last layer.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mav requested review of this revision.Aug 26 2021, 5:20 PM
mav created this revision.

Given pcib_grow_window also rounds requests it seems sensible to be consistent and do so here too. Not writing the updated window is indeed a silly oversight and explains why clear_pcib wasn't working for me on my board, stopping enumeration early. But best wait for John to check there isn't something I'm overlooking here.

This revision is now accepted and ready to land.Aug 26 2021, 5:32 PM
This revision now requires review to proceed.Aug 26 2021, 5:52 PM

Still an accept with the context added :)

This revision is now accepted and ready to land.Aug 26 2021, 6:13 PM

Thinking about it again, pcib_expand_window() should receive not the requested start/end values, but MIN()/MAX() respectively from them and the current window base/limit. Otherwise in case of multiple resources pcib_expand_window() panic on attempt to shrink the window on another side of where it growth. Unfortunately I don't have hardware configuration with more than one second level bridge connected to the one closest to the root to illustrate that.

This revision now requires review to proceed.Aug 26 2021, 8:55 PM

Yep that's another good observation... any more bugs you can think of with my original code? :)

This revision is now accepted and ready to land.Aug 26 2021, 10:08 PM