From: "Cinco, Dante" Subject: pt_msix_init: Error: Can't map physical MSI-X table: Invalid argument Date: Tue, 13 Oct 2009 16:51:15 -0600 Message-ID: <2B044E14371DA244B71F8BF2514563F503ECDB72@cosmail03.lsi.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1914726611==" Return-path: Content-Language: en-US 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 --===============1914726611== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_2B044E14371DA244B71F8BF2514563F503ECDB72cosmail03lsicom_" --_000_2B044E14371DA244B71F8BF2514563F503ECDB72cosmail03lsicom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I get the above error message when I boot the domU (Linux 2.6.30.1). I'm us= ing Xen 3.5-unstable (changeset 20303) with pv_ops kernel 2.6.31.1. I use p= ci-stub to hide the device so that I can assign/pass it through to domU. Th= e error is coming from ioemu-xxx/hw/pt-msi.c. I think it is complaining abo= ut the table_off that is part of the mmap() call: dev->msix->phys_iomem_base =3D mmap(0, total_entries * 16, PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED, fd, dev->msix->table_base + table_off); When I printed table_off, its value is 0x4100 (not page-aligned) which is c= onsistent with the BAR4 offset of the PCI device (see below). I think mmap(= ) requires the last argument to be a multiple of the page size and results = is a map error if it is not. Here's the partial output of "lspci -vv -s 0:0= 7:0.1" from dom0: 07:00.0 Fibre Channel: PMC-Sierra Inc. Device 8032 (rev 05) Subsystem: Atto Technology Device 003c Latency: 0, Cache Line Size: 64 bytes Interrupt: pin A routed to IRQ 11 Capabilities: [60] Message Signalled Interrupts: Mask- 64bit+ Queue= =3D0/1 Enable+ Address: 00000000fee11000 Data: 405e Capabilities: [70] Express (v2) Endpoint, MSI 01 DevCap: MaxPayload 4096 bytes, PhantFunc 0, Latency L0s <4u= s, L1 unlimited ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset- Capabilities: [b0] MSI-X: Enable- Mask- TabSize=3D9 Vector table: BAR=3D4 offset=3D00004100 PBA: BAR=3D4 offset=3D00004000 I'm able to workaround this problem by modifying pt-msi.c: force offset to = zero in mmap() and on the next line, adjust the pointer by table_off: table_off_adjust =3D table_off & 0x0fff; dev->msix->phys_iomem_base =3D mmap(0, total_entries * 16 + table_off_a= djust, PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED, fd, dev->msix->table_base + table_off - table_off= _adjust); dev->msix->phys_iomem_base =3D (void *)((char *)dev->msix->phys_iomem_b= ase + table_off_adjust); Ideally, I should only be applying this to my device but since I'm not pass= ing any other device that use MSI, I don't see any negative effect. In addi= tion, my device only uses MSI and not MSI-X. Obviously, this is a custom hack but I was wondering if there is a cleaner = solution for this. Is a non-page aligned BAR offset unusual? When I boot Li= nux 2.6.30.1 on bare metal (no Xen), I don't see this error. Dante Cinco --_000_2B044E14371DA244B71F8BF2514563F503ECDB72cosmail03lsicom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
I get the above error message when I boot the domU (Linux 2.6.30.1). I= 'm using Xen 3.5-unstable (changeset 20303) with pv_ops kernel 2.6.31.1. I = use pci-stub to hide the device so that I can assign/pass it through to dom= U. The error is coming from ioemu-xxx/hw/pt-msi.c. I think it is complaining about the table_off that is part of the mmap() ca= ll:
 
    dev->msix->phys_iomem_base =3D mmap(0, total_= entries * 16,
           &nbs= p;            &= nbsp; PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED,
           &nbs= p;            &= nbsp; fd, dev->msix->table_base + table_off);
 
When I printed table_off, its value is 0x4100 (not page-aligned) which= is consistent with the BAR4 offset of the PCI device (see below). I think = mmap() requires the last argument to be a multiple of the page size and res= ults is a map error if it is not. Here's the partial output of "lspci -vv -s 0:07:0.1" from dom0:
 
07:00.0 Fibre Channel: PMC-Sierra Inc. Device 8032 (rev 05)
        Subsystem: Atto Technology = Device 003c
        Latency: 0, Cache Line Size= : 64 bytes
        Interrupt: pin A routed to = IRQ 11
        Capabilities: [60] Message = Signalled Interrupts: Mask- 64bit+ Queue=3D0/1 Enable+
           &nbs= p;    Address: 00000000fee11000  Data: 405e
        Capabilities: [70] Express = (v2) Endpoint, MSI 01
           &nbs= p;    DevCap: MaxPayload 4096 bytes, PhantFunc 0, Latency L0= s <4us, L1 unlimited
           &nbs= p;            ExtTag= - AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
        Capabilities: [b0] MSI-X: E= nable- Mask- TabSize=3D9
           &nbs= p;    Vector table: BAR=3D4 offset=3D00004100
           &nbs= p;    PBA: BAR=3D4 offset=3D00004000
 
I'm able to workaround this problem by modifying pt-msi.c: force offse= t to zero in mmap() and on the next line, adjust the pointer by table_off:<= /div>
 
    table_off_adjust =3D table_off & 0x0fff;
    dev->msix->phys_iomem_base =3D mmap(0, total_= entries * 16 + table_off_adjust,
           &nbs= p;            &= nbsp; PROT_WRITE | PROT_READ, MAP_SHARED | MAP_LOCKED,
           &nbs= p;            &= nbsp; fd, dev->msix->table_base + table_off - table_off_adjust);<= /div>
    dev->msix->phys_iomem_base =3D (void *)((char= *)dev->msix->phys_iomem_base + table_off_adjust);
 
Ideally, I should only be applying this to my device but since I'm not= passing any other device that use MSI, I don't see any negative effect. In= addition, my device only uses MSI and not MSI-X.
 
Obviously, this is a custom hack but I was wondering if there is a cle= aner solution for this. Is a non-page aligned BAR offset unusual? When I bo= ot Linux 2.6.30.1 on bare metal (no Xen), I don't see this error.
 
Dante Cinco
 
--_000_2B044E14371DA244B71F8BF2514563F503ECDB72cosmail03lsicom_-- --===============1914726611== 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 --===============1914726611==--