Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757692AbbEWBi5 (ORCPT ); Fri, 22 May 2015 21:38:57 -0400 Received: from mail-bl2on0114.outbound.protection.outlook.com ([65.55.169.114]:32992 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750707AbbEWBiw (ORCPT ); Fri, 22 May 2015 21:38:52 -0400 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; arm.com; dkim=none (message not signed) header.d=none; X-WSS-ID: 0NOS4KI-07-TIL-02 X-M-MSG: Message-ID: <555FDA14.9050404@amd.com> Date: Fri, 22 May 2015 20:38:28 -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> <2939517.7sXtxU6TkU@vostro.rjw.lan> <555FC695.1000404@amd.com> <9319342.HPcAml3MbA@vostro.rjw.lan> In-Reply-To: <9319342.HPcAml3MbA@vostro.rjw.lan> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11OLC004;1:2nQGosggxSAQ9JXmISkTrdnE+UmXo0h0D9VEEoakIWWuj99vmzdVtmSsFYpX7CZ7b2zjOBRk5oxk98FNPwPt9lRJbzBNv4UGkqExrMsimggYB+EJps3wMYovBzKVUMzVlLtfXZYmv4xCUICJdd1cMwfbAgNipKGw5MkWESBeFMMBwyiwVabh6CVONBq9xtZ9sQGD9PsWSipPcd5jgshA1+aD+xkFM0z5yRD7Fn0mzl30m5cW/zUqxmeC0OmhcNM+hCgsHr6S5f3z2/gCcH4ditAxM0hS4gbDqUs7uq9ylu8PcDJCihH4tsDeX1hezKed X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(24454002)(479174004)(377454003)(51704005)(189002)(164054003)(199003)(36756003)(101416001)(76176999)(93886004)(87266999)(50986999)(23676002)(33656002)(64126003)(92566002)(86362001)(59896002)(87936001)(4001540100001)(5001860100001)(4001350100001)(46102003)(54356999)(97736004)(65816999)(80316001)(110136002)(189998001)(47776003)(77096005)(68736005)(2950100001)(83506001)(77156002)(105586002)(106466001)(120886001)(65806001)(65956001)(64706001)(5001830100001)(62966003)(50466002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR02MB1114;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR02MB1114;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR02MB1100; 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:BY1PR02MB1114;BCL:0;PCL:0;RULEID:;SRVR:BY1PR02MB1114; X-Forefront-PRVS: 0585417D7B X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2015 01:38:43.2906 (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.221];Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR02MB1114 X-OriginatorOrg: amd.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3403 Lines: 93 On 5/22/2015 8:25 PM, Rafael J. Wysocki wrote: > On Friday, May 22, 2015 07:15:17 PM Suravee Suthikulanit wrote: >> 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(). > > That's not correct. There may be ACPI companions for endpoint devices too. Ok. Duly noted :) >> 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. > > That one sets the flag for the *ACPI* *companion* of the device, which > I'm still thinking is pointless, isn't it? When you say pointless, are you referring to the part where we are end up calling arch_setup_dma_coherent() twice in this case? I am not quite following your point. >> However, I am not certain about this case since I don't have the DSDT >> containing PCI endpoint devices to test with. > > Every x86 PC has them (as far as I can say), but in that case there's no > _CCA and they are all coherent. Ok. 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/