qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 13/22] hw/pvrdma: Make sure PCI function 0 is


From: Yuval Shaia
Subject: Re: [Qemu-devel] [PATCH v2 13/22] hw/pvrdma: Make sure PCI function 0 is vmxnet3
Date: Sun, 18 Nov 2018 11:16:30 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

On Sat, Nov 17, 2018 at 01:41:41PM +0200, Marcel Apfelbaum wrote:
> 
> 
> On 11/11/18 9:45 AM, Yuval Shaia wrote:
> > On Sat, Nov 10, 2018 at 08:27:44PM +0200, Marcel Apfelbaum wrote:
> > > 
> > > On 11/8/18 6:08 PM, Yuval Shaia wrote:
> > > > Guest driver enforces it, we should also.
> > > > 
> > > > Signed-off-by: Yuval Shaia <address@hidden>
> > > > ---
> > > >    hw/rdma/vmw/pvrdma.h      | 2 ++
> > > >    hw/rdma/vmw/pvrdma_main.c | 3 +++
> > > >    2 files changed, 5 insertions(+)
> > > > 
> > > > diff --git a/hw/rdma/vmw/pvrdma.h b/hw/rdma/vmw/pvrdma.h
> > > > index b019cb843a..10a3c4fb7c 100644
> > > > --- a/hw/rdma/vmw/pvrdma.h
> > > > +++ b/hw/rdma/vmw/pvrdma.h
> > > > @@ -20,6 +20,7 @@
> > > >    #include "hw/pci/pci.h"
> > > >    #include "hw/pci/msix.h"
> > > >    #include "chardev/char-fe.h"
> > > > +#include "hw/net/vmxnet3_defs.h"
> > > >    #include "../rdma_backend_defs.h"
> > > >    #include "../rdma_rm_defs.h"
> > > > @@ -85,6 +86,7 @@ typedef struct PVRDMADev {
> > > >        RdmaBackendDev backend_dev;
> > > >        RdmaDeviceResources rdma_dev_res;
> > > >        CharBackend mad_chr;
> > > > +    VMXNET3State *func0;
> > > >    } PVRDMADev;
> > > >    #define PVRDMA_DEV(dev) OBJECT_CHECK(PVRDMADev, (dev), 
> > > > PVRDMA_HW_NAME)
> > > > diff --git a/hw/rdma/vmw/pvrdma_main.c b/hw/rdma/vmw/pvrdma_main.c
> > > > index ac8c092db0..fa6468d221 100644
> > > > --- a/hw/rdma/vmw/pvrdma_main.c
> > > > +++ b/hw/rdma/vmw/pvrdma_main.c
> > > > @@ -576,6 +576,9 @@ static void pvrdma_realize(PCIDevice *pdev, Error 
> > > > **errp)
> > > >            return;
> > > >        }
> > > > +    /* Break if not vmxnet3 device in slot 0 */
> > > > +    dev->func0 = VMXNET3(pci_get_function_0(pdev));
> > > > +
> > > I don't see the error code flow in case VMXNET3 is not func 0.
> > > Am I missing something?
> > Yes, this is a dynamic cast that will break the process when fail to cast.
> > 
> > This is the error message that you will get in case that device on function
> > 0 is not vmxnet3:
> > 
> > pvrdma_main.c:589:pvrdma_realize: Object 0x557b959841a0 is not an instance 
> > of type vmxnet3
> 
> I am not sure we will see this error if QEMU is compiled in Release mode.
> I think object_dynamic_cast_assert throws this error only if
> CONFIG_QOM_CAST_DEBUG
> is set, and is possible the mentioned flag is not set in Release.
> 
> Thanks,
> Marcel

Done.
Thanks.

> 
> > 
> > > 
> > > Thanks,
> > > Marcel
> > > 
> > > >        memdev_root = object_resolve_path("/objects", NULL);
> > > >        if (memdev_root) {
> > > >            object_child_foreach(memdev_root, pvrdma_check_ram_shared, 
> > > > &ram_shared);
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]