From patchwork Wed Oct 28 22:50:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 55730 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp213390lbr; Wed, 28 Oct 2015 15:53:20 -0700 (PDT) X-Received: by 10.107.160.143 with SMTP id j137mr53188464ioe.13.1446072800250; Wed, 28 Oct 2015 15:53:20 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e27si325971iod.151.2015.10.28.15.53.20; Wed, 28 Oct 2015 15:53:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753785AbbJ1WxR (ORCPT + 6 others); Wed, 28 Oct 2015 18:53:17 -0400 Received: from mail-by2on0066.outbound.protection.outlook.com ([207.46.100.66]:20544 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932124AbbJ1WvZ (ORCPT ); Wed, 28 Oct 2015 18:51:25 -0400 Received: from BN1PR12CA0014.namprd12.prod.outlook.com (10.160.77.24) by BN4PR12MB0849.namprd12.prod.outlook.com (10.164.59.11) with Microsoft SMTP Server (TLS) id 15.1.312.18; Wed, 28 Oct 2015 22:51:22 +0000 Received: from DM3NAM03FT003.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::205) by BN1PR12CA0014.outlook.office365.com (2a01:111:e400:49::24) with Microsoft SMTP Server (TLS) id 15.1.312.18 via Frontend Transport; Wed, 28 Oct 2015 22:51:22 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) 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 atltwp01.amd.com (165.204.84.221) by DM3NAM03FT003.mail.protection.outlook.com (10.152.82.87) with Microsoft SMTP Server id 15.1.318.9 via Frontend Transport; Wed, 28 Oct 2015 22:51:21 +0000 X-WSS-ID: 0NWYCTJ-07-6DJ-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 atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 21D80CAE635; Wed, 28 Oct 2015 18:51:18 -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:32 -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:18 -0400 From: Suravee Suthikulpanit To: , , , , CC: , , , , , , , , Suravee Suthikulpanit Subject: [PATCH V5 5/9] device property: ACPI: Make use of the new DMA Attribute APIs Date: Wed, 28 Oct 2015 15:50:50 -0700 Message-ID: <1446072654-5608-6-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.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(189998001)(5007970100001)(47776003)(92566002)(86362001)(19580395003)(5001770100001)(97736004)(53416004)(2950100001)(87936001)(5001920100001)(77096005)(229853001)(76176999)(5003600100002)(106466001)(19580405001)(2201001)(5003940100001)(11100500001)(50226001)(36756003)(5008740100001)(105586002)(50466002)(101416001)(48376002)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:BN4PR12MB0849; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0849; 2:KcZ3ITPFZlmpu7oVZJT6sGbwKgq9/ZtMtek97XBEa/dmFnTZMf/2Q7dPxI6zf0Sc6qg8ReWzwuXwA5phdqW3/Ko4516d1Pg9p5M2nDrDJzNID5S6JJ0SAJ7PVKIAF04v18EzSoFSxC0MajruPtltqeU1o5Ef0JvS0Ah88TQasus=; 3:VBno8ueTRg17m95sAgxLmNWwHuotJt8DC9whdK2nWA85j7EF+Qa9hfgvjFIIx0oBHJJFPMjbp5ipcnHmPW6Bsn6TCP5ZEZ4TgnPpdTeaO8I8tONnVZHC47hVKFIw3Q+cOYa/ykPV1nQdjl4PL8F5i85iXnl+xqOlGAA6P2K7wLwFxA3/IVnTR2wVueDzUh+gPSvsq8Tu76y6fwdQtkOpM9tp8alRb+pxQ3fe7g+mNYD+84mY6t+sqsWwIo1GtZnv; 25:YrptaTNxYRV1BzNx1uCiLxK048U6jSas8YCYVKOqgZFWJ3+UAfOACTZCnNsS2EaBV/FMbnvzYZLeDJfHN/VQW3riF7ZK5bLwP8CL7m+eJVk+owZdCW4JCWOBM/aVJeI81yuD8zec63/hf4gm5t9OePPagbD7K2crFv1lvzS4Egwe2xAaOMKiCtkt2Dio+zy4j8N/+pR7BoG3xFk/+1io/XUNRDZLo3Pym/Gai3TON3zFVfdDGYYYWmnTaQnfsKec X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN4PR12MB0849; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0849; 20:0zBpqHNCzAdin290HjdCc8o9KOJ4psHmIOOhxWkPdhPIlOfVslgc2O+i0IHNmmAwvzFyQUdXcdje6cUBhhTw3xsWuFrnA2iUqePd3Jk7KQ0m+4F+UfOF3qRLh/SV3SHQQOpqh6K5QjDlCnHQkmEgHvU2WYC3On924mZ2Mv+XzhbxKutAbtXg5tcNlSDjgGz77idke2D+KOifVttvamOj4B77w50KgDKJTsqaqycJP38wEXn6p7fN/j0/QbxyiINrkzbPjsrAga6VBVf52IijjNaI296E0RD+Rjx9GdPlRf2CCphJgO+hReJc+CLE0umsha+PtSivj35wE4xU9v5Gq2NvWSV3kcmk1bknIrE82U8VVjMTs2MGpKrYVkrcspx4o36XUuP/fK6lICXeJ1q+fgesub1kHm0WddHQWoKpgfleTAqi95K2tGRcpdZ4eNo/kslFC/u8txoc4oSLbPf7EjB7qdt5CYzobR5d0KqN0E/DLgA/pGmhj9dVm8Ax90zl; 4:kejYrDZgwZt6ORCBSaJeh92Q7FEHhtrcK9WOTyhHXiJa0DvmNQb1hh3NO+MvAu5I/8+NKlK5CEmLGlEVuNfX17lLjPJUsgDsa079yNJv1xFluN28n3Vo9+JW/y1WTklTMeCqPo6z0chNzWIyAxG50FpHdXbC9IB5UhScJsHNlpD9fPajLqnfXn00NJyIq96WqkIn6ZiojnO8lGQbqrCAw0pzeFwb+ePuTCWZ7S1VaxxIOP4jQou4D6Hyi0KGwYgF05ePbq/XeLkjE+jjg0lMFN6Cm/6dZ2pmCU0FsvCdhgfIW9vG+3+hwbGcqV+5hJnFIFeULOkslV7kEtelFh7JlCVnmhE1oL5eAXhNO50H63Nj+n3y01DXZuI5ecwgGu3X7qa+fs14wj7ZPl28togXSQ== 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)(5005006)(8121501046)(10201501046)(3002001)(102215026); SRVR:BN4PR12MB0849; BCL:0; PCL:0; RULEID:; SRVR:BN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0rXQZbvOmHptx7USfSvfJfKBWM?= =?us-ascii?Q?pZfzhjFVvciBcfEZj9ziN0dp17aXmR5PBNe3dNOw80GwdCf1VDfUDDVpMUid?= =?us-ascii?Q?3wkPtzv+VBo1d0C0jkyHc3gKwVyOuns6gCe7zr2Mf//uhWKmv33V4wBIilX0?= =?us-ascii?Q?UpYTWkeQaYkAKSgsh3UXXu3RZsE2ZVKUlrKKxnITw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0849; 5:qnrjR1g1UoUCl+QhA0h4DtoAzVEmirDNLjx3UGhS49fImTvpc109ZOPSAahCk6LBWFJfEKFxYSXWNZvTV6kEr+OeRZgTZnLy9CjBxHow7DmML3ADTCC1HnO4sqDLAsMgjT/5fOliUYocU0TCQLbGsQ==; 24:gZziQGmttGXfDC5eu6w0aVU9BAVNNGbaQ8VKdylhAM3BgggLmexF+4RKKuSKBvuV6QTUU/NMdxJvuGSQF++pRf3A1eI9PVlpynvQRsw9kqA=; 20:eBsiUYI91Q86/HDzOW7gTTw3bh77taSQfIYo2p/ArYyb1mrIKYE/b4BX72XXntzQ/p0nlimm2icFpxf5pPUS8L9kSyTdxkPXsSbqQ9jm96jsKsHiUlX6OkJL3dwVnPZ8Dv+8nYZfyjYgFhBa9iNHCy9A0m8rV+cLA/64xo7o0qEPMj+8G3qnb17Y/7fKmrCjDuJ6zd39sYxv1Yg2osLWk0jEOlz7CQgO29QK5t+X42SNBWqd2HgvIJ7Piirww/0X SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2015 22:51:21.5233 (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.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR12MB0849 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 | 15 +++++++++++---- drivers/net/ethernet/amd/xgbe/xgbe-main.c | 8 +++++++- 4 files changed, 29 insertions(+), 9 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 1470ae4..5ea5dc2 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..844118c 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,18 +123,24 @@ static int ccp_platform_probe(struct platform_device *pdev) } ccp->io_regs = ccp->io_map; - 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); + 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 = device_dma_is_coherent(ccp->dev); + ccp_platform->coherent = (attr == DEV_DMA_COHERENT); if (ccp_platform->coherent) ccp->axcache = CACHE_WB_NO_ALLOC; else ccp->axcache = CACHE_NONE; + 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; + } + dev_set_drvdata(dev, ccp); ret = ccp_init(ccp); diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index e83bd76..c607b3f 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"); @@ -609,7 +610,12 @@ static int xgbe_probe(struct platform_device *pdev) goto err_io; /* Set the DMA coherency values */ - pdata->coherent = device_dma_is_coherent(pdata->dev); + 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); if (pdata->coherent) { pdata->axdomain = XGBE_DMA_OS_AXDOMAIN; pdata->arcache = XGBE_DMA_OS_ARCACHE;