From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: PCI Pass-through in Xen ARM - Draft 2. Date: Tue, 14 Jul 2015 18:58:29 +0200 Message-ID: <55A53FB5.20906@citrix.com> References: <55903F12.7010908@caviumnetworks.com> <55911E66.2040009@citrix.com> <5598C6CD.2040207@caviumnetworks.com> <559A5BE4.1060707@citrix.com> <559A61FB.9070707@caviumnetworks.com> <559A6A4C.1090401@citrix.com> <559B7B4C.7080003@caviumnetworks.com> <559B8B64.9030800@citrix.com> <559B91DB.8030408@caviumnetworks.com> <1436268295.25646.162.camel@citrix.com> <559E1F0D.4050604@caviumnetworks.com> <559E2BFA.3050903@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Ian Campbell , Manish Jaggi , Prasun Kapoor , "Kumar, Vijaya" , "xen-devel@lists.xen.org" , Stefano Stabellini , "Kulkarni, Ganapatrao" List-Id: xen-devel@lists.xenproject.org Hi Stefano, On 14/07/2015 18:46, Stefano Stabellini wrote: >>> Linux provides a function (pci_for_each_dma_alias) which will return a >>> requester ID for a given PCI device. It appears that the BDF (the 's' of sBDF >>> is only internal to Linux and not part of the hardware) is equal to the >>> requester ID on your platform but we can't assume it for anyone else. >> >> The PCI Express Base Specification states that the requester ID is "The >> combination of a Requester's Bus Number, Device Number, and Function >> Number that uniquely identifies the Requester." >> >> I think it is safe to assume BDF = requester ID on all platforms. > > With the catch that in case of ARI devices > (http://pcisig.com/sites/default/files/specification_documents/ECN-alt-rid-interpretation-070604.pdf), > BDF is actually BF because the device number is always 0 and the > function number is 8 bits. And some other problem such as broken PCI device... Both Xen x86 (domain_context_mapping in drivers/passthrough/vtd/iommu.c) and Linux (pci_dma_for_each_alias) use a code more complex than requesterID = BDF. So I don't think we can use requesterID = BDF in physdev op unless we are *stricly* sure this is valid. Although, based on the x86 code, Xen should be able to translate the BDF into the requester ID... Regards, -- Julien Grall