From patchwork Tue Jan 12 02:15:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 8013291 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 DAEE39F88A for ; Tue, 12 Jan 2016 02:17:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 113F6201EC for ; Tue, 12 Jan 2016 02:17:31 +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 1842B20145 for ; Tue, 12 Jan 2016 02:17:30 +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 1aIoV0-0007d4-IV; Tue, 12 Jan 2016 02:15:54 +0000 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aIoUv-0007bO-R5 for linux-arm-kernel@lists.infradead.org; Tue, 12 Jan 2016 02:15:51 +0000 Received: from emea01-db3-obe.outbound.protection.outlook.com (mail-db3lrp0077.outbound.protection.outlook.com [213.199.154.77]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-1-g4_x1C6_RySRWwUyA76ZEA-1; Tue, 12 Jan 2016 02:15:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dBqWztPMQcF5uxe8utswzV7jY1eQ13SJ8+1/DrUcNkw=; b=kn63g92VELCfZdQb9nc3Xjk7wotjcX6ydCTNh1LmF7RQMP7bDSFONyszP1YYn61zrnxDT5pqDtxHifA0uCzKELqMGhYOxce3R353dRNyyUQ7kkYB0hnkUEbfmR740vbSrsQf2Q6R4YOiEdHdFR6MykCGUZRl5Tls6LukYXq+P84= Received: from VI1PR08CA0013.eurprd08.prod.outlook.com (10.164.95.23) by DB5PR08MB0855.eurprd08.prod.outlook.com (10.164.43.21) with Microsoft SMTP Server (TLS) id 15.1.365.19; Tue, 12 Jan 2016 02:15:21 +0000 Received: from DB3FFO11FD006.protection.gbl (2a01:111:f400:7e04::153) by VI1PR08CA0013.outlook.office365.com (2a01:111:e400:597a::23) with Microsoft SMTP Server (TLS) id 15.1.365.19 via Frontend Transport; Tue, 12 Jan 2016 02:15:21 +0000 Received: from nebula.arm.com (217.140.96.140) by DB3FFO11FD006.mail.protection.outlook.com (10.47.216.95) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Tue, 12 Jan 2016 02:15:21 +0000 Received: from sha-win-210.asiapac.arm.com (10.1.2.79) by mail.arm.com (10.1.105.66) with Microsoft SMTP Server id 14.3.266.1; Tue, 12 Jan 2016 02:15:17 +0000 From: Huang Shijie To: Subject: [PATCH] iommu/arm-smmu: add a shortcut when the @dev_node is NULL Date: Tue, 12 Jan 2016 10:15:05 +0800 Message-ID: <1452564905-2662-1-git-send-email-shijie.huang@arm.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; DB3FFO11FD006; 1:3Elvua4eFcwdhjljMnnPN6YmgBPNrZk/80Su0XVxzxDpGyCQyt7ywuFhTfR++2WVuoS3QyWkjM3oakqnDu5A4FOieww9tYAbeYuceOT7/ABNfxD9cYz4IMV0aIHkt9lFTIkEcu9b7mJiPp/HFv6aLIeVpagP8xEdr0sIDy6N/Ljfs6jWcms1QvkuMdCN2aWXG3+LK+9I3nlMhNBHott8F509lgPlnwekChTg1DUfxIBLtzgV0HdRpiocHuAwAsr6IS/OV/uBxozdbuoy9vWqG0B8ftmoW8VQ4pfJ+DDnicp79cj6H2syVkLlNeLdOF7lLjrJYFk0h3cJgpln13HVNQi0f5Z8uvQoao6WCXPJA4XYc/4U9c7B2Zw7HKZ4Uv6HO3hL2cMV3h3zETez+5dBNg== X-Forefront-Antispam-Report: CIP:217.140.96.140; CTRY:GB; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(229853001)(92566002)(110136002)(50466002)(50226001)(86362001)(2351001)(586003)(33646002)(5003600100002)(1220700001)(36756003)(5003940100001)(106466001)(189998001)(47776003)(4326007)(5008740100001)(19580405001)(26826002)(1096002)(19580395003)(48376002)(11100500001)(50986999)(2906002)(6806005)(104016004)(87936001)(77096005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR08MB0855; H:nebula.arm.com; FPR:; SPF:Pass; PTR:fw-tnat.cambridge.arm.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB0855; 2:GaaGfGh7ipgLvh8mKpG9BFosWytShFoiPhsCYTxp+K5mGSQWLQISPiHv+wjYbpNOVaqYay6pv0mPjDVB1e8IIB7vhcc7ie4Xz8qtnjp0LaPE2bCR4NlyPe0/DBt0eIDjzzEzR3QjEtGJxeCTYy5t6Q==; 3:Yk6zE4W6ul8+BIg6BIZhPhhZYp/0U2vmzar/rcLeGLtfG1yhhLqqQJw3gQvf4BJMlkqzMCEasE9IdJyvPI9UMyr96exNifn44rUZU1PtBz/R0dBfWpEdx9GApEBtkoEWkFLpQ/K1wtIQsXLCSMFaNZSC9NNR27GqmCX3rqEnvxzcsEFBP/Digon5jj4gj9W571lMThEheI581BIpd+xd86g5ZKl526thQM/9EbYTrgHuCQ/4rzpvrdpXEp9vhg749Pub/EsGz0i3p8P3zjeX2w==; 25:A/Z5aZXUlzB5goQZmhTdz9wOPy+mQaX+XUPoRVIr/XR73y7tVRF8hIoUFBqZtnRyuZTvgiW9zGuMU2Q49ApTiZ9tb+w9/+b9NBrT6ZhtjZviqeVKuTLgQ2jc0Ilz7HSNeiAr6UWxKZQA0mButXef2uw1wnT7E+bcVqk4qCXPjUOyEUXA7lYakOdgMkNhDYde8c7NEzESTfXNE1/1gTBZ/MQzB4m7SYCzeSi/060sYL9ZEKAbIX1lS/zJ7sJyZ0ZR; 20:svhT6I0WMBA1cUeu/Ndc1xV5TQcNga1GV5GNvwm20tV7ghrI1nhcovWB0StEoRaPIwjbZ8UKtGkUbt6h6E4f4nazBaCcq22nQko7AsmcWIzd17XhNRozDnN0Z+FnYKRbJztaU/UL1YuX3lXK5yEjxMXALqHprD0m7FzAm4ilQ3s= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501001); SRVR:DB5PR08MB0855; X-MS-Office365-Filtering-Correlation-Id: 791d366c-8715-4a3f-c088-08d31af63948 NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13013025)(13016025)(5005006)(13018025)(520078)(8121501046)(3002001)(10201501046); SRVR:DB5PR08MB0855; BCL:0; PCL:0; RULEID:; SRVR:DB5PR08MB0855; X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB0855; 4:nOlP13QPj1i0poem1N1m4WUrvF+FjKYdrw8g/R2NzcMIDdOZKBW5AUy3uGDvX190R/dwmCM070n8Htr+ZyQDmwTsaf/zCtruqViMo6KeE8yQpwl0HJCqOY6kLqlWU5pW3JO1eZ9jvWoC4lm2Wdjcn/olTtON05L8vU5I3PTUgnjoY5a5hmrWRydEaX5pdZ8/cRvsHFQB6mqGhGZHDvZdOPA1V2Hrb8r+9hBql0XCpZtqzWIcNHHXx0dxf7AjjK+n/iVXcuPmnWCcobhCjCKKwXfmXMzDnl7dAT9nRAdRJSjs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uFklOPVQ8ZtVDhz2LisFv4Idh2nWNOV67Fv0ZHh+A1+lSwDg4P1JQni6CHLdwFdzgqWAuc1Yfl6yl/xT/x7cKPd1aLZ6GHLv9ItC8OBfrD027/4C3o4sEcs5yC1u/cG1 X-Microsoft-Exchange-Diagnostics: 1; DB5PR08MB0855; 5:pbvPnpbLfgiOUU7lgzbQtJeJCIt1JsgGDqgIvzc5Mg67at5Px1spQwO7dDIQTBNmQdjDSURN1oVTZTs21QKMyQZhIbJ4AObk7NCwZcS6GJPeuKRMdRhgsIOhIJstLO/ugv8VNgtqMCg0EUtBMkR6yQ==; 24:rXycp1HoXxwG93KINqxtnM8B88iepCxO7NKOZqD8EaRyQKMibfr76CPMoEP632+3xEfrpCiOurHva22yjihikqCBND/VZFzyblElicKlvoU=; 20:Ug23Y3lYC70qSMawiPSvCZHK6rgiytUaXi14NGmt12/tuB0s59Jb+Ey7z9WjUfGk1vCEogA9BndaTfyDd3DX0FMcqWvhuXLTE6ZBK6ul63XUv/3AOHK2Mc4SLBLYNkTHY6clkiLJiQaXWVWVfbYnKsm0m2VjgxjFlkYERLEhhrM= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2016 02:15:21.1286 (UTC) X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[217.140.96.140]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB0855 X-MC-Unique: g4_x1C6_RySRWwUyA76ZEA-1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160111_181550_355950_7B379399 X-CRM114-Status: UNSURE ( 8.74 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -4.1 (----) 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: joro@8bytes.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Huang Shijie , nd@arm.com, 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 When a device is added to a bus, it will trigger the chain notifier hook, such as iommu_bus_notifier. The find_smmu_for_device() can be called here. In some cases, the @device_node can be NULL. For example, when the device is one of the following: alarmtime, serial, rtc or snd_soc. This patch adds a shortcut for the code when the @device_node is NULL. In my juno-r1 board, the boot time can be faster by 0.004014s. Signed-off-by: Huang Shijie --- drivers/iommu/arm-smmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 59ee4b8..6724a46 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -506,6 +506,9 @@ static struct arm_smmu_device *find_smmu_for_device(struct device *dev) struct arm_smmu_master *master = NULL; struct device_node *dev_node = dev_get_dev_node(dev); + if (!dev_node) + return NULL; + spin_lock(&arm_smmu_devices_lock); list_for_each_entry(smmu, &arm_smmu_devices, list) { master = find_smmu_master(smmu, dev_node);