All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] msix: revoke correct amount of msi-x related iomem
@ 2008-05-02 18:04 Espen Skoglund
  2008-05-06 16:31 ` Neil Turton
  0 siblings, 1 reply; 3+ messages in thread
From: Espen Skoglund @ 2008-05-02 18:04 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 116 bytes --]

Calculation of MSI-X table size needs to be masked.

Signed-off-by: Espen Skoglund <espen.skoglund@netronome.com>



[-- Attachment #2: msix-iomem.patch --]
[-- Type: application/octet-stream, Size: 1112 bytes --]

diff -r 25d5dce58729 tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py	Fri May 02 14:38:06 2008 +0100
+++ b/tools/python/xen/util/pci.py	Fri May 02 19:08:45 2008 +0100
@@ -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) | \

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] msix: revoke correct amount of msi-x related iomem
  2008-05-02 18:04 [PATCH] msix: revoke correct amount of msi-x related iomem Espen Skoglund
@ 2008-05-06 16:31 ` Neil Turton
  2008-05-06 16:49   ` Espen Skoglund
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Turton @ 2008-05-06 16:31 UTC (permalink / raw)
  To: Espen Skoglund; +Cc: xen-devel

Espen Skoglund wrote:
> +                        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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] msix: revoke correct amount of msi-x related iomem
  2008-05-06 16:31 ` Neil Turton
@ 2008-05-06 16:49   ` Espen Skoglund
  0 siblings, 0 replies; 3+ messages in thread
From: Espen Skoglund @ 2008-05-06 16:49 UTC (permalink / raw)
  To: Neil Turton; +Cc: xen-devel, Espen Skoglund

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]
> Espen Skoglund wrote:
>> +                        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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-06 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 18:04 [PATCH] msix: revoke correct amount of msi-x related iomem Espen Skoglund
2008-05-06 16:31 ` Neil Turton
2008-05-06 16:49   ` Espen Skoglund

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.