All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prashanth K <prashanth.k@oss.qualcomm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] usb: dwc3: Log dwc3 instance name in traces
Date: Wed, 7 Jan 2026 11:33:11 +0530	[thread overview]
Message-ID: <dec18683-5b43-464f-a735-4bf26644aa0a@oss.qualcomm.com> (raw)
In-Reply-To: <2026010652-dissuade-reproduce-008d@gregkh>



On 1/6/2026 3:28 PM, Greg Kroah-Hartman wrote:
> On Mon, Jan 05, 2026 at 05:23:25PM +0530, Prashanth K wrote:
>> When multiple DWC3 controllers are being used, trace events from
>> different instances get mixed up making debugging difficult as
>> there's no way to distinguish which instance generated the trace.
>>
>> Append the base address of dwc3 controller to trace events, so that
>> the source instance is clearly identifiable.
>>
>> Example trace output,
>> before ->  dwc3_event: event (00000101): Reset [U0]
>> after  ->  dwc3_event: 0a600000: event (00000101): Reset [U0]
>>
>> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
>> ---
>>  drivers/usb/dwc3/core.c   |  6 ++-
>>  drivers/usb/dwc3/core.h   |  2 +
>>  drivers/usb/dwc3/ep0.c    |  2 +-
>>  drivers/usb/dwc3/gadget.c |  2 +-
>>  drivers/usb/dwc3/io.h     |  4 +-
>>  drivers/usb/dwc3/trace.h  | 88 ++++++++++++++++++++++++---------------
>>  6 files changed, 66 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index 670a9d4bfff2..3aa85f5f1c47 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -158,7 +158,7 @@ void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode, bool ignore_susphy)
>>  	dwc3_writel(dwc, DWC3_GCTL, reg);
>>  
>>  	dwc->current_dr_role = mode;
>> -	trace_dwc3_set_prtcap(mode);
>> +	trace_dwc3_set_prtcap(dwc, mode);
>>  }
>>  EXPORT_SYMBOL_GPL(dwc3_set_prtcap);
>>  
>> @@ -2193,6 +2193,10 @@ int dwc3_core_probe(const struct dwc3_probe_data *data)
>>  	dwc_res = *res;
>>  	dwc_res.start += DWC3_GLOBALS_REGS_START;
>>  
>> +	/* Store the physical base address for logging in trace */
>> +	snprintf(dwc->base_addr, sizeof(dwc->base_addr), "%08llx",
>> +		 (unsigned long long)res->start);
> 
> I think start is defined as resource_size_t, which is really
> phys_addr_t, which is then either a u64 or u32, so why not just use u64
> here?
> 
Yes, we can substitute u64 instead of `unsigned long long`

+	snprintf(dwc->base_addr, sizeof(dwc->base_addr), "%08llx",
+		 (u64)res->start);

> And are you _sure_ it is ok to expose that to userspace?
> 
yes, because it's already part of devname in most cases.
> 
>> +
>>  	if (dev->of_node) {
>>  		struct device_node *parent = of_get_parent(dev->of_node);
>>  
>> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
>> index 23188b910528..c16e47273ea0 100644
>> --- a/drivers/usb/dwc3/core.h
>> +++ b/drivers/usb/dwc3/core.h
>> @@ -1178,6 +1178,7 @@ struct dwc3_glue_ops {
>>   * @wakeup_pending_funcs: Indicates whether any interface has requested for
>>   *			 function wakeup in bitmap format where bit position
>>   *			 represents interface_id.
>> + * @base_addr: The HW base address of DWC3 controller.
> 
> You already have this pointer to the resource in dwc3 somewhere, so why
> are you storing this as a char string and not just always using the
> "real" resource instead?
> 
No Greg, dwc3 struct doesn't have the resource pointer, but has res for
xhci.

> And also, document this as ONLY needed for debugging things, that's not
> obvious here at all.
> 
Sure

Regards,
Prashanth K


  reply	other threads:[~2026-01-07  6:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 11:53 [PATCH v2 0/3] Add the DWC3 instance name in traces Prashanth K
2026-01-05 11:53 ` [PATCH v2 1/3] usb: dwc3: Remove of dep->regs Prashanth K
2026-01-09  0:53   ` Thinh Nguyen
2026-01-05 11:53 ` [PATCH v2 2/3] usb: dwc3: Add dwc pointer to dwc3_readl/writel Prashanth K
2026-01-09  0:54   ` Thinh Nguyen
2026-01-05 11:53 ` [PATCH v2 3/3] usb: dwc3: Log dwc3 instance name in traces Prashanth K
2026-01-05 12:43   ` Greg Kroah-Hartman
2026-01-06  9:58   ` Greg Kroah-Hartman
2026-01-07  6:03     ` Prashanth K [this message]
2026-01-07  6:40       ` Greg Kroah-Hartman
2026-01-07  9:05         ` Prashanth K
2026-01-09  1:18   ` Thinh Nguyen
2026-01-09 10:04     ` Prashanth K
2026-01-13  1:38       ` Thinh Nguyen
2026-01-05 12:44 ` [PATCH v2 0/3] Add the DWC3 " Greg Kroah-Hartman
2026-01-05 16:11   ` Thinh Nguyen
2026-01-05 16:27     ` Greg Kroah-Hartman
2026-01-05 17:01       ` Thinh Nguyen
2026-01-05 19:59         ` Greg Kroah-Hartman
2026-01-05 21:16           ` Thinh Nguyen
2026-01-06  5:50             ` Greg Kroah-Hartman

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=dec18683-5b43-464f-a735-4bf26644aa0a@oss.qualcomm.com \
    --to=prashanth.k@oss.qualcomm.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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.