Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-21 Thread Tom Lendacky
On 6/21/2017 11:59 AM, Borislav Petkov wrote: On Wed, Jun 21, 2017 at 05:37:22PM +0200, Joerg Roedel wrote: Do you mean this is like the last exception case in that document above: " - Pointers to data structures in coherent memory which might be modified by I/O devices can, sometimes,

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-21 Thread Borislav Petkov
On Wed, Jun 21, 2017 at 05:37:22PM +0200, Joerg Roedel wrote: > > Do you mean this is like the last exception case in that document above: > > > > " > > - Pointers to data structures in coherent memory which might be modified > > by I/O devices can, sometimes, legitimately be volatile. A ri

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-21 Thread Joerg Roedel
On Thu, Jun 15, 2017 at 11:41:12AM +0200, Borislav Petkov wrote: > On Wed, Jun 14, 2017 at 03:40:28PM -0500, Tom Lendacky wrote: > > > WARNING: Use of volatile is usually wrong: see > > > Documentation/process/volatile-considered-harmful.rst > > > #134: FILE: drivers/iommu/amd_iommu.c:866: > > > +

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-19 Thread Borislav Petkov
On Thu, Jun 15, 2017 at 11:33:41AM -0500, Tom Lendacky wrote: > Changing the signature back reverts to the original way, so this can be > looked at separate from this patchset then. Right, the patch which added the volatile thing was this one: 4bf5beef578e ("iommu/amd: Don't put completion-wait

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-15 Thread Konrad Rzeszutek Wilk
On June 15, 2017 11:33:22 AM EDT, Borislav Petkov wrote: >On Thu, Jun 15, 2017 at 09:59:45AM -0500, Tom Lendacky wrote: >> Actually the detection routine, amd_iommu_detect(), is part of the >> IOMMU_INIT_FINISH macro support which is called early through >mm_init() >> from start_kernel() and that

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-15 Thread Tom Lendacky
On 6/15/2017 10:33 AM, Borislav Petkov wrote: On Thu, Jun 15, 2017 at 09:59:45AM -0500, Tom Lendacky wrote: Actually the detection routine, amd_iommu_detect(), is part of the IOMMU_INIT_FINISH macro support which is called early through mm_init() from start_kernel() and that routine is called be

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-15 Thread Borislav Petkov
On Thu, Jun 15, 2017 at 09:59:45AM -0500, Tom Lendacky wrote: > Actually the detection routine, amd_iommu_detect(), is part of the > IOMMU_INIT_FINISH macro support which is called early through mm_init() > from start_kernel() and that routine is called before init_amd(). Ah, we do that there too:

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-15 Thread Tom Lendacky
On 6/15/2017 4:41 AM, Borislav Petkov wrote: On Wed, Jun 14, 2017 at 03:40:28PM -0500, Tom Lendacky wrote: I was trying to keep all the logic for it here in the SME related files rather than put it in the iommu code itself. But it is easy enough to move if you think it's worth it. Yes please -

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-15 Thread Borislav Petkov
On Wed, Jun 14, 2017 at 03:40:28PM -0500, Tom Lendacky wrote: > I was trying to keep all the logic for it here in the SME related files > rather than put it in the iommu code itself. But it is easy enough to > move if you think it's worth it. Yes please - the less needlessly global symbols, the be

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-14 Thread Tom Lendacky
On 6/14/2017 12:42 PM, Borislav Petkov wrote: On Wed, Jun 07, 2017 at 02:17:45PM -0500, Tom Lendacky wrote: The IOMMU is programmed with physical addresses for the various tables and buffers that are used to communicate between the device and the driver. When the driver allocates this memory it

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-14 Thread Borislav Petkov
On Wed, Jun 07, 2017 at 02:17:45PM -0500, Tom Lendacky wrote: > The IOMMU is programmed with physical addresses for the various tables > and buffers that are used to communicate between the device and the > driver. When the driver allocates this memory it is encrypted. In order > for the IOMMU to a

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-08 Thread Tom Lendacky
On 6/7/2017 9:38 PM, Nick Sarnie wrote: On Wed, Jun 7, 2017 at 3:17 PM, Tom Lendacky wrote: The IOMMU is programmed with physical addresses for the various tables and buffers that are used to communicate between the device and the driver. When the driver allocates this memory it is encrypted. I

Re: [PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-07 Thread Nick Sarnie
On Wed, Jun 7, 2017 at 3:17 PM, Tom Lendacky wrote: > The IOMMU is programmed with physical addresses for the various tables > and buffers that are used to communicate between the device and the > driver. When the driver allocates this memory it is encrypted. In order > for the IOMMU to access the

[PATCH v6 26/34] iommu/amd: Allow the AMD IOMMU to work with memory encryption

2017-06-07 Thread Tom Lendacky
The IOMMU is programmed with physical addresses for the various tables and buffers that are used to communicate between the device and the driver. When the driver allocates this memory it is encrypted. In order for the IOMMU to access the memory as encrypted the encryption mask needs to be included