From: Julien Grall <julien.grall@arm.com>
To: Jan Beulich <JBeulich@suse.com>,
Oleksandr Tyshchenko <olekstysh@gmail.com>,
Stefano Stabellini <sstabellini@kernel.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
nd@arm.com, Wei Liu <wei.liu2@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v1 08/10] iommu: Split iommu_hwdom_init() into arch specific parts
Date: Mon, 15 May 2017 08:42:32 +0100 [thread overview]
Message-ID: <dd6d8929-e182-7d77-54a5-944d9889997c@arm.com> (raw)
In-Reply-To: <591972E20200007800159A86@prv-mh.provo.novell.com>
Hi Jan,
On 15/05/2017 08:20, Jan Beulich wrote:
>>>> On 12.05.17 at 17:34, <JBeulich@suse.com> wrote:
>>>>> On 12.05.17 at 17:25, <olekstysh@gmail.com> wrote:
>>> On Fri, May 12, 2017 at 5:41 PM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>>>> On 10.05.17 at 16:03, <olekstysh@gmail.com> wrote:
>>>>> The "retrieving mapping" code has never executed since
>>>>> iommu_use_hap_pt(d) always returned true on ARM so far. But, with
>>>>> introducing the non-shared IOMMU patch series we can no longer keep
>>>>> this code as is due to the lack of M2P support.
>>>>>
>>>>> In order to retain the current behavior for x86 this code was completely
>>>>> moved to x86 specific part.
>>>>> For ARM we just need to populate IOMMU page table if need_iommu flag
>>>>> is already set and the IOMMU is non-shared.
>>>>>
>>>>> So, the logic on ARM was changed a bit, but no functional change for x86.
>>>>>
>>>>> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>>>> CC: Jan Beulich <jbeulich@suse.com>
>>>>> CC: Julien Grall <julien.grall@arm.com>
>>>>>
>>>>> ---
>>>>> Changes in V1:
>>>>> - Clarify patch description.
>>>>
>>>> My prior objection stands: You don't make clear why architecture-
>>>> agnostic code needs to be moved into an architecture-specific file.
>>>
>>> Is the following description more cleaner?
>>>
>>> Although this code looks like architecture-agnostic code, there is
>>> only one thing that prevents it
>>> to be *completely* architecture-agnostic -> mfn_to_gmfn helper.
>>> As we don't have an M2P on ARM, it always returns incoming mfn.
>>> And if domain is not direct mapped we will get into the trouble using that.
>>>
>>> We didn't care about this code before because it has never been executed
>>> (iommu_use_hap_pt(d) always returned true on ARM so far).
>>> But, with introducing the non-shared IOMMU patch series we can no longer keep
>>> this code as is since it will be executed for non-shared IOMMU.
>>> So, move this code to x86-specific file in order not to expose a possible bug.
>>
>> Yes, this helps.
>
> Having thought about this some more, what's still missing is a
> clear explanation why this new need of a non-stub mfn_to_gmfn()
> isn't finally enough of a reason to introduce an M2P on ARM. We
> currently have several uses already which ARM fakes one way or
> another:
> - gnttab_shared_gmfn()
This does not use mfn_to_gmfn on ARM.
> - gnttab_status_gmfn()
gnttab_status_gmfn() returns 0 so far. I have to look at this one.
> - memory_exchange()
Memory exchange does not work on ARM today and will require more work
than that. When I looked at the code a couple of years ago, it was
possible to drop the call to mfn_to_gmfn().
> - getdomaininfo()
We could rework to store the gmfn in arch_domain.
> With this I think there's quite a bit of justification needed to keep
> going without M2P on ARM.
As said in a previous thread, I made a quick calculation, ARM32 supports
up 40-bit PA and IPA (e.g guest address), which means 28-bits of
MFN/GFN. The GFN would have to be stored in a 32-bit for alignment, so
we would need 2^28 * 4 = 1GiB of virtual address space and potentially
physical memory. We don't have 1GB of VA space free on 32-bit right now.
ARM64 currently supports up to 48-bit PA and 48-bit IPA, which means
36-bits of MFN/GFN. The GFN would have to be stored in 64-bit for
alignment, so we would need 2^36 * 8 = 512GiB of virtual address space
and potentially physical memory. While virtual address space is not a
problem, the memory is a problem for embedded platform. We want Xen to
be as lean as possible.
So the M2P is not a solution on ARM. A better approach is to drop those
calls from common code and replace by something different (as we did for
gnttab_shared_mfn).
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-05-15 7:42 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-10 14:03 [PATCH v1 00/10] "Non-shared" IOMMU support on ARM Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 01/10] xen/device-tree: Add dt_count_phandle_with_args helper Oleksandr Tyshchenko
2017-05-10 14:50 ` Jan Beulich
2017-05-10 15:06 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 02/10] iommu: Add extra order argument to the IOMMU APIs and platform callbacks Oleksandr Tyshchenko
2017-05-12 14:23 ` Jan Beulich
2017-05-12 15:50 ` Oleksandr Tyshchenko
2017-05-12 16:17 ` Jan Beulich
2017-05-12 16:25 ` Oleksandr Tyshchenko
2017-05-15 7:22 ` Jan Beulich
2017-05-15 10:43 ` Oleksandr Tyshchenko
2017-05-15 12:33 ` Jan Beulich
2017-05-16 12:48 ` Oleksandr Tyshchenko
2017-05-16 13:11 ` Jan Beulich
2017-05-17 15:28 ` Oleksandr Tyshchenko
2017-05-17 15:39 ` Jan Beulich
2017-05-17 18:49 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 03/10] xen/arm: p2m: Add helper to convert p2m type to IOMMU flags Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 04/10] xen/arm: p2m: Update IOMMU mapping whenever possible if page table is not shared Oleksandr Tyshchenko
2017-05-11 11:24 ` Julien Grall
2017-05-11 14:19 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 05/10] iommu/arm: Re-define iommu_use_hap_pt(d) as iommu_hap_pt_share Oleksandr Tyshchenko
2017-05-11 11:28 ` Julien Grall
2017-05-11 14:38 ` Oleksandr Tyshchenko
2017-05-11 17:58 ` Julien Grall
2017-05-11 18:21 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 06/10] iommu: Add extra use_iommu argument to iommu_domain_init() Oleksandr Tyshchenko
2017-05-12 14:31 ` Jan Beulich
2017-05-12 17:00 ` Oleksandr Tyshchenko
2017-05-15 7:27 ` Jan Beulich
2017-05-17 19:52 ` Julien Grall
2017-05-18 8:38 ` Jan Beulich
2017-05-18 17:41 ` Oleksandr Tyshchenko
2017-05-19 6:30 ` Jan Beulich
2017-05-19 8:56 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 07/10] iommu/arm: Add alloc_page_table platform callback Oleksandr Tyshchenko
2017-05-11 11:38 ` Julien Grall
2017-05-11 14:00 ` Oleksandr Tyshchenko
2017-05-11 18:06 ` Julien Grall
2017-05-11 18:43 ` Oleksandr Tyshchenko
2017-05-12 14:36 ` Jan Beulich
2017-05-10 14:03 ` [PATCH v1 08/10] iommu: Split iommu_hwdom_init() into arch specific parts Oleksandr Tyshchenko
2017-05-12 14:41 ` Jan Beulich
2017-05-12 15:25 ` Oleksandr Tyshchenko
2017-05-12 15:34 ` Jan Beulich
2017-05-15 7:20 ` Jan Beulich
2017-05-15 7:42 ` Julien Grall [this message]
2017-05-15 8:19 ` Jan Beulich
2017-05-15 11:45 ` Julien Grall
2017-05-15 12:43 ` Jan Beulich
2017-05-17 15:45 ` Oleksandr Tyshchenko
2017-05-17 16:01 ` Jan Beulich
2017-05-17 18:51 ` Oleksandr Tyshchenko
2017-05-17 20:30 ` Julien Grall
2017-05-18 8:53 ` Jan Beulich
2017-05-18 18:06 ` Oleksandr Tyshchenko
2017-05-19 6:33 ` Jan Beulich
2017-05-10 14:03 ` [PATCH v1 09/10] xen/arm: Add use_iommu flag to xen_arch_domainconfig Oleksandr Tyshchenko
2017-05-11 11:42 ` Julien Grall
2017-05-11 14:04 ` Oleksandr Tyshchenko
2017-05-10 14:03 ` [PATCH v1 10/10] xen/arm: domain_build: Don't expose the "iommus" property to the guest Oleksandr Tyshchenko
2017-05-11 11:58 ` Julien Grall
2017-05-11 14:15 ` Oleksandr Tyshchenko
2017-05-11 18:07 ` Julien Grall
2017-05-11 18:19 ` Oleksandr Tyshchenko
2017-05-11 18:19 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd6d8929-e182-7d77-54a5-944d9889997c@arm.com \
--to=julien.grall@arm.com \
--cc=JBeulich@suse.com \
--cc=ian.jackson@eu.citrix.com \
--cc=nd@arm.com \
--cc=olekstysh@gmail.com \
--cc=sstabellini@kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.