Skip to contentSkip to conversation

swiotlb: Use %pa to print phys_addr_t variables

PATCH In review Andy Shevchenko 3 participants 6 messages Sep 2, 2020 – Sep 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 swiotlb: Use %pa to print phys_addr_t variables

There is an extension to a %p to print phys_addr_t type of variables. Use it here.

---
v2: dropped bytes replacement (Fabio)

 kernel/dma/swiotlb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/dma/swiotlb.c +1 -3
index c19379fabd20..6499bda8f0b8 100644
@@ -172,9 +172,7 @@ void swiotlb_print_info(void)
 		return;
 	}
 
-	pr_info("mapped [mem %#010llx-%#010llx] (%luMB)\n",
-	       (unsigned long long)io_tlb_start,
-	       (unsigned long long)io_tlb_end,
+	pr_info("mapped [mem %pa-%pa] (%luMB)\n", &io_tlb_start, &io_tlb_end,
 	       bytes >> 20);
 }
 
Signature · 1 line
2.28.0
#1 lore raw

PATCH v2 2/3 swiotlb: Declare swiotlb_late_init_with_default_size() in header

Compiler is not happy about one function prototype:

CC kernel/dma/swiotlb.o
kernel/dma/swiotlb.c:275:1: warning: no previous prototype for ‘swiotlb_late_init_with_default_size’ [-Wmissing-prototypes] 275 | swiotlb_late_init_with_default_size(size_t default_size)

      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since it's used outside of the module, move its declaration to the header from the user.

---
v2: no change

 arch/x86/pci/sta2x11-fixup.c | 1 -
 include/linux/swiotlb.h      | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
arch/x86/pci/sta2x11-fixup.c +0 -1
index c313d784efab..11c0e80b9ed4 100644
@@ -15,7 +15,6 @@
 #include <asm/iommu.h>
 
 #define STA2X11_SWIOTLB_SIZE (4*1024*1024)
-extern int swiotlb_late_init_with_default_size(size_t default_size);
 
 /*
  * We build a list of bus numbers that are under the ConneXt. The
include/linux/swiotlb.h +1 -0
index 046bb94bd4d6..513913ff7486 100644
@@ -34,6 +34,7 @@ int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
 extern unsigned long swiotlb_nr_tbl(void);
 unsigned long swiotlb_size_or_default(void);
 extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
+extern int swiotlb_late_init_with_default_size(size_t default_size);
 extern void __init swiotlb_update_mem_attributes(void);
 
 /*
Signature · 1 line
2.28.0
#2 lore raw

PATCH v2 3/3 swiotlb: Mark max_segment with static keyword

In reply to Andy Shevchenko

Sparse is not happy about max_segment declaration:

CHECK kernel/dma/swiotlb.c
kernel/dma/swiotlb.c:96:14: warning: symbol 'max_segment' was not declared. Should it be static?

Mark it static as suggested.

---
v2: no change

 kernel/dma/swiotlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/swiotlb.c +1 -1
index 6499bda8f0b8..465a567678d9 100644
@@ -93,7 +93,7 @@ static unsigned int io_tlb_index;
  * Max segment that we can provide which (if pages are contingous) will
  * not be bounced (unless SWIOTLB_FORCE is set).
  */
-unsigned int max_segment;
+static unsigned int max_segment;
 
 /*
  * We need to save away the original address corresponding to a mapped entry
Signature · 1 line
2.28.0
#4 lore raw
Quoted 11 lines · Fabio Estevam
Quoted 7 lines · Andy Shevchenko

There is an extension to a %p to print phys_addr_t type of variables. Use it here.

---
v2: dropped bytes replacement (Fabio)

Thanks!

Guys, can this series be applied?

Signature · 8 lines
With Best Regards,
Andy Shevchenko


_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#5 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Fabio Estevam
Quoted 7 lines · Andy Shevchenko

There is an extension to a %p to print phys_addr_t type of variables. Use it here.

---
v2: dropped bytes replacement (Fabio)

Quoted 5 lines
Quoted 1 line

Thanks!

Guys, can this series be applied?

Sure.

Quoted 6 lines
Signature · 3 lines
-- 
With Best Regards,
Andy Shevchenko

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu