dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0147-usb-ehci-Ensure-frindex-writes-leave-a-valid-frindex.patch

Hans de Goede 56753f
From 4c245e5ecbc7d5c30c8e8bb4bfcd18c79fafddfe Mon Sep 17 00:00:00 2001
Hans de Goede 56753f
From: Hans de Goede <hdegoede@redhat.com>
Hans de Goede 56753f
Date: Tue, 3 Apr 2012 14:04:31 +0200
Hans de Goede 56753f
Subject: [PATCH 147/181] usb-ehci: Ensure frindex writes leave a valid
Hans de Goede 56753f
 frindex value
Hans de Goede 56753f
Hans de Goede 56753f
frindex is a 14 bits counter, so bits 31-14 should always be 0, and
Hans de Goede 56753f
after the commit titled "usb-ehci: frindex always is a 14 bits counter"
Hans de Goede 56753f
we rely on frindex always being a multiple of 8. I've not seen this in
Hans de Goede 56753f
practice, but theoretically a guest can write a value >= 0x4000 or a value
Hans de Goede 56753f
which is not a multiple of 8 value to frindex, this patch ensures that
Hans de Goede 56753f
things will still work when that happens.
Hans de Goede 56753f
Hans de Goede 56753f
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede 56753f
---
Hans de Goede 56753f
 hw/usb-ehci.c |    4 ++++
Hans de Goede 56753f
 1 file changed, 4 insertions(+)
Hans de Goede 56753f
Hans de Goede 56753f
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
Hans de Goede 56753f
index ff69587..16e6053 100644
Hans de Goede 56753f
--- a/hw/usb-ehci.c
Hans de Goede 56753f
+++ b/hw/usb-ehci.c
Hans de Goede 56753f
@@ -1081,6 +1081,10 @@ static void ehci_mem_writel(void *ptr, target_phys_addr_t addr, uint32_t val)
Hans de Goede 56753f
         val &= USBINTR_MASK;
Hans de Goede 56753f
         break;
Hans de Goede 56753f
 
Hans de Goede 56753f
+    case FRINDEX:
Hans de Goede 56753f
+        val &= 0x00003ff8; /* frindex is 14bits and always a multiple of 8 */
Hans de Goede 56753f
+        break;
Hans de Goede 56753f
+
Hans de Goede 56753f
     case CONFIGFLAG:
Hans de Goede 56753f
         val &= 0x1;
Hans de Goede 56753f
         if (val) {
Hans de Goede 56753f
-- 
Hans de Goede 56753f
1.7.10
Hans de Goede 56753f