Re: [PATCH] dma-direct: Force unencrypted DMA under SME for certain DMA masks

2019-07-24 Thread Kirill A. Shutemov
dev->bus_dma_mask); > + > + if (dma_dev_mask <= dma_enc_mask) > + return true; Hm. What is wrong with the dev mask being equal to enc mask? IIUC, it means that device mask is wide enough to cover encryption bit, doesn't it? > + } > + > + return false; > +} -- Kirill A. Shutemov

Re: [PATCH] dma-direct: Force unencrypted DMA under SME for certain DMA masks

2019-07-24 Thread Kirill A. Shutemov
On Wed, Jul 24, 2019 at 05:34:26PM +, Lendacky, Thomas wrote: > On 7/24/19 12:06 PM, Robin Murphy wrote: > > On 24/07/2019 17:42, Lendacky, Thomas wrote: > >> On 7/24/19 10:55 AM, Kirill A. Shutemov wrote: > >>> On Wed, Jul 10, 2019 at 07:01:19PM +, Lendacky,

Re: [PATCH] dma-direct: Force unencrypted DMA under SME for certain DMA masks

2019-07-24 Thread Kirill A. Shutemov
On Wed, Jul 24, 2019 at 06:30:21PM +, Lendacky, Thomas wrote: > On 7/24/19 1:11 PM, Kirill A. Shutemov wrote: > > On Wed, Jul 24, 2019 at 05:34:26PM +, Lendacky, Thomas wrote: > >> On 7/24/19 12:06 PM, Robin Murphy wrote: > >>> On 24/07/2019 17:42, Lendacky, T

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-12 Thread Kirill A. Shutemov
On Wed, Aug 11, 2021 at 10:52:55AM -0500, Tom Lendacky wrote: > On 8/11/21 7:19 AM, Kirill A. Shutemov wrote: > > On Tue, Aug 10, 2021 at 02:48:54PM -0500, Tom Lendacky wrote: > >> On 8/10/21 1:45 PM, Kuppuswamy, Sathyanarayanan wrote: > >>> > >>> &g

Re: [PATCH 07/11] treewide: Replace the use of mem_encrypt_active() with prot_guest_has()

2021-08-11 Thread Kirill A. Shutemov
ared/unencrypted > area, though? Or since it is shared, there's actually nothing you need to > do (the bss decrpyted section exists even if CONFIG_AMD_MEM_ENCRYPT is not > configured)? AFAICS, only kvmclock uses __bss_decrypted. We don't enable kvmclock in TDX at the moment. It may change in the future. -- Kirill A. Shutemov ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-21 Thread Kirill A. Shutemov
On Tue, Sep 21, 2021 at 04:43:59PM -0500, Tom Lendacky wrote: > On 9/21/21 4:34 PM, Kirill A. Shutemov wrote: > > On Tue, Sep 21, 2021 at 11:27:17PM +0200, Borislav Petkov wrote: > > > On Wed, Sep 22, 2021 at 12:20:59AM +0300, Kirill A. Shutemov wrote: > > >

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-21 Thread Kirill A. Shutemov
On Tue, Sep 21, 2021 at 11:27:17PM +0200, Borislav Petkov wrote: > On Wed, Sep 22, 2021 at 12:20:59AM +0300, Kirill A. Shutemov wrote: > > I still believe calling cc_platform_has() from __startup_64() is totally > > broken as it lacks proper wrapping while accessing global varia

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-21 Thread Kirill A. Shutemov
rypt_identity.c @@ -288,7 +288,7 @@ void __init sme_encrypt_kernel(struct boot_params *bp) unsigned long pgtable_area_len; unsigned long decrypted_base; - if (!cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) + if (1 || !cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT))

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-22 Thread Kirill A. Shutemov
On Wed, Sep 22, 2021 at 08:40:43AM -0500, Tom Lendacky wrote: > On 9/21/21 4:58 PM, Kirill A. Shutemov wrote: > > On Tue, Sep 21, 2021 at 04:43:59PM -0500, Tom Lendacky wrote: > > > On 9/21/21 4:34 PM, Kirill A. Shutemov wrote: > > > > On Tue, Sep 21, 2021 at 11:

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-22 Thread Kirill A. Shutemov
On Wed, Sep 22, 2021 at 09:52:07PM +0200, Borislav Petkov wrote: > On Wed, Sep 22, 2021 at 05:30:15PM +0300, Kirill A. Shutemov wrote: > > Not fine, but waiting to blowup with random build environment change. > > Why is it not fine? > > Are you suspecting that the co

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-20 Thread Kirill A. Shutemov
have a special version of the helper). Note that only AMD requires these cc_platform_has() to return true. -- Kirill A. Shutemov ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH v3 5/8] x86/sme: Replace occurrences of sme_active() with cc_platform_has()

2021-09-24 Thread Kirill A. Shutemov
On Thu, Sep 23, 2021 at 08:21:03PM +0200, Borislav Petkov wrote: > On Thu, Sep 23, 2021 at 12:05:58AM +0300, Kirill A. Shutemov wrote: > > Unless we find other way to guarantee RIP-relative access, we must use > > fixup_pointer() to access any global variables. > > Yah, I've

Memory clearing in swiotlb_update_mem_attributes()

2022-01-04 Thread Kirill A. Shutemov
with real data anyway. Can we drop it? -- Kirill A. Shutemov ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: Memory clearing in swiotlb_update_mem_attributes()

2022-01-05 Thread Kirill A. Shutemov
On Wed, Jan 05, 2022 at 06:12:34AM -0800, Christoph Hellwig wrote: > On Wed, Jan 05, 2022 at 08:06:10AM -0600, Tom Lendacky wrote: > > On 1/4/22 4:49 PM, Kirill A. Shutemov wrote: > > > Hi Tom, > > > > > > For larger TDX VM,

[PATCH] swiotlb: Do not zero buffer in set_memory_decrypted()

2022-01-25 Thread Kirill A. Shutemov
For larger TDX VM, memset() after set_memory_decrypted() in swiotlb_update_mem_attributes() takes substantial portion of boot time. Zeroing doesn't serve any functional purpose. Malicious VMM can mess with decrypted/shared buffer at any point. Remove the memset(). Signed-off-by: Kirill