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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0d3e8992-06e1-57e4-edd5-ba230caaa189@arm.com>
Date:   Tue, 2 Apr 2019 11:02:40 +0100
From:   Robin Murphy <robin.murphy@....com>
To:     Pankaj Dubey <pankaj.dubey@...sung.com>, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     mathias.nyman@...el.com, gregkh@...uxfoundation.org,
        jingoohan1@...il.com, krzk@...nel.org, mgautam@...eaurora.org,
        felipe.balbi@...ux.intel.com, Sriram Dash <sriram.dash@...sung.com>
Subject: Re: [PATCH] usb: xhci: inherit dma_mask from bus if set correctly

On 02/04/2019 10:40, Pankaj Dubey wrote:
> From: Sriram Dash <sriram.dash@...sung.com>
> 
> The xhci forcefully converts the dma_mask to either 64 or 32 and the
> dma-mask set by the bus is somewhat ignored. If the platform  sets the
> correct dma_mask, then respect that.

It's expected for dma_mask to be larger than bus_dma_mask if the latter 
is set - conceptually, the device mask represents what the device is 
inherently capable of, while the bus mask represents external 
interconnect restrictions which individual drivers should not have to 
care about. The DMA API backend should take care of combining the two to 
find the intersection. Are you seeing an actual problem here, and if so 
on which platform? (If the bus mask is set at all then it wouldn't seem 
to be the DT PCI issue that I'm still trying to fix).

Robin.

> Signed-off-by: Pankaj Dubey <pankaj.dubey@...sung.com>
> Signed-off-by: Sriram Dash <sriram.dash@...sung.com>
> ---
>   drivers/usb/host/xhci.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 005e659..55cf89e 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -5119,6 +5119,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
>   		dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
>   	}
>   
> +	/*
> +	 * A platform may require coherent masks other than 64/32 bit, and we
> +	 * should respect that. If the firmware has already requested for a
> +	 * dma-range, we inherit the dma_mask presuming the platform knows
> +	 * what it is doing.
> +	 */
> +
> +	if (dev->bus_dma_mask)
> +		dma_set_mask_and_coherent(dev, dev->bus_dma_mask);
> +
>   	xhci_dbg(xhci, "Calling HCD init\n");
>   	/* Initialize HCD and host controller data structures. */
>   	retval = xhci_init(hcd);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ