From: Oleksandr <olekstysh@gmail.com>
To: Paul Durrant <Paul.Durrant@citrix.com>,
'Julien Grall' <Julien.Grall@arm.com>,
'Jan Beulich' <jbeulich@suse.com>
Cc: Petre Pircalabu <ppircalabu@bitdefender.com>,
Stefano Stabellini <sstabellini@kernel.org>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Wei Liu <wl@xen.org>,
KonradRzeszutek Wilk <konrad.wilk@oracle.com>,
Andrew Cooper <Andrew.Cooper3@citrix.com>,
"Tim \(Xen.org\)" <tim@xen.org>,
George Dunlap <George.Dunlap@citrix.com>,
Tamas K Lengyel <tamas@tklengyel.com>,
David Scott <dave@recoil.org>,
Anthony Perard <anthony.perard@citrix.com>,
Ian Jackson <Ian.Jackson@citrix.com>, nd <nd@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v13 0/4] add per-domain IOMMU control
Date: Thu, 26 Sep 2019 12:22:06 +0300 [thread overview]
Message-ID: <dcf0a05d-22f3-53d3-558e-9bb3bf05d76f@gmail.com> (raw)
In-Reply-To: <3c719420dabd4cc1860f0d687cdc3f78@AMSPEX02CL03.citrite.net>
On 26.09.19 11:39, Paul Durrant wrote:
Hi Paul
>>
>>>> [CC Julien]
>>>>
>>>>
>>>> Hi Paul
>>>>
>>>> I may mistake, but looks like
>>>>
>>>> 80ff3d338dc93260b41ffeeebb0f852c2edef9ce iommu: tidy up
>>>> iommu_use_hap_pt() and need_iommu_pt_sync() macros
>>>>
>>>> triggers ASSERT_UNREACHABLE on Arm if no IOMMU has been found (I built
>>>> with my platform's IOMMU driver disabled: # CONFIG_IPMMU_VMSA is not set) .
>>>>
>>>> So, iommu_setup() calls clear_iommu_hap_pt_share() with
>>>> iommu_hap_pt_share being set (CONFIG_IOMMU_FORCE_PT_SHARE=y) which,
>>>> actually, triggers ASSERT.
>>>>
>>> Here a minimal patch, leaving 'force pt share' in place. Does this avoid the problem?
>>>
>>> ---8<---
>>> diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
>>> index e8763c7fdf..f88a285e7f 100644
>>> --- a/xen/common/sysctl.c
>>> +++ b/xen/common/sysctl.c
>>> @@ -268,9 +268,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
>>> pi->max_mfn = get_upper_mfn_bound();
>>> arch_do_physinfo(pi);
>>> if ( iommu_enabled )
>>> + {
>>> pi->capabilities |= XEN_SYSCTL_PHYSCAP_directio;
>>> - if ( iommu_hap_pt_share )
>>> - pi->capabilities |= XEN_SYSCTL_PHYSCAP_iommu_hap_pt_share;
>>> + if ( iommu_hap_pt_share )
>>> + pi->capabilities |= XEN_SYSCTL_PHYSCAP_iommu_hap_pt_share;
>>> + }
>>>
>>> if ( copy_to_guest(u_sysctl, op, 1) )
>>> ret = -EFAULT;
>>> diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
>>> index 7c3003f3f1..6a10a24128 100644
>>> --- a/xen/include/xen/iommu.h
>>> +++ b/xen/include/xen/iommu.h
>>> @@ -68,8 +68,6 @@ static inline void clear_iommu_hap_pt_share(void)
>>> {
>>> #ifndef iommu_hap_pt_share
>>> iommu_hap_pt_share = false;
>>> -#elif iommu_hap_pt_share
>>> - ASSERT_UNREACHABLE();
>>> #endif
>> IHMO, calling this function is a mistake on platform only supporting
>> shared page-table so the ASSERT() should be kept here.
>>
>> This raises the question why the function is actually called from common
>> code. iommu_hap_enabled() should technically not be used in any code if
>> the IOMMU is not enabled/present. So what are you trying to prevent here?
> What I'm trying to prevent, on x86, is a situation where the iommu_enabled == false but iommu_hap_pt_share == true. I had, mistakenly, believed that iommu_enabled would never be false for ARM but it seems this is not the case so that situation has to be tolerated. I guess, given the other hunk of my patch, I can actually leave the ASSERT in place and avoid making the call from common code, in which case the function ought to move into an x86 header as well.
Not all Arm based SoCs (which supported by Xen) contains SMMU (the only
one supported driver at the moment) or IPMMU-VMSA (on review now, but,
it will be under CONFIG_EXPERT when merged, so disabled by default). So,
"iommu_enabled" can be false.
--
Regards,
Oleksandr Tyshchenko
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
prev parent reply other threads:[~2019-09-26 9:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 10:41 [Xen-devel] [PATCH v13 0/4] add per-domain IOMMU control Paul Durrant
2019-09-18 10:41 ` [Xen-devel] [PATCH v13 1/4] remove late (on-demand) construction of IOMMU page tables Paul Durrant
2019-09-25 9:00 ` Paul Durrant
2019-09-25 9:16 ` Wei Liu
2019-09-18 10:41 ` [Xen-devel] [PATCH v13 2/4] iommu: tidy up iommu_use_hap_pt() and need_iommu_pt_sync() macros Paul Durrant
2019-09-18 10:41 ` [Xen-devel] [PATCH v13 3/4] tools/ocaml: abi check: Cope with consecutive relevant enums Paul Durrant
2019-09-18 10:41 ` [Xen-devel] [PATCH v13 4/4] introduce a 'passthrough' configuration option to xl.cfg Paul Durrant
2019-09-18 15:20 ` Anthony PERARD
2019-09-25 8:40 ` [Xen-devel] [PATCH v13 0/4] add per-domain IOMMU control Paul Durrant
2019-09-25 8:50 ` Jan Beulich
2019-09-25 8:56 ` Paul Durrant
2019-09-25 15:49 ` Oleksandr
2019-09-25 15:55 ` Paul Durrant
2019-09-25 16:03 ` Paul Durrant
2019-09-25 16:04 ` Paul Durrant
2019-09-25 16:14 ` Oleksandr
2019-09-25 16:10 ` Paul Durrant
2019-09-25 16:24 ` Oleksandr
2019-09-25 18:07 ` Oleksandr
2019-09-26 8:32 ` Paul Durrant
2019-09-25 21:34 ` Julien Grall
2019-09-26 8:39 ` Paul Durrant
2019-09-26 9:13 ` Julien Grall
2019-09-26 9:17 ` Paul Durrant
2019-09-26 9:26 ` Julien Grall
2019-09-26 9:22 ` Oleksandr [this message]
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=dcf0a05d-22f3-53d3-558e-9bb3bf05d76f@gmail.com \
--to=olekstysh@gmail.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=George.Dunlap@citrix.com \
--cc=Ian.Jackson@citrix.com \
--cc=Julien.Grall@arm.com \
--cc=Paul.Durrant@citrix.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=anthony.perard@citrix.com \
--cc=dave@recoil.org \
--cc=jbeulich@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=nd@arm.com \
--cc=ppircalabu@bitdefender.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=tamas@tklengyel.com \
--cc=tim@xen.org \
--cc=wl@xen.org \
--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.