xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roman Skakun <rm.skakun@gmail.com>
To: Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	xen-devel@lists.xenproject.org
Cc: Roman Skakun <roman_skakun@epam.com>,
	Roman Skakun <rm.skakun@gmail.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Andrii Anisov <andrii_anisov@epam.com>
Subject: [RFC 1/1] xen/arm: set iommu property for IOMMU-protected devices
Date: Mon,  4 Oct 2021 12:54:02 +0300	[thread overview]
Message-ID: <5b101e4e85668bbb18da83044520b0350344f408.1633106362.git.roman_skakun@epam.com> (raw)
In-Reply-To: <cover.1633106362.git.roman_skakun@epam.com>

From: Roman Skakun <roman_skakun@epam.com>

Xen is not exposing any IOMMU properties to Dom0.
So Dom0 assumes that all it's devices are not protected by IOMMU.

To make Dom0 aware of IOMMU-protected devices, we need to mark
them somehow. With this approach Dom0 Linux kernel will be able
to selectively disable swiotlb-xen fops for them which will remove
unnecessary buffer bounces.

This patch adds mechanism to describe IOMMU-protected devices by
adding `xen,behind-iommu` property to relevant device nodes in
Dom0 device tree.

Signed-off-by: Roman Skakun <roman_skakun@epam.com>
---
 xen/arch/arm/domain_build.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 69fff7fc29..99e2c42b6c 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -580,6 +580,13 @@ static int __init write_properties(struct domain *d, struct kernel_info *kinfo,
             return res;
     }
 
+    if ( iommu_node && is_iommu_enabled(d) && dt_device_is_protected(node) )
+    {
+        res = fdt_property(kinfo->fdt, "xen,behind-iommu", NULL, 0);
+        if ( res )
+            return res;
+    }
+
     /*
      * Override the property "status" to disable the device when it's
      * marked for passthrough.
-- 
2.27.0



  reply	other threads:[~2021-10-04  9:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04  9:54 [RFC 0/1] tag IOMMU-protected devices in Dom0 fdt Roman Skakun
2021-10-04  9:54 ` Roman Skakun [this message]
2021-10-06 12:45   ` [RFC 1/1] xen/arm: set iommu property for IOMMU-protected devices Oleksandr
2021-10-07 11:04     ` Roman Skakun
2021-11-08 18:30   ` Julien Grall
2021-11-10 21:12     ` Stefano Stabellini
2021-12-07 15:40       ` Sergiy Kibrik
2021-12-10  2:04         ` Stefano Stabellini
2021-10-04  9:54 ` [RFC PATCH] dma-mapping: don't set swiotlb-xen fops " Roman Skakun
2021-10-12 14:11 ` [RFC 0/1] tag IOMMU-protected devices in Dom0 fdt Roman Skakun
2021-10-12 14:20   ` Julien Grall
2021-10-12 14:23     ` Roman Skakun

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=5b101e4e85668bbb18da83044520b0350344f408.1633106362.git.roman_skakun@epam.com \
    --to=rm.skakun@gmail.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrii_anisov@epam.com \
    --cc=julien@xen.org \
    --cc=roman_skakun@epam.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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).