swiotlb: clean up reporting
commit 7d63fb3af87aa67aa7d24466e792f9d7c57d8e79 upstream. This removes needless use of '%p', and refactors the printk calls to use pr_*() helpers instead. Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> [bwh: Backported to 4.9: - Adjust filename - Remove "swiotlb: " prefix from an additional log message] Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
cb101349f5
commit
adcc5726f1
1 changed files with 9 additions and 11 deletions
|
@ -17,6 +17,8 @@
|
||||||
* 08/12/11 beckyb Add highmem support
|
* 08/12/11 beckyb Add highmem support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define pr_fmt(fmt) "software IO TLB: " fmt
|
||||||
|
|
||||||
#include <linux/cache.h>
|
#include <linux/cache.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
@ -147,20 +149,16 @@ static bool no_iotlb_memory;
|
||||||
void swiotlb_print_info(void)
|
void swiotlb_print_info(void)
|
||||||
{
|
{
|
||||||
unsigned long bytes = io_tlb_nslabs << IO_TLB_SHIFT;
|
unsigned long bytes = io_tlb_nslabs << IO_TLB_SHIFT;
|
||||||
unsigned char *vstart, *vend;
|
|
||||||
|
|
||||||
if (no_iotlb_memory) {
|
if (no_iotlb_memory) {
|
||||||
pr_warn("software IO TLB: No low mem\n");
|
pr_warn("No low mem\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vstart = phys_to_virt(io_tlb_start);
|
pr_info("mapped [mem %#010llx-%#010llx] (%luMB)\n",
|
||||||
vend = phys_to_virt(io_tlb_end);
|
|
||||||
|
|
||||||
printk(KERN_INFO "software IO TLB [mem %#010llx-%#010llx] (%luMB) mapped at [%p-%p]\n",
|
|
||||||
(unsigned long long)io_tlb_start,
|
(unsigned long long)io_tlb_start,
|
||||||
(unsigned long long)io_tlb_end,
|
(unsigned long long)io_tlb_end,
|
||||||
bytes >> 20, vstart, vend - 1);
|
bytes >> 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
|
int __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
|
||||||
|
@ -234,7 +232,7 @@ swiotlb_init(int verbose)
|
||||||
if (io_tlb_start)
|
if (io_tlb_start)
|
||||||
memblock_free_early(io_tlb_start,
|
memblock_free_early(io_tlb_start,
|
||||||
PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
|
PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
|
||||||
pr_warn("Cannot allocate SWIOTLB buffer");
|
pr_warn("Cannot allocate buffer");
|
||||||
no_iotlb_memory = true;
|
no_iotlb_memory = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,8 +274,8 @@ swiotlb_late_init_with_default_size(size_t default_size)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
if (order != get_order(bytes)) {
|
if (order != get_order(bytes)) {
|
||||||
printk(KERN_WARNING "Warning: only able to allocate %ld MB "
|
pr_warn("only able to allocate %ld MB\n",
|
||||||
"for software IO TLB\n", (PAGE_SIZE << order) >> 20);
|
(PAGE_SIZE << order) >> 20);
|
||||||
io_tlb_nslabs = SLABS_PER_PAGE << order;
|
io_tlb_nslabs = SLABS_PER_PAGE << order;
|
||||||
}
|
}
|
||||||
rc = swiotlb_late_init_with_tbl(vstart, io_tlb_nslabs);
|
rc = swiotlb_late_init_with_tbl(vstart, io_tlb_nslabs);
|
||||||
|
@ -691,7 +689,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
err_warn:
|
err_warn:
|
||||||
pr_warn("swiotlb: coherent allocation failed for device %s size=%zu\n",
|
pr_warn("coherent allocation failed for device %s size=%zu\n",
|
||||||
dev_name(hwdev), size);
|
dev_name(hwdev), size);
|
||||||
dump_stack();
|
dump_stack();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue