public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Raj, Ashok" <ashok.raj@intel.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	kevin.tian@intel.com, jacob.jun.pan@intel.com,
	yi.l.liu@intel.com, sanjay.k.kumar@intel.com,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	Ashok Raj <ashok.raj@intel.com>
Subject: Re: [PATCH 2/5] iommu/vt-d: Remove WO permissions on second-level paging entries
Date: Mon, 8 Mar 2021 11:47:46 -0800	[thread overview]
Message-ID: <20210308194746.GA15436@otc-nc-03> (raw)
In-Reply-To: <c7bffaee-6c3c-3254-a71a-d66d023d1e58@linux.intel.com>

Hi Joerg

On Mon, Mar 08, 2021 at 09:58:26AM +0800, Lu Baolu wrote:
> Hi Joerg,
> 
> On 3/4/21 8:26 PM, Joerg Roedel wrote:
> >On Thu, Feb 25, 2021 at 02:26:51PM +0800, Lu Baolu wrote:
> >>When the first level page table is used for IOVA translation, it only
> >>supports Read-Only and Read-Write permissions. The Write-Only permission
> >>is not supported as the PRESENT bit (implying Read permission) should
> >>always set. When using second level, we still give separate permissions
> >>that allows WriteOnly which seems inconsistent and awkward. There is no
> >>use case we can think off, hence remove that configuration to make it
> >>consistent.
> >
> >No use-case for WriteOnly mappings? How about DMA_FROM_DEVICE mappings?
> >
> 
> The statement of no use case is not correct. Sorry about it.
> 
> As we have moved to use first level for IOVA translation, the first
> level page table entry only provides RO and RW permissions. So if any
> device driver specifies DMA_FROM_DEVICE attribution, it will get RW
> permission in the page table. This patch aims to make the permissions
> of second level and first level consistent. No impact on the use of
> DMA_FROM_DEVICE attribution.
> 

That is the primary motivation, given that we have moved to 1st level for
general IOVA, first level doesn't have a WO mapping. I didn't know enough
about the history to determine if a WO without a READ is very useful. I
guess the ZLR was invented to support those cases without a READ in PCIe. I

Early Intel IOMMU's didn't handle ZLR properly, until we fixed it in the
next generation. It just seemed opposite to the CPU page-tables, and we
wanted to have consistent behavior. After moving to 1st level, we don't
want things to work sometimes, and break if we use 2nd level for the same
mappings.

Hope this helps

Cheers,
Ashok

  reply	other threads:[~2021-03-08 19:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  6:26 [PATCH 0/5] iommu/vt-d: Several misc fixes Lu Baolu
2021-02-25  6:26 ` [PATCH 1/5] iommu/vt-d: Report the right page fault address Lu Baolu
2021-02-25  6:26 ` [PATCH 2/5] iommu/vt-d: Remove WO permissions on second-level paging entries Lu Baolu
2021-03-04 12:26   ` Joerg Roedel
2021-03-08  1:58     ` Lu Baolu
2021-03-08 19:47       ` Raj, Ashok [this message]
2021-03-18  9:12         ` Joerg Roedel
2021-03-19  0:24           ` Lu Baolu
2021-02-25  6:26 ` [PATCH 3/5] iommu/vt-d: Invalidate PASID cache when root/context entry changed Lu Baolu
2021-02-25  6:26 ` [PATCH 4/5] iommu/vt-d: Use user privilege for RID2PASID translation Lu Baolu
2021-02-25  6:26 ` [PATCH 5/5] iommu/vt-d: Avoid unnecessary cache flush in pasid entry teardown Lu Baolu

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=20210308194746.GA15436@otc-nc-03 \
    --to=ashok.raj@intel.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jacob.jun.pan@intel.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sanjay.k.kumar@intel.com \
    --cc=will@kernel.org \
    --cc=yi.l.liu@intel.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