]>
Commit | Line | Data |
---|---|---|
c8c8255c SL |
1 | From 0e343a022e32ad9c5cf2dba94a8a9d59cc6e9451 Mon Sep 17 00:00:00 2001 |
2 | From: Kees Cook <keescook@chromium.org> | |
3 | Date: Mon, 10 Dec 2018 18:14:58 +0000 | |
4 | Subject: swiotlb: clean up reporting | |
5 | ||
6 | commit 7d63fb3af87aa67aa7d24466e792f9d7c57d8e79 upstream. | |
7 | ||
8 | This removes needless use of '%p', and refactors the printk calls to | |
9 | use pr_*() helpers instead. | |
10 | ||
11 | Signed-off-by: Kees Cook <keescook@chromium.org> | |
12 | Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | |
13 | Signed-off-by: Christoph Hellwig <hch@lst.de> | |
14 | [bwh: Backported to 4.14: | |
15 | - Adjust filename | |
16 | - Remove "swiotlb: " prefix from an additional log message] | |
17 | Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> | |
18 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
19 | --- | |
20 | lib/swiotlb.c | 20 +++++++++----------- | |
21 | 1 file changed, 9 insertions(+), 11 deletions(-) | |
22 | ||
23 | diff --git a/lib/swiotlb.c b/lib/swiotlb.c | |
24 | index 20df2fd9b150..b4c768de3344 100644 | |
25 | --- a/lib/swiotlb.c | |
26 | +++ b/lib/swiotlb.c | |
27 | @@ -17,6 +17,8 @@ | |
28 | * 08/12/11 beckyb Add highmem support | |
29 | */ | |
30 | ||
31 | +#define pr_fmt(fmt) "software IO TLB: " fmt | |
32 | + | |
33 | #include <linux/cache.h> | |
34 | #include <linux/dma-mapping.h> | |
35 | #include <linux/mm.h> | |
36 | @@ -177,20 +179,16 @@ static bool no_iotlb_memory; | |
37 | void swiotlb_print_info(void) | |
38 | { | |
39 | unsigned long bytes = io_tlb_nslabs << IO_TLB_SHIFT; | |
40 | - unsigned char *vstart, *vend; | |
41 | ||
42 | if (no_iotlb_memory) { | |
43 | - pr_warn("software IO TLB: No low mem\n"); | |
44 | + pr_warn("No low mem\n"); | |
45 | return; | |
46 | } | |
47 | ||
48 | - vstart = phys_to_virt(io_tlb_start); | |
49 | - vend = phys_to_virt(io_tlb_end); | |
50 | - | |
51 | - printk(KERN_INFO "software IO TLB [mem %#010llx-%#010llx] (%luMB) mapped at [%p-%p]\n", | |
52 | + pr_info("mapped [mem %#010llx-%#010llx] (%luMB)\n", | |
53 | (unsigned long long)io_tlb_start, | |
54 | (unsigned long long)io_tlb_end, | |
55 | - bytes >> 20, vstart, vend - 1); | |
56 | + bytes >> 20); | |
57 | } | |
58 | ||
59 | /* | |
60 | @@ -290,7 +288,7 @@ swiotlb_init(int verbose) | |
61 | if (io_tlb_start) | |
62 | memblock_free_early(io_tlb_start, | |
63 | PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT)); | |
64 | - pr_warn("Cannot allocate SWIOTLB buffer"); | |
65 | + pr_warn("Cannot allocate buffer"); | |
66 | no_iotlb_memory = true; | |
67 | } | |
68 | ||
69 | @@ -332,8 +330,8 @@ swiotlb_late_init_with_default_size(size_t default_size) | |
70 | return -ENOMEM; | |
71 | } | |
72 | if (order != get_order(bytes)) { | |
73 | - printk(KERN_WARNING "Warning: only able to allocate %ld MB " | |
74 | - "for software IO TLB\n", (PAGE_SIZE << order) >> 20); | |
75 | + pr_warn("only able to allocate %ld MB\n", | |
76 | + (PAGE_SIZE << order) >> 20); | |
77 | io_tlb_nslabs = SLABS_PER_PAGE << order; | |
78 | } | |
79 | rc = swiotlb_late_init_with_tbl(vstart, io_tlb_nslabs); | |
80 | @@ -770,7 +768,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size, | |
81 | ||
82 | err_warn: | |
83 | if (warn && printk_ratelimit()) { | |
84 | - pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n", | |
85 | + pr_warn("coherent allocation failed for device %s size=%zu\n", | |
86 | dev_name(hwdev), size); | |
87 | dump_stack(); | |
88 | } | |
89 | -- | |
90 | 2.19.1 | |
91 |