Skip to content

Commit

Permalink
powerpc/ptdump: Fix display a BAT's size unit
Browse files Browse the repository at this point in the history
We have wrong units on BAT's sizes (G instead of M, M instead of ...)

	---[ Instruction Block Address Translation ]---
	0: 0xc0000000-0xc03fffff 0x00000000         4G Kernel   x     m
	1: 0xc0400000-0xc05fffff 0x00400000         2G Kernel   x     m
	2: 0xc0600000-0xc06fffff 0x00600000         1G Kernel   x     m
	3: 0xc0700000-0xc077ffff 0x00700000       512M Kernel   x     m
	4: 0xc0780000-0xc079ffff 0x00780000       128M Kernel   x     m
	5: 0xc07a0000-0xc07bffff 0x007a0000       128M Kernel   x     m
	6:         -
	7:         -

This is because pt_dump_size() expects a size in Kbytes but
bat_show_603() gives the size in bytes.

To avoid risk of confusion, change pt_dump_size() to take bytes.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/f16c30f5c9185a63335322cf1a8b22f189d335ef.1637922595.git.christophe.leroy@csgroup.eu
  • Loading branch information
Christophe Leroy authored and Michael Ellerman committed Nov 29, 2021
1 parent 7dfbfb8 commit cdc81ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/mm/ptdump/ptdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static struct ptdump_range ptdump_range[] __ro_after_init = {

void pt_dump_size(struct seq_file *m, unsigned long size)
{
static const char units[] = "KMGTPE";
static const char units[] = " KMGTPE";
const char *unit = units;

/* Work out what appropriate unit to use */
Expand Down Expand Up @@ -176,7 +176,7 @@ static void dump_addr(struct pg_state *st, unsigned long addr)

pt_dump_seq_printf(st->seq, REG "-" REG " ", st->start_address, addr - 1);
pt_dump_seq_printf(st->seq, " " REG " ", st->start_pa);
pt_dump_size(st->seq, (addr - st->start_address) >> 10);
pt_dump_size(st->seq, addr - st->start_address);
}

static void note_prot_wx(struct pg_state *st, unsigned long addr)
Expand Down

0 comments on commit cdc81ae

Please sign in to comment.