From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sheng Yang Subject: Re: [PATCH 03/10] Figure out device capability Date: Wed, 4 Mar 2009 11:04:13 +0800 Message-ID: <200903041104.13499.sheng@linux.intel.com> References: <1235982573-6932-1-git-send-email-sheng@linux.intel.com> <1235982573-6932-4-git-send-email-sheng@linux.intel.com> <20090303125016.GB15492@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Anthony Liguori , kvm@vger.kernel.org, Allen Kay To: Marcelo Tosatti Return-path: Received: from mga06.intel.com ([134.134.136.21]:40968 "EHLO orsmga101.jf.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750796AbZCDDEU (ORCPT ); Tue, 3 Mar 2009 22:04:20 -0500 In-Reply-To: <20090303125016.GB15492@amt.cnet> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Tuesday 03 March 2009 20:50:16 Marcelo Tosatti wrote: > On Mon, Mar 02, 2009 at 04:29:26PM +0800, Sheng Yang wrote: > > Try to figure out device capability in update_dev_cap(). Now we are only > > care about MSI capability. > > > > The function pci_find_cap_offset original function wrote by Allen for > > Xen. Notice the function need root privilege to work. This depends on > > libpci to work. > > > > Signed-off-by: Allen Kay > > Signed-off-by: Sheng Yang > > --- > > qemu/hw/device-assignment.c | 29 +++++++++++++++++++++++++++++ > > qemu/hw/device-assignment.h | 1 + > > 2 files changed, 30 insertions(+), 0 deletions(-) > > > > diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c > > index c9a3b8e..fc05ac7 100644 > > --- a/qemu/hw/device-assignment.c > > +++ b/qemu/hw/device-assignment.c > > @@ -219,6 +219,35 @@ static void assigned_dev_ioport_map(PCIDevice > > *pci_dev, int region_num, (r_dev->v_addrs + region_num)); > > } > > > > +static uint8_t pci_find_cap_offset(struct pci_dev *pci_dev, uint8_t cap) > > +{ > > + int id; > > + int max_cap = 48; > > + int pos = PCI_CAPABILITY_LIST; > > Don't you need to handle cardbus capability list offset? I think cardbus and PCI bridge are out of our scope for now... Maybe we should prohibit from assigning them. -- regards Yang, Sheng