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: "Suthikulpanit, Suravee" X-Patchwork-Id: 55392 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f71.google.com (mail-lf0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id CF0BE230CD for ; Wed, 21 Oct 2015 15:55:01 +0000 (UTC) Received: by lffv3 with SMTP id v3sf19585527lff.1 for ; Wed, 21 Oct 2015 08:55:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :spamdiagnosticoutput:spamdiagnosticmetadata:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=wdHZCXnrekKU2amo5VgxdQ/fprBjAxVGbJfl7rbX44c=; b=ftI8fsIvepoyo02OTHteFk1yej1p20YfAXWwR4TZQCZh+cOngF+XDtK99l99MA2Kn/ P0wGzJqOyS5x/7AtJT2HqGtknr83lENV6TAZ/fUib4It0I2Xq0lqCFu+TWBzZKSoq69d /tuzF9ympaNeaeJPDK7z2sB10eTT5UzpTDduzMFRrfskpOTtz/HT2Azl+haE8f4tJTnN CcLNuv3sY7DdHVvoQwlV4YWbYZpIt82JsQvrnrZprhn21+4Ev2TFJeh4grOi6E3HX95f NKIMo2x4c4rpSZTDmCWaIsc3q5Djqa/kTx+8u4FMo4KBZBnCXl7o2DyzVr67SXlfjr7W Pg/A== X-Gm-Message-State: ALoCoQm9iDjy0Gs3/lD1dVgoKR6vkGQgIMVdJMUk5ULX6kbEcyREhQYn264HYI3vyYpOC1gXbRgD X-Received: by 10.112.202.165 with SMTP id kj5mr2373394lbc.5.1445442900637; Wed, 21 Oct 2015 08:55:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.209.145 with SMTP id i139ls56610lfg.0.gmail; Wed, 21 Oct 2015 08:55:00 -0700 (PDT) X-Received: by 10.112.77.10 with SMTP id o10mr5867697lbw.28.1445442900465; Wed, 21 Oct 2015 08:55:00 -0700 (PDT) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id so9si6849558lbb.137.2015.10.21.08.55.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 08:55:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lffz202 with SMTP id z202so23352236lff.3 for ; Wed, 21 Oct 2015 08:55:00 -0700 (PDT) X-Received: by 10.25.28.81 with SMTP id c78mr3836890lfc.29.1445442900280; Wed, 21 Oct 2015 08:55:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp67086lbq; Wed, 21 Oct 2015 08:54:59 -0700 (PDT) X-Received: by 10.68.201.33 with SMTP id jx1mr11222132pbc.75.1445442898832; Wed, 21 Oct 2015 08:54:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sf2si14170256pbc.162.2015.10.21.08.54.58; Wed, 21 Oct 2015 08:54:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755803AbbJUPy4 (ORCPT + 28 others); Wed, 21 Oct 2015 11:54:56 -0400 Received: from mail-bn1bon0082.outbound.protection.outlook.com ([157.56.111.82]:60934 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755173AbbJUPxH (ORCPT ); Wed, 21 Oct 2015 11:53:07 -0400 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 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: , , , , CC: , , , , , , , , Suravee Suthikulpanit 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/IkNbbqGeAElz2RmNcmOpG06TF6RSuA6OrgNYOjU8mbl99I5Z2uIy5GV7x9WKs9qRsfvrblJMTDx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l3FJFNMJwQJ5T16NuceOyITOU7W2t+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-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0854; 23:C93RJOj9z9LBbSSyB++8UucZJBuoTSgMmSGEjacyY?= =?us-ascii?Q?lFWTQZ21x+BqYslZK8Jxuvm9L8z6BGr3imtwADGRk8HpmeMXubrg8gnS7LUo?= =?us-ascii?Q?NQciyqMeKyTUmgQ4s+92rcDxRLd61fEOqY7AZpIpnteSaXYCEVJpLbIvVJJO?= =?us-ascii?Q?fQFhGpHd6II9UMJjY39DTcCHaPPEaCdW1VE8htBUU5nhtF1IifMg9lBe6Hro?= =?us-ascii?Q?MDB5VJRNBAVSgzI1fwvlGHkeDfT5U9au2hkNwO0iCb2YplpUEoxObv4gpD9H?= =?us-ascii?Q?ME4xzkv3Ookyo8fKxy/nSdmyJQ8rTa2WudOWgQ+L8QFIxLDrcfIaUaiMVrnA?= =?us-ascii?Q?jEoa5u7Wi4UHCRHGoBkHKIrF3ndnDSuGy2+J9Ok5mrAzch7erHGhHWXV5XPC?= =?us-ascii?Q?M8rdTdKGTiR2newcuXNVwDOddi8hlLUbAAJorsrd22b5WFC8+6WAZiZzsW6Q?= =?us-ascii?Q?CbUUmgu9tz853uVRIxyCM1s5v5Q/qZRXq6AK6VfXkbRpm2S5RwPy+yT9vwy2?= =?us-ascii?Q?ljb1nqVLJLoDhAPaYdftx7dA046kfqdF6ZfQlUWmNlB5A5Wwdl9fq78PAcGf?= =?us-ascii?Q?CnxNfqGE1ysEGopDD9f6PoYKK3ykT857q2dHdVwSIpC2tTbdFD/R9yhYrxax?= =?us-ascii?Q?UuGbgijzZISbwp0WN0BhEVpeqF2bkjHG46ZQr7LH3ZOSPof77a5VCs+89wux?= =?us-ascii?Q?Z3QlO4L8ZsPNIrwSWEyoHjHipKkurvcAjkuknXYAdwkMJggBh0l7t5vgpR3t?= =?us-ascii?Q?KcDy8PBOKmSI+s3k7dBtCQUYQZdvIVq5UO5pmXze5+wIHJ9CDaxG+HS6APUp?= =?us-ascii?Q?Yg2Rhvf5+b4fqfcoBrgzbFqw83YgyssHkrYu5hp18YbkoruBYwQMTjIHZ/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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: suravee.suthikulpanit@amd.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;