* [PATCH v2] usb: host: xhci-plat: Assign shared_hcd->rsrc_start
@ 2025-01-04 15:51 WangYuli
2025-01-07 10:36 ` Greg KH
2025-01-09 10:04 ` Mathias Nyman
0 siblings, 2 replies; 4+ messages in thread
From: WangYuli @ 2025-01-04 15:51 UTC (permalink / raw)
To: mathias.nyman, gregkh
Cc: linux-usb, linux-kernel, niklas.neronin, quic_wcheng,
andriy.shevchenko, michal.pecio, guanwentao, zhanjun, bigeasy,
balbi, sarah.a.sharp, hkallweit1, WangYuli, Xu Rao
When inserting a USB device, examining hcd->rsrc_start can be
helpful in identifying which hcd is mounted, as the physical
address represented here is typically unique.
The following code snippet demonstrates this:
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
unsigned long long usb_hcd_addr = (unsigned long long)hcd->rsrc_start;
However, this approach has limitations now. For USB hosts with an
MMIO interface, the effectiveness of this method is restricted to
USB 2.0.
Becase commit 3429e91a661e ("usb: host: xhci: add platform driver
support") assigned res->start to hcd->rsrc_start. But
shared_hcd->rsrc_start remains unassigned, which is also necessary
in certain scenarios.
Co-developed-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: Xu Rao <raoxu@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
--
Changlog:
v1 -> v2: Move code changes for commit e0fe986972f5 ("usb: host:
xhci-plat: prepare operation w/o shared hcd").
---
drivers/usb/host/xhci-plat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index e6c9006bd568..457e839b9b53 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -329,6 +329,8 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
usb3_hcd->can_do_streams = 1;
if (xhci->shared_hcd) {
+ xhci->shared_hcd->rsrc_start = hcd->rsrc_start;
+ xhci->shared_hcd->rsrc_len = hcd->rsrc_len;
ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
if (ret)
goto put_usb3_hcd;
--
2.45.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] usb: host: xhci-plat: Assign shared_hcd->rsrc_start
2025-01-04 15:51 [PATCH v2] usb: host: xhci-plat: Assign shared_hcd->rsrc_start WangYuli
@ 2025-01-07 10:36 ` Greg KH
2025-01-07 13:18 ` WangYuli
2025-01-09 10:04 ` Mathias Nyman
1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2025-01-07 10:36 UTC (permalink / raw)
To: WangYuli
Cc: mathias.nyman, linux-usb, linux-kernel, niklas.neronin,
quic_wcheng, andriy.shevchenko, michal.pecio, guanwentao, zhanjun,
bigeasy, balbi, sarah.a.sharp, hkallweit1, Xu Rao
On Sat, Jan 04, 2025 at 11:51:11PM +0800, WangYuli wrote:
> When inserting a USB device, examining hcd->rsrc_start can be
> helpful in identifying which hcd is mounted, as the physical
> address represented here is typically unique.
>
> The following code snippet demonstrates this:
> struct usb_hcd *hcd = bus_to_hcd(udev->bus);
> unsigned long long usb_hcd_addr = (unsigned long long)hcd->rsrc_start;
>
> However, this approach has limitations now. For USB hosts with an
> MMIO interface, the effectiveness of this method is restricted to
> USB 2.0.
>
> Becase commit 3429e91a661e ("usb: host: xhci: add platform driver
> support") assigned res->start to hcd->rsrc_start. But
> shared_hcd->rsrc_start remains unassigned, which is also necessary
> in certain scenarios.
>
> Co-developed-by: Xu Rao <raoxu@uniontech.com>
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
> Signed-off-by: WangYuli <wangyuli@uniontech.com>
> --
> Changlog:
> v1 -> v2: Move code changes for commit e0fe986972f5 ("usb: host:
> xhci-plat: prepare operation w/o shared hcd").
> ---
What commit id does this fix?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] usb: host: xhci-plat: Assign shared_hcd->rsrc_start
2025-01-07 10:36 ` Greg KH
@ 2025-01-07 13:18 ` WangYuli
0 siblings, 0 replies; 4+ messages in thread
From: WangYuli @ 2025-01-07 13:18 UTC (permalink / raw)
To: Greg KH
Cc: mathias.nyman, linux-usb, linux-kernel, niklas.neronin,
quic_wcheng, andriy.shevchenko, michal.pecio, guanwentao, zhanjun,
bigeasy, balbi, sarah.a.sharp, hkallweit1, Xu Rao
[-- Attachment #1.1.1.1: Type: text/plain, Size: 349 bytes --]
On 2025/1/7 18:36, Greg KH wrote:
> What commit id does this fix?
Hi Greg,
I'm not sure if this can be considered a bugfix for a specific commit.
Please see the commit message for more details.
If it is, then it does fix 3429e91a661e1 ("usb: host: xhci: add platform
driver support").
> thanks,
>
> greg k-h
>
--
WangYuli
[-- Attachment #1.1.1.2: Type: text/html, Size: 1092 bytes --]
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 645 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] usb: host: xhci-plat: Assign shared_hcd->rsrc_start
2025-01-04 15:51 [PATCH v2] usb: host: xhci-plat: Assign shared_hcd->rsrc_start WangYuli
2025-01-07 10:36 ` Greg KH
@ 2025-01-09 10:04 ` Mathias Nyman
1 sibling, 0 replies; 4+ messages in thread
From: Mathias Nyman @ 2025-01-09 10:04 UTC (permalink / raw)
To: WangYuli, mathias.nyman, gregkh
Cc: linux-usb, linux-kernel, niklas.neronin, quic_wcheng,
andriy.shevchenko, michal.pecio, guanwentao, zhanjun, bigeasy,
balbi, hkallweit1, Xu Rao
On 4.1.2025 17.51, WangYuli wrote:
> When inserting a USB device, examining hcd->rsrc_start can be
> helpful in identifying which hcd is mounted, as the physical
> address represented here is typically unique.
>
> The following code snippet demonstrates this:
> struct usb_hcd *hcd = bus_to_hcd(udev->bus);
> unsigned long long usb_hcd_addr = (unsigned long long)hcd->rsrc_start;
>
> However, this approach has limitations now. For USB hosts with an
> MMIO interface, the effectiveness of this method is restricted to
> USB 2.0.
>
> Becase commit 3429e91a661e ("usb: host: xhci: add platform driver
> support") assigned res->start to hcd->rsrc_start. But
> shared_hcd->rsrc_start remains unassigned, which is also necessary
> in certain scenarios.
Could you expand on those scenarios?
Is it possible those could be solved with something like:
unsigned long long usb_hcd_addr;
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
if (!usb_hcd_is_primary_hcd(hcd))
hcd = hcd->primary_hcd;
usb_hcd_addr = (unsigned long long)hcd->rsrc_start;
That should work for all hcds.
Thanks
Mathias
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-09 10:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-04 15:51 [PATCH v2] usb: host: xhci-plat: Assign shared_hcd->rsrc_start WangYuli
2025-01-07 10:36 ` Greg KH
2025-01-07 13:18 ` WangYuli
2025-01-09 10:04 ` Mathias Nyman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox