2014-06-10 21:53:52

by David Milburn

[permalink] [raw]
Subject: Re: [PATCH 1/1] ata: Check and set 64-bit DMA mask for platform AHCI driver

On 05/23/2014 12:35 PM, [email protected] wrote:
> From: Suravee Suthikulpanit <[email protected]>
>
> The current platform AHCI drier 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 <[email protected]>
> ---
> drivers/ata/libahci_platform.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index 7cb3a85..85049ef 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -368,6 +368,15 @@ int ahci_platform_init_host(struct platform_device *pdev,

Hi Suravee,

Would it be better to do the following before ahci_reset_controller()?

/* initialize adapter */
rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64);
if (rc)
return rc;


Thanks,
David



> ahci_init_controller(host);
> ahci_print_info(host, "platform");
>
> + if (hpriv->cap & HOST_CAP_64) {
> + if (!dev->dma_mask)
> + dev->dma_mask = &dev->coherent_dma_mask;
> +
> + rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> + if (rc)
> + return rc;
> + }
> +
> return ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED,
> &ahci_platform_sht);
> }
>


Subject: Re: [PATCH 1/1] ata: Check and set 64-bit DMA mask for platform AHCI driver


Hi,

On Tuesday, June 10, 2014 04:54:01 PM David Milburn wrote:
> On 05/23/2014 12:35 PM, [email protected] wrote:
> > From: Suravee Suthikulpanit <[email protected]>
> >
> > The current platform AHCI drier 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 <[email protected]>
> > ---
> > drivers/ata/libahci_platform.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> > index 7cb3a85..85049ef 100644
> > --- a/drivers/ata/libahci_platform.c
> > +++ b/drivers/ata/libahci_platform.c
> > @@ -368,6 +368,15 @@ int ahci_platform_init_host(struct platform_device *pdev,
>
> Hi Suravee,
>
> Would it be better to do the following before ahci_reset_controller()?
>
> /* initialize adapter */
> rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64);
> if (rc)
> return rc;

ahci_configure_dma_masks() is currently for PCI controllers only
so it can't be used for libahci_platform.c.

When it comes to setting DMA masks before ahci_reset_controller()
I don't think that it matters but it will make platform code more
similar to PCI one which is a good thing.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


> Thanks,
> David
>
>
>
> > ahci_init_controller(host);
> > ahci_print_info(host, "platform");
> >
> > + if (hpriv->cap & HOST_CAP_64) {
> > + if (!dev->dma_mask)
> > + dev->dma_mask = &dev->coherent_dma_mask;
> > +
> > + rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> > + if (rc)
> > + return rc;
> > + }
> > +
> > return ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED,
> > &ahci_platform_sht);
> > }

2014-06-12 06:36:38

by Suthikulpanit, Suravee

[permalink] [raw]
Subject: Re: [PATCH 1/1] ata: Check and set 64-bit DMA mask for platform AHCI driver



On 06/11/2014 04:30 AM, Bartlomiej Zolnierkiewicz wrote:
>
> Hi,
>
> On Tuesday, June 10, 2014 04:54:01 PM David Milburn wrote:
>> On 05/23/2014 12:35 PM, [email protected] wrote:
>>> From: Suravee Suthikulpanit <[email protected]>
>>>
>>> The current platform AHCI drier 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 <[email protected]>
>>> ---
>>> drivers/ata/libahci_platform.c | 9 +++++++++
>>> 1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
>>> index 7cb3a85..85049ef 100644
>>> --- a/drivers/ata/libahci_platform.c
>>> +++ b/drivers/ata/libahci_platform.c
>>> @@ -368,6 +368,15 @@ int ahci_platform_init_host(struct platform_device *pdev,
>>
>> Hi Suravee,
>>
>> Would it be better to do the following before ahci_reset_controller()?
>>
>> /* initialize adapter */
>> rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64);
>> if (rc)
>> return rc;
>
> ahci_configure_dma_masks() is currently for PCI controllers only
> so it can't be used for libahci_platform.c.
>
> When it comes to setting DMA masks before ahci_reset_controller()
> I don't think that it matters but it will make platform code more
> similar to PCI one which is a good thing.

I can move this logic before ahci_reset_controller() in V2.

Suravee