From patchwork Wed Aug 26 13:54:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7077491 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D850BC05AC for ; Wed, 26 Aug 2015 13:56:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 043AC20887 for ; Wed, 26 Aug 2015 13:56:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 039862089E for ; Wed, 26 Aug 2015 13:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756752AbbHZNz2 (ORCPT ); Wed, 26 Aug 2015 09:55:28 -0400 Received: from mail-bl2on0077.outbound.protection.outlook.com ([65.55.169.77]:15302 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752552AbbHZNzY (ORCPT ); Wed, 26 Aug 2015 09:55:24 -0400 Received: from CY1PR1201CA0038.namprd12.prod.outlook.com (10.169.17.176) by CY1PR12MB0714.namprd12.prod.outlook.com (10.163.238.20) with Microsoft SMTP Server (TLS) id 15.1.243.23; Wed, 26 Aug 2015 13:55:21 +0000 Received: from DM3NAM03FT003.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::209) by CY1PR1201CA0038.outlook.office365.com (2a01:111:e400:5b9a::48) with Microsoft SMTP Server (TLS) id 15.1.256.15 via Frontend Transport; Wed, 26 Aug 2015 13:55:21 +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; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp02.amd.com (165.204.84.222) by DM3NAM03FT003.mail.protection.outlook.com (10.152.82.87) with Microsoft SMTP Server id 15.1.256.10 via Frontend Transport; Wed, 26 Aug 2015 13:55:15 +0000 X-WSS-ID: 0NTP000-08-NWC-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (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 209B2D16001; Wed, 26 Aug 2015 09:55:12 -0400 (EDT) Received: from SATLEXDAG01.amd.com (10.181.40.3) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 26 Aug 2015 08:55:23 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server id 14.3.195.1; Wed, 26 Aug 2015 09:55:12 -0400 From: Suravee Suthikulpanit To: , , , , CC: , , , , , Suravee Suthikulpanit , Rob Herring , "Murali Karicheri" Subject: [PATCH V3 4/4] PCI: ACPI: Add support for PCI device DMA coherency Date: Wed, 26 Aug 2015 20:54:39 +0700 Message-ID: <1440597279-11802-5-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1440597279-11802-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1440597279-11802-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)(3050300001)(189002)(199003)(4001540100001)(5001920100001)(5001770100001)(101416001)(2201001)(5003600100002)(19580405001)(5001830100001)(64706001)(53416004)(47776003)(50466002)(5001860100001)(87936001)(106466001)(229853001)(50226001)(86362001)(105586002)(5007970100001)(97736004)(77096005)(189998001)(2950100001)(36756003)(5003940100001)(46102003)(68736005)(92566002)(50986999)(77156002)(76176999)(62966003)(48376002)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0714; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0714; 2:SoUHCRcpbSEbcqgLTY4JcLiSqcseZ9qxerv97j5S7iyGPhxUVENUdaxyed2ScjJTMOv2pMKmO93J535iV3LzNEkgOXyfpe4EklWFgtf1YKh3BQLqRVjG/a2w5g6a2PkzEgORwY4u0NtyhF/IWozm6bVAynznMt2bHaIUHpMq5Fg=; 3:+8cPlQec2pbkSJMwhRnH7e0zOepY6VVW/eMEhyGwc4BXEyZU/uJLrpzC2H4fSi73KoA84myVvJZQbz3lABfW2llDho/0Js77OxA9Ytfihlcmjzkct3NWgJmPR0Np7/1tzsjQKu7foHL6mhzvVlsc4M8ZYNYUpgtp09wTG5CLId7Gk7SQcgQlXboIlu84htDi+WSof+icVU/PV7G7zHZGBHbY3HrBDHy+jdRRc2ZNpf7Z4AknyRkbf0YiXfWZ/MUG; 25:SgAZL6DBcFAffNk+3R4fDC/a0p6KUt8+QhxbCIgj2vt6GgA5e6gYQWP615dgz7EwPX0NGWm+bJ0VrD88YnGF9fmMlCVfmJLN9JawwIj8uOwZlkQNQVCBqMCjZddE15nIokC1JSpCsP8C/LCSX4F9L1OKF0fQRiNOWnf96ddq825xA9GioPPW5Xx0NIWuEQegxGSzO5X1IEBUZe7ypiKrO5ZMvQ1eUXkxu+OkY+AQ96N1k9sbUhYaHH7kLdpyz3BY9RhNQ4QtlQJm0SwCvPFrJQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0714; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0714; 20:Z7gl0G7PRRRfbVZdlLSjsiOC6KW8XzjJQ5ZIkDYd1QFSShP0VX9Nwrp6gphBM20NYGNV2S/M8m16m4KGBRRWVPonrhhFKVpxo3Y6B9D0vPaLBg2PH8Gu3otg6WgPKfC7k39RCLQUCiujAGQIeTrAFfhCBYk39o7Q+ptULbHGdll6MeQt3/CFszLkJfQR5/Bq6vazAsvEYYxIHavEPqDRHdILFJP19VpINYcZavuhYOXG/MeE6yJTwJJD5WvdPywqWGNtbBWAvuRp/FqxNSlOYtuofcKM5Hdt8aYGg0LejTM6uMBcpdSAf4jffsQ+mvnh6pN9WNuVh6nbOqQM1Q1jVkXwxB5270AjoXR4R/4zKdm7MtxtmJ6TAIrT6/y3oCR+aBel11BekrO925hH6BxBVa6fiHSvr9b+Q63CUCpdOpZcZqgU2gDc/8nMf7nYVKcEXLmiJOtC2Df+Vv9sSCjeFUshkCci1oI0KNXeDbdZyqMAqKCTH7r9Ik436djfuwz9; 4:9EFpzqlYVH4/d2HpM7v4M2yyXGqGLDBlhEzjZ11ezw4pwoj7E7FLeE5HyoKPea347OdC6n1CKfpzosaZMtXftTZZyDcKBY6AUtZq9pYsKVtbCRco0gaNrabn2Zs+RK5VM9f6TGq7r3Ji4lecdnHViptDBwqVFTAJQw3eLkKcn1WyR5N2h2QvKSxKmPAKhcsZJaSVhf1FfVb5xM41fBcXVY/vha86lzS/j3k3rLPki2ugAmXdOSw4dAjwIhilwD45vddicYMC1jW9R0hhZ+XBPmukXwQdCtGUc8o+W7FlAfW6qvddnQeAFeDmu5u0meqk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(8121501046)(3002001); SRVR:CY1PR12MB0714; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0714; X-Forefront-PRVS: 0680FADD48 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0714; 23:HTRhsH4WeZFn0BFTb6D8hGKHG6LdravW8+fvff+v0?= =?us-ascii?Q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Nzvi?= =?us-ascii?Q?49inFMM3HvQ64hSj4PWZdsnDei00MQL3093erPAD2JVQB23YqRWx0p7Etb8Q?= =?us-ascii?Q?TAwgRCbtDGsxdS/wgFmgwyKUPppJevTFPtDqyG6R2NO/QbjaEbPW3hadwJnO?= =?us-ascii?Q?ng0G8L9+/i8FsDJIS1Hp3RCOEtFC3resGEy2KH82rOzzn9A1AsIeMgo+PWWn?= =?us-ascii?Q?CRNon3UjrP+ZEosg1/KUTGodNn0Lxny?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0714; 5:hIL5vmSUaBmk1qIZf+H6P8KNuJ+AahTm3zAJCql4zKEp9p10/wPkkCfhiZhNV8kDmb8stim5RAVuZ6/s0cnhCO/LNd8QL+3HpnKvOqjh4Esb1gQXylOFxCrtyRSLbk9HC4OBFX905zpoDLdOCXO9fQ==; 24:E3cVdufpy5WwK/gSI0D1jVFL5YIwPNnOyMRJltCr0NBCo2VE3xT034JaIgYW4BFS7OZMa2ijbgmF8B3AnVWENGga1x8Z0OO3m+4ZnX3VOBI=; 20:WxEdeYJwgNn6BdQZ6ltpdfwQNJ3dSrmv3DPnYFeErpgv2Nowuv4ftalLx7jjwxmemkI7KNSBduHJrAOFHZTBRA== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2015 13:55:15.9908 (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: CY1PR12MB0714 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 CC: Bjorn Helgaas CC: Catalin Marinas CC: Rob Herring CC: Will Deacon CC: Rafael J. Wysocki CC: Murali Karicheri --- drivers/pci/probe.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4de6594..7cfd8e2 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1551,17 +1551,25 @@ static void pci_init_capabilities(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) { struct device *bridge = pci_get_host_bridge_device(dev); if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) { - if (!bridge->parent) - return; - - of_dma_configure(&dev->dev, bridge->parent->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_node(bridge->fwnode); + int ret = acpi_check_dma_coherency(adev); + + if (ret < 0) + WARN(1, FW_BUG "PCI device %s fail to setup DMA.\n", + pci_name(dev)); + else + arch_setup_dma_ops(&dev->dev, 0, 0, NULL, ret); } pci_put_host_bridge_device(bridge);