[libvirt] [PATCH v2 2/2] util: disallow resetting a pci-bridge device

Martin Kletzander mkletzan at redhat.com
Mon Jan 23 16:35:42 UTC 2017


On Mon, Jan 23, 2017 at 07:07:10PM +0530, Shivaprasad G Bhat wrote:
>It is destructive to attempt reset on a pci-bridge, the host can crash.
>The bridges won't contain any guest data and neither they can be
>passed through using vfio/stub. So, no point in allowing a reset on them.
>

We should note somewhere that it's not something you want to do.  But
forbidding that is fine too.

>Signed-off-by: Shivaprasad G Bhat <sbhat at linux.vnet.ibm.com>
>---
> src/util/virpci.c |   11 +++++++++++
> 1 file changed, 11 insertions(+)
>
>diff --git a/src/util/virpci.c b/src/util/virpci.c
>index 0601f49..ae72587 100644
>--- a/src/util/virpci.c
>+++ b/src/util/virpci.c
>@@ -933,6 +933,17 @@ virPCIDeviceReset(virPCIDevicePtr dev,
>     char *drvName = NULL;
>     int ret = -1;
>     int fd = -1;
>+    int hdrType = -1;
>+
>+    if (virPCIGetHeaderType(dev, &hdrType) < 0)
>+        return -1;
>+
>+    if (hdrType != VIR_PCI_HEADER_ENDPOINT) {
>+        virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid attempt to reset "
>+                       "non-endpoint PCI device %s. Only PCI endpoint "
>+                       "devices can be reset"), dev->name);

This can be reworded to be shorter.  ACK otherwise, so I fixed this one
and pushed it also.

>+        return -1;
>+    }
>
>     if (activeDevs && virPCIDeviceListFind(activeDevs, dev)) {
>         virReportError(VIR_ERR_INTERNAL_ERROR,
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170123/93882045/attachment-0001.sig>


More information about the libvir-list mailing list