From patchwork Mon Sep 15 18:36:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 37424 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E1C2D203E6 for ; Mon, 15 Sep 2014 18:38:19 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id q58sf2404265wes.2 for ; Mon, 15 Sep 2014 11:38:16 -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:date:from:to:subject:message-id :references:mime-version:in-reply-to:user-agent:cc:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-disposition :content-type:content-transfer-encoding; bh=AzCSeIjBvC1DKvHdSRETO2VWspEwJZee2UprNFC+OYo=; b=lIWcst3s9m9kIuFuKqvaywvNkiIJLAeew6QaqukbyHDlQJPPtedK9uaEzs41aXuUJI CQi96CjsqwKnMVxl05t82fQPSee7wzssHhfKt6s+byZYl6611qM2kBNTfdbOfcDH3ty6 TDALi6yNEY61X4nbu3AsRNEgMZO+E+Z2Ua21DBmFNQfIyiBDVTmj0QZP+xQPrkDcuF8K 6ApKbcxKHp5US/S85eP2lsbxADBz/F8/snCc9uwGyyo0T3ESuyHv+bx8xIOuiYi4EJ5w A6UjrkFaORbS6bk9/gkKpJ1Kbrr4dSVbkR65TreG89fYgO+pgqSet463wHUh2wSPYV0F RK3Q== X-Gm-Message-State: ALoCoQmkOsMRS35tpkQLqghgNglPKYMfad2fgjuuuS7VWmmANh0IEBzSda4721E3I6LoGaPGFKxg X-Received: by 10.112.151.3 with SMTP id um3mr868464lbb.15.1410806296873; Mon, 15 Sep 2014 11:38:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.196 with SMTP id q4ls87197lal.22.gmail; Mon, 15 Sep 2014 11:38:16 -0700 (PDT) X-Received: by 10.152.37.72 with SMTP id w8mr30141418laj.48.1410806296610; Mon, 15 Sep 2014 11:38:16 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx.google.com with ESMTPS id ka2si9202872lbc.9.2014.09.15.11.38.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Sep 2014 11:38:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id u10so1460102lbd.27 for ; Mon, 15 Sep 2014 11:38:16 -0700 (PDT) X-Received: by 10.112.33.74 with SMTP id p10mr28697933lbi.0.1410806296467; Mon, 15 Sep 2014 11:38:16 -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.130.169 with SMTP id of9csp265606lbb; Mon, 15 Sep 2014 11:38:15 -0700 (PDT) X-Received: by 10.66.161.232 with SMTP id xv8mr40509729pab.81.1410806294978; Mon, 15 Sep 2014 11:38:14 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id fl10si24988492pab.23.2014.09.15.11.38.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Sep 2014 11:38:14 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) 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 1XTb91-0000Y9-Va; Mon, 15 Sep 2014 18:36:59 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XTb8x-0000TS-OC for linux-arm-kernel@lists.infradead.org; Mon, 15 Sep 2014 18:36:56 +0000 Received: from arm.com (edgewater-inn.cambridge.arm.com [10.1.203.204]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s8FIaKwo007944; Mon, 15 Sep 2014 19:36:21 +0100 (BST) Date: Mon, 15 Sep 2014 19:36:24 +0100 From: Will Deacon To: Joerg Roedel Subject: Re: [PATCH 2/7] iommu/arm-smmu: add support for multi-master iommu groups Message-ID: <20140915183624.GB30737@arm.com> References: <1409849405-17347-1-git-send-email-will.deacon@arm.com> <1409849405-17347-3-git-send-email-will.deacon@arm.com> <20140915152257.GX28786@8bytes.org> MIME-Version: 1.0 In-Reply-To: <20140915152257.GX28786@8bytes.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140915_113656_293594_C9E59043 X-CRM114-Status: GOOD ( 14.47 ) X-Spam-Score: -5.7 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: "iommu@lists.linuxfoundation.org" , "tchalamarla@cavium.com" , Robin Murphy , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.deacon@arm.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.217.182 as permitted sender) smtp.mail=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 Content-Disposition: inline Hi Joerg, On Mon, Sep 15, 2014 at 04:22:57PM +0100, Joerg Roedel wrote: > On Thu, Sep 04, 2014 at 05:50:00PM +0100, Will Deacon wrote: > > static struct arm_smmu_master_cfg * > > -find_smmu_master_cfg(struct arm_smmu_device *smmu, struct device *dev) > > +find_smmu_master_cfg(struct device *dev) > > { > > - struct arm_smmu_master *master; > > - > > - if (dev_is_pci(dev)) > > - return dev->archdata.iommu; > > - > > - master = find_smmu_master(smmu, dev->of_node); > > - return master ? &master->cfg : NULL; > > + struct iommu_group *group = iommu_group_get(dev); > > + return group ? iommu_group_get_iommudata(group) : NULL; > > Using iommu_group_get requires the call-sites to do an iommu_group_put > in the end, but I don't see the call-sites updated. Well spotted, thanks. Given that we have a reference on the group thanks to iommu_group_alloc, I think it's better just having the put in this helper. diff below. Unfortunately, I'm at a conference this week and so testing is going to be difficult. I'll test early next week and try to get you a pull request later that week for 3.18. Will --->8 diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index d2d8cdaf..939242c 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -474,8 +474,15 @@ static struct arm_smmu_master *find_smmu_master(struct arm_smmu_device *smmu, static struct arm_smmu_master_cfg * find_smmu_master_cfg(struct device *dev) { + struct arm_smmu_master_cfg *cfg = NULL; struct iommu_group *group = iommu_group_get(dev); - return group ? iommu_group_get_iommudata(group) : NULL; + + if (group) { + cfg = iommu_group_get_iommudata(group); + iommu_group_put(group); + } + + return cfg; }