msix: revoke correct amount of msi-x related iomem
PATCH 1/1 msix: revoke correct amount of msi-x related iomem
Calculation of MSI-X table size needs to be masked.
tools/python/xen/util/pci.py +4 -2
@@ -30,6 +30,7 @@ PCI_STATUS_OFFSET = 0x6 PCI_CAP_OFFSET = 0x34 MSIX_BIR_MASK = 0x7 +MSIX_SIZE_MASK = 0x3ff #Calculate PAGE_SHIFT: number of bits to shift an address to get the page number PAGE_SIZE = resource.getpagesize()
@@ -120,8 +121,9 @@ message_cont_lo = ord(conf_file.read(1)) message_cont_hi = ord(conf_file.read(1)) self.msix=1 - self.msix_entries = message_cont_lo + \ - message_cont_hi << 8 + self.msix_entries = (message_cont_lo + \ + message_cont_hi << 8) \ + & MSIX_SIZE_MASK t_off=conf_file.read(4) p_off=conf_file.read(4) self.table_offset=ord(t_off[0]) | (ord(t_off[1])<<8) | \
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
tools/python/xen/util/pci.py line 126
Quoted 3 lines · Espen Skoglund
tools/python/xen/util/pci.py +3
-0+ self.msix_entries = (message_cont_lo + \ + message_cont_hi << 8) \ + & MSIX_SIZE_MASK
That still doesn't look right to me since "+" binds tighter than "<<". I think it needs some more parentheses around "message_cont_hi << 8", at least if I've understood what the code's supposed to do.
Cheers, Neil.
Very true. Not being all that experienced with Python I simply believed that the previous code was correct. Checking the reference manual now I do see that the '<<' operator does indeed precedence over '+'. Also, the table size field is actually 11 bits rather than 10. MSIX_SIZE_MASK should therefore be 0x7ff.
eSk
[Neil Turton]
Quoted 9 lines
tools/python/xen/util/pci.py line 126
Quoted 3 lines · Espen Skoglund
tools/python/xen/util/pci.py +3
-0+ self.msix_entries = (message_cont_lo + \ + message_cont_hi << 8) \ + & MSIX_SIZE_MASKThat still doesn't look right to me since "+" binds tighter than "<<". I think it needs some more parentheses around "
message_cont_hi<< 8", at least if I've understood what the code's supposed to do.