Commit 9a51933e authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Steven Rostedt

tracing: Expose CPU physical addresses (resource values) for PCI devices

Previously, mmio_print_pcidev() put "user" addresses in the trace buffer.
On most architectures, these are the same as CPU physical addresses, but on
microblaze, mips, powerpc, and sparc, they may be something else, typically
a raw BAR value (a bus address as opposed to a CPU address).

Always expose the CPU physical address to avoid this arch-dependent
behavior.

This change should have no user-visible effect because this file currently
depends on CONFIG_HAVE_MMIOTRACE_SUPPORT, which is only defined for x86,
and pci_resource_to_user() is a no-op on x86.

Link: http://lkml.kernel.org/r/20160511190657.5898.4248.stgit@bhelgaas-glaptop2.roam.corp.google.comSigned-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent e947841c
...@@ -68,19 +68,15 @@ static void mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev) ...@@ -68,19 +68,15 @@ static void mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev)
trace_seq_printf(s, "PCIDEV %02x%02x %04x%04x %x", trace_seq_printf(s, "PCIDEV %02x%02x %04x%04x %x",
dev->bus->number, dev->devfn, dev->bus->number, dev->devfn,
dev->vendor, dev->device, dev->irq); dev->vendor, dev->device, dev->irq);
/*
* XXX: is pci_resource_to_user() appropriate, since we are
* supposed to interpret the __ioremap() phys_addr argument based on
* these printed values?
*/
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); start = dev->resource[i].start;
trace_seq_printf(s, " %llx", trace_seq_printf(s, " %llx",
(unsigned long long)(start | (unsigned long long)(start |
(dev->resource[i].flags & PCI_REGION_FLAG_MASK))); (dev->resource[i].flags & PCI_REGION_FLAG_MASK)));
} }
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
pci_resource_to_user(dev, i, &dev->resource[i], &start, &end); start = dev->resource[i].start;
end = dev->resource[i].end;
trace_seq_printf(s, " %llx", trace_seq_printf(s, " %llx",
dev->resource[i].start < dev->resource[i].end ? dev->resource[i].start < dev->resource[i].end ?
(unsigned long long)(end - start) + 1 : 0); (unsigned long long)(end - start) + 1 : 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment