From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH v5 p2 00/19] xen/arm Add support for non-PCI passthrough Date: Thu, 9 Apr 2015 16:09:26 +0100 Message-ID: <1428592185-18581-1-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YgE9j-0000JS-RS for xen-devel@lists.xenproject.org; Thu, 09 Apr 2015 15:14:12 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: ian.campbell@citrix.com, manish.jaggi@caviumnetworks.com, tim@xen.org, robert.vanvossen@dornerworks.com, Julien Grall , stefano.stabellini@citrix.com, suravee.suthikulpanit@amd.com, Josh.Whitehead@dornerworks.com, andrii.tseglytskyi@globallogic.com List-Id: xen-devel@lists.xenproject.org Hello all, This is the fifth version of this patch series to add support for platform device passthrough on ARM. In order to passthrough a non-PCI device, the user will have to: - Map manually MMIO/IRQ - Describe the device in the newly partial device tree support - Specify the list of device protected by an IOMMU to assign to the guest. While this solution is primitive, this is allow us to support more complex device in Xen with an little additionnal work for the user. Attempting to do it automatically is more difficult because we may not know the dependencies between devices (for instance a Network card and a phy). To avoid adding code in DOM0 to manage platform device deassignment, the user has to add the property "xen,passthrough" to the device tree node describing the device. This can be easily done via U-Boot. For instance, if we want to passthrough the second network card of a Midway server to the guest. The user will have to add the following line the u-boot script: fdt set /soc/ethernet@fff51000 xen,passthrough This series has been tested on Midway by assigning the secondary network card to a guest (see instruction below). Though, it requires a separate patch as we decide to not support the Midway SMMU within the new drivers. I plan to do futher testing on other boards. A working tree can be found here: git://xenbits.xen.org/julieng/xen-unstable.git branch passthrough-v5.2 Major changes in v5: - Series divided in 2 parts. The first part [6] has been pushed to Xen upstream - Add more documentation - Modify XSM check for bind_pt_irq on ARM Major changes in v4: - The partial device tree option can only be used with trusted device tree - Add more documentation - Use DOMCTL_bind_pt_irq rather than PHYSDEVOP_map_pirq - Add XSM support for non-PCI passthrough Major changes in v3: - Rework the approach to passthrough a device (xen,passthrough + partial device tree). - Extend the existing hypercalls to assign/deassign device rather than adding new one. - Merge series [4] and [5] in this serie. Major changes in v2: - Drop the patch #1 of the previous version - Virtual IRQ are not anymore equal to the physical interrupt - Move the hypercall to get DT informations for privcmd to domctl - Split the domain creation in 2 two parts to allow per guest VGIC configuration (such as the number of SPIs). - Bunch of typoes, commit improvement, function renaming. For all changes see in each patch. Sincerely yours, [1] http://lists.xen.org/archives/html/xen-devel/2014-07/msg04090.html [2] http://lists.xenproject.org/archives/html/xen-devel/2014-12/msg01386.html [3] http://lists.xenproject.org/archives/html/xen-devel/2014-12/msg01612.html [4] http://lists.xen.org/archives/html/xen-devel/2014-11/msg01672.html [5] http://lists.xenproject.org/archives/html/xen-devel/2014-07/msg02098.html [6] http://lists.xenproject.org/archives/html/xen-devel/2015-04/msg00248.html Cc: manish.jaggi@caviumnetworks.com Cc: suravee.suthikulpanit@amd.com Cc: andrii.tseglytskyi@globallogic.com Cc: robert.vanvossen@dornerworks.com Cc: Josh.Whitehead@dornerworks.com Julien Grall (19): xen/arm: Let the toolstack configure the number of SPIs xen/arm: vgic: Add spi_to_pending xen/arm: Release IRQ routed to a domain when it's destroying xen/arm: Implement hypercall DOMCTL_{,un}bind_pt_pirq xen: guestcopy: Provide an helper to safely copy string from guest xen/dts: Provide an helper to get a DT node from a path provided by a guest xen/passthrough: Introduce iommu_construct xen/passthrough: arm: release the DT devices assigned to a guest earlier xen/passthrough: iommu_deassign_device_dt: By default reassign device to nobody xen/iommu: arm: Wire iommu DOMCTL for ARM xen/xsm: Add helpers to check permission for device tree passthrough xen/passthrough: Extend XEN_DOMCTL_*assign_device to support DT device tools/libxl: Create a per-arch function to map IRQ to a domain tools/libxl: Check if fdt_{first,next}_subnode are present in libfdt tools/(lib)xl: Add partial device tree support for ARM tools/libxl: arm: Use an higher value for the GIC phandle libxl: Add support for Device Tree passthrough xl: Add new option dtdev docs/misc: arm: Add documentation about Device Tree passthrough docs/man/xl.cfg.pod.5 | 15 +++ docs/misc/arm/passthrough.txt | 61 +++++++++++ tools/config.h.in | 6 ++ tools/configure.ac | 5 + tools/libxc/include/xenctrl.h | 18 ++++ tools/libxc/xc_domain.c | 170 +++++++++++++++++++++++++++--- tools/libxl/Makefile | 2 +- tools/libxl/libxl.h | 6 ++ tools/libxl/libxl_arch.h | 4 + tools/libxl/libxl_arm.c | 192 +++++++++++++++++++++++++++++++++- tools/libxl/libxl_create.c | 38 ++++++- tools/libxl/libxl_internal.h | 5 + tools/libxl/libxl_libfdt_compat.c | 92 ++++++++++++++++ tools/libxl/libxl_types.idl | 9 ++ tools/libxl/libxl_x86.c | 13 +++ tools/libxl/xl_cmdimpl.c | 23 +++- xen/arch/arm/domain.c | 6 +- xen/arch/arm/domctl.c | 88 +++++++++++++++- xen/arch/arm/gic.c | 45 ++++++++ xen/arch/arm/irq.c | 46 ++++++++ xen/arch/arm/setup.c | 1 + xen/arch/arm/vgic.c | 34 +++++- xen/common/Makefile | 1 + xen/common/device_tree.c | 18 ++++ xen/common/guestcopy.c | 31 ++++++ xen/drivers/passthrough/arm/iommu.c | 7 +- xen/drivers/passthrough/arm/smmu.c | 8 +- xen/drivers/passthrough/device_tree.c | 136 ++++++++++++++++++++++-- xen/drivers/passthrough/iommu.c | 33 +++++- xen/drivers/passthrough/pci.c | 69 ++++++------ xen/include/asm-arm/gic.h | 4 + xen/include/asm-arm/irq.h | 2 + xen/include/asm-arm/vgic.h | 3 +- xen/include/public/arch-arm.h | 2 + xen/include/public/domctl.h | 28 ++++- xen/include/xen/device_tree.h | 14 +++ xen/include/xen/guest_access.h | 5 + xen/include/xen/iommu.h | 7 +- xen/include/xsm/dummy.h | 47 ++++++--- xen/include/xsm/xsm.h | 55 +++++++--- xen/xsm/dummy.c | 10 +- xen/xsm/flask/avc.c | 3 + xen/xsm/flask/flask_op.c | 49 +++------ xen/xsm/flask/hooks.c | 139 +++++++++++++++++------- xen/xsm/flask/include/avc.h | 2 + xen/xsm/flask/policy/access_vectors | 2 +- 46 files changed, 1373 insertions(+), 181 deletions(-) create mode 100644 docs/misc/arm/passthrough.txt create mode 100644 tools/libxl/libxl_libfdt_compat.c create mode 100644 xen/common/guestcopy.c -- 2.1.4