From bcf041f257623e5c9e77d35b7531bae59edc0423 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Thu, 24 Oct 2019 17:35:13 +0100 Subject: [PATCH] dev-arm: Automatically assign PCI device ids in attachPciDevice Simulation scripts currently need to assign PCI device addresses when adding new devices. This change moves this responsibility to the VExpress_GEM5_BASE::attachPciDevice method. Change-Id: I6d62af8a8f9176d964cc011dd8fb9744154bbb87 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22830 Tested-by: kokoro Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini --- configs/common/FSConfig.py | 3 +-- configs/example/arm/devices.py | 4 ---- src/dev/arm/RealView.py | 5 +++++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py index b34db4e26..55a6e9118 100644 --- a/configs/common/FSConfig.py +++ b/configs/common/FSConfig.py @@ -365,8 +365,7 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None, # Attach off-chip devices self.realview.attachIO(self.iobus) - for dev_id, dev in enumerate(pci_devices): - dev.pci_bus, dev.pci_dev, dev.pci_func = (0, dev_id + 1, 0) + for dev in pci_devices: self.realview.attachPciDevice( dev, self.iobus, dma_ports=self._dma_ports if ruby else None) diff --git a/configs/example/arm/devices.py b/configs/example/arm/devices.py index 16312eb72..4615daac2 100644 --- a/configs/example/arm/devices.py +++ b/configs/example/arm/devices.py @@ -303,14 +303,10 @@ def simpleSystem(BaseSystem, caches, mem_size, platform=None, **kwargs): self.dmabridge = Bridge(delay='50ns', ranges=[self.mem_ranges[0]]) - self._pci_devices = 0 self._clusters = [] self._num_cpus = 0 def attach_pci(self, dev): - dev.pci_bus, dev.pci_dev, dev.pci_func = \ - (0, self._pci_devices + 1, 0) - self._pci_devices += 1 self.realview.attachPciDevice(dev, self.iobus) def connect(self): diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py index 10d3abb27..6e8630a96 100644 --- a/src/dev/arm/RealView.py +++ b/src/dev/arm/RealView.py @@ -542,6 +542,7 @@ class RealView(Platform): cxx_header = "dev/arm/realview.hh" system = Param.System(Parent.any, "system") _mem_regions = [ AddrRange(0, size='256MB') ] + _num_pci_dev = 0 def _on_chip_devices(self): return [] @@ -952,6 +953,10 @@ Interrupts: def attachPciDevice(self, device, *args, **kwargs): device.host = self.pci_host + self._num_pci_dev += 1 + device.pci_bus = 0 + device.pci_dev = self._num_pci_dev + device.pci_func = 0 self._attach_device(device, *args, **kwargs) def attachSmmu(self, devices, bus): -- 2.30.2