linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: zhengfei <zhef2000@gmail.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [Question] Failed to access the BAR MMIO space of PCI device
Date: Mon, 08 Apr 2013 08:23:20 -0600	[thread overview]
Message-ID: <1365431000.16420.11.camel@bling.home> (raw)
In-Reply-To: <loom.20130407T204756-980@post.gmane.org>

On Sun, 2013-04-07 at 19:19 +0000, zhengfei wrote:
> Hi,
> 
> I'm writing a driver for a SR-IOV device on the PCI bus. My architecture is 
> a 64-bit X86 of intel Sandy bridge.
> 
> In my device driver, I want to configure the device to transfer data to/from 
> X86.I get the the device BAR MMIO base address with the command "lspci -s 
> 04:00.03 -xxx" in the guest os(kvm).
> But after I ioremap() that MMIO base address,I failed to access the BAR MMIO 
> space in the guest os(kvm).
> 
> Is there a function which show mapping between the real PCI address stored in 
> the BAR and the emulated address stored in the BAR?

Is this a userspace driver or a kernel driver?  I can't figure out why
you would use lspci to get a static BAR address, then use ioremap() to
map it.  If it's a kernel driver, the sequence you want is something
like:

pci_enable_device
pci_request_selected_regions
pci_iomap

Thanks,
Alex



  reply	other threads:[~2013-04-08 14:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-07 19:19 [Question] Failed to access the BAR MMIO space of PCI device zhengfei
2013-04-08 14:23 ` Alex Williamson [this message]
2013-04-11 17:15   ` zhengfei
2013-04-11 17:57     ` Alex Williamson
2013-04-12 15:28       ` zhengfei

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=1365431000.16420.11.camel@bling.home \
    --to=alex.williamson@redhat.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=zhef2000@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).