From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gordan Bobic Subject: Re: PCI passthrough problems after legacy update of xen 4.1 Date: Tue, 14 May 2013 15:05:34 +0100 Message-ID: <4420c929aaffe7b72ad45ccb5e97ef9b@mail.shatteredsilicon.net> References: <7fe927daf168b95128153bf104715689@mail.shatteredsilicon.net> <5182708302000078000D2A11@nat28.tlf.novell.com> <518287CC02000078000D2AA4@nat28.tlf.novell.com> <5183839502000078000D2F4F@nat28.tlf.novell.com> <5183C254.3010400@citrix.com> <5183E84902000078000D3246@nat28.tlf.novell.com> <5183EDDA02000078000D3286@nat28.tlf.novell.com> <51925FC702000078000D609A@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51925FC702000078000D609A@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Steven Haigh , Ian Campbell , Andrew Cooper , Ian Jackson , Andreas Falck , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Thanks Jan, I'll try this tonight and report back. Many thanks. Gordan On Tue, 14 May 2013 15:01:11 +0100, "Jan Beulich" wrote: >>>> On 05.05.13 at 21:33, Andreas Falck >>>> wrote: >> I tried adding some debugging statements in physdev_map_pirq. I have >> attached the physdev.c with my debug statements, a hypervisor log >> from >> testing, and the output of lspci -vv for my three devices. > > Since I didn't hear anything from either of you anymore, I went > through the (not very familiar to me) tool stack code again, and > found that qemu and xend/libxl fundamentally disagree about the > model to be used. Qemu wants to allocate PIRQs while xend/libxl > want a 1:1 mapping. Allocating after having created a 1:1 mapping > works by returning the 1:1 mapping as allocation result, so as long > as libxl completes its setup before launching qemu, it would be > obvious why things work there. Consequently I assume that xend > launches qemu quite a bit earlier in the process of creating a new > domain, and the result of an attempt to establish a 1:1 mapping > when a different mapping was already established is dependent on > the specific interrupt numbers (i.e. also explains the observations > one of you made). > > Since the tool stack as a whole really ought to use a consistent > model, and since the 1:1 mapping model for non-MSI IRQs seems > quite natural, the below/attached patch takes care of enforcing > a 1:1 mapping in libxc when allocation is being requested by the > caller. Ian, Ian - do you foresee any problem with this? > > Please both of you give this a try and let us know of the results > (patch applies cleanly to all of -unstable, 4.2, and 4.1). > > Jan > > --- a/tools/libxc/xc_physdev.c > +++ b/tools/libxc/xc_physdev.c > @@ -49,7 +49,7 @@ int xc_physdev_map_pirq(xc_interface *xc > map.domid = domid; > map.type = MAP_PIRQ_TYPE_GSI; > map.index = index; > - map.pirq = *pirq; > + map.pirq = *pirq < 0 ? index : *pirq; > > rc = do_physdev_op(xch, PHYSDEVOP_map_pirq, &map, sizeof(map)); > > --- a/tools/python/xen/xend/server/pciif.py > +++ b/tools/python/xen/xend/server/pciif.py > @@ -340,7 +340,7 @@ class PciController(DevController): > raise VmError(('pci: failed to configure I/O memory > on device '+ > '%s - errno=%d')%(dev.name,rc)) > > - if not self.vm.info.is_hvm() and dev.irq: > + if dev.irq > 0: > rc = xc.physdev_map_pirq(domid = fe_domid, > index = dev.irq, > pirq = dev.irq)