From: Alex Williamson <alex.williamson@redhat.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>
Cc: chen.fan.fnst@cn.fujitsu.com, izumi.taku@jp.fujitsu.com,
qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 07/10] vfio: add check aer functionality for hotplug device
Date: Mon, 21 Mar 2016 15:40:12 -0600 [thread overview]
Message-ID: <20160321154012.63648cbc@t450s.home> (raw)
In-Reply-To: <1458554926-7844-8-git-send-email-caoj.fnst@cn.fujitsu.com>
On Mon, 21 Mar 2016 18:08:43 +0800
Cao jin <caoj.fnst@cn.fujitsu.com> wrote:
> From: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
>
> because we make the vfio functions are combined
> in the same way as on the host for aer, so we can
> do the aer check when the function 0 was hotplugged.
Suggestion:
PCI hotplug requires that function 0 is added last to close the
slot. Since we require that the VM bus contains the same set of
devices as the host bus to support AER, we can perform an AER
validation test whenever a function 0 in the VM is hot-added.
>
> Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
> ---
> hw/vfio/pci.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
>
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index dce3b6d..9902c87 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2030,6 +2030,35 @@ out:
> return;
> }
>
> +static void vfio_bus_check_aer_functions(PCIDevice *pdev, Error **errp)
> +{
> + VFIOPCIDevice *vdev;
> + PCIDevice *dev;
> + Error *local_err = NULL;
> + int devfn;
> +
> + for (devfn = 0; devfn < 8; devfn++) {
ARI question again. Perhaps always use 0-255?
> + dev = pci_find_device(pdev->bus, pci_bus_num(pdev->bus),
> + PCI_DEVFN(PCI_SLOT(pdev->devfn), devfn));
> + if (!dev) {
> + continue;
> + }
> + if (!object_dynamic_cast(OBJECT(dev), "vfio-pci")) {
> + continue;
> + }
> + vdev = DO_UPCAST(VFIOPCIDevice, pdev, dev);
> + if (vdev->features & VFIO_FEATURE_ENABLE_AER) {
> + vfio_check_hot_bus_reset(vdev, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return;
> + }
> + }
> + }
> +
> + return;
> +}
> +
> static void vfio_aer_check_host_bus_reset(Error **errp)
> {
> VFIOGroup *group;
> @@ -2982,6 +3011,22 @@ static int vfio_initfn(PCIDevice *pdev)
> }
> }
>
> + /*
> + * If this function is func 0, indicate the closure of the slot.
> + * we get the chance to check aer-enabled devices whether support
> + * hot bus reset.
> + */
> + if (DEVICE(pdev)->hotplugged &&
> + pdev == pci_get_function_0(pdev)) {
> + Error *local_err = NULL;
> +
> + vfio_bus_check_aer_functions(pdev, &local_err);
> + if (local_err) {
> + error_report_err(local_err);
> + goto out_teardown;
> + }
> + }
> +
> vfio_register_err_notifier(vdev);
> vfio_register_req_notifier(vdev);
> vfio_setup_resetfn_quirk(vdev);
next prev parent reply other threads:[~2016-03-21 21:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 10:08 [Qemu-devel] [PATCH v4 00/10] vfio-pci: pass the aer error to guest, part2 Cao jin
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 01/10] vfio: extract vfio_get_hot_reset_info as a single function Cao jin
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 02/10] vfio: squeeze out vfio_pci_do_hot_reset for support bus reset Cao jin
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 03/10] vfio: add pcie extended capability support Cao jin
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 04/10] vfio: add aer support for vfio device Cao jin
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 05/10] vfio: extending function vfio_pci_host_match to support mask func number Cao jin
2016-03-21 21:39 ` Alex Williamson
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 06/10] vfio: add check host bus reset is support or not Cao jin
2016-03-21 21:40 ` Alex Williamson
2016-03-22 10:02 ` Chen Fan
2016-03-22 16:04 ` Alex Williamson
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 07/10] vfio: add check aer functionality for hotplug device Cao jin
2016-03-21 21:40 ` Alex Williamson [this message]
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 08/10] vfio: vote the function 0 to do host bus reset when aer occurred Cao jin
2016-03-21 21:40 ` Alex Williamson
2016-03-22 10:14 ` Chen Fan
2016-03-22 16:07 ` Alex Williamson
2016-03-23 6:25 ` Chen Fan
2016-03-23 6:25 ` Chen Fan
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 09/10] vfio-pci: pass the aer error to guest Cao jin
2016-03-21 10:08 ` [Qemu-devel] [PATCH v4 10/10] vfio: add 'aer' property to expose aercap Cao jin
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=20160321154012.63648cbc@t450s.home \
--to=alex.williamson@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=chen.fan.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).