From patchwork Mon Nov 11 08:31:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hiroshi DOYU X-Patchwork-Id: 3166721 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D69EE9F3AE for ; Mon, 11 Nov 2013 08:36:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B825B201BB for ; Mon, 11 Nov 2013 08:36:17 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 71F882017E for ; Mon, 11 Nov 2013 08:36:16 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vfmwk-0006Tu-JU; Mon, 11 Nov 2013 08:34:11 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VfmwB-0008J7-Rz; Mon, 11 Nov 2013 08:33:35 +0000 Received: from hqemgate14.nvidia.com ([216.228.121.143]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vfmvb-0008DV-Pp for linux-arm-kernel@lists.infradead.org; Mon, 11 Nov 2013 08:33:01 +0000 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Mon, 11 Nov 2013 00:32:33 -0800 Received: from hqemhub01.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Mon, 11 Nov 2013 00:27:00 -0800 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Mon, 11 Nov 2013 00:27:00 -0800 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by hqemhub01.nvidia.com (172.20.150.30) with Microsoft SMTP Server id 8.3.327.1; Mon, 11 Nov 2013 00:32:33 -0800 Received: from thelma.nvidia.com (Not Verified[172.16.212.77]) by hqnvemgw02.nvidia.com with MailMarshal (v7,1,2,5326) id ; Mon, 11 Nov 2013 00:32:33 -0800 Received: from oreo.Nvidia.com (dhcp-10-21-26-134.nvidia.com [10.21.26.134]) by thelma.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id rAB8W3Y8017621; Mon, 11 Nov 2013 00:32:30 -0800 (PST) From: Hiroshi Doyu To: , , , , , , Subject: [PATCHv4 7/7] iommu/tegra: smmu: Allow duplicate ASID wirte Date: Mon, 11 Nov 2013 10:31:58 +0200 Message-ID: <1384158718-4756-8-git-send-email-hdoyu@nvidia.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1384158718-4756-1-git-send-email-hdoyu@nvidia.com> References: <1384158718-4756-1-git-send-email-hdoyu@nvidia.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131111_033300_072251_575D2222 X-CRM114-Status: GOOD ( 11.30 ) X-Spam-Score: -1.9 (-) Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Hiroshi Doyu X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 The device, which belongs to the same ASID, can try to enable the same ASID as the other swgroup devices. This should be allowed but just skip the actual register write. If the write value is different, it will return -EINVAL. Signed-off-by: Hiroshi Doyu --- Update: This was the part of v3, which isn't used any more. [PATCHv3 10/19] iommu/tegra: smmu: Get "nvidia,swgroups" from DT --- drivers/iommu/tegra-smmu.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 904c36a..70f974c 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -346,8 +346,11 @@ static int __smmu_client_set_swgroups(struct smmu_client *c, offs = SWGROUP_ASID_REG(i); val = smmu_read(smmu, offs); if (on) { - if (WARN_ON(val & mask)) - goto err_hw_busy; + if (val) { + if (WARN_ON(val != mask)) + return -EINVAL; + goto skip; + } val |= mask; } else { WARN_ON((val & mask) == mask); @@ -357,16 +360,8 @@ static int __smmu_client_set_swgroups(struct smmu_client *c, } FLUSH_SMMU_REGS(smmu); c->swgroups = map; +skip: return 0; - -err_hw_busy: - for_each_set_bit(i, bitmap, TEGRA_SWGROUP_MAX) { - offs = SWGROUP_ASID_REG(i); - val = smmu_read(smmu, offs); - val &= ~mask; - smmu_write(smmu, val, offs); - } - return -EBUSY; } static int smmu_client_set_swgroups(struct smmu_client *c, u32 map, int on)