summaryrefslogtreecommitdiff
path: root/hw/usb/hcd-xhci.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-03-19 09:18:20 +0100
committerGerd Hoffmann <kraxel@redhat.com>2013-04-03 09:55:49 +0200
commitc94a7c6979cafa7a71f32b35e0ff71ed00c61a89 (patch)
tree68001dd495a66a289ed67973a380b335b1ea0d18 /hw/usb/hcd-xhci.c
parentc874ea97b9d0d079e9d65ef033b95afef0ed6532 (diff)
downloadqemu-c94a7c6979cafa7a71f32b35e0ff71ed00c61a89.tar.gz
xhci: fix numintrs sanity checks
Make sure numintrs is a power of two, msi requires this. https://bugzilla.redhat.com/show_bug.cgi?id=918035 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/hcd-xhci.c')
-rw-r--r--hw/usb/hcd-xhci.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 5aa342bda5..9d06c51f9c 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3290,6 +3290,9 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
if (xhci->numintrs > MAXINTRS) {
xhci->numintrs = MAXINTRS;
}
+ while (xhci->numintrs & (xhci->numintrs - 1)) { /* ! power of 2 */
+ xhci->numintrs++;
+ }
if (xhci->numintrs < 1) {
xhci->numintrs = 1;
}