Page MenuHomeFreeBSD

pci_host_generic: Use SYS_RES_MEMORY for the parent of I/O resource ranges
Needs ReviewPublic

Authored by jhb on Mar 4 2024, 10:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jan 17, 3:19 PM
Unknown Object (File)
Thu, Jan 16, 9:00 PM
Unknown Object (File)
Wed, Jan 15, 8:15 PM
Unknown Object (File)
Sep 19 2024, 5:33 AM
Unknown Object (File)
Sep 12 2024, 10:31 PM
Unknown Object (File)
Sep 9 2024, 2:13 AM
Unknown Object (File)
Sep 8 2024, 8:49 PM
Unknown Object (File)
Aug 31 2024, 1:31 PM
Subscribers

Details

Summary

When a SYS_RES_IOPORT resource crosses a pci_host_generic bridge, it
is translated into a memory access for an associated range, so use
SYS_RES_MEMORY for the resource allocated from the parent. This is
arguably a cleaner solution than having simplebus rewrite
SYS_RES_MEMORY to SYS_RES_IOPORT.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 61784
Build 58668: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Mar 4 2024, 10:44 PM

What about all the other PCI controller drivers though? Various use ofw_pcib, for example.

ofw_pcib doesn't pass child resources up to simplebus for allocation or activation, it uses bus_space_map directly with a new-bus method to get the bus_space_tag. I think this might be the only one passing SYS_RES_IOPORT up to simplebus and that if this works we might be able to remove all SYS_RES_IOPORT support from simplebus.

In D44207#1009367, @jhb wrote:

ofw_pcib doesn't pass child resources up to simplebus for allocation or activation, it uses bus_space_map directly with a new-bus method to get the bus_space_tag. I think this might be the only one passing SYS_RES_IOPORT up to simplebus and that if this works we might be able to remove all SYS_RES_IOPORT support from simplebus.

Should ofw_pcib not be doing it this way too then?

In D44207#1009367, @jhb wrote:

ofw_pcib doesn't pass child resources up to simplebus for allocation or activation, it uses bus_space_map directly with a new-bus method to get the bus_space_tag. I think this might be the only one passing SYS_RES_IOPORT up to simplebus and that if this works we might be able to remove all SYS_RES_IOPORT support from simplebus.

Should ofw_pcib not be doing it this way too then?

I have thought about changing ofw_pcib, but to be clear, ofw_pcib is not passing SYS_RES_IOPORT resources up to its parent bus driver currently.

@markj can you test this change on your Ampere box?

In D44207#1105839, @jhb wrote:

@markj can you test this change on your Ampere box?

Could you please rebase it past b313229969cc5? It doesn't apply to the latest main.

In D44207#1105839, @jhb wrote:

@markj can you test this change on your Ampere box?

It boots fine with this change. Is there anything in particular you'd like to see?

In D44207#1105839, @jhb wrote:

@markj can you test this change on your Ampere box?

It boots fine with this change. Is there anything in particular you'd like to see?

Booting fine is the main thing I wanted to see. Can you also apply D48501 (in the stack) on top of this and make sure it still boots fine?

In D44207#1107878, @jhb wrote:
In D44207#1105839, @jhb wrote:

@markj can you test this change on your Ampere box?

It boots fine with this change. Is there anything in particular you'd like to see?

Booting fine is the main thing I wanted to see. Can you also apply D48501 (in the stack) on top of this and make sure it still boots fine?

It still boots without problems, but this system boots using ACPI, I think that patch is a no-op here.