swiotlb: Use %pa to print phys_addr_t variables
Subsystems (3)
PATCH 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.
--- kernel/dma/swiotlb.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/dma/swiotlb.c +2 -5
@@ -165,17 +165,14 @@ unsigned long swiotlb_size_or_default(void)void swiotlb_print_info (void ) { -unsigned long bytes = io_tlb_nslabs <<IO_TLB_SHIFT ; +unsigned long mb = (io_tlb_nslabs <<IO_TLB_SHIFT ) >>20 ;if (no_iotlb_memory) {pr_warn ("No low mem\n" );return ; } -pr_info ("mapped [mem %#010llx-%#010llx] (%luMB)\n" , - (unsigned long long )io_tlb_start, - (unsigned long long )io_tlb_end, - bytes >>20 ); +pr_info ("mapped [mem %pa-%pa] (%luMB)\n" , &io_tlb_start, &io_tlb_end, mb); }/*
Signature · 6 lines
2.28.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 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.
--- arch/x86/pci/sta2x11-fixup.c | 3 ++- include/linux/swiotlb.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/pci/sta2x11-fixup.c +2 -1
@@ -12,10 +12,11 @@#include <linux/export.h> #include <linux/list.h> #include <linux/dma-direct.h> +#include <linux/swiotlb.h> +#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
@@ -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 · 6 lines
2.28.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 3/3 swiotlb: Mark max_segment with static keyword
In reply to Andy ShevchenkoSparse 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.
--- kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/swiotlb.c +1 -1
@@ -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 · 6 lines
2.28.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Hi Andy,
kernel/dma/swiotlb.c unsigned long swiotlb_size_or_default(void) · line 168
Quoted 2 lines · Andy Shevchenko
kernel/dma/swiotlb.c +1
-1-unsigned long bytes = io_tlb_nslabs <<IO_TLB_SHIFT ; +unsigned long mb = (io_tlb_nslabs <<IO_TLB_SHIFT ) >>20 ;
Looks like an unrelated change.
Quoted 7 lines · Fabio Estevam
kernel/dma/swiotlb.c unsigned long swiotlb_size_or_default(void) · line 168
Quoted 2 lines · Andy Shevchenko
kernel/dma/swiotlb.c +1
-1-unsigned long bytes = io_tlb_nslabs <<IO_TLB_SHIFT ; +unsigned long mb = (io_tlb_nslabs <<IO_TLB_SHIFT ) >>20 ;Looks like an unrelated change.
To put pr_info() onto one (not so long) line. But of course, can leave it.
Signature · 2 lines
With Best Regards, Andy Shevchenko