From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [XEN][RFC PATCH 03/15] hvm-pci: Handle PCI config space in Xen Date: Mon, 26 Mar 2012 13:52:42 +0100 Message-ID: <4F7082BA020000780007AE70__7650.08944222263$1332766434$gmane$org@nat28.tlf.novell.com> References: <869b10d6ef10def49aa8a94524c2949e6a6039f0.1332430810.git.julien.grall@citrix.com> <4F6C426B020000780007A722@nat28.tlf.novell.com> <4F705F12.1050308@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4F705F12.1050308@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: "qemu-devel@nongnu.org" , xen-devel , Julian Pidancet , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org >>> On 26.03.12 at 14:20, Julien Grall wrote: > On 03/23/2012 08:29 AM, Jan Beulich wrote: >> Is there a reasonably low enforced boundary on the number >> of devices? Otherwise, a linear lookup would seem overly >> simple to me. >> > The maximum of bdf is 2^16 => 65536. > Which kind of structure do you advice ? Array ? Hash Table ? Radix tree, especially if you fold in the segment number. >> Further, with how PCI_CMP_BDF() is defined, you're doing the >> wrong thing here anyway - bit 31 is required to be set for the >> port CFC access to be a config space one. Plus there's an AMD >> extension to this interface, so I think other than shifting out >> the low 8 bits and checking that the high bit is set, you shouldn't >> do any other masking here. >> > Actually in config address register the 24-30 bits are reserved. > So, do I need to mask it ? Not necessarily - I'd suggest considering the part of the address (which should generally result in a mismatch on any comparison. This so that this ... > Moreover what is the AMD extension ? ... can work without additional code. For an implementation, please have a look at current Linux'es arch/x86/pci/direct.c - bits 24...27 are used for extended config space register accesses (which will be needed for advanced PCIe or PCI-X functionality, and which may be particularly important as long as we don't emulate MMCFG - at least I don't think we do). Jan