linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sanm@codeaurora.org
To: Felipe Balbi <balbi@kernel.org>
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Stephen Boyd <swboyd@chromium.org>,
	Doug Anderson <dianders@chromium.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Manu Gautam <mgautam@codeaurora.org>
Subject: Re: [PATCH] usb: dwc3: qcom: Add shutdown callback for dwc3
Date: Mon, 18 Jan 2021 12:02:01 +0530	[thread overview]
Message-ID: <1a9050a56805b4d95482ccb45edcbb97@codeaurora.org> (raw)
In-Reply-To: <87sg7544da.fsf@kernel.org>

On 2021-01-13 14:10, Felipe Balbi wrote:
> Hi,
> 
> Sandeep Maheswaram <sanm@codeaurora.org> writes:
>> This patch adds a shutdown callback to USB DWC QCOM driver to ensure 
>> that
>> it is properly shutdown in reboot/shutdown path. This is required
>> where SMMU address translation is enabled like on SC7180
>> SoC and few others. If the hardware is still accessing memory after
>> SMMU translation is disabled as part of SMMU shutdown callback in
>> system reboot or shutdown path, then IOVAs(I/O virtual address)
>> which it was using will go on the bus as the physical addresses which
>> might result in unknown crashes (NoC/interconnect errors).
>> 
>> Signed-off-by: Sandeep Maheswaram <sanm@codeaurora.org>
> 
> sounds like this is fixing a bug. Do you have a Fixes tag for it? 
> Should
> this go to stable?
> 
Didn't encounter any bug till now but made this change to prevent issue.

>> diff --git a/drivers/usb/dwc3/dwc3-qcom.c 
>> b/drivers/usb/dwc3/dwc3-qcom.c
>> index c703d55..a930e06 100644
>> --- a/drivers/usb/dwc3/dwc3-qcom.c
>> +++ b/drivers/usb/dwc3/dwc3-qcom.c
>> @@ -790,13 +790,11 @@ static int dwc3_qcom_probe(struct 
>> platform_device *pdev)
>>  	return ret;
>>  }
>> 
>> -static int dwc3_qcom_remove(struct platform_device *pdev)
>> +static void __dwc3_qcom_teardown(struct dwc3_qcom *qcom)
>>  {
>> -	struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
>> -	struct device *dev = &pdev->dev;
>>  	int i;
>> 
>> -	of_platform_depopulate(dev);
>> +	of_platform_depopulate(qcom->dev);
>> 
>>  	for (i = qcom->num_clocks - 1; i >= 0; i--) {
>>  		clk_disable_unprepare(qcom->clks[i]);
>> @@ -807,12 +805,27 @@ static int dwc3_qcom_remove(struct 
>> platform_device *pdev)
>>  	dwc3_qcom_interconnect_exit(qcom);
>>  	reset_control_assert(qcom->resets);
>> 
>> -	pm_runtime_allow(dev);
>> -	pm_runtime_disable(dev);
>> +	pm_runtime_allow(qcom->dev);
>> +	pm_runtime_disable(qcom->dev);
>> +}
> 
> you can make the changes smaller by adding:
> 
> 	struct device *dev = qcom->dev;
> 
> The nothing else needs to change in this function ;-)

I will do this in next version

      reply	other threads:[~2021-01-18  6:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12  6:30 [PATCH] usb: dwc3: qcom: Add shutdown callback for dwc3 Sandeep Maheswaram
2021-01-13  5:44 ` sanm
2021-01-13  8:40 ` Felipe Balbi
2021-01-18  6:32   ` sanm [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=1a9050a56805b4d95482ccb45edcbb97@codeaurora.org \
    --to=sanm@codeaurora.org \
    --cc=agross@kernel.org \
    --cc=balbi@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mgautam@codeaurora.org \
    --cc=mka@chromium.org \
    --cc=robh+dt@kernel.org \
    --cc=swboyd@chromium.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 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).