diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-01-23 09:35:17 +0000 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-01-23 09:35:17 +0000 |
commit | 74c213c506afcd74a8556dd092995fd4dc38b225 (patch) | |
tree | 2d0e2eb788d9d710f0ac438a2ad63739bebf0565 /xen/include/xen/pci.h | |
parent | 9346f6cfbfb992b4fb38b802b794f194f1209dbf (diff) | |
download | xen-74c213c506afcd74a8556dd092995fd4dc38b225.tar.gz xen-74c213c506afcd74a8556dd092995fd4dc38b225.tar.bz2 xen-74c213c506afcd74a8556dd092995fd4dc38b225.zip |
x86/vMSI: miscellaneous fixes
This addresses a number of problems in msixtbl_{read,write}():
- address alignment was not checked, allowing for memory corruption in
the hypervisor (write case) or returning of hypervisor private data
to the guest (read case)
- the interrupt mask bit was permitted to be written by the guest
(while Xen's interrupt flow control routines need to control it)
- MAX_MSIX_TABLE_{ENTRIES,PAGES} were pointlessly defined to plain
numbers (making it unobvious why they have these values, and making
the latter non-portable)
- MAX_MSIX_TABLE_PAGES was also off by one (failing to account for a
non-zero table offset); this was also affecting host MSI-X code
- struct msixtbl_entry's table_flags[] was one element larger than
necessary due to improper open-coding of BITS_TO_LONGS()
- msixtbl_read() unconditionally accessed the physical table, even
though the data was only needed in a quarter of all cases
- various calculations were done unnecessarily for both of the rather
distinct code paths in msixtbl_read()
Additionally it is unclear on what basis MAX_MSIX_ACC_ENTRIES was
chosen to be 3.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/include/xen/pci.h')
-rw-r--r-- | xen/include/xen/pci.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h index 759f1aacf7..60e0b21092 100644 --- a/xen/include/xen/pci.h +++ b/xen/include/xen/pci.h @@ -11,6 +11,8 @@ #include <xen/list.h> #include <xen/spinlock.h> #include <xen/irq.h> +#include <xen/pci_regs.h> +#include <xen/pfn.h> #include <asm/pci.h> /* @@ -30,8 +32,10 @@ #define PCI_BDF(b,d,f) ((((b) & 0xff) << 8) | PCI_DEVFN(d,f)) #define PCI_BDF2(b,df) ((((b) & 0xff) << 8) | ((df) & 0xff)) -#define MAX_MSIX_TABLE_ENTRIES 2048 -#define MAX_MSIX_TABLE_PAGES 8 +#define MAX_MSIX_TABLE_ENTRIES (PCI_MSIX_FLAGS_QSIZE + 1) +#define MAX_MSIX_TABLE_PAGES PFN_UP(MAX_MSIX_TABLE_ENTRIES * \ + PCI_MSIX_ENTRY_SIZE + \ + (~PCI_MSIX_BIRMASK & (PAGE_SIZE - 1))) struct pci_dev_info { bool_t is_extfn; bool_t is_virtfn; |