qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, izumi.taku@jp.fujitsu.com, mst@redhat.com,
	Dou Liyang <douly.fnst@cn.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/3] pcie aer: verify if AER functionality is available
Date: Fri, 24 Mar 2017 16:12:30 -0600	[thread overview]
Message-ID: <20170324161230.5642283f@t450s.home> (raw)
In-Reply-To: <1490260163-6157-2-git-send-email-caoj.fnst@cn.fujitsu.com>

On Thu, 23 Mar 2017 17:09:21 +0800
Cao jin <caoj.fnst@cn.fujitsu.com> wrote:

> For devices which support AER function, verify it can work or not in the
> system:
> 1. AER capable device is a PCIe device, it can't be plugged into PCI bus
> 2. If root port doesn't support AER, then there is no need to expose the
>    AER capability
> 
> Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  hw/pci/pcie_aer.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c
> index daf1f65..a2e9818 100644
> --- a/hw/pci/pcie_aer.c
> +++ b/hw/pci/pcie_aer.c
> @@ -100,6 +100,34 @@ static void aer_log_clear_all_err(PCIEAERLog *aer_log)
>  int pcie_aer_init(PCIDevice *dev, uint8_t cap_ver, uint16_t offset,
>                    uint16_t size, Error **errp)
>  {
> +    PCIDevice *parent_dev;
> +    uint8_t type;
> +    uint8_t parent_type;
> +
> +    /* Topology test: see if there is need to expose AER cap */
> +    type = pcie_cap_get_type(dev);
> +    parent_dev = pci_bridge_get_device(dev->bus);
> +    while (parent_dev) {
> +        parent_type = pcie_cap_get_type(parent_dev);
> +
> +        if (type == PCI_EXP_TYPE_ENDPOINT &&
> +                (parent_type != PCI_EXP_TYPE_ROOT_PORT &&
> +                 parent_type != PCI_EXP_TYPE_DOWNSTREAM)) {
> +            error_setg(errp, "Parent device is not a PCIe component");
> +            return -ENOTSUP;
> +        }
> +        
> +        if (parent_type == PCI_EXP_TYPE_ROOT_PORT) {
> +            if (!parent_dev->exp.aer_cap)
> +            {

Curly brace at the end of the previous line.

> +                error_setg(errp, "Root port does not support AER");
> +                return -ENOTSUP;
> +            }
> +        }
> +
> +        parent_dev = pci_bridge_get_device(parent_dev->bus);
> +    }
> +
>      pcie_add_capability(dev, PCI_EXT_CAP_ID_ERR, cap_ver,
>                          offset, size);
>      dev->exp.aer_cap = offset;

This patch makes existing configurations including PCIe root ports,
upstream ports, downstream ports, and e1000e fail if they do not meet
this new configuration requirement.

  reply	other threads:[~2017-03-24 22:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23  9:09 [Qemu-devel] [PATCH v3 0/3] vfio-pci: support recovery of AER non fatal error Cao jin
2017-03-23  9:09 ` [Qemu-devel] [PATCH v3 1/3] pcie aer: verify if AER functionality is available Cao jin
2017-03-24 22:12   ` Alex Williamson [this message]
2017-03-28 13:47     ` Cao jin
2017-03-28 16:12       ` Alex Williamson
2017-03-28 16:16   ` Michael S. Tsirkin
2017-03-23  9:09 ` [Qemu-devel] [PATCH v3 2/3] vfio pci: new function to init AER capability Cao jin
2017-03-24 22:12   ` Alex Williamson
2017-03-28 13:47     ` Cao jin
2017-03-23  9:09 ` [Qemu-devel] [PATCH v3 3/3] vfio-pci: process non fatal error of AER Cao jin
2017-03-24 22:12   ` Alex Williamson
2017-03-28 13:49     ` Cao jin
2017-03-28 16:12       ` Alex Williamson
2017-03-28 23:59         ` Michael S. Tsirkin
2017-03-29  2:55           ` Alex Williamson
2017-04-25 20:32             ` Michael S. Tsirkin
2017-04-26  0:06               ` Alex Williamson
2017-03-24 22:12 ` [Qemu-devel] [PATCH v3 0/3] vfio-pci: support recovery of AER non fatal error Alex Williamson
2017-03-28 13:47   ` Cao jin
2017-03-28 16:12     ` Alex Williamson

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=20170324161230.5642283f@t450s.home \
    --to=alex.williamson@redhat.com \
    --cc=caoj.fnst@cn.fujitsu.com \
    --cc=douly.fnst@cn.fujitsu.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).