From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 04/10] Support for device capability Date: Tue, 3 Mar 2009 09:42:07 -0300 Message-ID: <20090303124207.GA15492@amt.cnet> References: <1235982573-6932-1-git-send-email-sheng@linux.intel.com> <1235982573-6932-5-git-send-email-sheng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , Anthony Liguori , kvm@vger.kernel.org To: Sheng Yang Return-path: Received: from mx2.redhat.com ([66.187.237.31]:58495 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752260AbZCCMnE (ORCPT ); Tue, 3 Mar 2009 07:43:04 -0500 Content-Disposition: inline In-Reply-To: <1235982573-6932-5-git-send-email-sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi Sheng, On Mon, Mar 02, 2009 at 04:29:27PM +0800, Sheng Yang wrote: > This framework can be easily extended to support device capability, like > MSI/MSI-x. > > Signed-off-by: Sheng Yang > --- > qemu/hw/pci.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > qemu/hw/pci.h | 30 ++++++++++++++++++++ > 2 files changed, 115 insertions(+), 0 deletions(-) > > @@ -205,6 +215,15 @@ struct PCIDevice { > > /* Current IRQ levels. Used internally by the generic PCI code. */ > int irq_state[4]; > + > + /* Device capability configuration space */ > + struct { > + int supported; > + uint8_t config[PCI_CAPABILITY_CONFIG_MAX_LENGTH]; > + unsigned int start, length; > + PCICapConfigReadFunc *config_read; > + PCICapConfigWriteFunc *config_write; > + } cap; > }; Why do you have a copy of the capabilities config space? Why not just access PCIDevice->config directly?