All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] xhci: add property to turn on/off streams support
@ 2014-10-21 13:16 Gerd Hoffmann
  2014-10-22 14:35 ` Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2014-10-21 13:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: hdegoede, Gerd Hoffmann, Dr. David Alan Gilbert,
	Markus Armbruster

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-xhci.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index a27c9d3..2930b72 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -459,6 +459,7 @@ struct XHCIState {
     uint32_t numintrs;
     uint32_t numslots;
     uint32_t flags;
+    uint32_t max_pstreams_mask;
 
     /* Operational Registers */
     uint32_t usbcmd;
@@ -500,6 +501,7 @@ enum xhci_flags {
     XHCI_FLAG_USE_MSI_X,
     XHCI_FLAG_SS_FIRST,
     XHCI_FLAG_FORCE_PCIE_ENDCAP,
+    XHCI_FLAG_ENABLE_STREAMS,
 };
 
 static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
@@ -1384,7 +1386,7 @@ static void xhci_init_epctx(XHCIEPContext *epctx,
     epctx->pctx = pctx;
     epctx->max_psize = ctx[1]>>16;
     epctx->max_psize *= 1+((ctx[1]>>8)&0xff);
-    epctx->max_pstreams = (ctx[0] >> 10) & 0xf;
+    epctx->max_pstreams = (ctx[0] >> 10) & epctx->xhci->max_pstreams_mask;
     epctx->lsa = (ctx[0] >> 15) & 1;
     if (epctx->max_pstreams) {
         xhci_alloc_streams(epctx, dequeue);
@@ -2956,9 +2958,9 @@ static uint64_t xhci_cap_read(void *ptr, hwaddr reg, unsigned size)
         break;
     case 0x10: /* HCCPARAMS */
         if (sizeof(dma_addr_t) == 4) {
-            ret = 0x00087000;
+            ret = 0x00080000 | (xhci->max_pstreams_mask << 12);
         } else {
-            ret = 0x00087001;
+            ret = 0x00080001 | (xhci->max_pstreams_mask << 12);
         }
         break;
     case 0x14: /* DBOFF */
@@ -3590,6 +3592,11 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
     if (xhci->numslots < 1) {
         xhci->numslots = 1;
     }
+    if (xhci_get_flag(xhci, XHCI_FLAG_ENABLE_STREAMS)) {
+        xhci->max_pstreams_mask = 7; /* == 256 primary streams */
+    } else {
+        xhci->max_pstreams_mask = 0;
+    }
 
     xhci->mfwrap_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, xhci_mfwrap_timer, xhci);
 
@@ -3853,6 +3860,8 @@ static Property xhci_properties[] = {
                     XHCIState, flags, XHCI_FLAG_SS_FIRST, true),
     DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags,
                     XHCI_FLAG_FORCE_PCIE_ENDCAP, false),
+    DEFINE_PROP_BIT("streams", XHCIState, flags,
+                    XHCI_FLAG_ENABLE_STREAMS, true),
     DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS),
     DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS),
     DEFINE_PROP_UINT32("p2",    XHCIState, numports_2, 4),
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] xhci: add property to turn on/off streams support
  2014-10-21 13:16 [Qemu-devel] [PATCH] xhci: add property to turn on/off streams support Gerd Hoffmann
@ 2014-10-22 14:35 ` Hans de Goede
  2014-10-22 14:59 ` Dr. David Alan Gilbert
  2014-10-22 15:28 ` Markus Armbruster
  2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2014-10-22 14:35 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel; +Cc: Dr. David Alan Gilbert, Markus Armbruster

Hi,

On 10/21/2014 03:16 PM, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Looks good:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  hw/usb/hcd-xhci.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
> index a27c9d3..2930b72 100644
> --- a/hw/usb/hcd-xhci.c
> +++ b/hw/usb/hcd-xhci.c
> @@ -459,6 +459,7 @@ struct XHCIState {
>      uint32_t numintrs;
>      uint32_t numslots;
>      uint32_t flags;
> +    uint32_t max_pstreams_mask;
>  
>      /* Operational Registers */
>      uint32_t usbcmd;
> @@ -500,6 +501,7 @@ enum xhci_flags {
>      XHCI_FLAG_USE_MSI_X,
>      XHCI_FLAG_SS_FIRST,
>      XHCI_FLAG_FORCE_PCIE_ENDCAP,
> +    XHCI_FLAG_ENABLE_STREAMS,
>  };
>  
>  static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
> @@ -1384,7 +1386,7 @@ static void xhci_init_epctx(XHCIEPContext *epctx,
>      epctx->pctx = pctx;
>      epctx->max_psize = ctx[1]>>16;
>      epctx->max_psize *= 1+((ctx[1]>>8)&0xff);
> -    epctx->max_pstreams = (ctx[0] >> 10) & 0xf;
> +    epctx->max_pstreams = (ctx[0] >> 10) & epctx->xhci->max_pstreams_mask;
>      epctx->lsa = (ctx[0] >> 15) & 1;
>      if (epctx->max_pstreams) {
>          xhci_alloc_streams(epctx, dequeue);
> @@ -2956,9 +2958,9 @@ static uint64_t xhci_cap_read(void *ptr, hwaddr reg, unsigned size)
>          break;
>      case 0x10: /* HCCPARAMS */
>          if (sizeof(dma_addr_t) == 4) {
> -            ret = 0x00087000;
> +            ret = 0x00080000 | (xhci->max_pstreams_mask << 12);
>          } else {
> -            ret = 0x00087001;
> +            ret = 0x00080001 | (xhci->max_pstreams_mask << 12);
>          }
>          break;
>      case 0x14: /* DBOFF */
> @@ -3590,6 +3592,11 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
>      if (xhci->numslots < 1) {
>          xhci->numslots = 1;
>      }
> +    if (xhci_get_flag(xhci, XHCI_FLAG_ENABLE_STREAMS)) {
> +        xhci->max_pstreams_mask = 7; /* == 256 primary streams */
> +    } else {
> +        xhci->max_pstreams_mask = 0;
> +    }
>  
>      xhci->mfwrap_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, xhci_mfwrap_timer, xhci);
>  
> @@ -3853,6 +3860,8 @@ static Property xhci_properties[] = {
>                      XHCIState, flags, XHCI_FLAG_SS_FIRST, true),
>      DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags,
>                      XHCI_FLAG_FORCE_PCIE_ENDCAP, false),
> +    DEFINE_PROP_BIT("streams", XHCIState, flags,
> +                    XHCI_FLAG_ENABLE_STREAMS, true),
>      DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS),
>      DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS),
>      DEFINE_PROP_UINT32("p2",    XHCIState, numports_2, 4),
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] xhci: add property to turn on/off streams support
  2014-10-21 13:16 [Qemu-devel] [PATCH] xhci: add property to turn on/off streams support Gerd Hoffmann
  2014-10-22 14:35 ` Hans de Goede
@ 2014-10-22 14:59 ` Dr. David Alan Gilbert
  2014-10-22 15:28 ` Markus Armbruster
  2 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2014-10-22 14:59 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: hdegoede, qemu-devel, Markus Armbruster, Dr. David Alan Gilbert

* Gerd Hoffmann (kraxel@redhat.com) wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/usb/hcd-xhci.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
> index a27c9d3..2930b72 100644
> --- a/hw/usb/hcd-xhci.c
> +++ b/hw/usb/hcd-xhci.c
> @@ -459,6 +459,7 @@ struct XHCIState {
>      uint32_t numintrs;
>      uint32_t numslots;
>      uint32_t flags;
> +    uint32_t max_pstreams_mask;
>  
>      /* Operational Registers */
>      uint32_t usbcmd;
> @@ -500,6 +501,7 @@ enum xhci_flags {
>      XHCI_FLAG_USE_MSI_X,
>      XHCI_FLAG_SS_FIRST,
>      XHCI_FLAG_FORCE_PCIE_ENDCAP,
> +    XHCI_FLAG_ENABLE_STREAMS,
>  };
>  
>  static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
> @@ -1384,7 +1386,7 @@ static void xhci_init_epctx(XHCIEPContext *epctx,
>      epctx->pctx = pctx;
>      epctx->max_psize = ctx[1]>>16;
>      epctx->max_psize *= 1+((ctx[1]>>8)&0xff);
> -    epctx->max_pstreams = (ctx[0] >> 10) & 0xf;
> +    epctx->max_pstreams = (ctx[0] >> 10) & epctx->xhci->max_pstreams_mask;
>      epctx->lsa = (ctx[0] >> 15) & 1;
>      if (epctx->max_pstreams) {
>          xhci_alloc_streams(epctx, dequeue);
> @@ -2956,9 +2958,9 @@ static uint64_t xhci_cap_read(void *ptr, hwaddr reg, unsigned size)
>          break;
>      case 0x10: /* HCCPARAMS */
>          if (sizeof(dma_addr_t) == 4) {
> -            ret = 0x00087000;
> +            ret = 0x00080000 | (xhci->max_pstreams_mask << 12);
>          } else {
> -            ret = 0x00087001;
> +            ret = 0x00080001 | (xhci->max_pstreams_mask << 12);
>          }
>          break;
>      case 0x14: /* DBOFF */
> @@ -3590,6 +3592,11 @@ static int usb_xhci_initfn(struct PCIDevice *dev)
>      if (xhci->numslots < 1) {
>          xhci->numslots = 1;
>      }
> +    if (xhci_get_flag(xhci, XHCI_FLAG_ENABLE_STREAMS)) {
> +        xhci->max_pstreams_mask = 7; /* == 256 primary streams */
> +    } else {
> +        xhci->max_pstreams_mask = 0;
> +    }
>  
>      xhci->mfwrap_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, xhci_mfwrap_timer, xhci);
>  
> @@ -3853,6 +3860,8 @@ static Property xhci_properties[] = {
>                      XHCIState, flags, XHCI_FLAG_SS_FIRST, true),
>      DEFINE_PROP_BIT("force-pcie-endcap", XHCIState, flags,
>                      XHCI_FLAG_FORCE_PCIE_ENDCAP, false),
> +    DEFINE_PROP_BIT("streams", XHCIState, flags,
> +                    XHCI_FLAG_ENABLE_STREAMS, true),

That's enabling by default; so do you plan to add a patch to disable that
with older machine types?

Dave

>      DEFINE_PROP_UINT32("intrs", XHCIState, numintrs, MAXINTRS),
>      DEFINE_PROP_UINT32("slots", XHCIState, numslots, MAXSLOTS),
>      DEFINE_PROP_UINT32("p2",    XHCIState, numports_2, 4),
> -- 
> 1.8.3.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] xhci: add property to turn on/off streams support
  2014-10-21 13:16 [Qemu-devel] [PATCH] xhci: add property to turn on/off streams support Gerd Hoffmann
  2014-10-22 14:35 ` Hans de Goede
  2014-10-22 14:59 ` Dr. David Alan Gilbert
@ 2014-10-22 15:28 ` Markus Armbruster
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2014-10-22 15:28 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: hdegoede, qemu-devel, Dr. David Alan Gilbert

Could you briefly explain in the commit message why turning off streams
support is useful?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-22 15:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 13:16 [Qemu-devel] [PATCH] xhci: add property to turn on/off streams support Gerd Hoffmann
2014-10-22 14:35 ` Hans de Goede
2014-10-22 14:59 ` Dr. David Alan Gilbert
2014-10-22 15:28 ` Markus Armbruster

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.