lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230502214419.rzybyuozzvslinwe@synopsys.com>
Date:   Tue, 2 May 2023 21:44:24 +0000
From:   Thinh Nguyen <Thinh.Nguyen@...opsys.com>
To:     Krishna Kurapati <quic_kriskura@...cinc.com>
CC:     Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>,
        Konrad Dybcio <konrad.dybcio@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Felipe Balbi <balbi@...nel.org>,
        Wesley Cheng <quic_wcheng@...cinc.com>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-msm@...r.kernel.org" <linux-arm-msm@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "quic_pkondeti@...cinc.com" <quic_pkondeti@...cinc.com>,
        "quic_ppratap@...cinc.com" <quic_ppratap@...cinc.com>,
        "quic_jackp@...cinc.com" <quic_jackp@...cinc.com>,
        "quic_harshq@...cinc.com" <quic_harshq@...cinc.com>,
        "ahalaney@...hat.com" <ahalaney@...hat.com>,
        "quic_shazhuss@...cinc.com" <quic_shazhuss@...cinc.com>
Subject: Re: [PATCH v7 4/9] usb: dwc3: core: Skip setting event buffers for
 host only controllers

On Mon, May 01, 2023, Krishna Kurapati wrote:
> On some SoC's like SA8295P where the tertiary controller is host-only
> capable, GEVTADDRHI/LO, GEVTSIZ, GEVTCOUNT registers are not accessible.
> Trying to setup them up during core_init leads to a crash.
> 
> For DRD/Peripheral supported controllers, event buffer setup is done
> again in gadget_pullup. Skip setup or cleanup of event buffers if
> controller is host-only capable.
> 
> Signed-off-by: Krishna Kurapati <quic_kriskura@...cinc.com>
> ---
>  drivers/usb/dwc3/core.c | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index b8ac7bcee391..8625fc5c7ab4 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -835,7 +835,12 @@ static void dwc3_clk_disable(struct dwc3 *dwc)
>  
>  static void dwc3_core_exit(struct dwc3 *dwc)
>  {
> -	dwc3_event_buffers_cleanup(dwc);
> +	unsigned int	hw_mode;
> +
> +	hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0);
> +	if (hw_mode != DWC3_GHWPARAMS0_MODE_HOST)
> +		dwc3_event_buffers_cleanup(dwc);

I think it's cleaner to do these checks in dwc3_event_buffers_cleanup
and dwc3_event_buffers_setup.

Thanks,
Thinh

> +
>  	dwc3_phy_power_off(dwc);
>  	dwc3_phy_exit(dwc);
>  	dwc3_clk_disable(dwc);
> @@ -1141,10 +1146,12 @@ static int dwc3_core_init(struct dwc3 *dwc)
>  	if (ret)
>  		goto err_exit_phy;
>  
> -	ret = dwc3_event_buffers_setup(dwc);
> -	if (ret) {
> -		dev_err(dwc->dev, "failed to setup event buffers\n");
> -		goto err_power_off_phy;
> +	if (hw_mode != DWC3_GHWPARAMS0_MODE_HOST) {
> +		ret = dwc3_event_buffers_setup(dwc);
> +		if (ret) {
> +			dev_err(dwc->dev, "failed to setup event buffers\n");
> +			goto err_power_off_phy;
> +		}
>  	}
>  
>  	/*
> @@ -1958,7 +1965,10 @@ static int dwc3_probe(struct platform_device *pdev)
>  
>  err_exit_debugfs:
>  	dwc3_debugfs_exit(dwc);
> -	dwc3_event_buffers_cleanup(dwc);
> +
> +	if (hw_mode != DWC3_GHWPARAMS0_MODE_HOST)
> +		dwc3_event_buffers_cleanup(dwc);
> +
>  	dwc3_phy_power_off(dwc);
>  	dwc3_phy_exit(dwc);
>  	dwc3_ulpi_exit(dwc);
> -- 
> 2.40.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ