[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Mouse not working on the console with the latest Windows Blue



On Mon, 2013-08-19 at 13:19 +0100, Frediano Ziglio wrote:
> Windows 8.1 (Blue) on initialization check if usb frame number increase
> after 5 ms. It could happen however that timer function is not run in
> that amount of time so Windows believe that usb controller is not working
> properly. This patch prevent this detecting that timer function was not
> run and run it.

Is this for qemu-trad? Please mention this in the future.

Is a similar fix needed for upstream qemu?

> 
> Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
> ---
>  hw/usb-uhci.c |   19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
> index d42d394..a255429 100644
> --- a/hw/usb-uhci.c
> +++ b/hw/usb-uhci.c
> @@ -129,6 +129,7 @@ typedef struct UHCIState {
>      uint32_t fl_base_addr; /* frame list base address */
>      uint8_t sof_timing;
>      uint8_t status2; /* bit 0 and 1 are used to generate UHCI_STS_USBINT */
> +    int64_t expire_time;
>      QEMUTimer *frame_timer;
>      UHCIPort ports[NB_PORTS];
>  
> @@ -166,6 +167,8 @@ static UHCIAsync *uhci_async_alloc(UHCIState *s)
>      return async;
>  }
>  
> +static void uhci_frame_timer(void *opaque);
> +
>  static void uhci_async_free(UHCIState *s, UHCIAsync *async)
>  {
>      qemu_free(async);
> @@ -398,6 +401,8 @@ static int uhci_load(QEMUFile *f, void *opaque, int 
> version_id)
>      qemu_get_8s(f, &s->sof_timing);
>      qemu_get_8s(f, &s->status2);
>      qemu_get_timer(f, s->frame_timer);
> +    s->expire_time = qemu_get_clock(vm_clock) +
> +        (ticks_per_sec / FRAME_TIMER_FREQ);
>  
>      return 0;
>  }
> @@ -441,8 +446,11 @@ static void uhci_ioport_writew(void *opaque, uint32_t 
> addr, uint32_t val)
>      switch(addr) {
>      case 0x00:
>          if ((val & UHCI_CMD_RS) && !(s->cmd & UHCI_CMD_RS)) {
> +            int64_t t_now = qemu_get_clock(vm_clock);
>              /* start frame processing */
> -            qemu_mod_timer(s->frame_timer, qemu_get_clock(vm_clock));
> +            s->expire_time = t_now +
> +                (ticks_per_sec / FRAME_TIMER_FREQ);
> +            qemu_mod_timer(s->frame_timer, t_now);
>              s->status &= ~UHCI_STS_HCHALTED;
>          } else if (!(val & UHCI_CMD_RS)) {
>              s->status |= UHCI_STS_HCHALTED;
> @@ -528,6 +536,10 @@ static uint32_t uhci_ioport_readw(void *opaque, uint32_t 
> addr)
>          val = s->intr;
>          break;
>      case 0x06:
> +        /* keep frame number in sync */
> +        if ((s->status & UHCI_STS_HCHALTED) == 0 &&
> +            s->expire_time <= qemu_get_clock(vm_clock))
> +            uhci_frame_timer(s);
>          val = s->frnum;
>          break;
>      case 0x10 ... 0x1f:
> @@ -1020,7 +1032,6 @@ static void uhci_process_frame(UHCIState *s)
>  static void uhci_frame_timer(void *opaque)
>  {
>      UHCIState *s = opaque;
> -    int64_t expire_time;
>  
>      if (!(s->cmd & UHCI_CMD_RS)) {
>          /* Full stop */
> @@ -1051,9 +1062,9 @@ static void uhci_frame_timer(void *opaque)
>      uhci_async_validate_end(s);
>  
>      /* prepare the timer for the next frame */
> -    expire_time = qemu_get_clock(vm_clock) +
> +    s->expire_time = qemu_get_clock(vm_clock) +
>          (ticks_per_sec / FRAME_TIMER_FREQ);
> -    qemu_mod_timer(s->frame_timer, expire_time);
> +    qemu_mod_timer(s->frame_timer, s->expire_time);
>  }
>  
>  static void uhci_map(PCIDevice *pci_dev, int region_num,



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.