From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wright Subject: Re: [PATCH v3] pci: correct pci config size default for cap version 2 endpoints Date: Fri, 22 Jul 2011 14:24:22 -0700 Message-ID: <20110722212422.GH9766@sequoia.sous-sol.org> References: <20110722155338.43049.12587.stgit@dddsys0.bos.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, alex.williamson@redhat.com, mst@redhat.com To: Donald Dutile Return-path: Received: from sous-sol.org ([216.99.217.87]:58884 "EHLO sequoia.sous-sol.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932244Ab1GVVY1 (ORCPT ); Fri, 22 Jul 2011 17:24:27 -0400 Content-Disposition: inline In-Reply-To: <20110722155338.43049.12587.stgit@dddsys0.bos.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: * Donald Dutile (ddutile@redhat.com) wrote: > diff --git a/hw/device-assignment.c b/hw/device-assignment.c > index 36ad6b0..34db52e 100644 > --- a/hw/device-assignment.c > +++ b/hw/device-assignment.c > @@ -1419,16 +1419,18 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) > } > > if ((pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_EXP, 0))) { > - uint8_t version; > + uint8_t version, size; > uint16_t type, devctl, lnkcap, lnksta; > uint32_t devcap; > - int size = 0x3c; /* version 2 size */ > > version = pci_get_byte(pci_dev->config + pos + PCI_EXP_FLAGS); > version &= PCI_EXP_FLAGS_VERS; > if (version == 1) { > size = 0x14; > - } else if (version > 2) { > + } else if (version == 2) { > + /* don't include slot cap/stat/ctrl 2 regs; only support endpoints */ > + size = 0x34; That doesn't look correct to me. The size is fixed, just that some registers are Reserved Zero when they do not apply (e.g. endpoint only).