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

Re: Proposal for virtual IOMMU binding b/w vIOMMU and passthrough devices


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 28 Oct 2022 15:45:41 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=+w3AIFOT56xT7gpTwnUOohy02sNHJLZ5KfBpaHLruyc=; b=lx1cqDmlgY9A2qmJWoZVhTpWVhi2Tg/Ql9yiHOsm6Itx4s9SU3y8EEsaRojnjNvjXP00SuqMhoSTq1sI8YnSXVIvO6aWQb6m4XbeCc/WoG5Nkm1xpGFIgqKlGaCbVZqmGj1L0tnVxUUhjQZu3LbHmajJ+2PDyEk3uI7Vb/SHZSGCf86ERo7sRC7u7HYY89D/jNrgQtAtbfH6Wznwq5OBIDLDeqUk57RlNG4v18dU/ljPHVL/ChHnzawssMtvn3XxF1a6VELV9rXdmBhJvgYmdYID+eDC5+ifUENGEukL9Bj/0KXz16/zwqrzPkMX8ba2aiKnpjDGPKDHLMB5/QnXgg==
  • 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=+w3AIFOT56xT7gpTwnUOohy02sNHJLZ5KfBpaHLruyc=; b=VC7JDKuRFWfx2pYXYhIIOPxywJ4UekDw8YZUE7q3d8XYTdSp3mziWmcCGOZaRSy70SzQ93+NGELkea+nN0Kz8je/J5D8Jbjd6bVxsIG78lAWa72R3gNzbNHEmGvv+aIki//1ly6OV6GAL+r7DNUf8gKKw1kGJesse04yaEyx+Yjk99SY8RJOn2CBj7YfjmZ52sf7HWPNGoS8abfWbSt8oqR2CfKk3BW/Yn2Jq/8DwXnHkdqBirfL7cV/7i5ylLOasbpXx17KcE5s5FhYfLC7OGZoqNT1abMcfk+SQ7yi/pJ8xX2hsJ4RYgcYgL4Huqs6qC+Xl0v6xWhuGgfydH9x6Q==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=TkITVSr14HQ+9/OxEDb9PJU6/ue0qyAiSfWt4TbGIZBOvK40plvVG1VTup+oIa9xr1gZhv/oYZGXePAka37WATpcGw/owP0fCWM+BxJRP7B5auk9/X8ogKB9QwXg2q/BbA5+243oA/+EzsVZib5X3nwqRJLPw7xiMvPTaIA7ym5BT9Qlb66kSwsyL6oZ/MxHi7LVWogdoC/LrpiFaI09WJHL2SjYwr7L3dTTSzAUk752rK+JKl7wFUS6P10267C8pKKwzKriT9zfw/RPKjqjniB15CjPXW4iZs+HlHLfxOxFP4HFDuU6YCvtsnEstsRmgsWEY3jtFiQKOItalgWgaA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K+t3ib1QBi2K3dmjY5ka82Iq9KCWlUp0XE4vpU8n0bm7TMn3/0FfNaIKoh4EhP35/jD1P2p43pgyuHdlfG7zolmclyMMQoWeZMnJIkxESm6J7lL7mAaRgVapqn8OlCzwW/vHJdKs4HT4jIY6c4tY7jA3fSVYV7jDqfBpm9s5z/Is+ZynKcJPAO28cu9ZqCbzB6FoTDJ3eY2ffLGmojUnuGtIBEtxPYvsDwQggIdzeOlRQQJT2zqk8Wo2hXvrQj82dK39OG5irMKDfHdkVMQ62BcDpdIjbGcux2vEX0B5V8xZOfD6ubsy5qTf3clflP0DtaTz6AS6uGOR99Ps/Hwimw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Rahul Singh <Rahul.Singh@xxxxxxx>, Xen developer discussion <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Michal Orzel <Michal.Orzel@xxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Fri, 28 Oct 2022 15:46:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHY6T1V+gcJbmRqpEyt0b8GeG9bFq4grXIAgAAQCACAAFf9AIABVMyAgAAG64CAAVVJgIAAAzuAgAACBwCAAAPNgIAAE5mAgAAGngCAAAxxAA==
  • Thread-topic: Proposal for virtual IOMMU binding b/w vIOMMU and passthrough devices

Hi Julien,

> On 28 Oct 2022, at 16:01, Julien Grall <julien@xxxxxxx> wrote:
> 
> 
> 
> On 28/10/2022 15:37, Bertrand Marquis wrote:
>> Hi Julien,
> 
> Hi Bertrand,
> 
>>> On 28 Oct 2022, at 14:27, Julien Grall <julien@xxxxxxx> wrote:
>>> 
>>> 
>>> 
>>> On 28/10/2022 14:13, Bertrand Marquis wrote:
>>>> Hi Julien,
>>> 
>>> Hi Bertrand,
>>> 
>>>>> On 28 Oct 2022, at 14:06, Julien Grall <julien@xxxxxxx> wrote:
>>>>> 
>>>>> Hi Rahul,
>>>>> 
>>>>> On 28/10/2022 13:54, Rahul Singh wrote:
>>>>>>>>>>> For ACPI, I would have expected the information to be found in the 
>>>>>>>>>>> IOREQ.
>>>>>>>>>>> 
>>>>>>>>>>> So can you add more context why this is necessary for everyone?
>>>>>>>>>> We have information for IOMMU and Master-ID but we don’t have 
>>>>>>>>>> information for linking vMaster-ID to pMaster-ID.
>>>>>>>>> 
>>>>>>>>> I am confused. Below, you are making the virtual master ID optional. 
>>>>>>>>> So shouldn't this be mandatory if you really need the mapping with 
>>>>>>>>> the virtual ID?
>>>>>>>> vMasterID is optional if user knows pMasterID is unique on the system. 
>>>>>>>> But if pMasterId is not unique then user needs to provide the 
>>>>>>>> vMasterID.
>>>>>>> 
>>>>>>> So the expectation is the user will be able to know that the pMasterID 
>>>>>>> is uniq. This may be easy with a couple of SMMUs, but if you have 50+ 
>>>>>>> (as suggested above). This will become a pain on larger system.
>>>>>>> 
>>>>>>> IHMO, it would be much better if we can detect that in libxl (see 
>>>>>>> below).
>>>>>> We can make the vMasterID compulsory to avoid complexity in libxl to 
>>>>>> solve this
>>>>> 
>>>>> In general, complexity in libxl is not too much of problem.
>>>> I am a bit unsure about this strategy.
>>>> Currently xl has one configuration file where you put all Xen parameters. 
>>>> The device tree is only needed by some guests to have a description of the 
>>>> system they run on.
>>>> If we change the model and say that Xen configuration parameters are both 
>>>> in the configuration and the device tree, we somehow enforce to have a 
>>>> device tree even though some guests do not need it at all (for example 
>>>> Zephyr).
>>> 
>>> I think my approach was misunderstood because there is no change in the 
>>> existing model.
>>> 
>>> What I am suggesting is to not introduce iommu_devid_map but instead let 
>>> libxl allocate the virtual Master-ID and create the mapping with the 
>>> physical Master-ID.
>>> 
>>> Libxl would then update the property "iommus" in the device-tree with the 
>>> allocated virtual Master-ID.
>> Ok I understand now.
>>> 
>>> Each node in the partial device-tree would need to have a property
>>> to refer to the physical device just so we know how to update the "iommus". 
>>> The list of device passthrough will still be specified in the configuration 
>>> file. IOW, the partial device-tree is not directly involved in the 
>>> configuration of the guest.
>> But we will generate it. How would something like Zephyr guest work ? Zephyr 
>> is not using the device tree we pass, it has an embedded one.
> 
> In general, guest that don't use the device-tree/ACPI table to detect the 
> layout are already in a bad situation because we don't guarantee that the 
> layout (memory, interrupt...) will be stable across Xen version. Although, 
> there are a implicit agreement that the layout will not change for minor 
> release (i.e. 4.14.x).

Well right now we have no ACPI support.
But I still think that a non dtb guest is definitely a use case we need to keep 
in mind for embedded and safety as most proprietary RTOS are not using a device 
tree.

> 
> But see below for some suggestions how this could be handled.
> 
>>> 
>>> So far, I don't see a particular issue with this approach because the 
>>> vMaster ID algorithm allocation should be generic. But please let me know 
>>> if you think there are bits I am missing.
>> I am a bit afraid of things that are “automatic”.
>> For everything else we let the user in control (IPA for mapping, virtual 
>> interrupt number) and in this case we switch to a model where we 
>> automatically generated a vMaster ID.
> 
> We only let the user control where the device is mapped. But this is quite 
> fragile... I think this should be generated at runtime.
> 
>> With this model, guest not using the device tree will have to guess the 
>> vMaster ID or somehow know how the tools are generating it to use the right 
>> one.
> 
> To be honest, this is already the case today because the layout exposed to 
> the guest is technically not fixed. Yes, so far, we haven't changed it too 
> much. But sooner or later, this is going to bite because we made clear that 
> the layout is not stable.
> 
> Now, if those projects are willing to rebuild for each version, then we could 
> use the following approach:
>  1) Write the xl.cfg
>  2) Ask libxl to generate the device-tree
>  3) Build Zephyr
>  4) Create the domain
> 
> The expectation is for a given Xen version (and compatible), libxl will 
> always generate the same Device-Tree.

This is a good idea yes :-)

Cheers
Bertrand

> 
> Cheers,
> 
> -- 
> Julien Grall


 


Rackspace

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