Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753878AbbD2QZ0 (ORCPT ); Wed, 29 Apr 2015 12:25:26 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:54969 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbbD2QZU (ORCPT ); Wed, 29 Apr 2015 12:25:20 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Suravee Suthikulpanit , rjw@rjwysocki.net, lenb@kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, al.stone@linaro.org, linaro-acpi@lists.linaro.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, leo.duran@amd.com, hanjun.guo@linaro.org, msalter@redhat.com, grant.likely@linaro.org Subject: Re: [PATCH 2/2] ACPI / scan: Parse _CCA and setup device coherency Date: Wed, 29 Apr 2015 18:25:04 +0200 Message-ID: <2968069.n1L1S3Mp2q@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1430315049-4663-3-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1430315049-4663-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1430315049-4663-3-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:vyEIhpD4RzX9q84CtuvMqReFHZ1LvHAG0/i1xS+R7zN9APcoVam jDTQHFlgLSXBeBQ25eKT+wC07I49NpPazGiTz0OSRnTO9Fj+8qaM8ljWHpc2gW+JmLbbzeK 9Ws3mAxbcwCPKhuwBPTWylQOEjSoTNLF+cmufA7UVxTbSgXIsH6kQstdRCZM5yca2FYJ6IV F+JeKHOWTEo5jhjR/LTyA== X-UI-Out-Filterresults: notjunk:1; Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2035 Lines: 45 On Wednesday 29 April 2015 08:44:09 Suravee Suthikulpanit wrote: > diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c > index 4bf7559..a4db208 100644 > --- a/drivers/acpi/acpi_platform.c > +++ b/drivers/acpi/acpi_platform.c > @@ -108,9 +108,12 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev) > if (IS_ERR(pdev)) > dev_err(&adev->dev, "platform device creation failed: %ld\n", > PTR_ERR(pdev)); > - else > + else { > + arch_setup_dma_ops(&pdev->dev, 0, 0, NULL, > + adev->flags.is_coherent); > dev_dbg(&adev->dev, "created platform device %s\n", > dev_name(&pdev->dev)); > + } > > kfree(resources); > Looking at this code in more detail, it seems that it unconditionally sets pdevinfo.dma_mask = DMA_BIT_MASK(32), before calling arch_setup_dma_ops(). This assignment should really done inside of arch_setup_dma_ops() instead, which means we should implement that function on all architectures that support ACPI. For the case where _CCA is missing (or coherency disabled, if you ask me), we would not call that function. On a related note, I'm not sure how to handle different DMA masks here. arch_setup_dma_ops() gets passed a size (and offset) argument, which should match the DMA mask, but I don't know if there is a way to find out the size from ACPI. Should we assume it's always 64-bit DMA capable? For legacy reasons, the default mask is probably best left at 32-bit, but drivers are expected to call dma_set_mask() if they can do 64-bit DMA, and that should fail based on the information provided by the platform if the bus is not capable of doing that. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/