Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1706543imu; Thu, 17 Jan 2019 01:48:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN6KzjQutZBwty5UOFNu1UAT33Zr++vCaLu/ECxqHhNgjiY6eZMOyLzsk0GLeJ3V8XUeBeR3 X-Received: by 2002:a17:902:622:: with SMTP id 31mr13992865plg.171.1547718531445; Thu, 17 Jan 2019 01:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547718531; cv=none; d=google.com; s=arc-20160816; b=Ud9OvJP/2V5nOKezDdj6sgv9qy8Hf6tCzvSdMMoitYcOFUhq/Musis3Xwe2TwVhzUx YaMTnseF34CAx5Is5dlS6O/I+Gy1lfPCJd74553SuWYcPINwLTb5ubIP9syFXDvSIeK6 vCvlAJZrG2bFbFcdt6ifAWS3ipv2t6LBChawDUP7BAuiB21VsrXwkZLnoehTccq7m0MB dQ6V1/1Pz76F94X2yJR0MZJN7HX2LXKsezKxS77Cvhms7u8GoZYWc/hoN6SPpkMtbvjO YgFEhb2/LIgIcubVxjdjMj5rB9mSApgKDfzloSF0aM1jUw3SFrMubDxKn00LZ5R+/U2d WP3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=gq+gTtQqP5pQf1S+07h1XZn+mA+C9BUMJWlIOLdALrw=; b=IAhaHfWoghjnsYoUubwbSXs+eFCzNDwywx3yUxNHKfQUiod/IjURHPoKTRRVc84Ulo +uSC6K3n1l+9Mz8l7GKAC/mCxfhxBcmyPIUGPj1Sx4vyz58IYknuKMg730nVTrkjr5vJ F0wFVwkg8NO+ovSX2PW6ghqutax1F2/Ldj0cIAi1um+05cxWJUX8sNzCn85qPlBxttce 24r9HX1wrPHp/URehHKusfP/BxyjhhWeNayX2OetR/i9Hd0VnYVU5/i8ae7VSH4coAWF LqmIOFjfPw7fanhdclRKUn3OpY84XOf8IzjlAHzMFY7Dk/K8riEzH+nVsUXFFtrzdhfR TYHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="c/GIolUk"; dkim=pass header.i=@codeaurora.org header.s=default header.b=otvSQucU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z20si1031213pgv.159.2019.01.17.01.48.35; Thu, 17 Jan 2019 01:48:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b="c/GIolUk"; dkim=pass header.i=@codeaurora.org header.s=default header.b=otvSQucU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728453AbfAQJ1k (ORCPT + 99 others); Thu, 17 Jan 2019 04:27:40 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:40012 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727280AbfAQJ1j (ORCPT ); Thu, 17 Jan 2019 04:27:39 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4BB4F608FD; Thu, 17 Jan 2019 09:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1547717258; bh=1FOuaIwqoqh+sAAt199GtzaQ16QwThY29t1r7ojLmQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/GIolUkQ5uk5aM6g7ktmM8nHhrKT0v8OPrfgsvrbz+tlG/ULPIqBbfuQCRI/sHsi bA5/xA/8/Ptyv6HVShLWj/q/i4HohwESJiPPoBVfd/wlw9qjm2Pb28owH5sBO4YvhG S0//5aN1KS+YvOEHXqd4umwKs1aibJ9NM8qyhSjw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D8587608BA; Thu, 17 Jan 2019 09:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1547717256; bh=1FOuaIwqoqh+sAAt199GtzaQ16QwThY29t1r7ojLmQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=otvSQucUmuvrM8TuHoI7I6qfkjj5smG15AC8ybFKkCvJPyaCkL128EgrUfwfag2rv 2Hg9MYvjLEDAg6m7ck8cPRRRdQ7McJpuaGhe4Fcws3RDMKe899rrCW5jahvXmnVW9t AuRL+GwYrgo23GIYbLfBZqKfQ+EnepgGmBbDyV18= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D8587608BA Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org From: Vivek Gautam To: will.deacon@arm.com, robin.murphy@arm.com, joro@8bytes.org, iommu@lists.linux-foundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, tfiga@chromium.org, Vivek Gautam Subject: [PATCH 2/2] iommu/arm-smmu: Add support for non-coherent page table mappings Date: Thu, 17 Jan 2019 14:57:18 +0530 Message-Id: <20190117092718.1396-3-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 2.16.1.72.g5be1f00a9a70 In-Reply-To: <20190117092718.1396-1-vivek.gautam@codeaurora.org> References: <20190117092718.1396-1-vivek.gautam@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding a device tree option for arm smmu to enable non-cacheable memory for page tables. We already enable a smmu feature for coherent walk based on whether the smmu device is dma-coherent or not. Have an option to enable non-cacheable page table memory to force set it for particular smmu devices. Signed-off-by: Vivek Gautam --- drivers/iommu/arm-smmu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index af18a7e7f917..7ebbcf1b2eb3 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -188,6 +188,7 @@ struct arm_smmu_device { u32 features; #define ARM_SMMU_OPT_SECURE_CFG_ACCESS (1 << 0) +#define ARM_SMMU_OPT_PGTBL_NON_COHERENT (1 << 1) u32 options; enum arm_smmu_arch_version version; enum arm_smmu_implementation model; @@ -273,6 +274,7 @@ static bool using_legacy_binding, using_generic_binding; static struct arm_smmu_option_prop arm_smmu_options[] = { { ARM_SMMU_OPT_SECURE_CFG_ACCESS, "calxeda,smmu-secure-config-access" }, + { ARM_SMMU_OPT_PGTBL_NON_COHERENT, "arm,smmu-pgtable-non-coherent" }, { 0, NULL}, }; @@ -902,6 +904,11 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, if (smmu_domain->non_strict) pgtbl_cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT; + /* Non coherent page table mappings only for Stage-1 */ + if (smmu->options & ARM_SMMU_OPT_PGTBL_NON_COHERENT && + smmu_domain->stage == ARM_SMMU_DOMAIN_S1) + pgtbl_cfg.quirks |= IO_PGTABLE_QUIRK_NON_COHERENT; + smmu_domain->smmu = smmu; pgtbl_ops = alloc_io_pgtable_ops(fmt, &pgtbl_cfg, smmu_domain); if (!pgtbl_ops) { -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation