public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Donald Dutile <ddutile@redhat.com>
Cc: kvm@vger.kernel.org, mst@redhat.com
Subject: Re: [PATCH 2/2] pci: correct pci config size default for cap version 2 endpoints
Date: Wed, 20 Jul 2011 20:43:37 -0600	[thread overview]
Message-ID: <1311216217.2653.87.camel@bling.home> (raw)
In-Reply-To: <20110720234940.5002.26262.stgit@dddsys0.bos.redhat.com>

On Wed, 2011-07-20 at 19:51 -0400, Donald Dutile wrote:
> Corrected default size of PCIe Cap Structure from 0x3c to 0x34.
> 0x34 is min size for version 2 Cap Structure for an endpoint.
> 
> 0x3c value failed on a real device that aligned this
> structure at 0xcc, exceeding the size of the config_map[]
> by 8 bytes.
> 
> Signed-off-by: Donald Dutile <ddutile@redhat.com>
> cc: Alex Williamson <alex.williamson@redhat.com>
> cc: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
>  hw/device-assignment.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/device-assignment.c b/hw/device-assignment.c
> index 36ad6b0..1d2ee5d 100644
> --- a/hw/device-assignment.c
> +++ b/hw/device-assignment.c
> @@ -1422,12 +1422,14 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
>          uint8_t version;
>          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) {
> +	    /* don't include slot cap/stat/ctrl 2 regs; only support endpoints */
> +	    size = 0x34;
>          } else if (version > 2) {
>              fprintf(stderr, "Unsupported PCI express capability version %d\n",
>                      version);
> 

Does this compile?  Where is size defined now?  Also whitespace issues
with tabs.

Alex


  reply	other threads:[~2011-07-21  2:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 23:46 [PATCH 0/2] pci: config space bounds check and correction Donald Dutile
2011-07-20 23:49 ` [PATCH 1/2] pci: bounds check offsets into config_map Donald Dutile
2011-07-21  8:11   ` Michael S. Tsirkin
2011-07-21 15:52     ` Don Dutile
2011-07-20 23:51 ` [PATCH 2/2] pci: correct pci config size default for cap version 2 endpoints Donald Dutile
2011-07-21  2:43   ` Alex Williamson [this message]
2011-07-21 15:52     ` Don Dutile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311216217.2653.87.camel@bling.home \
    --to=alex.williamson@redhat.com \
    --cc=ddutile@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox