From: Ankit Soni <Ankit.Soni@amd.com>
To: <iommu@lists.linux.dev>
Cc: <vasant.hegde@amd.com>, <suravee.suthikulpanit@amd.com>,
<joro@8bytes.org>, <will@kernel.org>, <robin.murphy@arm.com>,
<linux-kernel@vger.kernel.org>, <jgg@ziepe.ca>
Subject: [PATCH v5 3/4] iommu_pt: add kunit config for 32-bit VA (amdv1_cfg_1)
Date: Mon, 13 Apr 2026 14:45:20 +0000 [thread overview]
Message-ID: <2a9b91f957bc6538e86c71da75503fb320fbf30d.1776075533.git.Ankit.Soni@amd.com> (raw)
In-Reply-To: <cover.1776075533.git.Ankit.Soni@amd.com>
Add test coverage for small VAs (32‑bit) starting at level 2 by enabling
the AMDv1 KUnit configuration. This limits level expansion because the
starting level can accommodate only the maximum virtual address requested.
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Ankit Soni <Ankit.Soni@amd.com>
---
drivers/iommu/generic_pt/fmt/amdv1.h | 1 +
drivers/iommu/generic_pt/kunit_iommu_pt.h | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/generic_pt/fmt/amdv1.h b/drivers/iommu/generic_pt/fmt/amdv1.h
index 3b2c41d9654d..52ea88ee46da 100644
--- a/drivers/iommu/generic_pt/fmt/amdv1.h
+++ b/drivers/iommu/generic_pt/fmt/amdv1.h
@@ -404,6 +404,7 @@ amdv1pt_iommu_fmt_hw_info(struct pt_iommu_amdv1 *table,
static const struct pt_iommu_amdv1_cfg amdv1_kunit_fmt_cfgs[] = {
/* Matches what io_pgtable does */
[0] = { .starting_level = 2 },
+ [1] = { .starting_level = 2, .common.hw_max_vasz_lg2 = 32 },
};
#define kunit_fmt_cfgs amdv1_kunit_fmt_cfgs
enum { KUNIT_FMT_FEATURES = 0 };
diff --git a/drivers/iommu/generic_pt/kunit_iommu_pt.h b/drivers/iommu/generic_pt/kunit_iommu_pt.h
index e8a63c8ea850..ece1c9b8c55d 100644
--- a/drivers/iommu/generic_pt/kunit_iommu_pt.h
+++ b/drivers/iommu/generic_pt/kunit_iommu_pt.h
@@ -112,8 +112,9 @@ static void test_increase_level(struct kunit *test)
if (IS_32BIT)
kunit_skip(test, "Unable to test on 32bit");
- KUNIT_ASSERT_GT(test, common->max_vasz_lg2,
- pt_top_range(common).max_vasz_lg2);
+ if (common->max_vasz_lg2 <= pt_top_range(common).max_vasz_lg2)
+ kunit_skip(test,
+ "max_vasz_lg2 fits in starting level, no growth possible");
/* Add every possible level to the max */
while (common->max_vasz_lg2 != pt_top_range(common).max_vasz_lg2) {
--
2.43.0
next prev parent reply other threads:[~2026-04-13 14:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 14:45 [PATCH v5 0/4] Respect VASIZE for address limits Ankit Soni
2026-04-13 14:45 ` [PATCH v5 1/4] iommu_pt: Fix pgsize_bitmap calculation in get_info for smaller vasz's Ankit Soni
2026-04-13 16:11 ` Jason Gunthorpe
2026-04-13 14:45 ` [PATCH v5 2/4] iommu_pt: support small VA for AMDv1 Ankit Soni
2026-04-13 16:11 ` Jason Gunthorpe
2026-05-17 17:17 ` Vasant Hegde
2026-04-13 14:45 ` Ankit Soni [this message]
2026-05-17 17:47 ` [PATCH v5 3/4] iommu_pt: add kunit config for 32-bit VA (amdv1_cfg_1) Vasant Hegde
2026-04-13 14:45 ` [PATCH v5 4/4] iommu/amd: Adhere to IVINFO[VASIZE] for address limits Ankit Soni
2026-05-08 19:23 ` [PATCH v5 0/4] Respect VASIZE " Jerry Snitselaar
2026-05-15 4:47 ` Ankit Soni
2026-05-17 17:49 ` Vasant Hegde
2026-06-12 8:46 ` Ankit Soni
2026-06-12 12:55 ` Joerg Roedel
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=2a9b91f957bc6538e86c71da75503fb320fbf30d.1776075533.git.Ankit.Soni@amd.com \
--to=ankit.soni@amd.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.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
all inboxes | Powered by JetHome®