* [PATCH] usb: gadget: f_uvc: fix superspeedplus transfer
@ 2022-02-14 5:52 3090101217
2022-02-14 10:37 ` Greg KH
0 siblings, 1 reply; 11+ messages in thread
From: 3090101217 @ 2022-02-14 5:52 UTC (permalink / raw)
To: laurent.pinchart, balbi, gregkh; +Cc: linux-usb, linux-kernel, Jing Leng
From: Jing Leng <jleng@ambarella.com>
UVC driver doesn't set ssp_descriptors in struct usb_function,
If we use ssp UDC (e.g. cdnsp), UVC doesn't work.
Signed-off-by: Jing Leng <jleng@ambarella.com>
---
drivers/usb/gadget/function/f_uvc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 71bb5e477dba..8fc9b035481e 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -478,6 +478,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
void *mem;
switch (speed) {
+ case USB_SPEED_SUPER_PLUS:
case USB_SPEED_SUPER:
uvc_control_desc = uvc->desc.ss_control;
uvc_streaming_cls = uvc->desc.ss_streaming;
@@ -521,7 +522,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
+ uvc_control_ep.bLength + uvc_control_cs_ep.bLength
+ uvc_streaming_intf_alt0.bLength;
- if (speed == USB_SPEED_SUPER) {
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS) {
bytes += uvc_ss_control_comp.bLength;
n_desc = 6;
} else {
@@ -565,7 +566,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf;
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep);
- if (speed == USB_SPEED_SUPER)
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp);
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_cs_ep);
@@ -727,6 +728,15 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
}
}
+ if (gadget_is_superspeed_plus(c->cdev->gadget)) {
+ f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS);
+ if (IS_ERR(f->ssp_descriptors)) {
+ ret = PTR_ERR(f->ssp_descriptors);
+ f->ssp_descriptors = NULL;
+ goto error;
+ }
+ }
+
/* Preallocate control endpoint request. */
uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
uvc->control_buf = kmalloc(UVC_MAX_REQUEST_SIZE, GFP_KERNEL);
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] usb: gadget: f_uvc: fix superspeedplus transfer
2022-02-14 5:52 [PATCH] usb: gadget: f_uvc: fix superspeedplus transfer 3090101217
@ 2022-02-14 10:37 ` Greg KH
2022-02-15 2:16 ` [PATCH v2] " 3090101217
0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2022-02-14 10:37 UTC (permalink / raw)
To: 3090101217; +Cc: laurent.pinchart, balbi, linux-usb, linux-kernel, Jing Leng
On Mon, Feb 14, 2022 at 01:52:24PM +0800, 3090101217@zju.edu.cn wrote:
> From: Jing Leng <jleng@ambarella.com>
>
> UVC driver doesn't set ssp_descriptors in struct usb_function,
> If we use ssp UDC (e.g. cdnsp), UVC doesn't work.
I do not understand this text, sorry. Please try to reword it to have
more descriptions.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] usb: gadget: f_uvc: fix superspeedplus transfer
2022-02-14 10:37 ` Greg KH
@ 2022-02-15 2:16 ` 3090101217
2022-02-15 14:07 ` Greg KH
0 siblings, 1 reply; 11+ messages in thread
From: 3090101217 @ 2022-02-15 2:16 UTC (permalink / raw)
To: gregkh; +Cc: balbi, jleng, laurent.pinchart, linux-kernel, linux-usb
From: Jing Leng <jleng@ambarella.com>
UVC driver doesn't set ssp_descriptors in struct usb_function,
If UVC uses superspeedplus UDC (e.g. cdnsp), when
config_ep_by_speed_and_alt is called, the g->speed is
USB_SPEED_SUPER_PLUS, and f->ssp_descriptors is NULL,
So kernel will access NULL pointer of speed_desc.
Call trace:
config_ep_by_speed_and_alt+0x3c/0x2a0 [libcomposite]
uvc_function_set_alt+0xd4/0x2e8 [usb_f_uvc]
set_config.constprop.0+0x154/0x3a0 [libcomposite]
composite_setup+0x314/0xb44 [libcomposite]
configfs_composite_setup+0x84/0xb0 [libcomposite]
cdnsp_ep0_std_request+0x25c/0x470 [cdns3]
cdnsp_setup_analyze+0x94/0x25c [cdns3]
cdnsp_handle_event+0xe8/0x23c [cdns3]
cdnsp_thread_irq_handler+0x58/0xe8 [cdns3]
irq_thread_fn+0x2c/0xa0
irq_thread+0x164/0x280
kthread+0x128/0x134
ret_from_fork+0x10/0x40
Signed-off-by: Jing Leng <jleng@ambarella.com>
---
drivers/usb/gadget/function/f_uvc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 71bb5e477dba..8fc9b035481e 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -478,6 +478,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
void *mem;
switch (speed) {
+ case USB_SPEED_SUPER_PLUS:
case USB_SPEED_SUPER:
uvc_control_desc = uvc->desc.ss_control;
uvc_streaming_cls = uvc->desc.ss_streaming;
@@ -521,7 +522,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
+ uvc_control_ep.bLength + uvc_control_cs_ep.bLength
+ uvc_streaming_intf_alt0.bLength;
- if (speed == USB_SPEED_SUPER) {
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS) {
bytes += uvc_ss_control_comp.bLength;
n_desc = 6;
} else {
@@ -565,7 +566,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf;
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep);
- if (speed == USB_SPEED_SUPER)
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp);
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_cs_ep);
@@ -727,6 +728,15 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
}
}
+ if (gadget_is_superspeed_plus(c->cdev->gadget)) {
+ f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS);
+ if (IS_ERR(f->ssp_descriptors)) {
+ ret = PTR_ERR(f->ssp_descriptors);
+ f->ssp_descriptors = NULL;
+ goto error;
+ }
+ }
+
/* Preallocate control endpoint request. */
uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
uvc->control_buf = kmalloc(UVC_MAX_REQUEST_SIZE, GFP_KERNEL);
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2] usb: gadget: f_uvc: fix superspeedplus transfer
2022-02-15 2:16 ` [PATCH v2] " 3090101217
@ 2022-02-15 14:07 ` Greg KH
2022-02-16 2:34 ` 冷静
0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2022-02-15 14:07 UTC (permalink / raw)
To: 3090101217; +Cc: balbi, jleng, laurent.pinchart, linux-kernel, linux-usb
On Tue, Feb 15, 2022 at 10:16:47AM +0800, 3090101217@zju.edu.cn wrote:
> From: Jing Leng <jleng@ambarella.com>
>
> UVC driver doesn't set ssp_descriptors in struct usb_function,
> If UVC uses superspeedplus UDC (e.g. cdnsp), when
> config_ep_by_speed_and_alt is called, the g->speed is
> USB_SPEED_SUPER_PLUS, and f->ssp_descriptors is NULL,
> So kernel will access NULL pointer of speed_desc.
>
> Call trace:
> config_ep_by_speed_and_alt+0x3c/0x2a0 [libcomposite]
> uvc_function_set_alt+0xd4/0x2e8 [usb_f_uvc]
> set_config.constprop.0+0x154/0x3a0 [libcomposite]
> composite_setup+0x314/0xb44 [libcomposite]
> configfs_composite_setup+0x84/0xb0 [libcomposite]
> cdnsp_ep0_std_request+0x25c/0x470 [cdns3]
> cdnsp_setup_analyze+0x94/0x25c [cdns3]
> cdnsp_handle_event+0xe8/0x23c [cdns3]
> cdnsp_thread_irq_handler+0x58/0xe8 [cdns3]
> irq_thread_fn+0x2c/0xa0
> irq_thread+0x164/0x280
> kthread+0x128/0x134
> ret_from_fork+0x10/0x40
What does "call trace" here mean? Is this an error? Something else?
>
> Signed-off-by: Jing Leng <jleng@ambarella.com>
> ---
> drivers/usb/gadget/function/f_uvc.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
You did not read the information that my bot told you to read, for how
to properly version your patches :(
Please go back and do so when you resend all of them.
Also this is not a patch series? Why not?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] usb: gadget: f_uvc: fix superspeedplus transfer
2022-02-15 14:07 ` Greg KH
@ 2022-02-16 2:34 ` 冷静
2022-02-16 10:39 ` Greg KH
0 siblings, 1 reply; 11+ messages in thread
From: 冷静 @ 2022-02-16 2:34 UTC (permalink / raw)
To: Greg KH; +Cc: balbi, jleng, laurent.pinchart, linux-kernel, linux-usb
Hi Greg KH,
Sorry for the trouble, as a new contributor to kernel.
Although I have readed the document that how to submit patches,
I'm still missing some details.
> What does "call trace" here mean? Is this an error? Something else?
It is "call trace" when the kernel accessed NULL pointer and handed.
> You did not read the information that my bot told you to read, for how
> to properly version your patches :(
>
> Please go back and do so when you resend all of them.
>
> Also this is not a patch series? Why not?
I readed the bot told, but I still missed it.
The new patch only adds more detailed patch description.
So it is not a patch series.
thanks,
Jing Leng
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] usb: gadget: f_uvc: fix superspeedplus transfer
2022-02-16 2:34 ` 冷静
@ 2022-02-16 10:39 ` Greg KH
2022-02-17 2:57 ` Jing Leng
0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2022-02-16 10:39 UTC (permalink / raw)
To: 冷静; +Cc: balbi, jleng, laurent.pinchart, linux-kernel, linux-usb
On Wed, Feb 16, 2022 at 10:34:00AM +0800, 冷静 wrote:
> Hi Greg KH,
>
> Sorry for the trouble, as a new contributor to kernel.
That's fine, maybe get some more experience first before trying to add
new features? Try doing some coding style cleanups in drivers/staging/
or reviewing other people's code submissions first. That way you can
learn how things work easier.
> Although I have readed the document that how to submit patches,
> I'm still missing some details.
>
> > What does "call trace" here mean? Is this an error? Something else?
> It is "call trace" when the kernel accessed NULL pointer and handed.
I do not understand this, sorry.
> > You did not read the information that my bot told you to read, for how
> > to properly version your patches :(
> >
> > Please go back and do so when you resend all of them.
> >
> > Also this is not a patch series? Why not?
>
> I readed the bot told, but I still missed it.
> The new patch only adds more detailed patch description.
> So it is not a patch series.
I asked you to make it a patch series.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] usb: gadget: f_uvc: fix superspeedplus transfer
2022-02-16 10:39 ` Greg KH
@ 2022-02-17 2:57 ` Jing Leng
2022-02-17 3:10 ` [PATCH v3] usb: gadget: f_uvc: add superspeed plus transfer support 3090101217
0 siblings, 1 reply; 11+ messages in thread
From: Jing Leng @ 2022-02-17 2:57 UTC (permalink / raw)
To: Greg KH; +Cc: balbi, jleng, laurent.pinchart, linux-kernel, linux-usb
Hi Greg KH,
Sorry for the confusion.
I tested the feature on linux-5.10, it will cause Oops.
The Oops is as follows:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
Mem abort info:
ESR = 0x96000005
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000005
CM = 0, WnR = 0
user pgtable: 4k pages, 39-bit VAs, pgdp=00000001b12cf000
[0000000000000000] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
Internal error: Oops: 96000005 [#1] PREEMPT SMP
Modules linked in: ...
CPU: 0 PID: 619 Comm: irq/95-20200080 Tainted: G O 5.10.61 #2
Hardware name: Ambarella CV5 TIMN Board (DT)
pstate: 20c00085 (nzCv daIf +PAN +UAO -TCO BTYPE=--)
pc : config_ep_by_speed_and_alt+0x3c/0x2a0 [libcomposite]
lr : config_ep_by_speed+0x14/0x20 [libcomposite]
sp : ffffffc011dbbac0
x29: ffffffc011dbbac0 x28: 0000000000000001
x27: ffffff81b3eb1920 x26: 0000000000000000
x25: ffffff81b68085e8 x24: ffffff81b3ee4c00
x23: ffffff81b3d71c40 x22: 0000000000000000
x21: 0000000000000000 x20: ffffff81b68085e8
x19: ffffff81b6808000 x18: ffffffc091dbb737
x17: 0000000000000017 x16: 000000000000000a
x15: 0000000000000006 x14: ffffffc011dbb73f
x13: 0000000000000001 x12: ffffffc0109c97e8
x11: 0000000000000652 x10: 00000000000e5a65
x9 : ffffffc0109c97e8 x8 : 00000000fffff7ff
x7 : 00000000000017fd x6 : 0000000000000001
x5 : ffffff81fb5976a8 x4 : 0000000000000006
x3 : 0000000000000000 x2 : ffffff81b6838718
x1 : 0000000000000000 x0 : ffffff81b6838008
Call trace:
config_ep_by_speed_and_alt+0x3c/0x2a0 [libcomposite]
uvc_function_set_alt+0xd4/0x2e8 [usb_f_uvc]
set_config.constprop.0+0x154/0x3a0 [libcomposite]
composite_setup+0x314/0xb44 [libcomposite]
configfs_composite_setup+0x84/0xb0 [libcomposite]
cdnsp_ep0_std_request+0x25c/0x470 [cdns3]
cdnsp_setup_analyze+0x94/0x25c [cdns3]
cdnsp_handle_event+0xe8/0x23c [cdns3]
cdnsp_thread_irq_handler+0x58/0xe8 [cdns3]
irq_thread_fn+0x2c/0xa0
irq_thread+0x164/0x280
kthread+0x128/0x134
ret_from_fork+0x10/0x40
Code: 71000c9f 54000b60 f9400821 52800006 (f9400024)
---[ end trace 7d3065b8181de7a6 ]---
note: irq/95-20200080[619] exited with preempt_count 2
genirq: exiting task "irq/95-20200080" (619) is an active IRQ thread (irq 95)
But the Oops is fixed in the latest kernel by the following commit:
commit 16d42759207fc3d1bff7cfd330a08a225e470ba0
Author: Qihang Hu <huqihang@oppo.com>
Date: Wed Nov 10 18:11:29 2021 +0800
usb: gadget: composite: Show warning if function driver's descriptors are incomplete.
There are some problems with my previous understanding,
so the patch is a feature but not a bug, I will modify the
title and description of the patch and resend it.
Thanks
Jing Leng
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3] usb: gadget: f_uvc: add superspeed plus transfer support
2022-02-17 2:57 ` Jing Leng
@ 2022-02-17 3:10 ` 3090101217
2022-11-03 6:00 ` [PATCH v4] usb: gadget: f_uvc: add super speed " Jing Leng
0 siblings, 1 reply; 11+ messages in thread
From: 3090101217 @ 2022-02-17 3:10 UTC (permalink / raw)
To: gregkh, balbi, laurent.pinchart; +Cc: linux-kernel, linux-usb, Jing Leng
From: Jing Leng <jleng@ambarella.com>
UVC driver doesn't set ssp_descriptors in struct usb_function,
it doesn't support USB_SPEED_SUPER_PLUS transfer. So we can
refer to USB_SPEED_SUPER to realize the support of
USB_SPEED_SUPER_PLUS.
If users use a USB device controller that speed can be up to
USB_SPEED_SUPER_PLUS (10 Gbps), downgrading to USB_SPEED_SUPER
(5 Gbps) is not a good performance. In addition, it triggers a
warning "configfs-gadget gadget: uvc doesn't hold the descriptors
for current speed".
Signed-off-by: Jing Leng <jleng@ambarella.com>
---
ChangeLog v2->v3:
- Modify the title and description of the PATCH
- It is a feature but not a bug
ChangeLog v1->v2:
- Update more detailed description of the PATCH
---
drivers/usb/gadget/function/f_uvc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 71bb5e477dba..8fc9b035481e 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -478,6 +478,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
void *mem;
switch (speed) {
+ case USB_SPEED_SUPER_PLUS:
case USB_SPEED_SUPER:
uvc_control_desc = uvc->desc.ss_control;
uvc_streaming_cls = uvc->desc.ss_streaming;
@@ -521,7 +522,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
+ uvc_control_ep.bLength + uvc_control_cs_ep.bLength
+ uvc_streaming_intf_alt0.bLength;
- if (speed == USB_SPEED_SUPER) {
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS) {
bytes += uvc_ss_control_comp.bLength;
n_desc = 6;
} else {
@@ -565,7 +566,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf;
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep);
- if (speed == USB_SPEED_SUPER)
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp);
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_cs_ep);
@@ -727,6 +728,15 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
}
}
+ if (gadget_is_superspeed_plus(c->cdev->gadget)) {
+ f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS);
+ if (IS_ERR(f->ssp_descriptors)) {
+ ret = PTR_ERR(f->ssp_descriptors);
+ f->ssp_descriptors = NULL;
+ goto error;
+ }
+ }
+
/* Preallocate control endpoint request. */
uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
uvc->control_buf = kmalloc(UVC_MAX_REQUEST_SIZE, GFP_KERNEL);
--
2.17.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v4] usb: gadget: f_uvc: add super speed plus transfer support
2022-02-17 3:10 ` [PATCH v3] usb: gadget: f_uvc: add superspeed plus transfer support 3090101217
@ 2022-11-03 6:00 ` Jing Leng
[not found] ` <166746992763.2442643.8937261146141591391@Monstersaurus>
2022-11-03 13:30 ` Greg KH
0 siblings, 2 replies; 11+ messages in thread
From: Jing Leng @ 2022-11-03 6:00 UTC (permalink / raw)
To: balbi, gregkh, laurent.pinchart; +Cc: linux-kernel, linux-usb, Jing Leng
UVC driver doesn't set ssp_descriptors in struct usb_function,
it doesn't support USB_SPEED_SUPER_PLUS transfer. So we can
refer to USB_SPEED_SUPER to realize the support of
USB_SPEED_SUPER_PLUS.
If users use a USB device controller that speed can be up to
USB_SPEED_SUPER_PLUS (10 Gbps), downgrading to USB_SPEED_SUPER
(5 Gbps) is not a good performance. In addition, it triggers a
warning "configfs-gadget gadget: uvc doesn't hold the descriptors
for current speed".
Signed-off-by: Jing Leng <jleng@ambarella.com>
---
ChangeLog v3->v4:
- Rebase the patch.
- Make email addresses ('From' and 'Signed-off-by') consistent.
ChangeLog v2->v3:
- Modify the title and description of the PATCH
- It is a feature but not a bug
ChangeLog v1->v2:
- Update more detailed description of the PATCH
---
drivers/usb/gadget/function/f_uvc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 6e196e06181e..6ffaf594be9d 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -482,6 +482,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
void *mem;
switch (speed) {
+ case USB_SPEED_SUPER_PLUS:
case USB_SPEED_SUPER:
uvc_control_desc = uvc->desc.ss_control;
uvc_streaming_cls = uvc->desc.ss_streaming;
@@ -526,7 +527,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
+ uvc_control_ep.bLength + uvc_control_cs_ep.bLength
+ uvc_streaming_intf_alt0.bLength;
- if (speed == USB_SPEED_SUPER) {
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS) {
bytes += uvc_ss_control_comp.bLength;
n_desc = 6;
} else {
@@ -570,7 +571,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf;
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep);
- if (speed == USB_SPEED_SUPER)
+ if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp);
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_cs_ep);
@@ -733,6 +734,15 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
}
}
+ if (gadget_is_superspeed_plus(c->cdev->gadget)) {
+ f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS);
+ if (IS_ERR(f->ssp_descriptors)) {
+ ret = PTR_ERR(f->ssp_descriptors);
+ f->ssp_descriptors = NULL;
+ goto error;
+ }
+ }
+
/* Preallocate control endpoint request. */
uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
uvc->control_buf = kmalloc(UVC_MAX_REQUEST_SIZE, GFP_KERNEL);
--
2.17.1
**********************************************************************
This email and attachments contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* RE: [EXT] Re: [PATCH v4] usb: gadget: f_uvc: add super speed plus transfer support
[not found] ` <166746992763.2442643.8937261146141591391@Monstersaurus>
@ 2022-11-03 10:39 ` Jing Leng
0 siblings, 0 replies; 11+ messages in thread
From: Jing Leng @ 2022-11-03 10:39 UTC (permalink / raw)
To: Kieran Bingham, balbi, gregkh, laurent.pinchart
Cc: linux-kernel, linux-usb, Dan Scally
Hi Kieran,
The patch is everthing that is required to support USB_SPEED_SUPER_PLUS.
I don't have a way to disabling this trailing legal statement when sending emails, it is automatically added by Ambarella mail server, not added by me.
Ambarella follows the GPLv2 protocol when submitting any linux kernel patches to the Linux community.
Thanks!
-----Original Message-----
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
Sent: Thursday, November 3, 2022 6:05 PM
To: Jing Leng <jleng@ambarella.com>; balbi@kernel.org; gregkh@linuxfoundation.org; laurent.pinchart@ideasonboard.com
Cc: linux-kernel@vger.kernel.org; linux-usb@vger.kernel.org; Jing Leng <jleng@ambarella.com>; Dan Scally <dan.scally@ideasonboard.com>
Subject: [EXT] Re: [PATCH v4] usb: gadget: f_uvc: add super speed plus transfer support
Hi Jing,
Quoting Jing Leng (2022-11-03 06:00:41)
> UVC driver doesn't set ssp_descriptors in struct usb_function, it
> doesn't support USB_SPEED_SUPER_PLUS transfer. So we can refer to
> USB_SPEED_SUPER to realize the support of USB_SPEED_SUPER_PLUS.
This is a bit confusing to read. Do you mean that we should (later?) add more functionality to support USB_SPEED_SUPER_PLUS? Or is this everthing that is required ?
> If users use a USB device controller that speed can be up to
> USB_SPEED_SUPER_PLUS (10 Gbps), downgrading to USB_SPEED_SUPER
> (5 Gbps) is not a good performance. In addition, it triggers a warning
> "configfs-gadget gadget: uvc doesn't hold the descriptors for current
> speed".
>
> Signed-off-by: Jing Leng <jleng@ambarella.com>
> ---
> ChangeLog v3->v4:
> - Rebase the patch.
> - Make email addresses ('From' and 'Signed-off-by') consistent.
> ChangeLog v2->v3:
> - Modify the title and description of the PATCH
> - It is a feature but not a bug
> ChangeLog v1->v2:
> - Update more detailed description of the PATCH
> ---
> drivers/usb/gadget/function/f_uvc.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_uvc.c
> b/drivers/usb/gadget/function/f_uvc.c
> index 6e196e06181e..6ffaf594be9d 100644
> --- a/drivers/usb/gadget/function/f_uvc.c
> +++ b/drivers/usb/gadget/function/f_uvc.c
> @@ -482,6 +482,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
> void *mem;
>
> switch (speed) {
> + case USB_SPEED_SUPER_PLUS:
> case USB_SPEED_SUPER:
> uvc_control_desc = uvc->desc.ss_control;
> uvc_streaming_cls = uvc->desc.ss_streaming; @@ -526,7
> +527,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
> + uvc_control_ep.bLength + uvc_control_cs_ep.bLength
> + uvc_streaming_intf_alt0.bLength;
>
> - if (speed == USB_SPEED_SUPER) {
> + if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
> + {
> bytes += uvc_ss_control_comp.bLength;
> n_desc = 6;
> } else {
> @@ -570,7 +571,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
> uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf;
>
> UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep);
> - if (speed == USB_SPEED_SUPER)
> + if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS)
> UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp);
>
> UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_cs_ep); @@ -733,6
> +734,15 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
> }
> }
>
> + if (gadget_is_superspeed_plus(c->cdev->gadget)) {
> + f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS);
> + if (IS_ERR(f->ssp_descriptors)) {
> + ret = PTR_ERR(f->ssp_descriptors);
> + f->ssp_descriptors = NULL;
> + goto error;
> + }
> + }
> +
> /* Preallocate control endpoint request. */
> uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
> uvc->control_buf = kmalloc(UVC_MAX_REQUEST_SIZE, GFP_KERNEL);
> --
> 2.17.1
>
>
> **********************************************************************
> This email and attachments contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.
Do you have a way to disabling this trailing legal statement when sending emails?
It's really not appropriate for sending to public mailinglists, and if you are really asserting that this patch is confidential and proprietary
- then it probably can't be integrated into the kernel ...
--
Kieran
######################################################################
This EXTERNAL email has been scanned by Proofpoint Email Protect service.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4] usb: gadget: f_uvc: add super speed plus transfer support
2022-11-03 6:00 ` [PATCH v4] usb: gadget: f_uvc: add super speed " Jing Leng
[not found] ` <166746992763.2442643.8937261146141591391@Monstersaurus>
@ 2022-11-03 13:30 ` Greg KH
1 sibling, 0 replies; 11+ messages in thread
From: Greg KH @ 2022-11-03 13:30 UTC (permalink / raw)
To: Jing Leng; +Cc: balbi, laurent.pinchart, linux-kernel, linux-usb
On Thu, Nov 03, 2022 at 02:00:41PM +0800, Jing Leng wrote:
> **********************************************************************
> This email and attachments contain Ambarella Proprietary and/or Confidential Information and is intended solely for the use of the individual(s) to whom it is addressed. Any unauthorized review, use, disclosure, distribute, copy, or print is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy all copies of the original message. Thank you.
Now deleted, sorry.
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-11-03 13:30 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 5:52 [PATCH] usb: gadget: f_uvc: fix superspeedplus transfer 3090101217
2022-02-14 10:37 ` Greg KH
2022-02-15 2:16 ` [PATCH v2] " 3090101217
2022-02-15 14:07 ` Greg KH
2022-02-16 2:34 ` 冷静
2022-02-16 10:39 ` Greg KH
2022-02-17 2:57 ` Jing Leng
2022-02-17 3:10 ` [PATCH v3] usb: gadget: f_uvc: add superspeed plus transfer support 3090101217
2022-11-03 6:00 ` [PATCH v4] usb: gadget: f_uvc: add super speed " Jing Leng
[not found] ` <166746992763.2442643.8937261146141591391@Monstersaurus>
2022-11-03 10:39 ` [EXT] " Jing Leng
2022-11-03 13:30 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).