On Thu, Dec 07, 2023 at 11:13:52AM +0100, Lorenzo Pieralisi wrote: > > > What about the other way around - would we have a prefetchable BAR that > > > has portions which are unprefetchable? > > > > I would say possibly. > > > > Prefetch is a dead concept in PCIe, it was obsoleted in PCI-X about 20 > > years ago. No PCIe system has ever done prefetch. > > > > There is a strong incentive to mark BAR's as prefetchable because it > > allows 64 bit addressing in configurations with bridges. > > If by strong incentive you mean the "Additional guidance on the > Prefetchable Bit in Memory Space BARs" in the PCI express specifications, > I think it has been removed from the spec and the criteria that had to be > met to implement it were basically impossible to fulfill on ARM systems, > it did not make any sense in the first place. No, I mean many systems don't have room to accommodate large 32 bit BARs and the only real way to make stuff work is to have a 64 bit BAR by setting prefetchable. Given mis-marking a read-side-effect region as prefetchable has no actual consequence on PCI-E I would not be surprised to learn people have done this. > I agree on your statement related to the prefetchable concept but I > believe that a prefetchable BAR containing regions that have > read side-effects is essentially a borked design unless at system level > speculative reads are prevented (as far as I understand the > implementation note this could only be an endpoint integrated in a > system where read speculation can't just happen (?)). IMHO the PCIe concept of prefetchable has no intersection with the CPU. The CPU chooses entirely on its own what rules to apply to the PCI MMIO regions and no OS should drive that decision based on the prefetchable BAR flag. The *only* purpose of the prefetchable flag was to permit a classical 33/66MHz PCI bridge to prefetch reads because the physical bus protocol back then did not include a read length. For any system that does not have an ancient PCI bridge the indication is totally useless. Jason