Patchwork hw/usb-ohci.c: Ignore writes to HcPeriodCurrentED register

login
register
mail settings
Submitter Peter Maydell
Date June 7, 2011, 7:02 p.m.
Message ID <1307473349-25756-1-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/99320/
State New
Headers show

Comments

Peter Maydell - June 7, 2011, 7:02 p.m.
HcPeriodCurrentED is read-only, but Linux writes to it anyway; silently
ignore this rather than printing a warning message.

(Specifically, drivers/usb/host/ohci-hub.c:ohci_rh_resume() writes a
0, in at least kernels 2.6.25 through 2.6.39.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
LXR reference for your convenience:
 http://lxr.free-electrons.com/source/drivers/usb/host/ohci-hub.c#L209

I'm not sure what the consensus is for cases like this where QEMU's correct
to warn about dodgy device access but a popular operating system(tm) does
them anyway. Suppressing the warning seems a bit more user-friendly to
the average QEMU user...

 hw/usb-ohci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Gerd Hoffmann - June 8, 2011, 8:09 a.m.
Hi,

> I'm not sure what the consensus is for cases like this where QEMU's correct
> to warn about dodgy device access but a popular operating system(tm) does
> them anyway. Suppressing the warning seems a bit more user-friendly to
> the average QEMU user...

It is also a (minor) DoS, the guest can flood the logs on the host. 
Stuff like that should not be logged by default, having an option to 
enable such messages for trouble-shotting purposes is fine.

Patch queued up, thanks.

cheers,
   Gerd

Patch

diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 347814e..23a5e66 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1591,6 +1591,10 @@  static void ohci_mem_write(void *ptr, target_phys_addr_t addr, uint32_t val)
         ohci->hcca = val & OHCI_HCCA_MASK;
         break;
 
+    case 7: /* HcPeriodCurrentED */
+        /* Ignore writes to this read-only register, Linux does them */
+        break;
+
     case 8: /* HcControlHeadED */
         ohci->ctrl_head = val & OHCI_EDPTR_MASK;
         break;