From patchwork Wed Aug 15 14:45:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 10566681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2FEFF1390 for ; Wed, 15 Aug 2018 14:46:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C6B629E18 for ; Wed, 15 Aug 2018 14:46:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 103E629E34; Wed, 15 Aug 2018 14:46:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 87F2D29E18 for ; Wed, 15 Aug 2018 14:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=A+9unV2ETQCExKE7l+zzmnMh6gma1j4q9DVuON5pTqM=; b=DRk SAmw/F5lbGjsadCNMPuUW0UjjZOJjoVn/RKGLNd138583Gc/AIrs5s2jxI0NCRtiKMXoRmcNty4Li C+MqCcceHgN2pIDUOTlgre9HWy5d5cDDeYJYG/zOY6ZRoYZKn1LgXrCBn7QmcufL8RnS3za4tiaTm mI932kYSi6tcMG8lNYvATg0g7GJA3XPl3IdbzWlsPfZchck9DYYXJbsk4qr2DwLg7S9e16mV/ENMu jReJwP3cXDJgP+YP0UsTjTN003suhMI+UeCI4mQgTvoJ5AA2PVLlAOYCmtAikV7/LE+7laniFaatD xERSBKpUloEPMM+23y+WWchkFc58ktw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpx3u-00032Y-6a; Wed, 15 Aug 2018 14:46:14 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpx3q-0002qP-Il for linux-arm-kernel@lists.infradead.org; Wed, 15 Aug 2018 14:46:12 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4411B80D; Wed, 15 Aug 2018 07:45:57 -0700 (PDT) Received: from e110467-lin.cambridge.arm.com (e110467-lin.emea.arm.com [10.4.12.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 128673F5BD; Wed, 15 Aug 2018 07:45:55 -0700 (PDT) From: Robin Murphy To: will.deacon@arm.com Subject: [PATCH] iommu/arm-smmu-v3: Inline arm_smmu_cmdq_build_cmd() Date: Wed, 15 Aug 2018 15:45:47 +0100 Message-Id: <141de3c3278e280712d16d9ac9ab305c3b80a810.1534344167.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.17.1.dirty X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180815_074610_685952_2B0B1E00 X-CRM114-Status: GOOD ( 14.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jean-philippe.brucker@arm.com, iommu@lists.linux-foundation.org, joro@8bytes.org, linux-arm-kernel@lists.infradead.org, thunder.leizhen@huawei.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Outside arm_smmu_cmdq_issue_cmd(), the only places we build a command are those in which we are generating a sync for various reasons. Given the circumstances, one might hope GCC to be clever enough to emit a specialisation which avoids running through the switch statement with a known constant opcode just to copy two dwords of mostly-static data, but apparently it needs a little more help. Explicitly marking arm_smmu_cmdq_build_cmd() as inline reduces these sync special cases from an out-of-line call to a neat handful of ALU instructions at the couple of relevant sites, yet squashing the full switch statement into arm_smmu_cmdq_issue_cmd() somehow has a knock-on effect across various other areas of the driver for a surprising overall code size reduction: text data bss dec hex filename 16951 648 8 17607 44c7 arm-smmu-v3.o.new 17199 648 8 17855 45bf arm-smmu-v3.o.old Signed-off-by: Robin Murphy --- Having distilled this out of my pile of hacks, I'm fairly confident that it's a reasonable change. Nothing in the latest SVA branch seems to have any adverse effect either, which is reassuring. drivers/iommu/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index 1d647104bccc..94544cd9d929 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -776,7 +776,7 @@ static int queue_remove_raw(struct arm_smmu_queue *q, u64 *ent) } /* High-level queue accessors */ -static int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent) +static inline int arm_smmu_cmdq_build_cmd(u64 *cmd, struct arm_smmu_cmdq_ent *ent) { memset(cmd, 0, CMDQ_ENT_DWORDS << 3); cmd[0] |= FIELD_PREP(CMDQ_0_OP, ent->opcode);