On 14/06/2019 21:42, BALATON Zoltan wrote:
On Fri, 14 Jun 2019, Mark Cave-Ayland wrote:
On 13/06/2019 21:01, BALATON Zoltan wrote:
- If QEMU always supplies the driver as card ROM which will then be installed, when
is this fallback necessary at all? Wouldn't it be simpler to just remove it altogether? On QEMU it's not needed, other configs probably don't work anyway and if they worked you may get the same problem as in the QEMU case before this patch when card is missing so getting rid of this fallback would simplify code and may only break real hardware case which is likely already broken anyway.
or
- If you think fallback still makes sense and is used by some real case then the
correct test may be to check if TCX card is present or not, not if running on QEMU or not. Maybe you should do this when setting up the card during sbus scan. The drivers/sbus.c seems to create device nodes when some slots are occupied (? is this correct? are these cards hardwired to these slots or what if they are not in the expected slot or something else is there). Anyway, you could check if these nodes are existing but ROM is not valid to decide to install the driver fallback which seems more correct. Or you could try to fall back when mapping the ROM or interpreting it has failed.
And this patchset implements option 1 :)
Sort of, but instead of removing the fall back altogether and thus simplifying code it only disables it on QEMU which does not get rid of the the code but makes it even harder to follow by having a QEMU driver now only used when not on QEMU. So maybe a comment would be useful to explain this at least. If this work around is still useful for Temlib then that's a valid use case that might justify keeping it but otherwise I'd be for simpifyng code instead of keeping around now unused and unneeded hacks that may have helped in the past but now just makes it more difficult to follow the code. (Mixing different QEMU and OpenBIOS versions may not be a frequent use case either and may not work due to changes in fw_cfg anyway.) So if there's nothing left needing it any more it would be better to remove such fall backs/work arounds, rather than keep everything in fear of breaking some theoretical use case as that results in more and more complex code.
But that's just my view and I don't really mind either way, so don't take this as saying not to apply your patches.
Thanks for the feedback. Having reflected on this over the past week, I'm still happy with the approach taken (since it's consistent with what I've been doing for a while now) and given that it's coming up to QEMU freeze I'd like to have the fix included in the next release. So this is now pushed to master.
ATB,
Mark.