All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ajay Garg <ajaygargnsit@gmail.com>
To: linux-pci@vger.kernel.org
Subject: None of the virtual/physical/bus address matches the (base) BAR-0 register
Date: Fri, 1 Oct 2021 20:21:06 +0530	[thread overview]
Message-ID: <CAHP4M8UqzA4ET2bDVuucQYMJk9Lk4WqRr-9xX8=6YWXFOBBNzw@mail.gmail.com> (raw)

Hi All.

I have a SD/MMC reader over PCI, which displays the following (amongst
others) when we do "lspci -vv" :

#########################################################
Region 0: Memory at e2c20000 (32-bit, non-prefetchable) [size=512]
#########################################################

Above shows that e2c20000 is the physical (base-)address of BAR0.



Now, in the device driver, I do the following :

########################################################
.....
struct pci_dev *ptr;
void __iomem *bar0_ptr;
......

......
pci_request_region(ptr, 0, "ajay_sd_mmc_BAR0_region");
bar0_ptr = pci_iomap(ptr, 0, pci_resource_len(ptr, 0));

printk("Base virtual-address = [%p]\n", bar0_ptr);
printk("Base physical-address = [%p]\n", virt_to_phys(bar0_ptr));
printk("Base bus-address = [%p]\n", virt_to_bus(bar0_ptr));
....
########################################################


I have removed error-checking, but I confirm that pci_request_region()
and pci_iomap calls are successful.

Now, in the 3 printk's, none of the value is printed as e2c20000.
I was expecting that the 2nd result, of virt_to_phys() translation,
would be equal to the base-address of BAR0 register, as reported by
lspci.


What am I missing?
Will be grateful for pointers.


Thanks and Regards,
Ajay

             reply	other threads:[~2021-10-01 14:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 14:51 Ajay Garg [this message]
2021-10-01 15:13 ` None of the virtual/physical/bus address matches the (base) BAR-0 register Keith Busch
2021-10-02  4:06   ` Ajay Garg
2021-10-02  7:49     ` Ajay Garg
2021-10-02 15:55     ` Bjorn Helgaas
2021-10-02 17:12       ` Ajay Garg
2021-10-02 19:33         ` Bjorn Helgaas
2021-10-03  2:05           ` Ajay Garg
2021-10-03 17:05             ` Bjorn Helgaas
2021-10-05  7:32               ` Ajay Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHP4M8UqzA4ET2bDVuucQYMJk9Lk4WqRr-9xX8=6YWXFOBBNzw@mail.gmail.com' \
    --to=ajaygargnsit@gmail.com \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.