Re: [Qemu-devel] [for-2.12 4/7] pci: Simplify pci_bus_is_root()

2017-12-01 Thread David Gibson
On Thu, Nov 30, 2017 at 02:23:45PM +0800, Peter Xu wrote: > On Wed, Nov 29, 2017 at 07:46:25PM +1100, David Gibson wrote: > > [...] > > > struct PCIBus { > > BusState qbus; > > +enum PCIBusFlags flags; > > PCIIOMMUFunc iommu_fn; > > void *iommu_opaque; > > uint8_t devfn_m

Re: [Qemu-devel] [for-2.12 4/7] pci: Simplify pci_bus_is_root()

2017-11-29 Thread Peter Xu
On Wed, Nov 29, 2017 at 07:46:25PM +1100, David Gibson wrote: [...] > struct PCIBus { > BusState qbus; > +enum PCIBusFlags flags; > PCIIOMMUFunc iommu_fn; > void *iommu_opaque; > uint8_t devfn_min; > @@ -440,8 +446,12 @@ struct PCIBus { > Notifier machine_done; > };

Re: [Qemu-devel] [for-2.12 4/7] pci: Simplify pci_bus_is_root()

2017-11-29 Thread Marcel Apfelbaum
On 29/11/2017 15:12, David Gibson wrote: On Wed, Nov 29, 2017 at 12:45:28PM +0200, Marcel Apfelbaum wrote: On 29/11/2017 10:46, David Gibson wrote: pci_bus_is_root() currently relies on a method in the PCIBusClass. But it's always known if a PCI bus is a root bus when we create it, so using a d

Re: [Qemu-devel] [for-2.12 4/7] pci: Simplify pci_bus_is_root()

2017-11-29 Thread David Gibson
On Wed, Nov 29, 2017 at 12:45:28PM +0200, Marcel Apfelbaum wrote: > On 29/11/2017 10:46, David Gibson wrote: > > pci_bus_is_root() currently relies on a method in the PCIBusClass. > > But it's always known if a PCI bus is a root bus when we create it, so > > using a dynamic method is overkill. > >

Re: [Qemu-devel] [for-2.12 4/7] pci: Simplify pci_bus_is_root()

2017-11-29 Thread Marcel Apfelbaum
On 29/11/2017 10:46, David Gibson wrote: pci_bus_is_root() currently relies on a method in the PCIBusClass. But it's always known if a PCI bus is a root bus when we create it, so using a dynamic method is overkill. This replaces it with an IS_ROOT bit in a new flags field, which is set on root b

[Qemu-devel] [for-2.12 4/7] pci: Simplify pci_bus_is_root()

2017-11-29 Thread David Gibson
pci_bus_is_root() currently relies on a method in the PCIBusClass. But it's always known if a PCI bus is a root bus when we create it, so using a dynamic method is overkill. This replaces it with an IS_ROOT bit in a new flags field, which is set on root buses and otherwise clear. As a bonus this