Message ID | 1445442731-28819-5-git-send-email-Suravee.Suthikulpanit@amd.com |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBCO3DI5M3QNRBY7KT2YQKGQE43D2Z7Y@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 9344023024 for <linaro@patches.linaro.org>; Wed, 21 Oct 2015 15:55:16 +0000 (UTC) Received: by lbbor1 with SMTP id or1sf18955198lbb.2 for <linaro@patches.linaro.org>; Wed, 21 Oct 2015 08:55:15 -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:subject:date:message-id :in-reply-to:references:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=WVc2h8t/E8fk/buYB43NP7V+E+BRq4OHyplzPnkciPE=; b=i42FWsPvSXliXhtnQFH/hsoOahmpxlAGHMaMrX/3EKx8VhnYmjQJAAXDM2YLt292zZ uShtKzO7fC7szrkTjU3swuyEbk+5zA4Dfkt6lZweJ6vO9dHpVwH49Mg4ImNuVFt6ZwEX /I+mDq8gRT2IK51Gj4/wtEbjV1bLad0S6Rq9ksDXvP66oQWsJDkgWsfYoUpv8KxWXhad BQogkTNxsRCrcSmGuRPo3ACRpyh0i8nIfVdC8O0J0PbXEUkHVlcqrE1X6j2rl0R8xMSw gLNIGlgoNxoZMM3nOoDQ+33YncNtziPkOqsAyzm6Y2hNnk4nuHqyweO70+rTgZm+XXRy Gz0A== X-Gm-Message-State: ALoCoQnBC8tFKDIS4oYU6IqBI0wgHLuIlxwYn+mY1Bzysw8bfKYBrGAx77Fp8KjVyHP7vk/7KYZJ X-Received: by 10.194.109.233 with SMTP id hv9mr2383093wjb.1.1445442915543; Wed, 21 Oct 2015 08:55:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.44.12 with SMTP id s12ls235372lfs.90.gmail; Wed, 21 Oct 2015 08:55:15 -0700 (PDT) X-Received: by 10.25.23.69 with SMTP id n66mr3927668lfi.52.1445442915220; Wed, 21 Oct 2015 08:55:15 -0700 (PDT) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id ax1si6848124lbc.156.2015.10.21.08.55.15 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 08:55:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lffy185 with SMTP id y185so23287443lff.2 for <patchwork-forward@linaro.org>; Wed, 21 Oct 2015 08:55:15 -0700 (PDT) X-Received: by 10.25.145.209 with SMTP id t200mr3790231lfd.88.1445442915094; Wed, 21 Oct 2015 08:55:15 -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 w3csp67233lbq; Wed, 21 Oct 2015 08:55:14 -0700 (PDT) X-Received: by 10.68.91.193 with SMTP id cg1mr11425468pbb.98.1445442914030; Wed, 21 Oct 2015 08:55:14 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id sb1si14175039pac.127.2015.10.21.08.55.13 for <patch@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 08:55:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; 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 1ZoviO-0005nk-Fm; Wed, 21 Oct 2015 15:54:12 +0000 Received: from mail-bl2on0089.outbound.protection.outlook.com ([65.55.169.89] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zovhd-00052h-R9 for linux-arm-kernel@lists.infradead.org; Wed, 21 Oct 2015 15:53:26 +0000 Received: from BY2PR12CA0006.namprd12.prod.outlook.com (10.160.121.16) by BN4PR12MB0850.namprd12.prod.outlook.com (10.164.59.12) with Microsoft SMTP Server (TLS) id 15.1.306.13; Wed, 21 Oct 2015 15:53:03 +0000 Received: from CO1NAM03FT008.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::200) by BY2PR12CA0006.outlook.office365.com (2a01:111:e400:2c84::16) with Microsoft SMTP Server (TLS) id 15.1.306.13 via Frontend Transport; Wed, 21 Oct 2015 15:53:03 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp01.amd.com (165.204.84.221) by CO1NAM03FT008.mail.protection.outlook.com (10.152.80.81) with Microsoft SMTP Server id 15.1.306.8 via Frontend Transport; Wed, 21 Oct 2015 15:53:01 +0000 X-WSS-ID: 0NWKUSC-07-H0U-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 atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 264D2CAE648; Wed, 21 Oct 2015 11:53:00 -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: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:52:59 -0400 From: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> To: <bhelgaas@google.com>, <rjw@rjwysocki.net>, <lenb@kernel.org>, <catalin.marinas@arm.com>, <will.deacon@arm.com> Subject: [PATCH V4 4/8] device property: Adding DMA Attribute APIs for Generic Devices Date: Wed, 21 Oct 2015 08:52:07 -0700 Message-ID: <1445442731-28819-5-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.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(189002)(199003)(5008740100001)(19580405001)(47776003)(19580395003)(46102003)(64706001)(5003600100002)(87936001)(5003940100001)(50226001)(11100500001)(97736004)(92566002)(5001920100001)(36756003)(229853001)(106466001)(5001770100001)(2201001)(189998001)(86362001)(50466002)(50986999)(5007970100001)(76176999)(48376002)(101416001)(77096005)(2950100001)(105586002)(53416004)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN4PR12MB0850; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0850; 2:Ltwl9vRmpHimTlZnRY5QS4ZoPNezK2DJ5W5mPn91GaQqfUHkc10WeKN9PyO9zg66guwsLo/QBi5qXQnnEr3LUY9gimgq1FBpGUaqyp+L0k6zjPlbyjB+osDLT7Fb2OwxuxKdkTVIlQmyF29ID5IXu8eqtG//vDmNP5hZGzMxoqk=; 3:uQysXoVrbdPQygmGZGcrhZijlV+RVHWJArcL23UE5uySyoLa42Mw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3k1gS21mnK; 4:Gbxvc91TVV/JcD/43I99BsA3nQFrptkyRI3D32VjY/fpsglq4xdJSD3A2qLmxGvCv/GgiBduAaR2teHOIXShnMVw4Qly6C1b2hadTPVPxNrgsaCXL4DZrOs2NBdytvsm22wCpwuN+PXB//SQO2nvP0tV9gQRiH1TBGRUCq/7TubVqDiX+UbUW4rQIXRLOxhQ+88p4MkSymmR5oex37co4Ikx/FICj1TOtYAVGfYZCwSj7q5lHUBecnaZwx5U0OApQ9eOIYHc1o4TIjCDDVe4EdVhCdJjnnN3kojZeG5UVpIi9tbnOzz7fQZBHc+f7P7rowUxss7qLyjbQOLPdRAn4TlOHY6Jet0jGFinRHUnWLUpy4ahJaGlOtbrGbCsSgFP X-Microsoft-Antispam-PRVS: <BN4PR12MB0850AEE67ABDEEEB530E1163F3380@BN4PR12MB0850.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(3002001)(102115026); SRVR:BN4PR12MB0850; BCL:0; PCL:0; RULEID:; SRVR:BN4PR12MB0850; X-Forefront-PRVS: 073631BD3D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN4PR12MB0850; 23:upW/hgDpD4M+2Z0POoODWpCSwjlHdr7hGFvPGrMhi?= =?us-ascii?Q?0D9g3ibPMqKjbgKqNJPl3jsMkEPBYFoGFhrGfRkb0IZgL29qm1uKbqxspOhs?= =?us-ascii?Q?Q2bzO8cY+EVi29VnjzZRwlXLV1IXal/vAVxEA96+HQ0Ek6tTeb9L6Ifg6mOs?= =?us-ascii?Q?xJ5FI9NVIYG+EkPPZf+P0wpQf+Fu6JtkTrKArFh1PQ/dA6zbAHhFqMZrkZjB?= =?us-ascii?Q?KaW2bgltgJIVM1MO+FpCEyQrpylieVtM8n0W+qcbA1eDkZ3D0L8RVipSaW7Z?= =?us-ascii?Q?dKl65VIDnKU1c8Rduc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pCxrHBD2um2qGpNxvpZOw8T2Jg7bvA==; 24:guBPz+HiyjlDKJBobeQdd05S7QCTBUnborKDgHrQnsBTG1Vw6eY2/jUCH1aGmVTC67RUcM6NxapqGKSTOVhR5RXtwv9xjZKlafNe3WYA01Q=; 20:GLurHExeXkOphVrXRfr8WeXdwxhGlE4jZAPsOeylpO/j0xI/LMvBw+lf9ioquDP98pQAOjcRva4E+tF3Jd2/ivqNCQxul+oaNfIOa1MSjHJYXtncnAe1I9yHhKKccouqv5ZVMeVtuB8RikCz+199dfZi+cheg/uNnGgex0zzTw9+WXhh8IwjRfRs6KbxqfbBS7kLdWcnEFgQsiyNpaiSVcy5y89knJlwwjH6rDswCqfBxF/pl/0zEbqbsuUDhyJw SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2015 15:53:01.4794 (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: BN4PR12MB0850 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151021_085326_276995_FB2EE16E X-CRM114-Status: GOOD ( 13.39 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [65.55.169.89 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [65.55.169.89 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: <patchwork-forward.linaro.org> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=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 <Suravee.Suthikulpanit@amd.com>, davem@davemloft.net, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.50 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 |
diff --git a/drivers/base/property.c b/drivers/base/property.c index 2d75366..baac186 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -547,6 +547,35 @@ bool device_dma_is_coherent(struct device *dev) } EXPORT_SYMBOL_GPL(device_dma_is_coherent); +bool device_dma_supported(struct device *dev) +{ + /* For DT, this is always supported. + * For ACPI, this depends on CCA, which + * is determined by the acpi_dma_supported(). + */ + if (IS_ENABLED(CONFIG_OF) && dev->of_node) + return true; + + return acpi_dma_supported(ACPI_COMPANION(dev)); +} +EXPORT_SYMBOL_GPL(device_dma_supported); + +enum dev_dma_attr device_get_dma_attr(struct device *dev) +{ + enum dev_dma_attr attr = DEV_DMA_NOT_SUPPORTED; + + if (IS_ENABLED(CONFIG_OF) && dev->of_node) { + if (of_dma_is_coherent(dev->of_node)) + attr = DEV_DMA_COHERENT; + else + attr = DEV_DMA_NON_COHERENT; + } else + attr = acpi_get_dma_attr(ACPI_COMPANION(dev)); + + return attr; +} +EXPORT_SYMBOL_GPL(device_get_dma_attr); + /** * device_get_phy_mode - Get phy mode for given device * @dev: Pointer to the given device diff --git a/include/linux/property.h b/include/linux/property.h index 522c1bf..bde8de3 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -172,6 +172,10 @@ void device_add_property_set(struct device *dev, struct property_set *pset); bool device_dma_is_coherent(struct device *dev); +bool device_dma_supported(struct device *dev); + +enum dev_dma_attr device_get_dma_attr(struct device *dev); + int device_get_phy_mode(struct device *dev); void *device_get_mac_address(struct device *dev, char *addr, int alen);
The function device_dma_is_coherent() does not sufficiently communicate device DMA attributes. Instead, this patch introduces device_get_dma_attr(), which returns enum dev_dma_attr. It replaces the acpi_check_dma(), which will be removed in subsequent patch. This also provides a convenient function, device_dma_supported(), to check DMA support of the specified device. Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> CC: Rafael J. Wysocki <rjw@rjwysocki.net> --- drivers/base/property.c | 29 +++++++++++++++++++++++++++++ include/linux/property.h | 4 ++++ 2 files changed, 33 insertions(+)