* Igor Mammedov (imamm...@redhat.com) wrote:
> On Tue, 30 Jul 2019 10:37:18 +0100
> "Dr. David Alan Gilbert (git)" <dgilb...@redhat.com> wrote:
> 
> > From: "Dr. David Alan Gilbert" <dgilb...@redhat.com>
> > 
> > ACS was added in 4.0 unconditionally, this breaks migration
> > compatibility.
> > Allow ACS to be disabled by adding a property that's
> > checked by pcie_root_port.
> > 
> > Unfortunately pcie-root-port doesn't have any instance data,
> > so there's no where for that flag to live, so stuff it into
> > PCIESlot.
> > 
> > Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com>
> > ---
> >  hw/pci-bridge/pcie_root_port.c | 3 ++-
> >  include/hw/pci/pcie_port.h     | 2 ++
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/pci-bridge/pcie_root_port.c b/hw/pci-bridge/pcie_root_port.c
> > index 09019ca05d..1d8a778709 100644
> > --- a/hw/pci-bridge/pcie_root_port.c
> > +++ b/hw/pci-bridge/pcie_root_port.c
> > @@ -111,7 +111,7 @@ static void rp_realize(PCIDevice *d, Error **errp)
> >      pcie_aer_root_init(d);
> >      rp_aer_vector_update(d);
> >  
> > -    if (rpc->acs_offset) {
> > +    if (rpc->acs_offset && !s->disable_acs) {
> 
> it's not like it would be used per instance,
> so could we use class property and with rpc->disable_acs instead of PCIESlot?

I'm not clear I understand how class properties help;
    object_class_property_add_bool
takes a getter/setter that takes an Object *  parameter;
my reading of that is that it's the instance data so has the same
problem.

Dave

> >          pcie_acs_init(d, rpc->acs_offset);
> >      }
> >      return;
> > @@ -145,6 +145,7 @@ static void rp_exit(PCIDevice *d)
> >  static Property rp_props[] = {
> >      DEFINE_PROP_BIT(COMPAT_PROP_PCP, PCIDevice, cap_present,
> >                      QEMU_PCIE_SLTCAP_PCP_BITNR, true),
> > +    DEFINE_PROP_BOOL("disable-acs", PCIESlot, disable_acs, false),
> >      DEFINE_PROP_END_OF_LIST()
> >  };
> >  
> > diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h
> > index 09586f4641..7515430087 100644
> > --- a/include/hw/pci/pcie_port.h
> > +++ b/include/hw/pci/pcie_port.h
> > @@ -53,6 +53,8 @@ struct PCIESlot {
> >      PCIExpLinkSpeed speed;
> >      PCIExpLinkWidth width;
> >  
> > +    /* Disable ACS (really for a pcie_root_port) */
> > +    bool        disable_acs;
> >      QLIST_ENTRY(PCIESlot) next;
> >  };
> >  
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK

Reply via email to