All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
To: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org
Cc: joro@8bytes.org, Jon.Grimm@amd.com, wei.huang2@amd.com,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: [PATCH 1/3] iommu/amd: Introduce helper function to check feature bit on all IOMMUs
Date: Fri, 20 Aug 2021 15:29:55 -0500	[thread overview]
Message-ID: <20210820202957.187572-2-suravee.suthikulpanit@amd.com> (raw)
In-Reply-To: <20210820202957.187572-1-suravee.suthikulpanit@amd.com>

IOMMU advertises feature via Extended Features Register (EFR).
The helper function checks if the specified feature bit is set
across all IOMMUs.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/init.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 46280e6e1535..c97961451ac5 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -298,6 +298,19 @@ int amd_iommu_get_num_iommus(void)
 	return amd_iommus_present;
 }
 
+static bool check_feature_on_all_iommus(u64 mask)
+{
+	bool ret = false;
+	struct amd_iommu *iommu;
+
+	for_each_iommu(iommu) {
+		ret = iommu_feature(iommu, mask);
+		if (!ret)
+			return false;
+	}
+
+	return true;
+}
 /*
  * For IVHD type 0x11/0x40, EFR is also available via IVHD.
  * Default to IVHD EFR since it is available sooner
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Suravee Suthikulpanit via iommu <iommu@lists.linux-foundation.org>
To: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org
Cc: Jon.Grimm@amd.com, wei.huang2@amd.com
Subject: [PATCH 1/3] iommu/amd: Introduce helper function to check feature bit on all IOMMUs
Date: Fri, 20 Aug 2021 15:29:55 -0500	[thread overview]
Message-ID: <20210820202957.187572-2-suravee.suthikulpanit@amd.com> (raw)
In-Reply-To: <20210820202957.187572-1-suravee.suthikulpanit@amd.com>

IOMMU advertises feature via Extended Features Register (EFR).
The helper function checks if the specified feature bit is set
across all IOMMUs.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 drivers/iommu/amd/init.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 46280e6e1535..c97961451ac5 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -298,6 +298,19 @@ int amd_iommu_get_num_iommus(void)
 	return amd_iommus_present;
 }
 
+static bool check_feature_on_all_iommus(u64 mask)
+{
+	bool ret = false;
+	struct amd_iommu *iommu;
+
+	for_each_iommu(iommu) {
+		ret = iommu_feature(iommu, mask);
+		if (!ret)
+			return false;
+	}
+
+	return true;
+}
 /*
  * For IVHD type 0x11/0x40, EFR is also available via IVHD.
  * Default to IVHD EFR since it is available sooner
-- 
2.17.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2021-08-20 20:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 20:29 [PATCH 0/3] iommu/amd: Fix unable to handle page fault due to AVIC Suravee Suthikulpanit
2021-08-20 20:29 ` Suravee Suthikulpanit via iommu
2021-08-20 20:29 ` Suravee Suthikulpanit [this message]
2021-08-20 20:29   ` [PATCH 1/3] iommu/amd: Introduce helper function to check feature bit on all IOMMUs Suravee Suthikulpanit via iommu
2021-08-20 20:29 ` [PATCH 2/3] iommu/amd: Relocate GAMSup check to early_enable_iommus Suravee Suthikulpanit
2021-08-20 20:29   ` Suravee Suthikulpanit via iommu
2021-08-20 20:29 ` [PATCH 3/3] iommu/amd: Remove iommu_init_ga() Suravee Suthikulpanit
2021-08-20 20:29   ` Suravee Suthikulpanit via iommu
2021-08-31 17:10 ` [PATCH 0/3] iommu/amd: Fix unable to handle page fault due to AVIC Suthikulpanit, Suravee
2021-08-31 17:10   ` Suthikulpanit, Suravee via iommu
2021-09-02  7:38   ` Joerg Roedel
2021-09-02  7:38     ` Joerg Roedel
2021-09-02 16:13     ` Suthikulpanit, Suravee
2021-09-02 16:13       ` Suthikulpanit, Suravee via iommu
2021-09-09  9:36       ` Joerg Roedel
2021-09-09  9:36         ` Joerg Roedel
2021-09-09 11:17       ` Joerg Roedel
2021-09-09 11:17         ` Joerg Roedel
2021-09-10 18:01         ` Wei Huang
2021-09-10 18:01           ` Wei Huang via iommu

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=20210820202957.187572-2-suravee.suthikulpanit@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=Jon.Grimm@amd.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wei.huang2@amd.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.