On 06.11.2024 10:07, Roger Pau Monné wrote:> > Wait - how can msi->vectors ever be 0? AFAICT there's no way in the > MSI logic to configure 0 vectors, there will always be at least 1 vector > enabled. > > Maybe what you want, if this fix is for compliance reasons, is an > assert unreachable that msi->vectors > 0?
I did some investigation and figured out that the value of 0 is being set by guest writing to msi_control_reg. As far as I understand, the control_write() function only checks that vectors are not greater than the maximum allowed value, but does not check for 0. So I am not sure if this is a valid scenario or not. Is this incorrect guest behavior and it should be forbidden from setting vectors to 0 and enable to 1 at the same time? On 06.11.24 13:31, Jan Beulich wrote: > > Which raises a question as to (lack of) context: Was this spotted by > mere code inspection? Or by a static analyzer? If so, which one? That > may help figure whether some workaround like the one suggested is > necessary, or whether it can simply be left alone. > > Jan I have found this while porting the PCI passthrough patches to Xen 4.20. After checking the previous version which was on 4.18 it seems that on it msi->vectors are also set to 0 but nothing breaks due to it being the explicit end of the loop. So I have assumed that setting it to 0 is a valid scenario. I am testing all of this on Rcar Gen4 boards. Mykyta
