From patchwork Wed Oct 28 22:50:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7515151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D34A39F37F for ; Wed, 28 Oct 2015 22:56:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E4E0D20461 for ; Wed, 28 Oct 2015 22:56:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 55529204D1 for ; Wed, 28 Oct 2015 22:56:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZrZbl-0006OP-7F; Wed, 28 Oct 2015 22:54:17 +0000 Received: from mail-bn1on0673.outbound.protection.outlook.com ([2a01:111:f400:fc10::673] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZrZZR-0004XG-Uf for linux-arm-kernel@lists.infradead.org; Wed, 28 Oct 2015 22:51:55 +0000 Received: from SN1PR12CA0002.namprd12.prod.outlook.com (10.162.96.140) by SN1PR12MB0720.namprd12.prod.outlook.com (10.163.209.22) with Microsoft SMTP Server (TLS) id 15.1.306.13; Wed, 28 Oct 2015 22:51:30 +0000 Received: from CO1NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::200) by SN1PR12CA0002.outlook.office365.com (2a01:111:e400:5174::12) with Microsoft SMTP Server (TLS) id 15.1.312.18 via Frontend Transport; Wed, 28 Oct 2015 22:51:31 +0000 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; arm.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp02.amd.com (165.204.84.222) by CO1NAM03FT011.mail.protection.outlook.com (10.152.80.87) with Microsoft SMTP Server id 15.1.318.9 via Frontend Transport; Wed, 28 Oct 2015 22:51:29 +0000 X-WSS-ID: 0NWYCTQ-08-J8W-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2FA11D1600A; Wed, 28 Oct 2015 18:51:25 -0400 (EDT) Received: from SATLEXDAG03.amd.com (10.181.40.7) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 28 Oct 2015 17:51:40 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag03.amd.com (10.181.40.7) with Microsoft SMTP Server id 14.3.266.1; Wed, 28 Oct 2015 18:51:27 -0400 From: Suravee Suthikulpanit To: , , , , Subject: [PATCH V5 9/9] PCI: ACPI: Add support for PCI device DMA coherency Date: Wed, 28 Oct 2015 15:50:54 -0700 Message-ID: <1446072654-5608-10-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1446072654-5608-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1446072654-5608-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(2950100001)(5008740100001)(77096005)(5003600100002)(19580395003)(5007970100001)(105586002)(5001770100001)(106466001)(86362001)(2201001)(47776003)(229853001)(92566002)(101416001)(5001920100001)(19580405001)(189998001)(53416004)(87936001)(50226001)(50986999)(50466002)(36756003)(48376002)(76176999)(97736004)(5003940100001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0720; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0720; 2:MXkyv1gRc6mV4/3N6VFpF2PqyKmh0rsmBtuEfDS09FDOnmGKSLhBobEFLq3rBwaQj4F2MnFwDA8S1kVua1I0Fgn4t9YzgCSQp12DewErwQhbMqurN5A+G4hFSTTm+bNe0R+stR+bKymuxdSus5yw3bU3x1J+AVREJf6IuQpOpa0=; 3:SA4sairAa06Fu/F5d9k2nMypZUpPIZ+HeZHrJ0E3UzJwBMktnNpXrpYUxE8iVmdHWjwmKASIZPCeVFb1uJG5YVXBugBaD3Gj4iJtAhEkQeB1hQ7i5GJW14tYFT/Wz91K5iCosIzAtvskQGQlnNDaOHd7GF85ozzYP6vO/odYxCLQHet/ZAiKNdWzQVMWhPIrkW4/TYBnhxCsgTv668w/G6UOjwIVkZcgzVa1xJmbnQbuDnfjMYcXcvogAbbyLtdm; 25:HtZYYUURJKbwEcq0EGF6ez/x942ozUw3mQFlAZGuPB//MW2+xtY5VQ3YbXvLWjaEtncznlj0j86RgQIsVtUi8zor85Pu6iqbBHijz0bHC4ETg4xcPlftkmZkMWM489Xg6hc8fo5S5MYVuNN3CtuHcVDrP4JD0ue4hqfwiplfq5SrZ8kZcWXceI3p5J6BkJBZFVFTS9Pq+oamOFag/EO33P3ZO16U2bMByJn0iB9Z8bsydW792/Y/ZKZWj0Cud7zN X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0720; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0720; 20:jfIEzRppg9n/k4oAmFGO9unLKKvLAAuW3p4Vr85FYm4aLF46cNl0u+5rFvsw3Wh5HUjehAZ3JlD/cLsqNRiYmcED9Y4SHsVe7vXqvivcJt5hgTh0MYK4KHr/49LTgs6nHaEQPfL1y8QkO6A8+1vIAM3w3Ikl3lZ2SyHlyruudwYYEd4ebw+hhGa1Qlrt9l6WnoLYmgHv+wWUvRHlyz/mOh71PG1K+SotUAQd9tegtoG1zKkFr15alVinK1LRT9OxDbpnTykWmwL6TAHyYW92iO9PcJj5YbnJ1LyJjAA0Dt4QDQekwPirVH+kuc14l4Nyb7t7eoyLAA7BTxdA/WMm8jDx5rdRPqPlXsTQ+qaApu1vbWwjMGd8m36+VxGcjbm7pfdDh6U5Rv8ukRQaZQSfy1G+2+6o15TNJOEr4KY26ABZWm9aUHKrj6/yQcWxct31h+yR2YBCQuMB8ZBG3R/jggxrl9fwzbbZBwzEzEG2H7bXBmXPFcFqwoP1zJH6ir8t; 4:G1BkvrM5N7peb0oD+lIyzWzEXf4FShguS+GEh4GK1TDJ4ELbRElW8DW8i4a4poxce39uQFFqYyxuGR9AkUCZokQSRxNakzeBmcdHmIdUREyTi0PoAeEqoq/9viV6lkgNPR3FKs0vy1Qx0hp5fDcDUn/yyoYxA8gpxlZzPQsNFjXDOP6Z9NA+5xiTUHOD7aGgp++Cl4CjvdkAYAaWnytPLljqNHhIKXQZaa+XAaVijiBXIf8/mXreBW8DFUNMpY8GIinnOObv0i/GNg+uQ7eG++chD5UqLWTTWBOnmWC1UtF084MgNw8vlxHndqp10qZlDBDuCsCU5T7j02AnFoY9ErnYnIlmi7V7MTPby24hJ9TSeA6aVqq2KTUSjWMm6mqoIn+RNoX0u4pCy56bXxIpew== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046)(102215026); SRVR:SN1PR12MB0720; BCL:0; PCL:0; RULEID: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; 5:nEyoCPeVT4gbtEVLFRAkSD4xqL6mBpc9R+F52tK2WBZPIMNjLec64biV0C6o9mXY7ENl9/M+gmbsu4d8HDUPT9QF2y3Pp7OYsb+e2vEit2Prsll9e5TWM3s4FPb1WCarlJV6XMk7BSi1bhJD06DMgw==; 24:9LScVCz9K3tizEDfZ0CaG3vOISaI/Ge6gMo/6/f0S/e5wP/z8IQorUYDhoHC1122mRstes2Voj1lEIMaM2efCWxgu3QZz2V1iv/7tQM+x2Y=; 20:O+WdhAQYD0tQLEEED7uhZ5GVrqAFGZXUqgBRdrA+DeKOU1KVefyx6slDqLsWQ6puJRDntqi4T5+utN2vp2cf6oybc9MZdaVaiFnVjvZkOEatQmIkPnm5R58NIuMXRYw0SBxpBSq9g04STUMCuGFqWvpe3/TX8PvxuhkZ8Xz+runUO5jxXyqviOEmwXIJ07N9U2m/Tc0EG6BLzgXEzs20jgs9em5i3NLjiuilZOQjHGquKzQdksmXVgh01qZuGP1h SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2015 22:51:29.4074 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0720 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151028_155154_519100_32F73F28 X-CRM114-Status: GOOD ( 13.51 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thomas.lendacky@amd.com, herbert@gondor.apana.org.au, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, hanjun.guo@linaro.org, Suravee Suthikulpanit , davem@davemloft.net, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for setting up PCI device DMA coherency from ACPI _CCA object that should normally be specified in the DSDT node of its PCI host bridge. Signed-off-by: Suravee Suthikulpanit Acked-by: Bjorn Helgaas Reviewed-by: Hanjun Guo CC: Rafael J. Wysocki --- drivers/pci/probe.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 31e3eef..40eed54 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "pci.h" @@ -1638,7 +1639,7 @@ static void pci_set_msi_domain(struct pci_dev *dev) * @dev: ptr to pci_dev struct of the PCI device * * Function to update PCI devices's DMA configuration using the same - * info from the OF node of host bridge's parent (if any). + * info from the OF node or ACPI node of host bridge's parent (if any). */ static void pci_dma_configure(struct pci_dev *dev) { @@ -1647,6 +1648,15 @@ static void pci_dma_configure(struct pci_dev *dev) if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) { if (bridge->parent) of_dma_configure(&dev->dev, bridge->parent->of_node); + } else if (has_acpi_companion(bridge)) { + struct acpi_device *adev = to_acpi_device_node(bridge->fwnode); + enum dev_dma_attr attr = acpi_get_dma_attr(adev); + + if (attr == DEV_DMA_NOT_SUPPORTED) + dev_warn(&dev->dev, "DMA not supported.\n"); + else + arch_setup_dma_ops(&dev->dev, 0, 0, NULL, + attr == DEV_DMA_COHERENT); } pci_put_host_bridge_device(bridge);