All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ajay Garg <ajaygargnsit@gmail.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Keith Busch <kbusch@kernel.org>, linux-pci@vger.kernel.org
Subject: Re: None of the virtual/physical/bus address matches the (base) BAR-0 register
Date: Tue, 5 Oct 2021 13:02:23 +0530	[thread overview]
Message-ID: <CAHP4M8UC-rrW5iff-6iYYMC=k85D-M1WYW44aXXECSFaJ=22kA@mail.gmail.com> (raw)
In-Reply-To: <20211003170510.GA982214@bhelgaas>

Hi Bjorn.

I tried enabling and dumping the kernel-page-tables (via
/sys/kernel/debug/kernel_page_tables), but there we only have the
kernel-virtual-addresses :-\

So, I tried navigating the code (beginning from
arch/x86/mm/debug_pagetables.c), and stumbled upon
slow_virt_to_phys(), and hit the jackpot !
Even the code there looks as simple as the procedure - we fetch the
pte for the vpn, get the mapped pfn, and return the physical-address
after adding offset.

#####################################################################
So, now, the following :

    {
        phys_addr_t mmu_mapped_address;

        printk("original (kernel-virtual) address \t= [%lx]\n",
bar0_ptr);

        mmu_mapped_address = slow_virt_to_phys(bar0_ptr);
        printk("mapped address (via MMU) \t\t= [%lx]\n", mmu_mapped_address);
    }
#####################################################################



gives :

#####################################################################
original (kernel-virtual) address     = [ffffa11040217000]
mapped address (via MMU)         = [e2c20000]
#####################################################################



Thanks a ton Bjorn, this could not have been possible without you !


Thanks and Regards,
Ajay

      reply	other threads:[~2021-10-05  7:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 14:51 None of the virtual/physical/bus address matches the (base) BAR-0 register Ajay Garg
2021-10-01 15:13 ` 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 [this message]

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='CAHP4M8UC-rrW5iff-6iYYMC=k85D-M1WYW44aXXECSFaJ=22kA@mail.gmail.com' \
    --to=ajaygargnsit@gmail.com \
    --cc=helgaas@kernel.org \
    --cc=kbusch@kernel.org \
    --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.