Hello Viresh [sorry for the possible format issues]
On Fri, May 5, 2023 at 9:19 AM Viresh Kumar <viresh.ku...@linaro.org> wrote: > On 05-04-23, 05:12, Viresh Kumar wrote: > > On 04-04-23, 21:16, Oleksandr Tyshchenko wrote: > > > ok, probably makes sense > > > > While testing both foreign and grant mappings I stumbled upon another > > related problem. How do I control the creation of iommu node from > > guest configuration file, irrespective of the domain backend is > > running at ? This is what we have right now: > > > > - always create iommu nodes if backend-dom != 0 > > - always create iommu nodes if forced_grant == 1 > > > > what I need to cover is > > - don't create iommu nodes irrespective of the domain > > > > This is required if you want to test both foreign and grant memory > > allocations, with different guests kernels. i.e. one guest kernel for > > device with grant mappings and another guest for device with foreign > > mappings. There is no way, that I know of, to disable the creation of > > iommu nodes. Of course we would want to use the same images for kernel > > and other stuff, so this needs to be controlled from guest > > configuration file. > > Any input on this please ? > I was going to propose an idea, but I have just realized that you already voiced it here [1] )) So what you proposed there sounds reasonable to me. I will just rephrase it according to my understanding: We probably need to consider transforming your "forced_grant" to something three-state, for example "grant_usage" (or "use_grant" as you suggested) which could be "default behaviour" or "always disabled", or "always enabled". With "grant_usage=default" we will get exact what we have at the moment (only create iommu nodes if backend-domid != 0) With "grant_usage=disabled" we will force grants to be always disabled (don't create iommu nodes irrespective of the domain) With "grant_usage=enabled" we will force grants to be always enabled (always create iommu nodes irrespective of the domain) [1] https://lore.kernel.org/xen-devel/20230505093835.jcbwo6zjk5hcjvsm@vireshk-i7/ > > -- > viresh > -- Regards, Oleksandr Tyshchenko