Re: [PATCH] clk: explicitly disable CONFIG_UML_PCI_OVER_VIRTIO in .kunitconfig

From: Stephen Boyd
Date: Tue Jul 26 2022 - 16:07:52 EST


Quoting David Gow (2022-07-11 23:44:08)
>
> So, as I understand it, casting a regular pointer to an __iomem
> pointer (as the clk test does) isn't technically correct, though it
> does work on almost every architecture out there. If we want some way
> of intercepting I/O access, then then that'll need to be handled by
> the various read()/write() functions.

Yep. It's test code though so it seemed ok at the time.

>
> UML doesn't support iomem at all out of the box, and logic_iomem is a
> way of implementing it which allow us to attach handler functions to
> blocks of memory, albeit with more constraints about what addresses
> get used. Brendan started implementing a "fake hardware" interface on
> top of this here, though it's still in-progress:
> https://kunit-review.googlesource.com/c/linux/+/5272/4

Cool.

>
> Ultimately, I think the 'correct' solution here will be
> logic_iomem-based, but doing that nicely will probably require one of
> two things:
> - logic_iomem to support non-UML architectures as well (becoming a
> generic "insert a 'fake' device here" system)
> - logic_iomem to have some way of "passing through" access to an io
> memory region through to the normal underlying memory.
>
> Ideally, we'll have both, and maybe even defaults which will allow
> hacks like this to continue working (perhaps with a warning?). That'll
> require some significant (and probably not uncontroversial) work on
> how iomem accesses work in general, though, possibly with performance
> impact.

Does it matter to pass through to real iomem? I'd think we wouldn't want
to actually affect real hardware in test code. Instead we'd like to fake
it and then look at the result, like how the clk test works.

>
> The other option of using function redirection on the io read()
> write() functions exists, and would be a bit simpler in the
> short-term, but would probably result in a lot of tests reimplementing
> this, and also would have some performance impacts, as the I/O
> accesses wouldn't be able to be inlined if KUNIT is enabled.
>

That sounds OK to me because nobody is enabling KUNIT in production,
right?