diff mbox

[v1] spi: pxa2xx: Allow 64-bit DMA

Message ID 20180419165333.32962-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted
Commit 7956fadd40af82cec610a0ccf1ca937e0dfecf94
Headers show

Commit Message

Andy Shevchenko April 19, 2018, 4:53 p.m. UTC
Currently the 32-bit device address only is supported for DMA. However,
starting from Intel Sunrisepoint PCH the DMA address of the device FIFO
can be 64-bit.

Change the respective variable to be compatible with DMA engine
expectations, i.e. to phys_addr_t.

Fixes: 34cadd9c1bcb ("spi: pxa2xx: Add support for Intel Sunrisepoint")
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-pxa2xx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jarkko Nikula April 20, 2018, 7:54 a.m. UTC | #1
On 04/19/18 19:53, Andy Shevchenko wrote:
> Currently the 32-bit device address only is supported for DMA. However,
> starting from Intel Sunrisepoint PCH the DMA address of the device FIFO
> can be 64-bit.
> 
> Change the respective variable to be compatible with DMA engine
> expectations, i.e. to phys_addr_t.
> 
> Fixes: 34cadd9c1bcb ("spi: pxa2xx: Add support for Intel Sunrisepoint")
> Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/spi/spi-pxa2xx.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h
> index 513ec6c6e25b..0ae7defd3492 100644
> --- a/drivers/spi/spi-pxa2xx.h
> +++ b/drivers/spi/spi-pxa2xx.h
> @@ -38,7 +38,7 @@ struct driver_data {
>   
>   	/* SSP register addresses */
>   	void __iomem *ioaddr;
> -	u32 ssdr_physical;
> +	phys_addr_t ssdr_physical;
>   
Nice catch! Sunrisepoint SPI PCI BAR indeed has BAR high register and 
BAR low type bits indicate 64 address range even BAR high seems to 0 in 
my test machines.

Have you seen a real issue with this? And more over, can this cause 
memory corruption if DMA is writing into (ssp->phys_base + SSDR) & 
0xFFFFFFFF? I don't know so well the DMA handshaking can it do so but 
both points are valid reasons to queue the fix into linux-stable.

Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Shevchenko April 20, 2018, 11:59 a.m. UTC | #2
On Fri, 2018-04-20 at 10:54 +0300, Jarkko Nikula wrote:
> On 04/19/18 19:53, Andy Shevchenko wrote:
> > Currently the 32-bit device address only is supported for DMA.
> > However,
> > starting from Intel Sunrisepoint PCH the DMA address of the device
> > FIFO
> > can be 64-bit.
> > 
> > Change the respective variable to be compatible with DMA engine
> > expectations, i.e. to phys_addr_t.
> > 
> > Fixes: 34cadd9c1bcb ("spi: pxa2xx: Add support for Intel
> > Sunrisepoint")
> > Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >   drivers/spi/spi-pxa2xx.h | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h
> > index 513ec6c6e25b..0ae7defd3492 100644
> > --- a/drivers/spi/spi-pxa2xx.h
> > +++ b/drivers/spi/spi-pxa2xx.h
> > @@ -38,7 +38,7 @@ struct driver_data {
> >   
> >   	/* SSP register addresses */
> >   	void __iomem *ioaddr;
> > -	u32 ssdr_physical;
> > +	phys_addr_t ssdr_physical;
> >   
> 
> Nice catch! Sunrisepoint SPI PCI BAR indeed has BAR high register and 
> BAR low type bits indicate 64 address range even BAR high seems to 0
> in 
> my test machines.
> 
> Have you seen a real issue with this?

Yes. It fixes an actual issue on our Kabylake and Coffeelake systems.

>  And more over, can this cause 
> memory corruption if DMA is writing into (ssp->phys_base + SSDR) & 
> 0xFFFFFFFF? I don't know so well the DMA handshaking can it do so but 
> both points are valid reasons to queue the fix into linux-stable.

It requires DMA request / acknowledge lines to be asserted in certain
time. It might be a corruption up to burst size though.
diff mbox

Patch

diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h
index 513ec6c6e25b..0ae7defd3492 100644
--- a/drivers/spi/spi-pxa2xx.h
+++ b/drivers/spi/spi-pxa2xx.h
@@ -38,7 +38,7 @@  struct driver_data {
 
 	/* SSP register addresses */
 	void __iomem *ioaddr;
-	u32 ssdr_physical;
+	phys_addr_t ssdr_physical;
 
 	/* SSP masks*/
 	u32 dma_cr1;