[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] pcie: using error_setg instead of impolite
From: |
Gonglei (Arei) |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] pcie: using error_setg instead of impolite assert |
Date: |
Wed, 20 Aug 2014 02:50:47 +0000 |
> > ---
> > hw/pci/pcie.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
> > index a123c01..7b46140 100644
> > --- a/hw/pci/pcie.c
> > +++ b/hw/pci/pcie.c
> > @@ -254,7 +254,11 @@ void pcie_cap_slot_hotplug_cb(HotplugHandler
> *hotplug_dev, DeviceState *dev,
> > * Right now, only a device of function = 0 is allowed to be
> > * hot plugged/unplugged.
> > */
> > - assert(PCI_FUNC(pci_dev->devfn) == 0);
> > + if (PCI_FUNC(pci_dev->devfn) != 0) {
> > + error_setg(errp, "Unsupported device function %d for PCIe
> hotplugging, "
> > + "only supported function 0",
> PCI_FUNC(pci_dev->devfn));
> > + return;
> > + }
>
> Unplug of multifunction devices really should work.
> Drop this assert and see what happens.
>
I'm sorry to say that the device of function !=0 cannot been
recognized by guest os, which I have said in another conversation
[Why doesn't PCIe hotplug work for Q35 machine?]
> For hot-plug we don't have good APIs yet but we
> really should define them rather than add more
> code that we have to later remove.
>
Hmm.. I just think the simple assert is not friendly
at present, if someone hotplug a device with function !0 .
MST, If you think this change is superfluous, I can drop this patch,
and I'm fine with it. Thanks.
Best regards,
-Gonglei