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, Apr 6, 4:36 PM
Unknown Object (File)
Sat, Apr 6, 4:36 PM
Unknown Object (File)
Sat, Apr 6, 12:36 PM
Unknown Object (File)
Wed, Mar 27, 6:45 PM
Unknown Object (File)
Mar 11 2024, 11:30 PM
Unknown Object (File)
Feb 23 2024, 9:27 PM
Unknown Object (File)
Jan 20 2024, 9:26 AM
Unknown Object (File)
Jan 18 2024, 11:23 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