|
| From: | Vikram Sethi |
| Subject: | Re: [Qemu-devel] [PATCH v12 7/9] hw/arm/sysbus-fdt: enable vfio-calxeda-xgmac dynamic instantiation |
| Date: | Fri, 24 Apr 2015 17:35:21 -0500 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
|
Hi Eric,
On 03/19/15 12:16, Eric Auger wrote: Since this function is applicable to any dma-coherent device withThis patch allows the instantiation of the vfio-calxeda-xgmac device from the QEMU command line (-device vfio-calxeda-xgmac,host="<device>"). A specialized device tree node is created for the guest, containing compat, dma-coherent, reg and interrupts properties. Signed-off-by: Eric Auger <address@hidden> --- v10 -> v11: - add dma-coherent property to calxeda midway xgmac node (fix) - use qemu_fdt_setprop to add reg property instead of qemu_fdt_setprop_sized_cells_from_array - commit message rewording v8 -> v9: - properly free resources in case of errors in add_calxeda_midway_xgmac_fdt_node v7 -> v8: - move the add_fdt_node_functions array declaration between the device specific code and the generic code to avoid forward declarations of decice specific functions - rename add_basic_vfio_fdt_node into add_calxeda_midway_xgmac_fdt_node v6 -> v7: - compat string re-formatting removed since compat string is not exposed anymore as a user option - VFIO IRQ kick-off removed from sysbus-fdt and moved to VFIO platform device --- hw/arm/sysbus-fdt.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c index 3038b94..6e465b2 100644 --- a/hw/arm/sysbus-fdt.c +++ b/hw/arm/sysbus-fdt.c @@ -26,6 +26,8 @@ #include "sysemu/device_tree.h" #include "hw/platform-bus.h" #include "sysemu/sysemu.h" +#include "hw/vfio/vfio-platform.h" +#include "hw/vfio/vfio-calxeda-xgmac.h" /* * internal struct that contains the information to create dynamic @@ -53,11 +55,81 @@ typedef struct NodeCreationPair { int (*add_fdt_node_fn)(SysBusDevice *sbdev, void *opaque); } NodeCreationPair; +/* Device Specific Code */ + +/** + * add_calxeda_midway_xgmac_fdt_node + * + * Generates a simple node with following properties: + * compatible string, regs, interrupts, dma-coherent + */ only mmio and irq properties to be exposed, should it be named something more generic so that it can be reused for other devices?
You are missing the
cpu_to_be32 for mmio_base and size. As a result, a 0x1000 size really gets encoded as 0x100000. If you have a device with 2 MMIO regions, this results in the second region getting a wrong starting address in the guest kernel, which also doesn't match the 2nd stage mapping done by KVM. With that fix, able to test this function with a device with 2 regions as well.
|
| [Prev in Thread] | Current Thread | [Next in Thread] |