Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757227AbbEWAa7 (ORCPT ); Fri, 22 May 2015 20:30:59 -0400 Received: from mail-bn1bon0143.outbound.protection.outlook.com ([157.56.111.143]:50545 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751161AbbEWAa4 (ORCPT ); Fri, 22 May 2015 20:30:56 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NOS0PT-08-GU2-02 X-M-MSG: Message-ID: <555FC695.1000404@amd.com> Date: Fri, 22 May 2015 19:15:17 -0500 From: Suravee Suthikulanit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: "Rafael J. Wysocki" CC: , , , , , , , , , , , , , , , , , Subject: Re: [V5 PATCH 1/5] ACPI / scan: Parse _CCA and setup device coherency References: <1432159758-4486-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1815824.lIg0NQ97lU@vostro.rjw.lan> <555FAC8F.4010306@amd.com> <2939517.7sXtxU6TkU@vostro.rjw.lan> In-Reply-To: <2939517.7sXtxU6TkU@vostro.rjw.lan> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD033;1:SjmFUep2EZFb3HXeMzmQRWVXTjARzIavRnlMiFyCzuMg+DrFoKAHIVKSFKGB25OxNOu+9OE84S741sUtgAokePn40S9EsTR3he1bQ+buxnNY1U5qJn1iqOpHLtJoo11UiE+m6DEweNSD/fkISTMGfNd8oAqWDqAdWIqwwxdvHHCCVDz2+sXU0VQRS6zyY4Z3J6kmNbJe2wI0lCC8ca9iKj9KkYO3Ie8HFehCur7VBgkOQZlDkcL2Uucbpa9sfF8wvJ8GyuEDsipSfXe4bQQGkyTjVBS9caejgJ8eqiPmimz1qO6NbhGUn4kwrM87Md0Y X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(377454003)(51704005)(189002)(199003)(164054003)(479174004)(24454002)(4001350100001)(97736004)(83506001)(105586002)(59896002)(87936001)(33656002)(4001540100001)(50466002)(93886004)(65956001)(92566002)(64706001)(65806001)(106466001)(47776003)(62966003)(77156002)(46102003)(86362001)(101416001)(76176999)(50986999)(65816999)(54356999)(87266999)(36756003)(5001860100001)(23676002)(5001830100001)(2950100001)(110136002)(189998001)(120886001)(64126003)(77096005)(80316001)(68736005);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR02MB241;H:atltwp02.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB241; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520002)(3002001);SRVR:BLUPR02MB241;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB241; X-Forefront-PRVS: 0585417D7B X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2015 00:15:32.2743 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB241 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2630 Lines: 74 On 5/22/2015 6:05 PM, Rafael J. Wysocki wrote: > On Friday, May 22, 2015 05:24:15 PM Suravee Suthikulanit wrote: >> Not sure if this went out earlier. So I am resending. >> >> On 5/22/15 16:56, Rafael J. Wysocki wrote: >>>> diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c >>>>> index 39c485b..b9657af 100644 >>>>> --- a/drivers/acpi/glue.c >>>>> +++ b/drivers/acpi/glue.c >>>>> @@ -13,6 +13,7 @@ >>>>> #include >>>>> #include >>>>> #include >>>>> +#include >>>>> >>>>> #include "internal.h" >>>>> >>>>> @@ -167,6 +168,7 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev) >>>>> struct list_head *physnode_list; >>>>> unsigned int node_id; >>>>> int retval = -EINVAL; >>>>> + bool coherent; >>>>> >>>>> if (has_acpi_companion(dev)) { >>>>> if (acpi_dev) { >>>>> @@ -223,6 +225,9 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev) >>>>> if (!has_acpi_companion(dev)) >>>>> ACPI_COMPANION_SET(dev, acpi_dev); >>>>> >>>>> + if (acpi_check_dma(acpi_dev, &coherent)) >>>>> + arch_setup_dma_ops(dev, 0, 0, NULL, coherent); >>>>> + >>> Well, so is this going to work for PCI too after all? >>> >> >> No, as Bjorn suggested, PCI changes for setting DMA coherent from _CCA >> (patch 3/6 in V4) will be submitted separately. We are working on >> cleaning up and up-streaming the PCI ACPI support for ARM64. > > OK, but acpi_bind_one() is called for PCI devices too. Won't that be a problem? > > > In this case, we would be going through the following call path: --> pci_device_add() |--> pci_dma_configure() ** 1 ** |--> device_add() |--> platform_notify() |--> acpi_platform_notify() |--> acpi_bind_one() ** 2 ** At (1), we would be calling arch_setup_dma_ops() with the PCI host bridge _CCA information. So, it should have already taken care of setting up device coherency here. At (2), if there is no acpi_dev for endpoint devices (which I believe this is normally the case), it would return early and skip arch_setup_dma_ops(). At (2), if there is an acpi_dev, the coherent_dma flag should have already been setup by the acpi_init_device_object during ACPI scan. However, I am not certain about this case since I don't have the DSDT containing PCI endpoint devices to test with. Thanks, Suravee -- 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/