From patchwork Wed Oct 21 15:52:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7457941 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 4E7D9BEEA4 for ; Wed, 21 Oct 2015 15:54:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E256208E2 for ; Wed, 21 Oct 2015 15:54:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C28B208E0 for ; Wed, 21 Oct 2015 15:54:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755570AbbJUPxQ (ORCPT ); Wed, 21 Oct 2015 11:53:16 -0400 Received: from mail-bn1bon0059.outbound.protection.outlook.com ([157.56.111.59]:12033 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753535AbbJUPxN (ORCPT ); Wed, 21 Oct 2015 11:53:13 -0400 Received: from CY1PR1201CA0023.namprd12.prod.outlook.com (10.169.17.161) by CY1PR12MB0714.namprd12.prod.outlook.com (10.163.238.20) with Microsoft SMTP Server (TLS) id 15.1.306.13; Wed, 21 Oct 2015 15:53:10 +0000 Received: from BY2NAM03FT032.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::209) by CY1PR1201CA0023.outlook.office365.com (2a01:111:e400:5b9a::33) with Microsoft SMTP Server (TLS) id 15.1.306.13 via Frontend Transport; Wed, 21 Oct 2015 15:53:09 +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 BY2NAM03FT032.mail.protection.outlook.com (10.152.84.228) with Microsoft SMTP Server id 15.1.306.8 via Frontend Transport; Wed, 21 Oct 2015 15:53:08 +0000 X-WSS-ID: 0NWKUSG-08-0A3-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 221A6BD8902; Wed, 21 Oct 2015 11:53:03 -0400 (EDT) Received: from SATLEXDAG04.amd.com (10.181.40.9) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 21 Oct 2015 10:53:15 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag04.amd.com (10.181.40.9) with Microsoft SMTP Server id 14.3.266.1; Wed, 21 Oct 2015 11:53:05 -0400 From: Suravee Suthikulpanit To: , , , , CC: , , , , , , , , Suravee Suthikulpanit , Rob Herring , Murali Karicheri Subject: [PATCH V4 8/8] PCI: ACPI: Add support for PCI device DMA coherency Date: Wed, 21 Oct 2015 08:52:11 -0700 Message-ID: <1445442731-28819-9-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1445442731-28819-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1445442731-28819-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)(5003600100002)(50986999)(50466002)(77096005)(48376002)(5008740100001)(97736004)(5001770100001)(46102003)(76176999)(53416004)(2950100001)(5003940100001)(101416001)(47776003)(189998001)(19580395003)(19580405001)(92566002)(2201001)(87936001)(106466001)(86362001)(105586002)(50226001)(5007970100001)(36756003)(229853001)(64706001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0714; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0714; 2:WcnEDK6Qr7iN2TOZ/Gjl7qOw762IwVU0B2NGB8g3TO6XeHo/tci9MEla7Sz+7b1hHWTgrRbwQDDo3vLcR2pzgPOJgJOmm3gHeBSa0PTrJ0fMQgNlqQPNu6Xet10YwaYu5d+KIrgipUpwjnKhxLtEyS9kw2jLLVnnj9d/QFLeGYw=; 3:Jkfp+QACCBO34g4bSstU3tfZetmH4CwuXGo00SDNWkMn4LDXU0q94xrSjJFf0mIkoMrgtfgDFGP22vux4aZ2IVPQu2uaORw99G019HbZVSNawNFYZokFNDu5ODw9iZe+Xlyj+H1GgZPYgucUboULwEFXTRWMimRy8eZvAr6IzvQF7j9kF4WgKYIa891ALopsMtI5pOgC6XfLSqFblwCJmBazr+v6fzGoUKKApmtB7MXNQ582xOOMEk8EfFRpIa7v; 25:grRNYaHIr81Nz2YMmnGKCgKBShCl85wGf9WOHOby6yU9npIZk7hEvozX+Ue9oQ/ZAoKTEMR6CO+/6wUGTzY0cWosbDAoXmgVNIa3/H3umQYIu2dtmbqVE7c5QHpBVimt7qD9OO8ZrRQC8IeVtMw02bbWdUuN5vSrNNa3gdV7PNWZagwNzW1RW9xvP9TDH2wu64GdAdnJeIk1yOdIHaoIa9CrnHOb11n+se5/vPJIsJAUfQABZ68ntsg0BwFrpTji X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0714; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0714; 20:nDuZ+SNJ65C162espSuLKG/Q8+5EvoKnSknta7rQtf1P7cXhXmN9M929XcyJPpppsEQzzxWyyiwByTiohRGq8MhM4TDynLi6290pl6gsT03AXjYKU1UEUcxEZ0unMhmk/yygb1fDQFNnxng/y1nwBfR8I8bpCR8lJrffdTezctSr1Bmp6JM6f9QH/fWV2u7vofaVijzQExAtR1DCx0Sf/d7hXWDFjR8M5p4N39rLlgv7DwnhxnkAQqPKWlq3wvsNEW/RbBZ8aB4ycbzpjsafdFONuMVIWV2MREclg2gSKrticrCxUiZjdr6LMU2Ib/H6Lfs72DsWCDHxU6oXW5dCfiY878WOjM8DoLO9zZflnG5y773dotsf1D7aAay4+Q+SMicjArBK2ah7TuUPmxgdiVAjYlF4ADeiZVhDVEnA9bpsJH6hh7DHbO3ZSH/Yu7KSjE1DhNi3ef7xxirLBUuQFLdyEkdMMX3Od9ujHTFVKJbBFC3FOrgx9hypdbYDSub5; 4:hYjAlbqYQKXZyK7pkIiyi8TfFe68zwN7GwhygfXOVMorc8YXGDCSJenuEvwbvIhB7LE/yfuv9wERhFGhFXi5MGMKJ/5Y6j6Bw+NLN2lSahGhd9P4WDRQzs6P3/1iP2r8H7M8CgSbKvH9bGsXc6vC//lXxnf5h9ynVNwUe5xtlLMsEqLnXFle3PidQ3rLbwxMiEzQB+XWZuq4KVLpwU+pgDFcs5cp1wLO5cof3teY5UMz/ZhD2eCLyxqeL/SLPZI6HYxc+1HQA6y/ODjBWJgpL/zpBR2bb6dSioL5bbRVQM+GcIvqv0qRGY6HvfZTmnsA9kTSRvA9OklC5b9a+2s3+wYvqSaJWPKwr51B2FmXkU3uXhuK0gxDSV6uRf2j20Tg X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(3002001)(102115026); SRVR:CY1PR12MB0714; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0714; X-Forefront-PRVS: 073631BD3D X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0714; 23:/RfBZsYceQqJd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/gGZzRzHr9oaIdyaUmr1ebgzzJ93eVMnaMm2SW7Jg==; 24:iPmLjFmCeOTE706d8C7PbPDVZ56mi1KMPvzMYJ8DsolIqPYp8bcK6lZwCvuHcZpl2yGCbimKGqLSUuuDhwXCpHJOPm/sQSfDlz5nwXSKHnI=; 20:vzTa7yawCU9Pd7PB7MT61e+Pm8TJrozH6b9zLgOgdFNPsn3HfGHq4TXylr72ywVheti2cuSc9N2mcqrsJyNxdW0Xp/oksEwxP2ymEz+B4oypGUFDjk0Af/BhASawKGZ8jOp5xx7Z1OBMH6Va2pnGDWBp70mUtCU0gB2xUCgXY/wnu/FklxTODXC1zIoA04yY3OsO5Lf2BebjHgk2E+3+A9K4Z6k5/yjN04ipJasVgq5QATUBlhrTPzmc/37I0Pfd SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2015 15:53:08.4960 (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=-6.9 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 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 09264f8..6e9f7e6 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1642,17 +1642,26 @@ 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) { 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); + enum dev_dma_attr attr = acpi_get_dma_attr(adev); + + if (attr != DEV_DMA_NOT_SUPPORTED) + arch_setup_dma_ops(&dev->dev, 0, 0, NULL, + attr == DEV_DMA_COHERENT); + else + WARN(1, FW_BUG "PCI device %s fail to setup DMA.\n", + pci_name(dev)); } pci_put_host_bridge_device(bridge);