x86/vMSI: miscellaneous fixes
authorJan Beulich <jbeulich@suse.com>
Mon, 23 Jan 2012 09:35:17 +0000 (09:35 +0000)
committerJan Beulich <jbeulich@suse.com>
Mon, 23 Jan 2012 09:35:17 +0000 (09:35 +0000)
commit74c213c506afcd74a8556dd092995fd4dc38b225
tree2d0e2eb788d9d710f0ac438a2ad63739bebf0565
parent9346f6cfbfb992b4fb38b802b794f194f1209dbf
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>
xen/arch/x86/hvm/vmsi.c
xen/include/asm-x86/msi.h
xen/include/xen/pci.h
xen/include/xen/pci_regs.h