| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v6 5/8] xen/arm: assign devices to boot domains
 Hi, On 9/27/19 12:11 AM, Stefano Stabellini wrote: Scan the user provided dtb fragment at boot. For each device node, map memory to guests, and route interrupts and setup the iommu. The memory region to remap is specified by the "xen,reg" property. The iommu is setup by passing the node of the device to assign on the host device tree. The path is specified in the device tree fragment as the "xen,path" string property. The interrupts are remapped based on the information from the corresponding node on the host device tree. Call handle_device_interrupts to remap interrupts. Interrupts related device tree properties are copied from the device tree fragment, same as all the other properties. Also set add the new flag XEN_DOMCTL_CDF_iommu so that dom0less domU can use the IOMMU if a partial dtb is specified. Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx> --- Changes in v6: - turn dprintks into printks - return error on page alignment check failure - set XEN_DOMCTL_CDF_iommu if partial dtb is specified Changes in v5: - use local variable for name - use map_regions_p2mt - add warning for not page aligned addresses/sizes - introduce handle_passthrough_prop Changes in v4: - use unsigned - improve commit message - code style - use dt_prop_cmp - use device_tree_get_reg - don't copy over xen,reg and xen,path - don't create special interrupt properties for domU: copy them from the fragment - in-code comment Changes in v3: - improve commit message - remove superfluous cast - merge code with the copy code - add interrup-parent - demove depth > 2 check - reuse code from handle_device_interrupts - copy interrupts from host dt Changes in v2: - rename "path" to "xen,path" - grammar fix - use gaddr_to_gfn and maddr_to_mfn - remove depth <= 2 limitation in scanning the dtb fragment - introduce and parse xen,reg - code style - support more than one interrupt per device - specify only the GIC is supported --- xen/arch/arm/domain_build.c | 104 ++++++++++++++++++++++++++++++++++-- 1 file changed, 101 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 08d6d238e3..a461816345 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1699,6 +1699,88 @@ static int __init make_vpl011_uart_node(struct kernel_info *kinfo) } #endif+/*+ * Scan device tree properties for passthrough specific information. + * Returns -ENOENT when no passthrough properties are found Such things only work if you control the return value. Looking at the code, you propagate the value from iommu_assign_dt_device(). While today we return -EINVAL when the device is not protected, it may make sense to return -ENOENT (after all the device is not behind an IOMMU and therefore technically not found). You would end up to present the property when it should not. So it would be better to consider returning a positive value when the property needs to be copied. NIT: Newline between declaration and code. + cell = (const __be32 *)prop->data; + len = fdt32_to_cpu(prop->len) / + ((address_cells * 2 + size_cells) * sizeof(uint32_t)); NIT: The indentation looks incorrect. I missed this one on the previous review. Same here. It might be worth checking your editor configuration to avoid such things happening in the future... Same here. 
 As you now moved the code to passthrough properties in a separate function, it now a bit unclear what "other" mean here. 
 Cheers, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel 
 
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |