linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Manoj Vishwanathan <manojvishy@google.com>
To: Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	 Joerg Roedel <joro@8bytes.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	 linux-arm-kernel@lists.infradead.org
Cc: kvm@vger.kernel.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org,  David Dillow <dillow@google.com>,
	Manoj Vishwanathan <manojvishy@google.com>
Subject: [PATCH v1 2/4] iommu/io-pgtable-arm: Force outer cache for page-level MAIR via user flag
Date: Mon, 26 Aug 2024 07:16:39 +0000	[thread overview]
Message-ID: <20240826071641.2691374-3-manojvishy@google.com> (raw)
In-Reply-To: <20240826071641.2691374-1-manojvishy@google.com>

This change introduces a user-accessible flag that allows controlling
the system-level outer cache behavior for mapped buffers.

By setting this flag, the page-level MAIR attribute will be forced to
use the outer cache, potentially improving performance for frequently
accessed data.

Signed-off-by: Manoj Vishwanathan <manojvishy@google.com>
---
 drivers/iommu/io-pgtable-arm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index f5d9fd1f45bf..31dd6203db96 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -471,6 +471,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_SYS_CACHE)
+			pte |= (ARM_LPAE_MAIR_ATTR_IDX_INC_OCACHE
+				<< ARM_LPAE_PTE_ATTRINDX_SHIFT);
 	}
 
 	/*
-- 
2.46.0.295.g3b9ea8a38a-goog



  parent reply	other threads:[~2024-08-26  7:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26  7:16 [PATCH v1 0/4] vfio/iommu: Flag to allow userspace to set DMA buffers system cacheable Manoj Vishwanathan
2024-08-26  7:16 ` [PATCH v1 1/4] iommu: Add IOMMU_SYS_CACHE flag for system cache control Manoj Vishwanathan
2024-08-26  7:16 ` Manoj Vishwanathan [this message]
2024-08-26  7:16 ` [PATCH v1 3/4] vfio: Add VFIO_DMA_MAP_FLAG_SYS_CACHE to control device access to system cache Manoj Vishwanathan
2024-08-26  7:16 ` [PATCH v1 4/4] vfio/type1: Add support for VFIO_DMA_MAP_FLAG_SYS_CACHE Manoj Vishwanathan
2024-08-26 17:04 ` [PATCH v1 0/4] vfio/iommu: Flag to allow userspace to set DMA buffers system cacheable Alex Williamson
2024-08-26 17:36   ` Manoj Vishwanathan
2024-08-26 23:17   ` Jason Gunthorpe
2024-08-27 17:31     ` Robin Murphy
2024-08-28  2:55       ` Manoj Vishwanathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240826071641.2691374-3-manojvishy@google.com \
    --to=manojvishy@google.com \
    --cc=alex.williamson@redhat.com \
    --cc=dillow@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).