iommu/amd: Trivial fixes
Subsystems (2)
Vasant Hegde
maintainercover iommu/amd: Trivial fixes
This series contains minor cleanup and trivial fixes.
base-commit: v6.14-rc3
Vasant Hegde (7):
iommu/amd: Log IOMMU control register in event log path iommu/amd: Remove unused variable iommu/amd/pgtbl_v2: Improve error handling iommu/amd: Remove outdated comment
iommu/amd: Fix header file
iommu/amd: Remove unused forward declaration iommu/amd: Make protection_domain as static
drivers/iommu/amd/amd_iommu.h | 8 +++----- drivers/iommu/amd/amd_iommu_types.h | 3 --- drivers/iommu/amd/init.c | 1 - drivers/iommu/amd/io_pgtable.c | 7 ------- drivers/iommu/amd/io_pgtable_v2.c | 2 +- drivers/iommu/amd/iommu.c | 6 ++++-- drivers/iommu/amd/pasid.c | 2 +- 7 files changed, 9 insertions(+), 20 deletions(-)
Signature · 1 line
2.31.1
Vasant Hegde
maintainerPATCH 1/7 iommu/amd: Log IOMMU control register in event log path
Useful for debugging ILLEGAL_DEV_TABLE_ENTRY events as some of the DTE settings depends on Control register settings.
--- drivers/iommu/amd/iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/amd/iommu.c +3 -1
@@ -868,7 +868,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt)int type, devid, flags, tag;volatile u32 *event = __evt;int count =0 ; -u64 address; +u64 address, ctrl;u32 pasid; retry:
@@ -878,6 +878,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) (event[1 ] &EVENT_DOMID_MASK_LO ); flags = (event[1 ] >>EVENT_FLAGS_SHIFT ) &EVENT_FLAGS_MASK ; address = (u64)(((u64 )event[3 ]) <<32 ) | event[2 ]; + ctrl =readq (iommu->mmio_base +MMIO_CONTROL_OFFSET );if (type ==0 ) {/* Did we hit the erratum? */
@@ -899,6 +900,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt)dev_err (dev,"Event logged [ILLEGAL_DEV_TABLE_ENTRY device=%04x:%02x:%02x.%x pasid=0x%05x address=0x%llx flags=0x%04x]\n" , iommu->pci_seg->id,PCI_BUS_NUM (devid),PCI_SLOT (devid),PCI_FUNC (devid), pasid, address, flags); +dev_err (dev,"Control Reg : 0x%llx\n" , ctrl);dump_dte_entry (iommu, devid);break ;case EVENT_TYPE_DEV_TAB_ERR :
Signature · 1 line
2.31.1
Re: [PATCH 1/7] iommu/amd: Log IOMMU control register in event log path
Quoted 7 lines · Vasant Hegde
Useful for debugging
ILLEGAL_DEV_TABLE_ENTRYevents as some of the DTE settings depends on Control register settings.Signed-off-by Vasant Hegde <[email protected]>--- drivers/iommu/amd/iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Jason
Vasant Hegde
maintainerPATCH 2/7 iommu/amd: Remove unused variable
In reply to Vasant HegdeRemove 'amd_iommu_aperture_order' as its not used since commit d9cfed925448.
--- drivers/iommu/amd/amd_iommu_types.h | 3 --- 1 file changed, 3 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +0 -3
@@ -928,9 +928,6 @@ struct unity_map_entry {* Data structures for device handling */ -/* size of the dma_ops aperture as power of 2 */ -extern unsigned amd_iommu_aperture_order; -extern bool amd_iommu_force_isolation;/* Max levels of glxval supported */
Signature · 1 line
2.31.1
Re: [PATCH 2/7] iommu/amd: Remove unused variable
Quoted 6 lines · Vasant Hegde
Remove '
amd_iommu_aperture_order' as its not used since commitd9cfed925448.Signed-off-by Vasant Hegde <[email protected]>--- drivers/iommu/amd/amd_iommu_types.h | 3 --- 1 file changed, 3 deletions(-)
Jason
Vasant Hegde
maintainerPATCH 3/7 iommu/amd/pgtbl_v2: Improve error handling
In reply to Vasant HegdeReturn -ENOMEM if v2_alloc_pte() fails to allocate memory.
--- drivers/iommu/amd/io_pgtable_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/io_pgtable_v2.c +1 -1
@@ -254,7 +254,7 @@ static int iommu_v2_map_pages(struct io_pgtable_ops *ops, unsigned long iova, pte =v2_alloc_pte (cfg->amd.nid, pgtable->pgd, iova, map_size, gfp, &updated);if (!pte) { - ret = -EINVAL ; + ret = -ENOMEM ; goto out; }
Signature · 1 line
2.31.1
Re: [PATCH 3/7] iommu/amd/pgtbl_v2: Improve error handling
Quoted 6 lines · Vasant Hegde
Return
-ENOMEMifv2_alloc_pte()fails to allocate memory.Signed-off-by Vasant Hegde <[email protected]>--- drivers/iommu/amd/io_pgtable_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Jason
Vasant Hegde
maintainerPATCH 4/7 iommu/amd: Remove outdated comment
In reply to Vasant HegdeRemove outdated comment.
--- drivers/iommu/amd/io_pgtable.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/iommu/amd/io_pgtable.c +0 -7
@@ -47,13 +47,6 @@ static u64 *first_pte_l7(u64 *pte, unsigned long *page_size,return fpte; } -/**************************************************************************** -* -* The functions below are used the create the page table mappings for -* unity mapped regions. -* -****************************************************************************/ -static void free_pt_page (u64 *pt,struct list_head *freelist) {struct page *p =virt_to_page (pt);
Signature · 1 line
2.31.1
Re: [PATCH 4/7] iommu/amd: Remove outdated comment
Quoted 6 lines · Vasant Hegde
Remove outdated comment.
Signed-off-by Vasant Hegde <[email protected]>--- drivers/iommu/amd/io_pgtable.c | 7 ------- 1 file changed, 7 deletions(-)
Jason
Vasant Hegde
maintainerPATCH 5/7 iommu/amd: Fix header file
In reply to Vasant HegdeMove function declaration inside AMD_IOMMU_H defination.
--- drivers/iommu/amd/amd_iommu.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iommu/amd/amd_iommu.h +3 -4
@@ -176,12 +176,11 @@ void amd_iommu_apply_ivrs_quirks(void);#else static inline void amd_iommu_apply_ivrs_quirks (void ) { }#endif +struct dev_table_entry *amd_iommu_get_ivhd_dte_flags (u16 segid,u16 devid);void amd_iommu_domain_set_pgtable (struct protection_domain *domain,u64 *root,int mode);struct dev_table_entry *get_dev_table (struct amd_iommu *iommu); - -#endif - -struct dev_table_entry *amd_iommu_get_ivhd_dte_flags (u16 segid,u16 devid);struct iommu_dev_data *search_dev_data (struct amd_iommu *iommu,u16 devid); + +#endif /* AMD_IOMMU_H */
Signature · 1 line
2.31.1
Re: [PATCH 5/7] iommu/amd: Fix header file
Quoted 9 lines · Vasant Hegde
Move function declaration inside
AMD_IOMMU_Hdefination.Fixes fd5dff9de4be ("iommu/amd: Modify set_dte_entry() to use 256-bit DTE helpers")Fixes 457da5764668 ("iommu/amd: Lock DTE before updating the entry with WRITE_ONCE()")Cc Suravee Suthikulpanit <[email protected]>Signed-off-by Vasant Hegde <[email protected]>--- drivers/iommu/amd/amd_iommu.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Oh weird that happened
Jason
Vasant Hegde
maintainerPATCH 6/7 iommu/amd: Remove unused forward declaration
In reply to Vasant HegdeRemove unused forward declaration.
--- drivers/iommu/amd/init.c | 1 - 1 file changed, 1 deletion(-)
drivers/iommu/amd/init.c +0 -1
@@ -219,7 +219,6 @@ static bool __initdata cmdline_maps;static enum iommu_init_state init_state =IOMMU_START_STATE ;static int amd_iommu_enable_interrupts (void ); -static int __init iommu_go_to_state (enum iommu_init_state state);static void init_device_table_dma (struct amd_iommu_pci_seg *pci_seg);static bool amd_iommu_pre_enabled = true;
Signature · 1 line
2.31.1
Re: [PATCH 6/7] iommu/amd: Remove unused forward declaration
Quoted 6 lines · Vasant Hegde
Remove unused forward declaration.
Signed-off-by Vasant Hegde <[email protected]>--- drivers/iommu/amd/init.c | 1 - 1 file changed, 1 deletion(-)
Jason
Vasant Hegde
maintainerPATCH 7/7 iommu/amd: Make protection_domain as static
In reply to Vasant HegdeAnd update amd_iommu_domain_alloc_sva() error path to call amd_iommu_domain_free() directly.
--- drivers/iommu/amd/amd_iommu.h | 1 - drivers/iommu/amd/iommu.c | 2 +- drivers/iommu/amd/pasid.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-)
drivers/iommu/amd/amd_iommu.h +0 -1
@@ -47,7 +47,6 @@ extern unsigned long amd_iommu_pgsize_bitmap;/* Protection domain ops */ void amd_iommu_init_identity_domain (void );struct protection_domain *protection_domain_alloc (void ); -void protection_domain_free (struct protection_domain *domain);struct iommu_domain *amd_iommu_domain_alloc_sva (struct device *dev,struct mm_struct *mm);void amd_iommu_domain_free (struct iommu_domain *dom);
drivers/iommu/amd/iommu.c +1 -1
@@ -2434,7 +2434,7 @@ static struct iommu_group *amd_iommu_device_group(struct device *dev)* *****************************************************************************/ -void protection_domain_free (struct protection_domain *domain) +static void protection_domain_free (struct protection_domain *domain) {WARN_ON (!list_empty (&domain->dev_list));if (domain->domain.type & __IOMMU_DOMAIN_PAGING)
drivers/iommu/amd/pasid.c +1 -1
@@ -195,7 +195,7 @@ struct iommu_domain *amd_iommu_domain_alloc_sva(struct device *dev, ret =mmu_notifier_register (&pdom->mn, mm);if (ret) { -protection_domain_free (pdom); +amd_iommu_domain_free (&pdom->domain);return ERR_PTR (ret); }
Signature · 1 line
2.31.1
Re: [PATCH 7/7] iommu/amd: Make protection_domain as static
Quoted 9 lines · Vasant Hegde
And update
amd_iommu_domain_alloc_sva()error path to callamd_iommu_domain_free()directly.Signed-off-by Vasant Hegde <[email protected]>--- drivers/iommu/amd/amd_iommu.h | 1 - drivers/iommu/amd/iommu.c | 2 +- drivers/iommu/amd/pasid.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-)
Why do we even have protection_domain_free() just fold it into amd_iommu_domain_free()?
Jason
Vasant Hegde
maintainerRe: [PATCH 7/7] iommu/amd: Make protection_domain as static
Jason,
Quoted 11 lines · Jason Gunthorpe
Quoted 9 lines · Vasant Hegde
And update
amd_iommu_domain_alloc_sva()error path to callamd_iommu_domain_free()directly.Signed-off-by Vasant Hegde <[email protected]>--- drivers/iommu/amd/amd_iommu.h | 1 - drivers/iommu/amd/iommu.c | 2 +- drivers/iommu/amd/pasid.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-)
Quoted 2 lines
Why do we even have
protection_domain_free()just fold it intoamd_iommu_domain_free()?
Yeah. We can do that. Will update.
Quoted 2 lines
Reviewed-by Jason Gunthorpe <[email protected]>
Thanks
-Vasant