From mboxrd@z Thu Jan 1 00:00:00 1970 From: veerasena reddy Subject: Re: Accessing PCI BAR space directly from XEN hypervisor Date: Tue, 14 Jun 2011 08:55:15 +0530 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0668531920==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0668531920== Content-Type: multipart/alternative; boundary=001485f8974ea87c3704a5a39599 --001485f8974ea87c3704a5a39599 Content-Type: text/plain; charset=ISO-8859-1 Hi, Can someone please throw some light on this Thanks in advance. Regards, VSR. On Mon, Jun 13, 2011 at 2:24 PM, veerasena reddy wrote: > Hi, > > I am doing an experiment to see if I can get more throughput by moving the > Tx ring update and doorbell ring mechanism to hypervisor and provide a > hypercall to HVM Guest. When there is a Tx packet ready, the HVM guest > invokes the hypercall along with the packet address as argument. The > hypercall function will write the packet address to the Tx ring and rings > the doorbell directly without involving dom0. > > AS part of this, i need to access IO Memory BAR region of the PCI network > device from XEN hypervisor (hypercall handler). For this, i tried converting > the BAR Physical address (captured from lspci as shown below) of the PCI > device to MFN, but got all F's (invalid entry). Even pfn_valid(0xf0904000) > failed on this address. Where as I could successfully map a dom0 page > (allocated using vmalloc()) and access in hypervisor using > map_domain_page(mfn). > > Could any one please suggest how to access the BAR regions of a PCI device > from hypervisor? how to do mapping and read/write operations? > > Also, Could you please explain the difference between mapping locally > allocated pages and PCI BAR memory of dom0 in hypervisor? > > Thanks in advance. > > Regards, > VSR. > ========================== > [root@fc13 xen]# lspci -vvs 09:00.0 > 09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B > PCI Express Gigabit Ethernet controller (rev 03) > Subsystem: Lenovo Device 2131 > Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- > Stepping- SERR+ FastB2B- DisINTx+ > Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- Latency: 0, Cache Line Size: 64 bytes > Interrupt: pin A routed to IRQ 1247 > Region 0: I/O ports at 4000 [size=256] > Region 2: Memory at f0904000 (64-bit, prefetchable) [size=4K] > Region 4: Memory at f0900000 (64-bit, prefetchable) [size=16K] > [virtual] Expansion ROM at f0920000 [disabled] [size=128K] > =========================== > --001485f8974ea87c3704a5a39599 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

Can someone please throw some light on this

Thanks in adv= ance.

Regards,
VSR.
On Mon, Jun 13,= 2011 at 2:24 PM, veerasena reddy <veeruyours@gmail.com> wrote:
Hi,

I am d= oing an experiment to see if I can get more throughput by moving the Tx rin= g update and doorbell ring mechanism to hypervisor and provide a hypercall = to HVM Guest. When there is a Tx packet ready, the HVM guest invokes the hy= percall along with the packet address as argument. The hypercall function w= ill write the packet address to the Tx ring and rings the doorbell directly= without involving dom0.

AS part of this, i need to access IO Memory BAR region of the PCI netwo= rk device from XEN hypervisor (hypercall handler). For this, i tried conver= ting the BAR Physical address (captured from lspci as shown below) of the P= CI device to MFN, but got all F's (invalid entry). Even pfn_valid(0xf09= 04000) failed on this address. Where as I could successfully map a dom0 pag= e (allocated using vmalloc()) and access in hypervisor using map_domain_pag= e(mfn).

Could any one please suggest how to access the BAR regions of a PCI dev= ice from hypervisor? how to do mapping and read/write operations?

Al= so, Could you please explain the difference between mapping locally allocat= ed pages and PCI BAR memory of dom0 in hypervisor?

Thanks in advance.

Regards,
VSR.
=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
[root@fc13 xen]# = lspci -vvs 09:00.0
09:00.0 Ethernet controller: Realtek Semiconductor Co= ., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)
=A0=A0=A0 Subsystem: Lenovo Device 2131
=A0=A0=A0 Control: I/O+ Mem+ Bus= Master+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisI= NTx+
=A0=A0=A0 Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=3Dfast &= gt;TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
=A0=A0=A0 Latency: 0, Cache Line Size: 64 bytes
=A0=A0=A0 Interrupt: pin= A routed to IRQ 1247
=A0=A0=A0 Region 0: I/O ports at 4000 [size=3D256]=
=A0=A0=A0 Region 2: Memory at f0904000 (64-bit, prefetchable) [size=3D4= K]
=A0=A0=A0 Region 4: Memory at f0900000 (64-bit, prefetchable) [size= =3D16K]
=A0=A0=A0 [virtual] Expansion ROM at f0920000 [disabled] [size=3D128K]
= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D

--001485f8974ea87c3704a5a39599-- --===============0668531920== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0668531920==--