lspci memory behind bridge reporting
Subsystems (2)
Hello all,
I am currently debugging a PCIE BAR assignment issue and am working on a = patch to save me some time in future with lspci. Would patches like this = be considered? Does anyone have any input on the proposed formats of the = readouts?
1. Currently if a bridge has no memory behind bridge it displays = messages like the following, for reasons of PCI implementation detail.
I/O behind bridge: 0000f000-00000fff
Memory behind bridge: fff00000-000fffff
Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff
I would prefer:
I/O behind bridge: None
Memory behind bridge: None
Prefetchable memory behind bridge: None
2. It would be useful for me to have access to the amount of memory in = these chunks (my mental hex subtraction is pretty terrible). Maybe this = would be displayed something like
I/O behind bridge: 0000c000-0000dfff [8.00K]
Memory behind bridge: f4000000-f65fffff [38.00M] Prefetchable memory behind bridge: 00000000e0000000-00000000f3ffffff = [320.00M]
Thanks for your feedback,
Harry Mallon
[+cc Martin (lspci maintainer)]
Quoted 6 lines · Harry Mallon
Hello all,
I am currently debugging a PCIE BAR assignment issue and am working on a patch to save me some time in future with lspci. Would patches like this be considered? Does anyone have any input on the proposed formats of the readouts?
1. Currently if a bridge has no memory behind bridge it displays messages like the following, for reasons of PCI implementation detail.
Quoted 8 lines
I/O behind bridge: 0000f000-00000fff
Memory behind bridge: fff00000-000fffff
Prefetchable memory behind bridge: 00000000fff00000-00000000000fffffI would prefer:
I/O behind bridge: None
Memory behind bridge: None
Prefetchable memory behind bridge: None
Thanks for the suggestions, Harry. I would like this, too. Maybe this with "-v":
I/O behind bridge: None
and this with "-vv":
I/O behind bridge: None (0000f000-00000fff)
There are many register values that disable the windows, and it's conceivable that somebody would want to match the actual register values with an analyzer trace or a piece of code.
Quoted 5 lines
2. It would be useful for me to have access to the amount of memory in these chunks (my mental hex subtraction is pretty terrible). Maybe this would be displayed something like
I/O behind bridge: 0000c000-0000dfff [8.00K]
Memory behind bridge: f4000000-f65fffff [38.00M]
Prefetchable memory behind bridge: 00000000e0000000-00000000f3ffffff [320.00M]
This makes sense to me, too, though I would use the same size format lspci already uses for endpoint BARs, e.g.,
Memory at f1000000 (64-bit, non-prefetchable) [size=8K]
Of course, BARs are always a nice power-of-two, so there's no need for fractions, while bridge window sizes are much less constrained. I don't know whether it's better to use decimal places as you did, or to use the largest unit size (K, M, G) that expresses the size as a whole number.
Be sure to send any patches to Martin directly; I doubt he monitors linux-pci closely.
Bjorn
I attach a patch with behaviour similar to what you describe. It is based on the current master branch of pciutils (hash 4a190235224ff6dfe44adbb07ac929afea612acd).
Here is a sample taken from my machine with -vvv:
I/O behind bridge: 0000f000-00000fff [size=None]
Memory behind bridge: f4400000-f47fffff [size=4M]
Prefetchable memory behind bridge: 00000000cfc00000-00000000cfcfffff [size=1M]With -vv or -v it shows (as before but with size):
Memory behind bridge: f4400000-f47fffff [size=4M]
Prefetchable memory behind bridge: 00000000cfc00000-00000000cfcfffff [size=1M]I have not altered anything in the tests folder yet as I am not sure about how to run them.
Harry
From a8f0d7b68376d5d04a861893278337f2622d9c3a Mon Sep 17 00:00:00 2001
From: Harry Mallon <[email protected]>
Date: Thu, 22 Dec 2016 12:39:54 +0000
Subject: [PATCH] Give more info on "X behind bridge"
* Show size of buffer
* Show [size=None] if no size
--- lib/types.h | 2 ++ lspci.c | 43 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 6 deletions(-)
lib/types.h +2 -0
@@ -42,10 +42,12 @@ typedef unsigned long long u64;#ifdef PCI_HAVE_64BIT_ADDRESS typedef u64 pciaddr_t ;#define PCIADDR_T_FMT "%08" PCI_U64_FMT "x" +#define PCIADDR_T_FMT_L "%016" PCI_U64_FMT "x"#define PCIADDR_PORT_FMT "%04" PCI_U64_FMT "x"#else typedef u32 pciaddr_t ;#define PCIADDR_T_FMT "%08x" +#define PCIADDR_T_FMT_L PCIADDR_T_FMT#define PCIADDR_PORT_FMT "%04x"#endif
lspci.c +37 -6
83 lines not on this page · raw message
Signature · 1 line
2.11.0
Quoted 58 lines · Bjorn Helgaas
[+cc Martin (lspci maintainer)]
Quoted 6 lines · Harry Mallon
Hello all,
I am currently debugging a PCIE BAR assignment issue and am working on a patch to save me some time in future with lspci. Would patches like this be considered? Does anyone have any input on the proposed formats of the readouts?
1. Currently if a bridge has no memory behind bridge it displays messages like the following, for reasons of PCI implementation detail.
Quoted 8 lines
I/O behind bridge: 0000f000-00000fff
Memory behind bridge: fff00000-000fffff
Prefetchable memory behind bridge: 00000000fff00000-00000000000fffffI would prefer:
I/O behind bridge: None
Memory behind bridge: None
Prefetchable memory behind bridge: NoneThanks for the suggestions, Harry. I would like this, too. Maybe this with "-v":
I/O behind bridge: None
and this with "-vv":
I/O behind bridge: None (0000f000-00000fff)
There are many register values that disable the windows, and it's conceivable that somebody would want to match the actual register values with an analyzer trace or a piece of code.
Quoted 5 lines
2. It would be useful for me to have access to the amount of memory in these chunks (my mental hex subtraction is pretty terrible). Maybe this would be displayed something like
I/O behind bridge: 0000c000-0000dfff [8.00K]
Memory behind bridge: f4000000-f65fffff [38.00M]
Prefetchable memory behind bridge: 00000000e0000000-00000000f3ffffff [320.00M]This makes sense to me, too, though I would use the same size format lspci already uses for endpoint BARs, e.g.,
Memory at
f1000000(64-bit, non-prefetchable) [size=8K]Of course, BARs are always a nice power-of-two, so there's no need for fractions, while bridge window sizes are much less constrained. I don't know whether it's better to use decimal places as you did, or to use the largest unit size (K, M, G) that expresses the size as a whole number.
Be sure to send any patches to Martin directly; I doubt he monitors linux-pci closely.
Bjorn
Hi!
Quoted 3 lines
I attach a patch with behaviour similar to what you describe. It is based on the current master branch of pciutils (hash
4a190235224ff6dfe44adbb07ac929afea612acd).
I like the idea, but not much the ifdeffery in your implementation. I wrote something similar in a little bit more systematic way, please see commit 41d883cb97f94e844e96b4631a99c3da557cf162.
Quoted 1 line
I have not altered anything in the tests folder yet as I am not sure about how to run them.
The tests are not automated yet. Just add a configuration space dump together with the expected output.
Have a nice fortnight
Signature · 3 lines
Martin `MJ' Mares <[email protected]> http://mj.ucw.cz/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth Power corrupts; Powerpoint corrupts absolutely. -- Vint Cerf
Hi Martin,
Happy New Year. Thanks for looking at my patch. The reason I had the, = admittedly horrible, ifdeffery is that I assumed that I should not be = using u64 types without making sure they were available, looking back = now I think I was mistaken.
I will make a configuration space dump/output combination when I can. = The current machine I am working on is very non-standard and seems to be = having some problems assigning PCI bridge memory so I will have to bring = another machine up.
Harry
Quoted 5 lines · Martin Mares
=20
Hi!
=20Quoted 1 line
I attach a patch with behaviour similar to what you describe. It is =
based on
Quoted 8 lines
Quoted 2 lines
the current master branch of pciutils (hash
4a190235224ff6dfe44adbb07ac929afea612acd).=20
I like the idea, but not much the ifdeffery in your implementation. I wrote something similar in a little bit more systematic way, please see commit41d883cb97f94e844e96b4631a99c3da557cf162.
=20Quoted 1 line
I have not altered anything in the tests folder yet as I am not sure =
about how to run them.
Quoted 7 lines
=20
The tests are not automated yet. Just add a configuration space dump together with the expected output.
=20
Have a nice fortnight
--=20
Martin `MJ' Mares <[email protected]> =
Quoted 1 line
Faculty of Math and Physics, Charles University, Prague, Czech Rep., =
Earth
Quoted 1 line
Power corrupts; Powerpoint corrupts absolutely. -- Vint Cerf