linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
To: Auger Eric <eric.auger@redhat.com>,
	"eric.auger.pro@gmail.com" <eric.auger.pro@gmail.com>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
	joro@8bytes.org, alex.williamson@redhat.com,
	jacob.jun.pan@linux.intel.com, "yi.l.liu\""@linux.intel.com,
	will.deacon@arm.com, robin.murphy@arm.com
Cc: marc.zyngier@arm.com, peter.maydell@linaro.org, christoffer.dall@arm.com
Subject: Re: [RFC 02/13] iommu: Introduce tlb_invalidate API
Date: Mon, 3 Sep 2018 13:28:03 +0100	[thread overview]
Message-ID: <8a3b8fcd-48c4-7d9e-7672-e73431bcde5b@arm.com> (raw)
In-Reply-To: <95e423a6-3f67-d101-a391-369a1493dff9@redhat.com>

On 31/08/2018 15:07, Auger Eric wrote:
>> Since the ioctl will be used to combine invalidations (invalidate both
>> ATC and TLB with a single call), we need an additional ASID field for
>> the SMMU - ATC is invalidated by PASID, TLB by ASID. I used to call it
>> "tag", but I'm leaning towards "arch_id" now
>> (http://www.linux-arm.org/git?p=linux-jpb.git;a=commitdiff;h=40fdef74816dd8d8d113100b9e0162fab4cec28d)
> 
> I aknowledge I am not crystal clear about that. for a given iommu_domain
> don't you have a single asid. Can't you retrieve the asid from the
> iommu_domain/arm_smmu_domain/arm_smmu_s1_cfg/arm_smmu_ctx_desc.asid?
> Here again I am confused bout the dual iommu_domain/struct device
> parameters.

In nested mode, ASIDs are allocated by the guest and written into the CD
table. Even if there is a single CD it will still be private to the
guest. When receiving the invalidation, the host could walk the CD
tables to retrieve the ASID, but it's not guaranteed to be here anymore:
the guest could well clear a CD before sending the invalidate command.

> I have another trouble while doing the QEMU integration.
> When the guests does an NH_ALL, this propagates an invalidation on the
> whole IPA range and we must discriminate that from regular NH_VA calls.
> How would you encode the NH_ALL with this API?

I think that translates to an invalidate-all for the domain:

struct tlb_iommu_invalidate_info info = {
	.hdr.type = IOMMU_INV_TYPE_TLB,
	.granularity = IOMMU_INV_GRANU_DOMAIN_ALL_PASID,
};

Reading the spec again, I though the API was missing a way to encode
TLBI_NH_VAA, invalidate a range for all ASIDs. Although it feels
contrived, we could represent it with the following:

struct tlb_iommu_invalidate_info info = {
	.hdr.type = IOMMU_INV_TYPE_TLB,
	.granularity = IOMMU_INV_GRANU_PAGE_PASID,
	.flags = IOMMU_INVALIDATE_GLOBAL_PAGE,
	.addr = ...
};

Thanks,
Jean

  reply	other threads:[~2018-09-03 12:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1535026656-8450-1-git-send-email-eric.auger@redhat.com>
     [not found] ` <1535026656-8450-2-git-send-email-eric.auger@redhat.com>
2018-08-23 15:25   ` [RFC 01/13] iommu: Introduce bind_guest_stage API Auger Eric
2018-08-31 13:11     ` Jean-Philippe Brucker
2018-08-31 13:52       ` Auger Eric
2018-09-03 12:19         ` Jean-Philippe Brucker
2018-09-04  7:57         ` Tian, Kevin
2018-09-04  8:10           ` Auger Eric
2018-09-04  8:34             ` Tian, Kevin
2018-09-04  8:41               ` Auger Eric
2018-09-04  8:43                 ` Tian, Kevin
2018-09-04  9:53                 ` Jean-Philippe Brucker
2018-09-05  0:36                   ` Tian, Kevin
     [not found]   ` <A2975661238FB949B60364EF0F2C257439CCE9EE@SHSMSX104.ccr.corp.intel.com>
2018-08-24 13:20     ` Auger Eric
     [not found] ` <1535026656-8450-3-git-send-email-eric.auger@redhat.com>
2018-08-31 13:17   ` [RFC 02/13] iommu: Introduce tlb_invalidate API Jean-Philippe Brucker
2018-08-31 14:07     ` Auger Eric
2018-09-03 12:28       ` Jean-Philippe Brucker [this message]
2018-09-03 12:41         ` Auger Eric
2018-09-03 13:41           ` Jean-Philippe Brucker
     [not found] ` <1535026656-8450-10-git-send-email-eric.auger@redhat.com>
2018-08-31 13:20   ` [RFC 09/13] iommu/smmuv3: Get prepared for nested stage support Jean-Philippe Brucker
2018-08-31 14:11     ` Auger Eric
2018-09-03 12:29       ` Jean-Philippe Brucker
2018-09-03 12:48         ` Auger Eric

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=8a3b8fcd-48c4-7d9e-7672-e73431bcde5b@arm.com \
    --to=jean-philippe.brucker@arm.com \
    --cc="yi.l.liu\""@linux.intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=christoffer.dall@arm.com \
    --cc=eric.auger.pro@gmail.com \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=peter.maydell@linaro.org \
    --cc=robin.murphy@arm.com \
    --cc=will.deacon@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).