linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ahci: Add support for 64-bit DMA mask driver
@ 2014-06-12 17:40 suravee.suthikulpanit
  2014-06-12 17:40 ` [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver suravee.suthikulpanit
  2014-06-12 17:40 ` [PATCH 2/2] ahci/xgene: Remove logic to set 64-bit DMA mask suravee.suthikulpanit
  0 siblings, 2 replies; 8+ messages in thread
From: suravee.suthikulpanit @ 2014-06-12 17:40 UTC (permalink / raw)
  To: tj, b.zolnierkie
  Cc: hdegoede, lho, tphan, stripathi, linux-ide, linux-kernel,
	Suravee Suthikulpanit

From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>

V2:
	- Changes based on review comments from Hans and Bartlomiej.
	- Remove the logic in ahci_xgene as suggested by Bartlomiej.

Suravee Suthikulpanit (2):
  ata: Check and set 64-bit DMA mask for platform AHCI driver
  ahci/xgene: Remove logic to set 64-bit DMA mask

 drivers/ata/ahci_xgene.c       | 10 ----------
 drivers/ata/libahci_platform.c | 13 +++++++++++++
 2 files changed, 13 insertions(+), 10 deletions(-)

-- 
1.9.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver
  2014-06-12 17:40 [PATCH 0/2] ahci: Add support for 64-bit DMA mask driver suravee.suthikulpanit
@ 2014-06-12 17:40 ` suravee.suthikulpanit
  2014-06-12 17:47   ` Sergei Shtylyov
                     ` (3 more replies)
  2014-06-12 17:40 ` [PATCH 2/2] ahci/xgene: Remove logic to set 64-bit DMA mask suravee.suthikulpanit
  1 sibling, 4 replies; 8+ messages in thread
From: suravee.suthikulpanit @ 2014-06-12 17:40 UTC (permalink / raw)
  To: tj, b.zolnierkie
  Cc: hdegoede, lho, tphan, stripathi, linux-ide, linux-kernel,
	Suravee Suthikulpanit

From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>

The current platform AHCI driver does not set the dma_mask correctly
for 64-bit DMA capable AHCI controller. This patch checks the AHCI
capability bit and set the dma_mask and coherent_dma_mask accordingly.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/ata/libahci_platform.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index 3a5b4ed..a958a2b 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -364,6 +364,19 @@ int ahci_platform_init_host(struct platform_device *pdev,
 			ap->ops = &ata_dummy_port_ops;
 	}
 
+	if (hpriv->cap & HOST_CAP_64) {
+		rc = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
+		if (rc) {
+			rc = dma_coerce_mask_and_coherent(dev,
+							  DMA_BIT_MASK(32));
+			if (rc) {
+				dev_err(dev, "Failed to enable 64-bit DMA.\n");
+				return rc;
+			}
+			dev_warn(dev, "Enable 32-bit DMA instead of 64-bit.\n");
+		}
+	}
+
 	rc = ahci_reset_controller(host);
 	if (rc)
 		return rc;
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] ahci/xgene: Remove logic to set 64-bit DMA mask
  2014-06-12 17:40 [PATCH 0/2] ahci: Add support for 64-bit DMA mask driver suravee.suthikulpanit
  2014-06-12 17:40 ` [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver suravee.suthikulpanit
@ 2014-06-12 17:40 ` suravee.suthikulpanit
  1 sibling, 0 replies; 8+ messages in thread
From: suravee.suthikulpanit @ 2014-06-12 17:40 UTC (permalink / raw)
  To: tj, b.zolnierkie
  Cc: hdegoede, lho, tphan, stripathi, linux-ide, linux-kernel,
	Suravee Suthikulpanit

From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>

Instead of doing the check here, this should be handled
in the common AHCI platform code.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Loc Ho <lho@apm.com>
Cc: Tuan Phan <tphan@apm.com>
Cc: Suman Triphati <stripathi@apm.com>
---
 drivers/ata/ahci_xgene.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index 042a9bb..a9fc2ae 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -440,16 +440,6 @@ static int xgene_ahci_probe(struct platform_device *pdev)
 	/* Configure the host controller */
 	xgene_ahci_hw_init(hpriv);
 
-	/*
-	 * Setup DMA mask. This is preliminary until the DMA range is sorted
-	 * out.
-	 */
-	rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
-	if (rc) {
-		dev_err(dev, "Unable to set dma mask\n");
-		goto disable_resources;
-	}
-
 	hflags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ;
 
 	rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info,
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver
  2014-06-12 17:40 ` [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver suravee.suthikulpanit
@ 2014-06-12 17:47   ` Sergei Shtylyov
  2014-06-13 12:45     ` Suravee Suthikulanit
  2014-06-13  8:40   ` Hans de Goede
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2014-06-12 17:47 UTC (permalink / raw)
  To: suravee.suthikulpanit, tj, b.zolnierkie
  Cc: hdegoede, lho, tphan, stripathi, linux-ide, linux-kernel

Hello.

On 06/12/2014 09:40 PM, suravee.suthikulpanit@amd.com wrote:

> From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>

> The current platform AHCI driver does not set the dma_mask correctly
> for 64-bit DMA capable AHCI controller. This patch checks the AHCI
> capability bit and set the dma_mask and coherent_dma_mask accordingly.

> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> ---
>   drivers/ata/libahci_platform.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)

> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index 3a5b4ed..a958a2b 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -364,6 +364,19 @@ int ahci_platform_init_host(struct platform_device *pdev,
>   			ap->ops = &ata_dummy_port_ops;
>   	}
>
> +	if (hpriv->cap & HOST_CAP_64) {
> +		rc = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
> +		if (rc) {
> +			rc = dma_coerce_mask_and_coherent(dev,
> +							  DMA_BIT_MASK(32));
> +			if (rc) {
> +				dev_err(dev, "Failed to enable 64-bit DMA.\n");

    Not 32-bit?

> +				return rc;
> +			}
> +			dev_warn(dev, "Enable 32-bit DMA instead of 64-bit.\n");
> +		}
> +	}
> +

WBR, Sergei


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver
  2014-06-12 17:40 ` [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver suravee.suthikulpanit
  2014-06-12 17:47   ` Sergei Shtylyov
@ 2014-06-13  8:40   ` Hans de Goede
  2014-06-13 20:21   ` Hans de Goede
  2014-06-17 19:03   ` Tejun Heo
  3 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2014-06-13  8:40 UTC (permalink / raw)
  To: suravee.suthikulpanit, tj, b.zolnierkie
  Cc: lho, tphan, stripathi, linux-ide, linux-kernel

Hi,

On 06/12/2014 07:40 PM, suravee.suthikulpanit@amd.com wrote:
> From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> 
> The current platform AHCI driver does not set the dma_mask correctly
> for 64-bit DMA capable AHCI controller. This patch checks the AHCI
> capability bit and set the dma_mask and coherent_dma_mask accordingly.
> 
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

I did not review this patch, just because you CC-ed me does not mean
I've reviewed it. Please don't add my Reviewed-by unless you've gotten
a mail from me saying something along these lines:

This patch is:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>

More in general please do not add any tags, other then Cc or your own
Signed-off-by, unless you've actually received those tags in an email
from people.

Regards,

Hans

p.s.

About the patch itself, I'll try to test this on sunxi devices to
make sure that it does not break anything this weekend.



> ---
>  drivers/ata/libahci_platform.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index 3a5b4ed..a958a2b 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -364,6 +364,19 @@ int ahci_platform_init_host(struct platform_device *pdev,
>  			ap->ops = &ata_dummy_port_ops;
>  	}
>  
> +	if (hpriv->cap & HOST_CAP_64) {
> +		rc = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
> +		if (rc) {
> +			rc = dma_coerce_mask_and_coherent(dev,
> +							  DMA_BIT_MASK(32));
> +			if (rc) {
> +				dev_err(dev, "Failed to enable 64-bit DMA.\n");
> +				return rc;
> +			}
> +			dev_warn(dev, "Enable 32-bit DMA instead of 64-bit.\n");
> +		}
> +	}
> +
>  	rc = ahci_reset_controller(host);
>  	if (rc)
>  		return rc;
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver
  2014-06-12 17:47   ` Sergei Shtylyov
@ 2014-06-13 12:45     ` Suravee Suthikulanit
  0 siblings, 0 replies; 8+ messages in thread
From: Suravee Suthikulanit @ 2014-06-13 12:45 UTC (permalink / raw)
  To: Sergei Shtylyov, tj, b.zolnierkie
  Cc: hdegoede, lho, tphan, stripathi, linux-ide, linux-kernel

On 6/12/2014 12:47 PM, Sergei Shtylyov wrote:
>> diff --git a/drivers/ata/libahci_platform.c
>> b/drivers/ata/libahci_platform.c
>> index 3a5b4ed..a958a2b 100644
>> --- a/drivers/ata/libahci_platform.c
>> +++ b/drivers/ata/libahci_platform.c
>> @@ -364,6 +364,19 @@ int ahci_platform_init_host(struct
>> platform_device *pdev,
>>               ap->ops = &ata_dummy_port_ops;
>>       }
>>
>> +    if (hpriv->cap & HOST_CAP_64) {
>> +        rc = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
>> +        if (rc) {
>> +            rc = dma_coerce_mask_and_coherent(dev,
>> +                              DMA_BIT_MASK(32));
>> +            if (rc) {
>> +                dev_err(dev, "Failed to enable 64-bit DMA.\n");
>
>     Not 32-bit?
Actually, I intended to say 64 since this is supposed to be setting up 
64-bit DMA mask. Or we could just say failed to set up DMA mask.

Suravee


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver
  2014-06-12 17:40 ` [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver suravee.suthikulpanit
  2014-06-12 17:47   ` Sergei Shtylyov
  2014-06-13  8:40   ` Hans de Goede
@ 2014-06-13 20:21   ` Hans de Goede
  2014-06-17 19:03   ` Tejun Heo
  3 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2014-06-13 20:21 UTC (permalink / raw)
  To: suravee.suthikulpanit, tj, b.zolnierkie
  Cc: lho, tphan, stripathi, linux-ide, linux-kernel

Hi,

On 06/12/2014 07:40 PM, suravee.suthikulpanit@amd.com wrote:
> From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> 
> The current platform AHCI driver does not set the dma_mask correctly
> for 64-bit DMA capable AHCI controller. This patch checks the AHCI
> capability bit and set the dma_mask and coherent_dma_mask accordingly.
> 
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

I see no adverse effects from this on sunxi, please drop the
Reviewed-by: Hans .... tag and replace it with:

Tested-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>  drivers/ata/libahci_platform.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index 3a5b4ed..a958a2b 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -364,6 +364,19 @@ int ahci_platform_init_host(struct platform_device *pdev,
>  			ap->ops = &ata_dummy_port_ops;
>  	}
>  
> +	if (hpriv->cap & HOST_CAP_64) {
> +		rc = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
> +		if (rc) {
> +			rc = dma_coerce_mask_and_coherent(dev,
> +							  DMA_BIT_MASK(32));
> +			if (rc) {
> +				dev_err(dev, "Failed to enable 64-bit DMA.\n");
> +				return rc;
> +			}
> +			dev_warn(dev, "Enable 32-bit DMA instead of 64-bit.\n");
> +		}
> +	}
> +
>  	rc = ahci_reset_controller(host);
>  	if (rc)
>  		return rc;
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver
  2014-06-12 17:40 ` [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver suravee.suthikulpanit
                     ` (2 preceding siblings ...)
  2014-06-13 20:21   ` Hans de Goede
@ 2014-06-17 19:03   ` Tejun Heo
  3 siblings, 0 replies; 8+ messages in thread
From: Tejun Heo @ 2014-06-17 19:03 UTC (permalink / raw)
  To: suravee.suthikulpanit
  Cc: b.zolnierkie, hdegoede, lho, tphan, stripathi, linux-ide, linux-kernel

On Thu, Jun 12, 2014 at 12:40:23PM -0500, suravee.suthikulpanit@amd.com wrote:
> From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> 
> The current platform AHCI driver does not set the dma_mask correctly
> for 64-bit DMA capable AHCI controller. This patch checks the AHCI
> capability bit and set the dma_mask and coherent_dma_mask accordingly.
> 
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Applied 1-2 to libata/for-3.17.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-06-17 19:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 17:40 [PATCH 0/2] ahci: Add support for 64-bit DMA mask driver suravee.suthikulpanit
2014-06-12 17:40 ` [PATCH 1/2] ahci: Check and set 64-bit DMA mask for platform AHCI driver suravee.suthikulpanit
2014-06-12 17:47   ` Sergei Shtylyov
2014-06-13 12:45     ` Suravee Suthikulanit
2014-06-13  8:40   ` Hans de Goede
2014-06-13 20:21   ` Hans de Goede
2014-06-17 19:03   ` Tejun Heo
2014-06-12 17:40 ` [PATCH 2/2] ahci/xgene: Remove logic to set 64-bit DMA mask suravee.suthikulpanit

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).