[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 1/9] xen/arm: don't pass iommu properties to hwdom for iommu-map


  • To: Julien Grall <julien@xxxxxxx>, Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Mon, 23 Oct 2023 11:00:01 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Vube39Ka9BVyhP1vz/u0gAMi5EPqVvIMArcc279spGU=; b=iZ6AmanI2oRTmbXsk40KR1qUUBqgGC3a5CrTQM2jgFkdazcuwA1KqpuO0cPE/2R9j9jE0EqcWwpbifVAi25sU5yFT9rSsOe5U8u7SqRlOt5bLdqZ6SL5JPVF+v4kVZEAUHyEQbMWZFzd+bC8QF25xRcUiKXj7lkk7SXohxZ5XhJZcumeQAU89Ia3DwRl/nmxfL7RYCdCu73lyukUuwYjEoRL+MLLIJYi9iSy3wr7qjHwvRAx1CSJ9oKKjA3Rik6SyY9srZE5xmiaVeSMvf1Yw+nTOT4sJDuTb52tNHmvMFE/FDbFb7JEExPnwcOY5qvsFvUy3mev+HHNO1TFhi29ng==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kJJMWTnWnmwG4SzJqi/tcWf0c2UtWljQyYtPqIvgb44Q5FQvy2bYmak3Hx2SYOLCoubQ160KV4ZJKix8SJyrMaBLJz6ZS4xfX6ariaK0yOKEgc126Fw4VRv+ZhPC1HyVJBptPKKOAZ5/7hjJwUqmn8ZjL+7JOUxCzXLtfxr6Kc3aTIDgbGYtN+JuVgo7WvWm5eUt4I8OQfUC4wCRs1ZueY1cPDXqRKHvF2vrvd9SltzKxFiV56HcqZG4FkpP1Jj1yvkvXoB7lbMbGo/msOiSXGDBzXrcGcZpb6yyUw9fvO3o7ofWg/sWeNl3XQy2HOLcDx4WpewFFaHSTIWqZbe75A==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 23 Oct 2023 09:00:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi,

On 20/10/2023 20:48, Julien Grall wrote:
> 
> 
> Hi,
> 
> On 04/10/2023 15:55, Stewart Hildebrand wrote:
>> A device tree node for a PCIe root controller may have an iommu-map property 
>> [1]
>> with a phandle reference to the SMMU node, but not necessarily an iommus
>> property. In this case, we want to treat it the same as we currently handle
>> devices with an iommus property: don't pass the iommu related properties to
>> hwdom.
>>
>> [1] 
>> https://www.kernel.org/doc/Documentation/devicetree/bindings/pci/pci-iommu.txt
>>
>> Reported-by: Michal Orzel <michal.orzel@xxxxxxx>
>> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
> 
> Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
> 
>> ---
>> v4->v5:
>> * new patch
>> ---
>>   xen/arch/arm/domain_build.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 24c9019cc43c..7da254709d17 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -1135,6 +1135,8 @@ static int __init write_properties(struct domain *d, 
>> struct kernel_info *kinfo,
>>        * should be skipped.
>>        */
>>       iommu_node = dt_parse_phandle(node, "iommus", 0);
>> +    if ( !iommu_node )
>> +        iommu_node = dt_parse_phandle(node, "iommu-map", 1);
>>       if ( iommu_node && device_get_class(iommu_node) != DEVICE_IOMMU )
>>           iommu_node = NULL;
> 
> I was looking at the history to understand why we decided to not always
> hide the properties.
> 
> AFAICT, this was mainly to avoid removing the master properties but
> keeping the IOMMU nodes in the DT. However, in reality, I don't expect
> the IOMMU to function properly in dom0 (in particular when grants are
> used for DMA).
> 
> Looking at the bindings, it turns out that all the IOMMU using the
> generic bindigns would contain the property #iommu-cells. So we could
> remove any device with such property.
> 
> This would not work for IOMMU bindings not using the generic one. AFAIK,
> this is only legacy SMMUv{1,2} binding so we could filter them by
> compatible.
> 
> With that we would unconditionally remove the properties iommu-* and
> avoid increasing the complexity.
> 
> Any thoughts?
I think it is a good idea to skip all IOMMU nodes and properties and not only 
the ones
recognized by Xen. I realized that it may have an impact on Rahul's RFC vSMMU 
series
but I checked the patches and impact is negligible. As for supporting legacy 
bindings, I think
we would be good if we search for #iommu-cells || mmu-masters.

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.