* [PATCH 1/4] iommu/amd: Make iommu_sva_set_dev_pasid as static
2026-09-11 8:33 [PATCH 0/4] iommu/amd: Cleanup and fixes Vasant Hegde
@ 2026-09-11 8:33 ` Vasant Hegde
2026-09-11 8:33 ` [PATCH 2/4] iommu/amd: Remove redundant check in irq_remapping_select() Vasant Hegde
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2026-09-11 8:33 UTC (permalink / raw)
To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde
Its used inside pasid.c only.
No functional changes.
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
---
drivers/iommu/amd/amd_iommu.h | 3 ---
drivers/iommu/amd/pasid.c | 6 +++---
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h
index a2fe804b038b..71113e860859 100644
--- a/drivers/iommu/amd/amd_iommu.h
+++ b/drivers/iommu/amd/amd_iommu.h
@@ -54,9 +54,6 @@ struct protection_domain *protection_domain_alloc(void);
struct iommu_domain *amd_iommu_domain_alloc_sva(struct device *dev,
struct mm_struct *mm);
void amd_iommu_domain_free(struct iommu_domain *dom);
-int iommu_sva_set_dev_pasid(struct iommu_domain *domain,
- struct device *dev, ioasid_t pasid,
- struct iommu_domain *old);
void amd_iommu_remove_dev_pasid(struct device *dev, ioasid_t pasid,
struct iommu_domain *domain);
diff --git a/drivers/iommu/amd/pasid.c b/drivers/iommu/amd/pasid.c
index d708c6532480..40be5902087c 100644
--- a/drivers/iommu/amd/pasid.c
+++ b/drivers/iommu/amd/pasid.c
@@ -99,9 +99,9 @@ static const struct mmu_notifier_ops sva_mn = {
.release = sva_mn_release,
};
-int iommu_sva_set_dev_pasid(struct iommu_domain *domain,
- struct device *dev, ioasid_t pasid,
- struct iommu_domain *old)
+static int iommu_sva_set_dev_pasid(struct iommu_domain *domain,
+ struct device *dev, ioasid_t pasid,
+ struct iommu_domain *old)
{
struct pdom_dev_data *pdom_dev_data;
struct protection_domain *sva_pdom = to_pdomain(domain);
--
2.31.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/4] iommu/amd: Remove redundant check in irq_remapping_select()
2026-09-11 8:33 [PATCH 0/4] iommu/amd: Cleanup and fixes Vasant Hegde
2026-09-11 8:33 ` [PATCH 1/4] iommu/amd: Make iommu_sva_set_dev_pasid as static Vasant Hegde
@ 2026-09-11 8:33 ` Vasant Hegde
2026-09-11 8:33 ` [PATCH 3/4] iommu/amd: Remove redundant checks from interrupt handler path Vasant Hegde
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2026-09-11 8:33 UTC (permalink / raw)
To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde
The amd_iommu_irq_remap flag is already validated during irq remapping
domain creation (before calling amd_iommu_create_irq_domain()). The
duplicate check in irq_remapping_select() is unnecessary and can be
removed.
Additionally, mark amd_iommu_irq_remap as static.
No functional changes.
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
---
drivers/iommu/amd/amd_iommu_types.h | 3 ---
drivers/iommu/amd/init.c | 2 +-
drivers/iommu/amd/iommu.c | 3 ---
3 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
index 3dbe20023456..bce5027388b9 100644
--- a/drivers/iommu/amd/amd_iommu_types.h
+++ b/drivers/iommu/amd/amd_iommu_types.h
@@ -434,9 +434,6 @@ struct irq_remap_table {
u32 *table;
};
-/* Interrupt remapping feature used? */
-extern bool amd_iommu_irq_remap;
-
extern const struct iommu_ops amd_iommu_ops;
/* IVRS indicates that pre-boot remapping was enabled */
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index edcc187b8f14..8a410d4aa370 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -152,7 +152,7 @@ struct ivmd_header {
} __attribute__((packed));
bool amd_iommu_dump;
-bool amd_iommu_irq_remap __read_mostly;
+static bool amd_iommu_irq_remap __read_mostly;
enum protection_domain_mode amd_iommu_pgtable = PD_MODE_V1;
/* Virtual address size */
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 9f9afec68969..5bb7d8cb506e 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -3977,9 +3977,6 @@ static int irq_remapping_select(struct irq_domain *d, struct irq_fwspec *fwspec,
struct amd_iommu *iommu;
int devid = -1;
- if (!amd_iommu_irq_remap)
- return 0;
-
if (x86_fwspec_is_ioapic(fwspec))
devid = get_ioapic_devid(fwspec->param[0]);
else if (x86_fwspec_is_hpet(fwspec))
--
2.31.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/4] iommu/amd: Remove redundant checks from interrupt handler path
2026-09-11 8:33 [PATCH 0/4] iommu/amd: Cleanup and fixes Vasant Hegde
2026-09-11 8:33 ` [PATCH 1/4] iommu/amd: Make iommu_sva_set_dev_pasid as static Vasant Hegde
2026-09-11 8:33 ` [PATCH 2/4] iommu/amd: Remove redundant check in irq_remapping_select() Vasant Hegde
@ 2026-09-11 8:33 ` Vasant Hegde
2026-09-11 8:33 ` [PATCH 4/4] iommu/amd: Remove unused macro Vasant Hegde
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2026-09-11 8:33 UTC (permalink / raw)
To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde
PPR and GAlog interrupt is enabled only if buffer is allocated.
(See amd_iommu_enable_ppr_log() and iommu_ga_log_enable()).
The duplicate check in interrupt hanlder path is unnecessary
and can be removed.
No functional changes.
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
---
drivers/iommu/amd/iommu.c | 3 ---
drivers/iommu/amd/ppr.c | 3 ---
2 files changed, 6 deletions(-)
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 5bb7d8cb506e..ed38f2328618 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -1076,9 +1076,6 @@ static void iommu_poll_ga_log(struct amd_iommu *iommu)
{
u32 head, tail;
- if (iommu->ga_log == NULL)
- return;
-
head = readl(iommu->mmio_base + MMIO_GA_HEAD_OFFSET);
tail = readl(iommu->mmio_base + MMIO_GA_TAIL_OFFSET);
diff --git a/drivers/iommu/amd/ppr.c b/drivers/iommu/amd/ppr.c
index 76296079bb8b..2039a9dd71ac 100644
--- a/drivers/iommu/amd/ppr.c
+++ b/drivers/iommu/amd/ppr.c
@@ -165,9 +165,6 @@ void amd_iommu_poll_ppr_log(struct amd_iommu *iommu)
{
u32 head, tail;
- if (iommu->ppr_log == NULL)
- return;
-
head = readl(iommu->mmio_base + MMIO_PPR_HEAD_OFFSET);
tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET);
--
2.31.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] iommu/amd: Remove unused macro
2026-09-11 8:33 [PATCH 0/4] iommu/amd: Cleanup and fixes Vasant Hegde
` (2 preceding siblings ...)
2026-09-11 8:33 ` [PATCH 3/4] iommu/amd: Remove redundant checks from interrupt handler path Vasant Hegde
@ 2026-09-11 8:33 ` Vasant Hegde
2026-09-11 10:18 ` [PATCH 0/4] iommu/amd: Cleanup and fixes Vasant Hegde
2026-09-12 8:43 ` Jörg Rödel
5 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2026-09-11 8:33 UTC (permalink / raw)
To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit, Vasant Hegde
Remove unsed device range capability related macros.
No functional changes.
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
---
drivers/iommu/amd/amd_iommu_types.h | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/drivers/iommu/amd/amd_iommu_types.h b/drivers/iommu/amd/amd_iommu_types.h
index bce5027388b9..8241ef922519 100644
--- a/drivers/iommu/amd/amd_iommu_types.h
+++ b/drivers/iommu/amd/amd_iommu_types.h
@@ -39,18 +39,6 @@
#define MMIO_RANGE_OFFSET 0x0c
#define MMIO_MISC_OFFSET 0x10
-/* Masks, shifts and macros to parse the device range capability */
-#define MMIO_RANGE_LD_MASK 0xff000000
-#define MMIO_RANGE_FD_MASK 0x00ff0000
-#define MMIO_RANGE_BUS_MASK 0x0000ff00
-#define MMIO_RANGE_LD_SHIFT 24
-#define MMIO_RANGE_FD_SHIFT 16
-#define MMIO_RANGE_BUS_SHIFT 8
-#define MMIO_GET_LD(x) (((x) & MMIO_RANGE_LD_MASK) >> MMIO_RANGE_LD_SHIFT)
-#define MMIO_GET_FD(x) (((x) & MMIO_RANGE_FD_MASK) >> MMIO_RANGE_FD_SHIFT)
-#define MMIO_GET_BUS(x) (((x) & MMIO_RANGE_BUS_MASK) >> MMIO_RANGE_BUS_SHIFT)
-#define MMIO_MSI_NUM(x) ((x) & 0x1f)
-
/* Used offsets into the MMIO space */
#define MMIO_DEV_TABLE_OFFSET 0x0000
#define MMIO_CMD_BUF_OFFSET 0x0008
@@ -247,7 +235,6 @@
/* constants to configure the command buffer */
#define CMD_BUFFER_SIZE 8192
-#define CMD_BUFFER_UNINITIALIZED 1
#define CMD_BUFFER_ENTRIES 512
#define MMIO_CMD_SIZE_SHIFT 56
#define MMIO_CMD_SIZE_512 (0x9ULL << MMIO_CMD_SIZE_SHIFT)
--
2.31.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] iommu/amd: Cleanup and fixes
2026-09-11 8:33 [PATCH 0/4] iommu/amd: Cleanup and fixes Vasant Hegde
` (3 preceding siblings ...)
2026-09-11 8:33 ` [PATCH 4/4] iommu/amd: Remove unused macro Vasant Hegde
@ 2026-09-11 10:18 ` Vasant Hegde
2026-09-12 8:43 ` Jörg Rödel
5 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2026-09-11 10:18 UTC (permalink / raw)
To: iommu, joro; +Cc: will, robin.murphy, suravee.suthikulpanit
On 9/11/2026 2:03 PM, Vasant Hegde wrote:
> This series contains few trivial cleanup (like removing redundant
> checks, unsed macros, etc,) and fixes.
Forgot to mention, this patch is based on top of iommu/fixes branch (Commit
adbd8a08208dc6).
-Vasant
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 0/4] iommu/amd: Cleanup and fixes
2026-09-11 8:33 [PATCH 0/4] iommu/amd: Cleanup and fixes Vasant Hegde
` (4 preceding siblings ...)
2026-09-11 10:18 ` [PATCH 0/4] iommu/amd: Cleanup and fixes Vasant Hegde
@ 2026-09-12 8:43 ` Jörg Rödel
5 siblings, 0 replies; 7+ messages in thread
From: Jörg Rödel @ 2026-09-12 8:43 UTC (permalink / raw)
To: Vasant Hegde; +Cc: iommu, will, robin.murphy, suravee.suthikulpanit
On Fri, Sep 11, 2026 at 08:33:49AM +0000, Vasant Hegde wrote:
> This series contains few trivial cleanup (like removing redundant
> checks, unsed macros, etc,) and fixes.
>
> Vasant Hegde (4):
> iommu/amd: Make iommu_sva_set_dev_pasid as static
> iommu/amd: Remove redundant check in irq_remapping_select()
> iommu/amd: Remove redundant checks from interrupt handler path
> iommu/amd: Remove unused macro
Applied and on their way to Linus, thanks Vasant.
^ permalink raw reply [flat|nested] 7+ messages in thread