From: Sairaj Kodilkar <sarunkod@amd.com>
To: <joro@8bytes.org>, <iommu@lists.linux.dev>
Cc: <suravee.suthikulpanit@amd.com>, <will@kernel.org>,
<robin.murphy@arm.com>, <vasant.hegde@amd.com>,
<sarunkod@amd.com>
Subject: [PATCH 3/4] iommu/amd: Rename DTE_INTTABLEN* and MAX_IRQS_PER_TABLE macro
Date: Fri, 7 Mar 2025 15:28:21 +0530 [thread overview]
Message-ID: <20250307095822.2274-4-sarunkod@amd.com> (raw)
In-Reply-To: <20250307095822.2274-1-sarunkod@amd.com>
AMD iommu can support both 512 and 2K interrupts on newer platform. Hence
add suffix "512" to the existing macros.
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
---
drivers/iommu/amd/amd_iommu_types.h | 6 +++---
drivers/iommu/amd/init.c | 2 +-
drivers/iommu/amd/iommu.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
index a1e2b8317d11..2efb47dba270 100644
--- a/drivers/iommu/amd/amd_iommu_types.h
+++ b/drivers/iommu/amd/amd_iommu_types.h
@@ -313,10 +313,10 @@
* AMD IOMMU hardware only support 512 IRTEs despite
* the architectural limitation of 2048 entries.
*/
-#define DTE_INTTABLEN_VALUE 9ULL
-#define DTE_INTTABLEN (DTE_INTTABLEN_VALUE << 1)
#define DTE_INTTABLEN_MASK (0xfULL << 1)
-#define MAX_IRQS_PER_TABLE (1 << DTE_INTTABLEN_VALUE)
+#define DTE_INTTABLEN_VALUE_512 9ULL
+#define DTE_INTTABLEN_512 (DTE_INTTABLEN_VALUE_512 << 1)
+#define MAX_IRQS_PER_TABLE_512 BIT(DTE_INTTABLEN_VALUE_512)
#define PAGE_MODE_NONE 0x00
#define PAGE_MODE_1_LEVEL 0x01
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 0fbe92a0b48a..9a311c627090 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -1061,7 +1061,7 @@ static bool __copy_device_table(struct amd_iommu *iommu)
int_tab_len = old_devtb[devid].data[2] & DTE_INTTABLEN_MASK;
if (irq_v && (int_ctl || int_tab_len)) {
if ((int_ctl != DTE_IRQ_REMAP_INTCTL) ||
- (int_tab_len != DTE_INTTABLEN)) {
+ (int_tab_len != DTE_INTTABLEN_512)) {
pr_err("Wrong old irq remapping flag: %#x\n", devid);
memunmap(old_devtb);
return false;
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 0960b95656e6..1063c4988dca 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -3093,7 +3093,7 @@ static void set_dte_irq_entry(struct amd_iommu *iommu, u16 devid,
new &= ~DTE_IRQ_PHYS_ADDR_MASK;
new |= iommu_virt_to_phys(table->table);
new |= DTE_IRQ_REMAP_INTCTL;
- new |= DTE_INTTABLEN;
+ new |= DTE_INTTABLEN_512;
new |= DTE_IRQ_REMAP_ENABLE;
WRITE_ONCE(dte->data[2], new);
--
2.34.1
next prev parent reply other threads:[~2025-03-07 9:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 9:58 [PATCH 0/4] iommu/amd: Enable support for up to 2K interrupts per Sairaj Kodilkar
2025-03-07 9:58 ` [PATCH 1/4] iommu/amd: Introduce generic function to set multibit feature value Sairaj Kodilkar
2025-03-07 9:58 ` [PATCH 2/4] iommu/amd: Replace slab cache allocator with page allocator Sairaj Kodilkar
2025-03-07 9:58 ` Sairaj Kodilkar [this message]
2025-03-07 9:58 ` [PATCH 4/4] iommu/amd: Enable support for up to 2K interrupts per function Sairaj Kodilkar
2025-03-13 5:41 ` [PATCH 0/4] iommu/amd: Enable support for up to 2K interrupts per Vasant Hegde
2025-03-13 11:15 ` 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=20250307095822.2274-4-sarunkod@amd.com \
--to=sarunkod@amd.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.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