All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: WangYuli <wangyuli@uniontech.com>,
	mathias.nyman@intel.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	niklas.neronin@linux.intel.com, quic_wcheng@quicinc.com,
	andriy.shevchenko@linux.intel.com, michal.pecio@gmail.com,
	guanwentao@uniontech.com, zhanjun@uniontech.com,
	bigeasy@linutronix.de, balbi@ti.com, hkallweit1@gmail.com,
	Xu Rao <raoxu@uniontech.com>
Subject: Re: [PATCH v2] usb: host: xhci-plat: Assign shared_hcd->rsrc_start
Date: Thu, 9 Jan 2025 12:04:58 +0200	[thread overview]
Message-ID: <1f8f3630-e96a-4929-b95f-46002c8d0143@linux.intel.com> (raw)
In-Reply-To: <7ECE325975663D2D+20250104155111.100597-1-wangyuli@uniontech.com>

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


      parent reply	other threads:[~2025-01-09 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f8f3630-e96a-4929-b95f-46002c8d0143@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=guanwentao@uniontech.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=michal.pecio@gmail.com \
    --cc=niklas.neronin@linux.intel.com \
    --cc=quic_wcheng@quicinc.com \
    --cc=raoxu@uniontech.com \
    --cc=wangyuli@uniontech.com \
    --cc=zhanjun@uniontech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.