From patchwork Mon Apr 17 11:57:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9683753 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 3CBAF600C5 for ; Mon, 17 Apr 2017 11:58:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3000C2018F for ; Mon, 17 Apr 2017 11:58:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22BE226E48; Mon, 17 Apr 2017 11:58:16 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 D86532018F for ; Mon, 17 Apr 2017 11:58:15 +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=RblEJhK21+z1QPIGIinbpN5FG4vvVeHpwYV9D4TT7EE=; b=SKf unWzFHfsZHJCz2HtRtJRwiK3SzChV8OPVbIRSCDK+jmgyC66Ju8ka+YAw6NXW6KmqnbfCqE0hmsJS 4u3+voMMBJgYlzWlE0m/tyR4Hes+kzsOwIgcJR0EttsPwMZPaYtxmSO1IzICDW0xmneiPbLLhxV9D 483BLSnaj0KrmRtPVIRkD1mC0z+k1p0z3bGHo85xhuu5g+doqzkTVHVjAp9msTImFsfjGYQiFJCX6 9n4HR6f8PJbFp7RmcHZsxla66EDONgDFtb0Z8a4++Gh+adubH1nk5TMEGTVegI6NfJVRv5+RvJg4V WXhsRv6vQPYkccDVG741dXkq7kIpBHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d05IN-0007uM-2G; Mon, 17 Apr 2017 11:58:15 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d05IK-0007sv-QH for linux-arm-kernel@lists.infradead.org; Mon, 17 Apr 2017 11:58:14 +0000 Received: by mail-pg0-x244.google.com with SMTP id 34so23914373pgx.3 for ; Mon, 17 Apr 2017 04:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bCqyJWKtzzV75zq+4GQ8zM8KHN9548ZMuYceDWtjY/Q=; b=e5NwbRuO8eVo4QnmjOy477Ms1tRl3ZR5LtVIEuGMj0A0GkK7sB5rNWhOr7mzbL78VS pjzvbfUNoalfDhv+cMW5Vu7Oc75w5f3jAOuwxNLpjdzBaG/oNdp91OCTndHr+6XeW3VG iing+KFgovlOA78cT5WTDnDfxYtBY9cPFWBjNQA29yOKks0Jol6hKa6evccMIlWgkI3t Ain2jvqbsaya0UK4AmNCqrnKJFfevnCdXs+fG9OUdRJR3jEkNcvD2sXBnXNMHJRXDIGj aHSESOIjlWDcVJzmWKKiqqJAbgLZiWxLqSYYmtvlegjYrAaFGNfBPBF9hI3kXyjittNA u5VQ== 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:subject:date:message-id; bh=bCqyJWKtzzV75zq+4GQ8zM8KHN9548ZMuYceDWtjY/Q=; b=QTcjxdxDdGugs0xfP0cL0ZsCLJ/VQQ5hNukItk+bB5md/9cyoILGrEbAXVIIEK2h08 E7WgcuU7abQQMKVNr3jnkByBcCnQlVG3hqfoymPNGuBSg444t8nX+DR+mQ7wiFkAti4O B4pCVw1gUWqAW1grjeameu6x/3SCPk/GTa5dYsfh98vvj5dVOezpnEBqVqAiBJd4tfUM anX8JTLnCNe7myAtXVYevrjq+GE01Jn3Xn/pfUi9++bh0ypB1YH6S3vFo8WwCiF4scPS MRBdRAVP/SDaLZDCKISXMkvSp+CdL9WPEeKcRqwFh2n7ohKV39N7NYA1G8iB3hcJr6wA aFLA== X-Gm-Message-State: AN3rC/7+Z1DBsHg41OdFz70kWwv2DkNCjEIxz9C8STTwvvZC+7Zf8cCg qhWqYQ9OpZLryw== X-Received: by 10.84.142.133 with SMTP id 5mr15534851plx.129.1492430271796; Mon, 17 Apr 2017 04:57:51 -0700 (PDT) Received: from machine421.in.caveonetworks.com ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id t2sm7683676pfl.34.2017.04.17.04.57.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Apr 2017 04:57:50 -0700 (PDT) From: sunil.kovvuri@gmail.com To: will.deacon@arm.com, iommu@lists.linux-foundation.org Subject: [PATCH] iommu/arm-smmu: Return IOVA in iova_to_phys when SMMU is bypassed Date: Mon, 17 Apr 2017 17:27:26 +0530 Message-Id: <1492430246-17267-1-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170417_045812_896301_60A912B1 X-CRM114-Status: UNSURE ( 9.27 ) X-CRM114-Notice: Please train this message. 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: robert.richter@cavium.com, Sunil Goutham , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 From: Sunil Goutham For software initiated address translation, when domain type is IOMMU_DOMAIN_IDENTITY i.e SMMU is bypassed, mimic HW behavior i.e return the same IOVA as translated address. This patch is an extension to Will Deacon's patchset "Implement SMMU passthrough using the default domain". Signed-off-by: Sunil Goutham --- 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 41afb07..2f4a130 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1405,6 +1405,9 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain, struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); struct io_pgtable_ops *ops= smmu_domain->pgtbl_ops; + if (domain->type == IOMMU_DOMAIN_IDENTITY) + return iova; + if (!ops) return 0;