From patchwork Mon Jul 17 13:05:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 9844903 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 44FF16037F for ; Mon, 17 Jul 2017 13:08:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3694F26E4A for ; Mon, 17 Jul 2017 13:08:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A28028505; Mon, 17 Jul 2017 13:08:56 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7407526E4A for ; Mon, 17 Jul 2017 13:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751293AbdGQNIy (ORCPT ); Mon, 17 Jul 2017 09:08:54 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32978 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751280AbdGQNIx (ORCPT ); Mon, 17 Jul 2017 09:08:53 -0400 Received: by mail-pf0-f195.google.com with SMTP id e199so19589265pfh.0; Mon, 17 Jul 2017 06:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=MOzWru8yeDzfEkgAtrbW5pwlM37FfaMMBYrHbcMGzfE=; b=i495rkLw3qjG0G/VhZssB8lhMB+N3W3iM+nyYZIYiP3GeZ3LSj0Bys1432b/B5Wba4 5R7lmQp1+Lf+PLZWQKOXz2dGWilMn7dIO+485NhOpwBwnFdLCIYn/VmZtIMuwg1PgAbp k3zU5sOLHB2zHpGqQmuKBdcweZAGVNb9RpwFA69ROXjk+NDRulEZ55mZrXiIcFH3DCIP 9rdrabv340K64wYZ7cGUl9cMJbIfZEBPy+wYiclsOJWSPqSvhQD+MxdMA3/DZti+MHKB Fj6ZemxIXvPNSREAIQagd42+wdhxgSkjW33yZ3Z8teclb/amiWmM2LXhqP1LxW752WIx DKsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:date:message-id:in-reply-to :references:subject; bh=MOzWru8yeDzfEkgAtrbW5pwlM37FfaMMBYrHbcMGzfE=; b=brk1qq2qiacn3/L/Eb1x8v4ks7AsVpgqJO4QgCE1Vu1hqQ9HumshP1ZQQNW1oUtguZ 7u56wrkys/uiqbmdkvglu/baQcFdcJTd5O4aX2W4/byvuGV3wvlu2qlB2Sg8M3raWVJD I+LMCyx4UA0xlMv7mQMddRs+sndVcPIngmtK4mPxC3AKCy4TW0v4sWeMb1q+4l1VY3bS e6Nrt1TZ67F7DqY/Hz1AfA9Sb+qWeDSp2wZv2pVzw97WSqMczcqNA5tYBp2BoJpF3d6G 2OqeLNlXsF1P8UjnW6OYNPaRP2iPYthGEZ9STrR9HNGtOncdp1aqN6fnONJLOScIo0Eg ew2g== X-Gm-Message-State: AIVw113+lqD9klvsN2h4qk455YrdISksCAY88jheWRuhDVUDWLNN6Yoe q1Dvh4aq3jPhmA== X-Received: by 10.84.224.142 with SMTP id s14mr30891605plj.195.1500296932854; Mon, 17 Jul 2017 06:08:52 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id f70sm47618088pfk.27.2017.07.17.06.08.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 06:08:51 -0700 (PDT) From: Magnus Damm To: joro@8bytes.org Cc: laurent.pinchart+renesas@ideasonboard.com, geert+renesas@glider.be, robin.murphy@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, iommu@lists.linux-foundation.org, horms+renesas@verge.net.au, Magnus Damm , sricharan@codeaurora.org, m.szyprowski@samsung.com Date: Mon, 17 Jul 2017 22:05:31 +0900 Message-Id: <150029673120.22030.6013637834677159530.sendpatchset@little-apple> In-Reply-To: <150029669967.22030.8059216113725566341.sendpatchset@little-apple> References: <150029669967.22030.8059216113725566341.sendpatchset@little-apple> Subject: [PATCH v2 03/05] iommu/ipmmu-vmsa: Use fwspec on both 32 and 64-bit ARM Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Robin Murphy Consolidate the 32-bit and 64-bit code to make use of fwspec instead of archdata for the 32-bit ARM case. This is a simplified version of the fwspec handling code from Robin posted as [PATCH] iommu/ipmmu-vmsa: Convert to iommu_fwspec Signed-off-by: Robin Murphy Signed-off-by: Magnus Damm --- Changes since V1: - Rebased to apply on top of earlier changes in series drivers/iommu/ipmmu-vmsa.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) --- 0004/drivers/iommu/ipmmu-vmsa.c +++ work/drivers/iommu/ipmmu-vmsa.c 2017-07-17 21:04:54.850607110 +0900 @@ -73,22 +73,9 @@ static struct ipmmu_vmsa_domain *to_vmsa return container_of(dom, struct ipmmu_vmsa_domain, io_domain); } - static struct ipmmu_vmsa_iommu_priv *to_priv(struct device *dev) { -#if defined(CONFIG_ARM) - return dev->archdata.iommu; -#else - return dev->iommu_fwspec->iommu_priv; -#endif -} -static void set_priv(struct device *dev, struct ipmmu_vmsa_iommu_priv *p) -{ -#if defined(CONFIG_ARM) - dev->archdata.iommu = p; -#else - dev->iommu_fwspec->iommu_priv = p; -#endif + return dev->iommu_fwspec ? dev->iommu_fwspec->iommu_priv : NULL; } #define TLB_LOOP_TIMEOUT 100 /* 100us */ @@ -726,7 +713,7 @@ static int ipmmu_init_platform_device(st priv->utlbs = utlbs; priv->num_utlbs = num_utlbs; priv->dev = dev; - set_priv(dev, priv); + dev->iommu_fwspec->iommu_priv = priv; return 0; error: @@ -887,14 +874,12 @@ static void ipmmu_domain_free_dma(struct static int ipmmu_add_device_dma(struct device *dev) { - struct iommu_fwspec *fwspec = dev->iommu_fwspec; struct iommu_group *group; /* * Only let through devices that have been verified in xlate() - * We may get called with dev->iommu_fwspec set to NULL. */ - if (!fwspec || !fwspec->iommu_priv) + if (!to_priv(dev)) return -ENODEV; group = iommu_group_get_for_dev(dev);