From patchwork Wed Oct 21 15:52:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 7458131 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 E850C9F37F for ; Wed, 21 Oct 2015 15:56:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DAACA20525 for ; Wed, 21 Oct 2015 15:56:00 +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 C71CA20524 for ; Wed, 21 Oct 2015 15:55:59 +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 1ZoviZ-000618-KP; Wed, 21 Oct 2015 15:54:23 +0000 Received: from mail-bn1bon0061.outbound.protection.outlook.com ([157.56.111.61] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zovhf-00053C-7Q for linux-arm-kernel@lists.infradead.org; Wed, 21 Oct 2015 15:53:28 +0000 Received: from SN1PR12CA0003.namprd12.prod.outlook.com (10.162.96.141) by CY1PR12MB0854.namprd12.prod.outlook.com (10.164.70.12) with Microsoft SMTP Server (TLS) id 15.1.300.14; Wed, 21 Oct 2015 15:53:04 +0000 Received: from CO1NAM03FT012.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::209) by SN1PR12CA0003.outlook.office365.com (2a01:111:e400:5174::13) with Microsoft SMTP Server (TLS) id 15.1.306.13 via Frontend Transport; Wed, 21 Oct 2015 15:53:04 +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 CO1NAM03FT012.mail.protection.outlook.com (10.152.80.99) with Microsoft SMTP Server id 15.1.306.8 via Frontend Transport; Wed, 21 Oct 2015 15:53:02 +0000 X-WSS-ID: 0NWKUSB-08-0A0-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 25D39BD8902; Wed, 21 Oct 2015 11:52:59 -0400 (EDT) Received: from SATLEXDAG04.amd.com (10.181.40.9) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 21 Oct 2015 10:53:09 -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:01 -0400 From: Suravee Suthikulpanit To: , , , , Subject: [PATCH V4 5/8] device property: acpi: Make use of the new DMA Attribute APIs Date: Wed, 21 Oct 2015 08:52:08 -0700 Message-ID: <1445442731-28819-6-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)(76176999)(50986999)(19580405001)(2201001)(19580395003)(97736004)(101416001)(47776003)(87936001)(64706001)(5001770100001)(5007970100001)(92566002)(5003600100002)(2950100001)(5003940100001)(77096005)(86362001)(11100500001)(229853001)(189998001)(50466002)(105586002)(106466001)(48376002)(5008740100001)(46102003)(53416004)(36756003)(50226001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0854; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0854; 2:ZbEtBAyhIGeamAvSwYnKSND3xwWEfAYc0JQQElo4wv163R3nuEoD2FTagMed7fv99TLZQADlz9khfb1VoJHrke0DTwoQP+cadCeIrPJucXm1h3YYkW36ZPaDU2KFwkJBW8b1gQ/o3yolIMk9Poh62ldoX2YGhcXQC9jHVx/rW6I=; 3:N0u+Iy0aX6wszik6gAp84S6jpuxeCitBdxfzbLZfG0UL2O/seLT/57j7uuyNbrTKXym/UW1Ugv48bHdYQnD2Aav/QVM3sKkNqc25+Obvytc/gpBZX8sl7aktkk/yfwbXf0IzDlPv2If8VI5hSyJGir3GYhNOoG1iiQ3n2w1mWHwBprWbyVmjQaB7dASu8nxakAsh/shDfJcxnXsViIn9Ov/6i4tF9AlLzEo0/iomIP/2cHKwsce9lNl0jSDdL5ep; 25:wv1IysqpLANG4DDO/IkNbbqGeAElz2RmNcmOpG06TF6RSuA6OrgNYOjU8mbl99I5Z2uIy5GV7x9WKs9qRsfvrblJMTDxTC3JxMXKpLGnT/Y+oxGVG9WrU2x80X22d7Bn3ErcFYroaUiuZmYlQgSvWp6U3jtAZZH998gKsAOJ4WgoCO4H2lgz73pmvN1u1SzHyQoGrPrsRYeV13QGv32h91CFONJf3J3FDuPpJU4drn1JreXaI34cwV7A4nPLr08y X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR12MB0854; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0854; 20:+PM1oZBF/e7XkfrTsYqQRkZ6dPt5PypUWjlmW5WSzPMjSkIR0AJYCaLYiB7/ao00+9d9nsJFUS01K5d3gdNU2huxc0eAIhxOtkv0lKnPSkqQonUsZjwDfZxuEjvLbkqd8OBBPP8p6X+vqVTmXccLq/Mdw0FZrIh7mtgxtldji33QzF0dPuKRTuEC/ZfBu4xj8EO5YyaEwarZEGOOzwo0RavxYh9fC+f3A3C92I+VJUzd7uFDvyFXWlv+CfPuF+HCYJm5WCreU1DPdYrWHGWgNr7BdCjaftHsyC+x81s/BpWZfNuJM6h4gHtmNTVA6tjqv80zis4sjXP/iAk6zz8JuxPhKFDJDiuOjx4GUG5Zv85Mn8SR5z+UnKp5ob4OZ0+TZHk3+2k/tc9+TorL3T69bLBO5gAJUhdVG3m80RCo+vjIbCpiQrjgiN2uH8sWhW6jmTot2vule4Bp5B+BlFch1kTOJDipmzaXaacygLRxC3AJfGHnguGb/e7HMb2myF+r; 4:zAD072CctXnAG5mCZsuqjNfq+gWocru0U9B9KrA9KW4inadKg71dLz1Va7dUdW18sW8EeMDB00/VxqWGN6IWDaBmZ7LSqE0lgX040rJptjr+1MKr3sIQTeWzbDJbmswkHeq6jlMhqXL4OuiiZy1TRJkCyXVt7hO6WO/Y9CqhffiYhQ48euEOWY934Tq7VqALgY2WEdZl4hZ4feQFWDnrp7tdyj9L0enBM2v+mRTiQ5OzEq4g7IiD/rd0oxhKgQxGAz42lkZSw906AdLF5cnQ+7Vr1am40zT1ULimMBhTCSZcT2Y9bfXl3FJFNMJwQJ5T16NuceOyITOU7W2t+Fl8bk13Ub5KrduYe75QyjfM8Wgz/WKe9/tn/0czKcA4FIJC X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(102115026); SRVR:CY1PR12MB0854; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0854; X-Forefront-PRVS: 073631BD3D X-Microsoft-Exchange-Di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qw83YgyssHkrYu5hp18YbkoruBYwQMTjIHZ/42?= =?us-ascii?Q?t5y4SctsRvXZafXlAlC8jj6hW9HbXDY+lKw6lz1iQTUaKO7luahYuNerL+1E?= =?us-ascii?Q?WLkp85eS/acACsjqAXCMm1WHZI19GhZRNtprfnL7C8nKcr4LJMHheLV5iYBf?= =?us-ascii?Q?XQ=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0854; 5:VUfyBili/vX+bC9m8jqL8X7j2/QLweu+D4p4DgzinotXTnrnZTZZHaqibpUqGA2KGytkDY9+n2hsfwK5kNtVKLi4CyzXAhF9mrYDBJvLkViMDrSq5tN1nlnXZ4fJDYiQTrbgPRDktl34rudLS08Knw==; 24:rXQMU17RJRSsPq5senXYhvqLizl78XM7OKElZl+WfwXjw7cGnMEx4iJDDzm5uwE2bmrQtmcSgj7k+QRYkF5B7lUM5ACfh9wIqtwMfSjLv+U=; 20:6XVD1y9r7PlJgtGdLsEbK/VOVOGVgSc/0gqzGL6g1SRKKIlph+CpYFOS3E6TsquSCG7Wq/swZpHxdCR5dS6Wxs5gceuEudLbJpTM3PFzM14PR4gbVQsRgwiTo18cJFwFyv2xJQ/mWtb9DvskUbYZOXiXJQiB2NUJ7dd2VKnXqHfE8ABj6Y3xnIcMFU5zsJC/krtkVv8r6U238EIp8ywgffEOuJLE2JGYW5eWq+oV/gGfuO7DmScx63zpOKiLtJdm SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2015 15:53:02.8961 (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: CY1PR12MB0854 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151021_085327_556509_79E2BE7F X-CRM114-Status: GOOD ( 14.55 ) 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=BAD_ENC_HEADER,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 Now that we have the new DMA attribute APIs, we can replace the older acpi_check_dma() and device_dma_is_coherent(). Signed-off-by: Suravee Suthikulpanit CC: Rafael J. Wysocki CC: Tom Lendacky CC: Herbert Xu CC: David S. Miller --- drivers/acpi/acpi_platform.c | 7 ++++++- drivers/acpi/glue.c | 8 +++++--- drivers/crypto/ccp/ccp-platform.c | 9 ++++++++- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 9 ++++++++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 06a67d5..296b7a1 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -103,7 +103,12 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev) pdevinfo.res = resources; pdevinfo.num_res = count; pdevinfo.fwnode = acpi_fwnode_handle(adev); - pdevinfo.dma_mask = acpi_check_dma(adev, NULL) ? DMA_BIT_MASK(32) : 0; + + if (acpi_dma_supported(adev)) + pdevinfo.dma_mask = DMA_BIT_MASK(32); + else + pdevinfo.dma_mask = 0; + pdev = platform_device_register_full(&pdevinfo); if (IS_ERR(pdev)) dev_err(&adev->dev, "platform device creation failed: %ld\n", diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index b9657af..a66e776 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -168,7 +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; + enum dev_dma_attr attr; if (has_acpi_companion(dev)) { if (acpi_dev) { @@ -225,8 +225,10 @@ 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); + attr = acpi_get_dma_attr(acpi_dev); + if (attr != DEV_DMA_NOT_SUPPORTED) + arch_setup_dma_ops(dev, 0, 0, NULL, + attr == DEV_DMA_COHERENT); acpi_physnode_link_name(physical_node_name, node_id); retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, diff --git a/drivers/crypto/ccp/ccp-platform.c b/drivers/crypto/ccp/ccp-platform.c index bb241c3..edd9e16 100644 --- a/drivers/crypto/ccp/ccp-platform.c +++ b/drivers/crypto/ccp/ccp-platform.c @@ -96,6 +96,7 @@ static int ccp_platform_probe(struct platform_device *pdev) struct ccp_platform *ccp_platform; struct device *dev = &pdev->dev; struct acpi_device *adev = ACPI_COMPANION(dev); + enum dev_dma_attr attr; struct resource *ior; int ret; @@ -122,13 +123,19 @@ static int ccp_platform_probe(struct platform_device *pdev) } ccp->io_regs = ccp->io_map; + attr = device_get_dma_attr(dev); + if (attr == DEV_DMA_NOT_SUPPORTED) { + dev_err(dev, "DMA is not supported"); + goto e_err; + } + ccp_platform->coherent = (attr == DEV_DMA_COHERENT); + ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)); if (ret) { dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", ret); goto e_err; } - ccp_platform->coherent = device_dma_is_coherent(ccp->dev); if (ccp_platform->coherent) ccp->axcache = CACHE_WB_NO_ALLOC; else diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index e83bd76..b596c7f 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c @@ -342,6 +342,7 @@ static int xgbe_probe(struct platform_device *pdev) struct resource *res; const char *phy_mode; unsigned int i, phy_memnum, phy_irqnum; + enum dev_dma_attr attr; int ret; DBGPR("--> xgbe_probe\n"); @@ -608,8 +609,14 @@ static int xgbe_probe(struct platform_device *pdev) if (ret) goto err_io; + attr = device_get_dma_attr(dev); + if (attr == DEV_DMA_NOT_SUPPORTED) { + dev_err(dev, "DMA is not supported"); + goto err_io; + } + pdata->coherent = (attr == DEV_DMA_COHERENT); + /* Set the DMA coherency values */ - pdata->coherent = device_dma_is_coherent(pdata->dev); if (pdata->coherent) { pdata->axdomain = XGBE_DMA_OS_AXDOMAIN; pdata->arcache = XGBE_DMA_OS_ARCACHE;