Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2297998pxb; Mon, 11 Jan 2021 06:20:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJmZzTkHWtgkEbQ3r4Xvah/3KYB99wic4USmoGM867ch1F0DO1omb1o6Wj0TmiPsnH/yu6 X-Received: by 2002:a17:906:2358:: with SMTP id m24mr10754146eja.198.1610374829555; Mon, 11 Jan 2021 06:20:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610374829; cv=none; d=google.com; s=arc-20160816; b=S6ajODiZKsDrtycrdvUuQsfObbN/+dbzh3tB09VWn7qboALuZKKgOhGUgbZjuliD3E C8Q4ZzFS8BxSxwTcVoE9+Tu4Cybko+220GnfrjJdFrZxH55FTPhXnl7vlFy7821DVtOE uAH2miKPeDHFiXwRO5gAdaZpQlUM5Kxg02kfKU0IasKyAll9D6Ljpk7FVl5OtWt7OT6x FupkPgLdKw6Q0gE5gP9Rm/YnA2CDUGZAJu/XA2srJ7nz5sdW5hoTJIFRAMTO8zqLeNnJ 9ILK2vnAdjMFtEBUEzVsbRnW9Ds46l0qgqEQxL9XQtpOL0yTxIQGrifFyimepKjDWFPM KVZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:sender:dkim-signature; bh=S7ghM8SZchF7c80cwqN9NHmmDjAUzAAus0Q+CMEfR2I=; b=SHtwo0K4/wwnPQhaZX+za1zMc7PC9AjlHrB3gaDWMqToxWa4yFlpwkdfuo9dp3bEPT v3ESP/t+rPJALB0++Nt8CcPosaIql0qhKL69fq6UEdoiak3wfk7/TYNSi1yFeteoQifx EvfFb+BMfZ0ZFrhvBhkjiv+PSELKn693+0CA3v4/1z2Z9O1KZ+wk6YIIbyH+kRoS0q/C M1rqw+JL19zVik48Av5Lo1m7vbfn3jHTRX27kbi2kkza6mwTQsxN4GBHDMrkEJfbHqBA n0d6brZfQUDQ2OJlcQx/bvfEZ9RpQePYkRima1b99lAWmuCvO35gF54Nfm+ho+MEIJNJ fq2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=rt5YTPtd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p14si6456596ejf.275.2021.01.11.06.20.04; Mon, 11 Jan 2021 06:20:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=rt5YTPtd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731847AbhAKOQr (ORCPT + 99 others); Mon, 11 Jan 2021 09:16:47 -0500 Received: from so254-31.mailgun.net ([198.61.254.31]:60393 "EHLO so254-31.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727363AbhAKOQq (ORCPT ); Mon, 11 Jan 2021 09:16:46 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1610374582; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=S7ghM8SZchF7c80cwqN9NHmmDjAUzAAus0Q+CMEfR2I=; b=rt5YTPtdV4bqiOECWwYmFs0AUrD3JgUCYON9HglxnOrvcGJ7ktrtu5UR5cS9KMlECkt1fwMS LfXdQuPPFwe4bURQGw4O3GO8ru/iCE7jp6GVUTsxLUQcdoMovP+/pAmvo5jG2pvqNgLKlL++ 6ms7qc15bkA4CH8MJbqknGHRgyY= X-Mailgun-Sending-Ip: 198.61.254.31 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 5ffc5d898fb3cda82fc26238 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 11 Jan 2021 14:15:37 GMT Sender: saiprakash.ranjan=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3D58AC43465; Mon, 11 Jan 2021 14:15:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-253.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: saiprakash.ranjan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 029ECC43467; Mon, 11 Jan 2021 14:15:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 029ECC43467 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=saiprakash.ranjan@codeaurora.org From: Sai Prakash Ranjan To: Will Deacon , Robin Murphy , Joerg Roedel , Jordan Crouse , Rob Clark , Akhil P Oommen , isaacm@codeaurora.org Cc: iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno , Kristian H Kristensen , Sean Paul , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, Sai Prakash Ranjan Subject: [PATCH 2/3] iommu/io-pgtable-arm: Add IOMMU_LLC page protection flag Date: Mon, 11 Jan 2021 19:45:04 +0530 Message-Id: <3f589e7de3f9fa93e84c83420c5270c546a0c368.1610372717.git.saiprakash.ranjan@codeaurora.org> X-Mailer: git-send-email 2.29.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new page protection flag IOMMU_LLC which can be used by non-coherent masters to set cacheable memory attributes for an outer level of cache called as last-level cache or system cache. Initial user of this page protection flag is the adreno gpu and then can later be used by other clients such as video where this can be used for per-buffer based mapping. Signed-off-by: Sai Prakash Ranjan --- drivers/iommu/io-pgtable-arm.c | 3 +++ include/linux/iommu.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index 7439ee7fdcdb..ebe653ef601b 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -415,6 +415,9 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data, else if (prot & IOMMU_CACHE) pte |= (ARM_LPAE_MAIR_ATTR_IDX_CACHE << ARM_LPAE_PTE_ATTRINDX_SHIFT); + else if (prot & IOMMU_LLC) + pte |= (ARM_LPAE_MAIR_ATTR_IDX_INC_OCACHE + << ARM_LPAE_PTE_ATTRINDX_SHIFT); } if (prot & IOMMU_CACHE) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index ffaa389ea128..1f82057df531 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -31,6 +31,12 @@ * if the IOMMU page table format is equivalent. */ #define IOMMU_PRIV (1 << 5) +/* + * Non-coherent masters can use this page protection flag to set cacheable + * memory attributes for only a transparent outer level of cache, also known as + * the last-level or system cache. + */ +#define IOMMU_LLC (1 << 6) struct iommu_ops; struct iommu_group; -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation