All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Singh <Rahul.Singh@arm.com>
To: Julien Grall <julien@xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	"lucmiccio@gmail.com" <lucmiccio@gmail.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Bertrand Marquis <Bertrand.Marquis@arm.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH] xen/arm: fix gnttab_need_iommu_mapping
Date: Mon, 8 Feb 2021 18:19:04 +0000	[thread overview]
Message-ID: <3EEEACBE-2028-4DE9-A3BD-053FF82CFC75@arm.com> (raw)
In-Reply-To: <7e963696-a21f-4c79-5f35-a342982bee86@xen.org>

Hello Julien,

> On 8 Feb 2021, at 6:11 pm, Julien Grall <julien@xen.org> wrote:
> 
> 
> 
> On 08/02/2021 18:06, Rahul Singh wrote:
>>> On 6 Feb 2021, at 12:38 am, Stefano Stabellini <sstabellini@kernel.org> wrote:
>>> 
>>> Commit 91d4eca7add broke gnttab_need_iommu_mapping on ARM.
>>> The offending chunk is:
>>> 
>>> #define gnttab_need_iommu_mapping(d)                    \
>>> -    (is_domain_direct_mapped(d) && need_iommu(d))
>>> +    (is_domain_direct_mapped(d) && need_iommu_pt_sync(d))
>>> 
>>> On ARM we need gnttab_need_iommu_mapping to be true for dom0 when it is
>>> directly mapped, like the old check did, but the new check is always
>>> false.
>>> 
>>> In fact, need_iommu_pt_sync is defined as dom_iommu(d)->need_sync and
>>> need_sync is set as:
>>> 
>>>    if ( !is_hardware_domain(d) || iommu_hwdom_strict )
>>>        hd->need_sync = !iommu_use_hap_pt(d);
>>> 
>>> iommu_hwdom_strict is actually supposed to be ignored on ARM, see the
>>> definition in docs/misc/xen-command-line.pandoc:
>>> 
>>>    This option is hardwired to true for x86 PVH dom0's (as RAM belonging to
>>>    other domains in the system don't live in a compatible address space), and
>>>    is ignored for ARM.
>>> 
>>> But aside from that, the issue is that iommu_use_hap_pt(d) is true,
>>> hence, hd->need_sync is false, and gnttab_need_iommu_mapping(d) is false
>>> too.
>>> 
>>> As a consequence, when using PV network from a domU on a system where
>>> IOMMU is on from Dom0, I get:
>>> 
>>> (XEN) smmu: /smmu@fd800000: Unhandled context fault: fsr=0x402, iova=0x8424cb148, fsynr=0xb0001, cb=0
>>> [   68.290307] macb ff0e0000.ethernet eth0: DMA bus error: HRESP not OK
>> I also observed the IOMMU fault when DOMU guest is created and great table is used when IOMMU is enabled. I fixed the error in different way but I am not sure if you also observing the same error. I submitted the patch to pci-passthrough integration branch. Please have a look once if that make sense.
> 
> I belive this is the same error as Stefano has observed. However, your patch will unfortunately not work if you have a system with a mix of protected and non-protected DMA-capable devices.

Yes you are right thats what I though when I fixed the error but then I thought in different direction if IOMMU is enabled system wise every device should be protected by IOMMU. My understanding might be wrong.

Regards,
Rahul

> Cheers,
> 
> -- 
> Julien Grall



  reply	other threads:[~2021-02-08 18:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-06  0:38 [PATCH] xen/arm: fix gnttab_need_iommu_mapping Stefano Stabellini
2021-02-06 11:09 ` Julien Grall
2021-02-08  9:13   ` Julien Grall
2021-02-08 17:53   ` Stefano Stabellini
2021-02-08 18:06 ` Rahul Singh
2021-02-08 18:11   ` Julien Grall
2021-02-08 18:19     ` Rahul Singh [this message]
2021-02-08 18:49       ` Julien Grall
2021-02-09 13:10         ` Rahul Singh

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=3EEEACBE-2028-4DE9-A3BD-053FF82CFC75@arm.com \
    --to=rahul.singh@arm.com \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=julien@xen.org \
    --cc=lucmiccio@gmail.com \
    --cc=sstabellini@kernel.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.