On Tue, 25 Nov 2025 at 02:31, Navid Emamdoost <[email protected]> wrote:
>
> On Thu, Nov 13, 2025 at 6:03 AM Peter Maydell <[email protected]> 
> wrote:
> > I think if we added the size to the QPCIBar struct then we
> > could assert in the accessors like qpci_io_readb() and
> > friends that the offset provided was in range. That would
> > catch both the unlikely "we implemented the BAR with no
> > size" case and the rather more likely "we got the size too
> > small" case (and also the "bug in the test and it got the
> > offset too big" case), and would mean that we don't lose
> > anything by not asserting that we have a non-zero-size BAR here.

> That's a much more elegant approach. Thank you for the suggestion!
> I've done an initial investigation into the impact of adding a size
> field to QPCIBar and checking it in the accessors. As you anticipated,
> making the API safer immediately and correctly flushed out a few
> latent issues in the existing qtest suite.
> Before I prepare and send the full v2 patch series, I wanted to run my
> plan for fixing the test failures by you:
>
> - Issue with qpci_legacy_iomap: Several tests (like ide-test and
> tco-test) fail because they use qpci_legacy_iomap, which has no way to
> provide a BAR size. My plan is to change its signature to
> qpci_legacy_iomap(dev, addr, size) and then update the handful of
> failing call sites to provide the correct, explicit I/O region size.
> This seems like the cleanest way to make them compatible and safer.
>
> - Issue with nvme-test: The qos-test fails during the
> nvmetest_oob_cmb_test because the test logic was performing an illegal
> out-of-bounds access on the entire PCI BAR. My plan is to rewrite this
> specific test to correctly read the CMB registers and perform a valid
> out-of-bounds check within the BAR's limits, which is what the test
> was originally intended to do.
>
> Does this plan for handling the test failures seem correct to you? If
> yes, I will go ahead and prepare the v2 series with the above fixes.

Yes, that all sounds OK.

thanks
-- PMM

Reply via email to