From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: Tom Lendacky <thomas.lendacky-5C7GfCeVMHo@public.gmane.org>
Cc: Konrad Rzeszutek Wilk
<konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Muli Ben-Yehuda <mulix-BzGcCpaT2IbYtjvyW6yDsg@public.gmane.org>,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH 11/13] dma-direct: handle the memory encryption bit in common code
Date: Tue, 13 Mar 2018 14:10:05 +0100 [thread overview]
Message-ID: <20180313131005.GA6260@lst.de> (raw)
In-Reply-To: <0c9d3e4a-8407-282a-73eb-21d28047e0e3-5C7GfCeVMHo@public.gmane.org>
On Mon, Mar 12, 2018 at 02:48:51PM -0500, Tom Lendacky wrote:
> Ok, I found one issue that allows this to work when the IOMMU isn't
> enabled (see below).
Thanks, folded!
> But the bigger issue is when the IOMMU is enabled. The IOMMU code uses
> a common mapping routine to create the I/O page tables. This routine
> assumes that all memory being mapped is encrypted and therefore sets the
> encryption bit in the I/O page tables. With this patch, the call to
> dma_alloc_direct() now returns un-encrypted memory which results in an
> encryption mis-match. I think keeping dma_alloc_direct() as it was prior
> to this patch is the way to go. It allows SME DMA allocations to remain
> encrypted and avoids added complexity in the amd_iommu.c file. This
> would mean that SEV would still have special DMA operations (so that the
> alloc/free can change the memory to un-encrypted).
>
> What do you think?
In terms of logic you are right. I still don't like keeping a just
slightly tweaked version of dma_alloc_direct around just for this, it
will be perpetually out of sync in terms of features and bug fixes.
What do you think about this version that does the decision at runtime:
http://git.infradead.org/users/hch/misc.git/commitdiff/b89f24dc856595dc7610d672bf077195ab0dabf4
The full tree is available here for testing:
git://git.infradead.org/users/hch/misc.git dma-direct-x86
next prev parent reply other threads:[~2018-03-13 13:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 17:46 use generic dma-direct and swiotlb code for x86 Christoph Hellwig
2018-03-05 17:46 ` [PATCH 08/13] iommu/intel-iommu: cleanup intel_{alloc,free}_coherent Christoph Hellwig
2018-03-05 17:46 ` [PATCH 10/13] set_memory.h: provide set_memory_{en,de}crypted stubs Christoph Hellwig
2018-03-05 17:46 ` [PATCH 11/13] dma-direct: handle the memory encryption bit in common code Christoph Hellwig
[not found] ` <20180305174655.9878-12-hch-jcswGhMUV9g@public.gmane.org>
2018-03-12 18:29 ` Tom Lendacky
[not found] ` <114e27be-5814-4258-4985-af08763c8a74-5C7GfCeVMHo@public.gmane.org>
2018-03-12 19:48 ` Tom Lendacky
[not found] ` <0c9d3e4a-8407-282a-73eb-21d28047e0e3-5C7GfCeVMHo@public.gmane.org>
2018-03-13 13:10 ` Christoph Hellwig [this message]
[not found] ` <20180313131005.GA6260-jcswGhMUV9g@public.gmane.org>
2018-03-14 15:44 ` Tom Lendacky
[not found] ` <69e98163-beca-fb8a-a26b-66dfeef2f689-5C7GfCeVMHo@public.gmane.org>
2018-03-19 10:39 ` Christoph Hellwig
[not found] ` <20180319103939.GA23333-jcswGhMUV9g@public.gmane.org>
2018-03-19 13:17 ` Tom Lendacky
[not found] ` <20180305174655.9878-1-hch-jcswGhMUV9g@public.gmane.org>
2018-03-05 17:46 ` [PATCH 01/13] x86: remove X86_PPRO_FENCE Christoph Hellwig
[not found] ` <20180305174655.9878-2-hch-jcswGhMUV9g@public.gmane.org>
2018-03-08 21:06 ` Konrad Rzeszutek Wilk
2018-03-05 17:46 ` [PATCH 02/13] x86: remove dma_alloc_coherent_mask Christoph Hellwig
[not found] ` <20180305174655.9878-3-hch-jcswGhMUV9g@public.gmane.org>
2018-03-08 21:30 ` Konrad Rzeszutek Wilk
2018-03-05 17:46 ` [PATCH 03/13] x86: use dma-direct Christoph Hellwig
2018-03-05 17:46 ` [PATCH 04/13] x86: use generic swiotlb_ops Christoph Hellwig
[not found] ` <20180305174655.9878-5-hch-jcswGhMUV9g@public.gmane.org>
2018-03-08 16:03 ` Robin Murphy
[not found] ` <825d4b49-8fa2-e670-75e3-77a88258af3a-5wv7dgnIgG8@public.gmane.org>
2018-03-12 8:26 ` Christoph Hellwig
2018-03-05 17:46 ` [PATCH 05/13] x86/amd_gart: look at coherent_dma_mask instead of GFP_DMA Christoph Hellwig
2018-03-05 17:46 ` [PATCH 06/13] x86/amd_gart: use dma_direct_{alloc,free} Christoph Hellwig
2018-03-05 17:46 ` [PATCH 07/13] iommu/amd_iommu: " Christoph Hellwig
2018-03-05 17:46 ` [PATCH 09/13] x86: remove dma_alloc_coherent_gfp_flags Christoph Hellwig
2018-03-05 17:46 ` [PATCH 12/13] swiotlb: remove swiotlb_set_mem_attributes Christoph Hellwig
2018-03-05 17:46 ` [PATCH 13/13] swiotlb: remove swiotlb_{alloc,free}_coherent Christoph Hellwig
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=20180313131005.GA6260@lst.de \
--to=hch-jcswghmuv9g@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mulix-BzGcCpaT2IbYtjvyW6yDsg@public.gmane.org \
--cc=thomas.lendacky-5C7GfCeVMHo@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 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).