From: Gerd Hoffmann Date: Tue, 19 Mar 2013 08:18:20 +0000 (+0100) Subject: xhci: fix numintrs sanity checks X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c94a7c6979cafa7a71f32b35e0ff71ed00c61a89;p=qemu.git 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 --- 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; }