On 21.11.2014 19:07, Alvise Rigo wrote: > This patch series is based on the previous work [1] and [2] by Rob > Herring and on [3] by myself. For sake of readability and since this is > still a RFC, these patches come as a stand alone work, so there's no > need to apply first [1][2][3]. it tries to enhance this work on these > points: > > Improvements from v1: > > - The code should be general enough to allow the use of the controller > with other platforms, not only with mach-virt. The only assumption > made is that a GIC v2 is used at guest side (the interrupt-map > property describes the parent interrupts using the three cells > format). > - The interrupt-map node generation has been enhanced in the following > aspects: > - support of multi-function PCI device has been added > - a PCI device can now use an interrupt pin different from #INTA > > Since some other works like [4] require to modify the device tree only > when all the devices have been instantiated, the PATCH[1/4] proposes a > solution for mach-virt to allow multiple agents (e.g., generic-pci, > VFIO) to modify the device tree. The approach in simple: a global list > is kept to store all the routines that perform the modification of the > device tree. Eventually, when the machine is completed, all these > routines are sequentially executed and the kernel is loaded to the guest > by mean of a machine_init_done_notifier. > In the context of this patch, here are some questions: > Rather than postponing the arm_load_kernel call as this patch does, > should we use instead the modify_dtb call provided by arm_boot_info to > modify the device tree? > If so, shouldn't modify_dtb be used to modify only *user* provided > device trees? > > This work has been tested attaching several PCI devices to the mach-virt > platform using an ARMv7 CPU. The tested devices are: virtio-blk-pci, > virtio-net-pci, lsi53c895a and pci-ohci (all attached at the same time). > > TODO: > - Add MSI, MSI-X support > - PCI-E support. Due to a lack of devices, this part is a bit hard to > accomplish at the moment. > > Thank you, alvise > > [1] > "[Qemu-devel] [RFC PATCH 1/2] hw/pci-host: add a generic PCI host" > http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg03482.html > [2] > "[Qemu-devel] [RFC PATCH 2/2] hw/arm/virt: Add generic PCI host device" > http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg03483.html > [3] > "[Qemu-devel] [RFC PATCH 0/8] Add Generic PCI host device update" > https://lists.gnu.org/archive/html/qemu-devel/2014-07/msg01957.html > [4] > http://lists.nongnu.org/archive/html/qemu-devel/2014-10/msg03816.html > > Alvise Rigo (4): > hw/arm/virt: Allow multiple agents to modify dt > hw/arm/virt: find_machine_info: handle NULL value > hw/pci-host: Add a generic PCI host controller for virtual platforms > hw/arm/virt: Add generic-pci device support > > hw/arm/virt.c | 114 +++++++++++++++- > hw/pci-host/Makefile.objs | 2 +- > hw/pci-host/generic-pci.c | 280 > ++++++++++++++++++++++++++++++++++++++ > include/hw/pci-host/generic-pci.h | 74 ++++++++++ > 4 files changed, 468 insertions(+), 2 deletions(-) > create mode 100644 hw/pci-host/generic-pci.c > create mode 100644 include/hw/pci-host/generic-pci.h >
Tested with modified OSv guest on AArch64. Tested-by: Claudio Fontana <claudio.font...@huawei.com>