linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Kuppuswamy Sathyanarayanan 
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>
Cc: Peter H Anvin <hpa@zytor.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Tony Luck <tony.luck@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	Kirill Shutemov <kirill.shutemov@linux.intel.com>,
	Sean Christopherson <seanjc@google.com>,
	Kuppuswamy Sathyanarayanan <knsathya@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 6/7] x86/kvm: Use bounce buffers for TD guest
Date: Fri, 11 Jun 2021 09:52:49 -0500	[thread overview]
Message-ID: <5f4dd90d-3761-3e1d-4f7b-86f504f769ae@amd.com> (raw)
In-Reply-To: <20210609215537.1956150-7-sathyanarayanan.kuppuswamy@linux.intel.com>

On 6/9/21 4:55 PM, Kuppuswamy Sathyanarayanan wrote:
> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> diff --git a/arch/x86/mm/mem_encrypt_common.c b/arch/x86/mm/mem_encrypt_common.c
> index 8053b43298ff..2da70f58b208 100644
> --- a/arch/x86/mm/mem_encrypt_common.c
> +++ b/arch/x86/mm/mem_encrypt_common.c
> @@ -9,6 +9,7 @@
>  
>  #include <asm/mem_encrypt_common.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/swiotlb.h>
>  
>  /* Override for DMA direct allocation check - ARCH_HAS_FORCE_DMA_UNENCRYPTED */
>  bool force_dma_unencrypted(struct device *dev)
> @@ -21,3 +22,18 @@ bool force_dma_unencrypted(struct device *dev)
>  
>  	return false;
>  }
> +
> +/* Architecture __weak replacement functions */
> +void __init mem_encrypt_init(void)
> +{
> +	/*
> +	 * For TDX guest or SEV/SME, call into SWIOTLB to update
> +	 * the SWIOTLB DMA buffers
> +	 */
> +	if (sme_me_mask || prot_guest_has(PR_GUEST_MEM_ENCRYPT))
> +		swiotlb_update_mem_attributes();
> +
> +	if (sme_me_mask)
> +		amd_mem_encrypt_init();

The sme_me_mask is checked in amd_mem_encrypt_init(), so you should just
invoke amd_mem_encrypt_init() unconditionally.

Thanks,
Tom

> +}
> +
> 

  reply	other threads:[~2021-06-11 14:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 21:55 [PATCH v1 0/7] Add TDX Guest Support (shared-mm support) Kuppuswamy Sathyanarayanan
2021-06-09 21:55 ` [PATCH v1 1/7] x86/mm: Move force_dma_unencrypted() to common code Kuppuswamy Sathyanarayanan
2021-06-11 14:43   ` Tom Lendacky
2021-06-11 16:00     ` Kuppuswamy, Sathyanarayanan
2021-06-09 21:55 ` [PATCH v1 2/7] x86/tdx: Exclude Shared bit from physical_mask Kuppuswamy Sathyanarayanan
2021-06-09 21:55 ` [PATCH v1 3/7] x86/tdx: Make pages shared in ioremap() Kuppuswamy Sathyanarayanan
2021-06-09 21:55 ` [PATCH v1 4/7] x86/tdx: Add helper to do MapGPA hypercall Kuppuswamy Sathyanarayanan
2021-06-09 21:55 ` [PATCH v1 5/7] x86/tdx: Make DMA pages shared Kuppuswamy Sathyanarayanan
2021-06-09 21:55 ` [PATCH v1 6/7] x86/kvm: Use bounce buffers for TD guest Kuppuswamy Sathyanarayanan
2021-06-11 14:52   ` Tom Lendacky [this message]
2021-06-11 16:03     ` Kuppuswamy, Sathyanarayanan
2021-06-09 21:55 ` [PATCH v1 7/7] x86/tdx: ioapic: Add shared bit for IOAPIC base address Kuppuswamy Sathyanarayanan

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=5f4dd90d-3761-3e1d-4f7b-86f504f769ae@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=knsathya@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.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).