linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan  <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>,
	Dave Hansen <dave.hansen@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>,
	Kirill Shutemov <kirill.shutemov@linux.intel.com>,
	Kuppuswamy Sathyanarayanan <knsathya@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Raj Ashok <ashok.raj@intel.com>,
	Sean Christopherson <seanjc@google.com>,
	linux-kernel@vger.kernel.org,
	Kuppuswamy Sathyanarayanan 
	<sathyanarayanan.kuppuswamy@linux.intel.com>
Subject: [RFC v1 01/26] x86/paravirt: Introduce CONFIG_PARAVIRT_XL
Date: Fri,  5 Feb 2021 15:38:18 -0800	[thread overview]
Message-ID: <ecbb771d8616e45cec8bf457a044c4233a50ad09.1612563142.git.sathyanarayanan.kuppuswamy@linux.intel.com> (raw)
In-Reply-To: <cover.1612563142.git.sathyanarayanan.kuppuswamy@linux.intel.com>

From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>

Split off halt paravirt calls from CONFIG_PARAVIRT_XXL into
a separate config option. It provides a middle ground for
not-so-deep paravirtulized environments.

CONFIG_PARAVIRT_XL will be used by TDX that needs couple of paravirt
calls that was hidden under CONFIG_PARAVIRT_XXL, but the rest of the
config would be a bloat for TDX.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
 arch/x86/Kconfig                      |  4 +++
 arch/x86/boot/compressed/misc.h       |  1 +
 arch/x86/include/asm/irqflags.h       | 42 +++++++++++++++------------
 arch/x86/include/asm/paravirt.h       | 22 +++++++-------
 arch/x86/include/asm/paravirt_types.h |  3 +-
 arch/x86/kernel/paravirt.c            |  4 ++-
 arch/x86/mm/mem_encrypt_identity.c    |  1 +
 7 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 7b6dd10b162a..8fe91114bfee 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -776,8 +776,12 @@ config PARAVIRT
 	  over full virtualization.  However, when run without a hypervisor
 	  the kernel is theoretically slower and slightly larger.
 
+config PARAVIRT_XL
+	bool
+
 config PARAVIRT_XXL
 	bool
+	select PARAVIRT_XL
 
 config PARAVIRT_DEBUG
 	bool "paravirt-ops debugging"
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 901ea5ebec22..4b84abe43765 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -9,6 +9,7 @@
  * paravirt and debugging variants are added.)
  */
 #undef CONFIG_PARAVIRT
+#undef CONFIG_PARAVIRT_XL
 #undef CONFIG_PARAVIRT_XXL
 #undef CONFIG_PARAVIRT_SPINLOCKS
 #undef CONFIG_KASAN
diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
index 2dfc8d380dab..299c9b1ed857 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
@@ -68,11 +68,33 @@ static inline __cpuidle void native_halt(void)
 
 #endif
 
-#ifdef CONFIG_PARAVIRT_XXL
+#ifdef CONFIG_PARAVIRT_XL
 #include <asm/paravirt.h>
 #else
 #ifndef __ASSEMBLY__
 #include <linux/types.h>
+/*
+ * Used in the idle loop; sti takes one instruction cycle
+ * to complete:
+ */
+static inline __cpuidle void arch_safe_halt(void)
+{
+	native_safe_halt();
+}
+
+/*
+ * Used when interrupts are already enabled or to
+ * shutdown the processor:
+ */
+static inline __cpuidle void halt(void)
+{
+	native_halt();
+}
+#endif /* !__ASSEMBLY__ */
+#endif /* CONFIG_PARAVIRT_XL */
+
+#ifndef CONFIG_PARAVIRT_XXL
+#ifndef __ASSEMBLY__
 
 static __always_inline unsigned long arch_local_save_flags(void)
 {
@@ -94,24 +116,6 @@ static __always_inline void arch_local_irq_enable(void)
 	native_irq_enable();
 }
 
-/*
- * Used in the idle loop; sti takes one instruction cycle
- * to complete:
- */
-static inline __cpuidle void arch_safe_halt(void)
-{
-	native_safe_halt();
-}
-
-/*
- * Used when interrupts are already enabled or to
- * shutdown the processor:
- */
-static inline __cpuidle void halt(void)
-{
-	native_halt();
-}
-
 /*
  * For spinlocks, etc:
  */
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index f8dce11d2bc1..700b94abfd1b 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -84,6 +84,18 @@ static inline void paravirt_arch_exit_mmap(struct mm_struct *mm)
 	PVOP_VCALL1(mmu.exit_mmap, mm);
 }
 
+#ifdef CONFIG_PARAVIRT_XL
+static inline void arch_safe_halt(void)
+{
+	PVOP_VCALL0(irq.safe_halt);
+}
+
+static inline void halt(void)
+{
+	PVOP_VCALL0(irq.halt);
+}
+#endif
+
 #ifdef CONFIG_PARAVIRT_XXL
 static inline void load_sp0(unsigned long sp0)
 {
@@ -145,16 +157,6 @@ static inline void __write_cr4(unsigned long x)
 	PVOP_VCALL1(cpu.write_cr4, x);
 }
 
-static inline void arch_safe_halt(void)
-{
-	PVOP_VCALL0(irq.safe_halt);
-}
-
-static inline void halt(void)
-{
-	PVOP_VCALL0(irq.halt);
-}
-
 static inline void wbinvd(void)
 {
 	PVOP_VCALL0(cpu.wbinvd);
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index b6b02b7c19cc..634482a0a60d 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -190,7 +190,8 @@ struct pv_irq_ops {
 	struct paravirt_callee_save restore_fl;
 	struct paravirt_callee_save irq_disable;
 	struct paravirt_callee_save irq_enable;
-
+#endif
+#ifdef CONFIG_PARAVIRT_XL
 	void (*safe_halt)(void);
 	void (*halt)(void);
 #endif
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 6c3407ba6ee9..85714a6389d6 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -327,9 +327,11 @@ struct paravirt_patch_template pv_ops = {
 	.irq.restore_fl		= __PV_IS_CALLEE_SAVE(native_restore_fl),
 	.irq.irq_disable	= __PV_IS_CALLEE_SAVE(native_irq_disable),
 	.irq.irq_enable		= __PV_IS_CALLEE_SAVE(native_irq_enable),
+#endif /* CONFIG_PARAVIRT_XXL */
+#ifdef CONFIG_PARAVIRT_XL
 	.irq.safe_halt		= native_safe_halt,
 	.irq.halt		= native_halt,
-#endif /* CONFIG_PARAVIRT_XXL */
+#endif /* CONFIG_PARAVIRT_XL */
 
 	/* Mmu ops. */
 	.mmu.flush_tlb_user	= native_flush_tlb_local,
diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c
index 6c5eb6f3f14f..20d0cb116557 100644
--- a/arch/x86/mm/mem_encrypt_identity.c
+++ b/arch/x86/mm/mem_encrypt_identity.c
@@ -24,6 +24,7 @@
  * be extended when new paravirt and debugging variants are added.)
  */
 #undef CONFIG_PARAVIRT
+#undef CONFIG_PARAVIRT_XL
 #undef CONFIG_PARAVIRT_XXL
 #undef CONFIG_PARAVIRT_SPINLOCKS
 
-- 
2.25.1


  parent reply	other threads:[~2021-02-06  4:33 UTC|newest]

Thread overview: 161+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-06  3:02 Test Email sathyanarayanan.kuppuswamy
2021-02-05 23:38 ` [RFC v1 00/26] Add TDX Guest Support Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` Kuppuswamy Sathyanarayanan [this message]
2021-02-05 23:38 ` [RFC v1 02/26] x86/cpufeatures: Add TDX Guest CPU feature Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 03/26] x86/cpufeatures: Add is_tdx_guest() interface Kuppuswamy Sathyanarayanan
2021-04-01 21:08   ` Dave Hansen
2021-04-01 21:15     ` Kuppuswamy, Sathyanarayanan
2021-04-01 21:19       ` Dave Hansen
2021-04-01 22:25         ` Kuppuswamy, Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 04/26] x86/tdx: Get TD execution environment information via TDINFO Kuppuswamy Sathyanarayanan
2021-02-08 10:00   ` Peter Zijlstra
2021-02-08 19:10     ` Kuppuswamy, Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 05/26] x86/traps: Add #VE support for TDX guest Kuppuswamy Sathyanarayanan
2021-02-08 10:20   ` Peter Zijlstra
2021-02-08 16:23     ` Andi Kleen
2021-02-08 16:33       ` Peter Zijlstra
2021-02-08 16:46         ` Sean Christopherson
2021-02-08 16:59           ` Peter Zijlstra
2021-02-08 19:05             ` Kuppuswamy, Sathyanarayanan
2021-02-08 16:46         ` Andi Kleen
2021-02-12 19:20   ` Dave Hansen
2021-02-12 19:47   ` Andy Lutomirski
2021-02-12 20:06     ` Sean Christopherson
2021-02-12 20:17       ` Dave Hansen
2021-02-12 20:37         ` Sean Christopherson
2021-02-12 20:46           ` Dave Hansen
2021-02-12 20:54             ` Sean Christopherson
2021-02-12 21:06               ` Dave Hansen
2021-02-12 21:37                 ` Sean Christopherson
2021-02-12 21:47                   ` Andy Lutomirski
2021-02-12 21:48                     ` Dave Hansen
2021-02-14 19:33                       ` Andi Kleen
2021-02-14 19:54                         ` Andy Lutomirski
2021-02-12 20:20       ` Andy Lutomirski
2021-02-12 20:44         ` Sean Christopherson
2021-02-05 23:38 ` [RFC v1 06/26] x86/tdx: Add HLT " Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 07/26] x86/tdx: Wire up KVM hypercalls Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 08/26] x86/tdx: Add MSR support for TDX guest Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 09/26] x86/tdx: Handle CPUID via #VE Kuppuswamy Sathyanarayanan
2021-02-05 23:42   ` Andy Lutomirski
2021-02-07 14:13     ` Kirill A. Shutemov
2021-02-07 16:01       ` Dave Hansen
2021-02-07 20:29         ` Kirill A. Shutemov
2021-02-07 22:31           ` Dave Hansen
2021-02-07 22:45             ` Andy Lutomirski
2021-02-08 17:10               ` Sean Christopherson
2021-02-08 17:35                 ` Andy Lutomirski
2021-02-08 17:47                   ` Sean Christopherson
2021-03-18 21:30               ` [PATCH v1 1/1] x86/tdx: Add tdcall() and tdvmcall() helper functions Kuppuswamy Sathyanarayanan
2021-03-19 16:55                 ` Sean Christopherson
2021-03-19 17:42                   ` Kuppuswamy, Sathyanarayanan
2021-03-19 18:22                     ` Dave Hansen
2021-03-19 19:58                       ` Kuppuswamy, Sathyanarayanan
2021-03-26 23:38                         ` [PATCH v2 1/1] x86/tdx: Add __tdcall() and __tdvmcall() " Kuppuswamy Sathyanarayanan
2021-04-20 17:36                           ` Dave Hansen
2021-04-20 19:20                             ` Kuppuswamy, Sathyanarayanan
2021-04-20 19:59                               ` Dave Hansen
2021-04-20 23:12                                 ` Kuppuswamy, Sathyanarayanan
2021-04-20 23:42                                   ` Dave Hansen
2021-04-23  1:09                                     ` Kuppuswamy, Sathyanarayanan
2021-04-23  1:21                                       ` Dave Hansen
2021-04-23  1:35                                         ` Andi Kleen
2021-04-23 15:15                                           ` Sean Christopherson
2021-04-23 15:28                                             ` Dan Williams
2021-04-23 15:38                                               ` Andi Kleen
2021-04-23 15:50                                               ` Sean Christopherson
2021-04-23 15:47                                             ` Andi Kleen
2021-04-23 18:18                                             ` Kuppuswamy, Sathyanarayanan
2021-04-20 23:53                                   ` Dan Williams
2021-04-20 23:59                                     ` Kuppuswamy, Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 10/26] x86/io: Allow to override inX() and outX() implementation Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 11/26] x86/tdx: Handle port I/O Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 12/26] x86/tdx: Handle in-kernel MMIO Kuppuswamy Sathyanarayanan
2021-04-01 19:56   ` Dave Hansen
2021-04-01 22:26     ` Sean Christopherson
2021-04-01 22:53       ` Dave Hansen
2021-02-05 23:38 ` [RFC v1 13/26] x86/tdx: Handle MWAIT, MONITOR and WBINVD Kuppuswamy Sathyanarayanan
2021-02-05 23:43   ` Andy Lutomirski
2021-02-05 23:54     ` Kuppuswamy, Sathyanarayanan
2021-02-06  1:05       ` Andy Lutomirski
2021-03-27  0:18         ` [PATCH v1 1/1] " Kuppuswamy Sathyanarayanan
2021-03-27  2:40           ` Andy Lutomirski
2021-03-27  3:40             ` Kuppuswamy, Sathyanarayanan
2021-03-27 16:03               ` Andy Lutomirski
2021-03-27 22:54                 ` [PATCH v2 " Kuppuswamy Sathyanarayanan
2021-03-29 17:14                   ` Dave Hansen
2021-03-29 21:55                     ` Kuppuswamy, Sathyanarayanan
2021-03-29 22:02                       ` Dave Hansen
2021-03-29 22:09                         ` Kuppuswamy, Sathyanarayanan
2021-03-29 22:12                           ` Dave Hansen
2021-03-29 22:42                             ` Kuppuswamy, Sathyanarayanan
2021-03-29 23:16                             ` [PATCH v3 " Kuppuswamy Sathyanarayanan
2021-03-29 23:23                               ` Andy Lutomirski
2021-03-29 23:37                                 ` Kuppuswamy, Sathyanarayanan
2021-03-29 23:42                                   ` Sean Christopherson
2021-03-29 23:58                                     ` Andy Lutomirski
2021-03-30  2:04                                       ` Andi Kleen
2021-03-30  2:58                                         ` Andy Lutomirski
2021-03-30 15:14                                           ` Sean Christopherson
2021-03-30 16:37                                             ` Andy Lutomirski
2021-03-30 16:57                                               ` Sean Christopherson
2021-04-07 15:24                                                 ` Andi Kleen
2021-03-31 21:09                                           ` [PATCH v4 " Kuppuswamy Sathyanarayanan
2021-03-31 21:49                                             ` Dave Hansen
2021-03-31 22:29                                               ` Kuppuswamy, Sathyanarayanan
2021-03-31 21:53                                             ` Sean Christopherson
2021-03-31 22:00                                               ` Dave Hansen
2021-03-31 22:06                                                 ` Sean Christopherson
2021-03-31 22:11                                                   ` Dave Hansen
2021-03-31 22:28                                                     ` Kuppuswamy, Sathyanarayanan
2021-03-31 22:32                                                       ` Sean Christopherson
2021-03-31 22:34                                                       ` Dave Hansen
2021-04-01  3:28                                                         ` Andi Kleen
2021-04-01  3:46                                                           ` Dave Hansen
2021-04-01  4:24                                                             ` Andi Kleen
2021-04-01  4:51                                                               ` [PATCH v5 " Kuppuswamy Sathyanarayanan
2021-03-29 23:39                                 ` [PATCH v3 " Sean Christopherson
2021-03-29 23:38                               ` Dave Hansen
2021-03-30  4:56           ` [PATCH v1 " Xiaoyao Li
2021-03-30 15:00             ` Andi Kleen
2021-03-30 15:10               ` Dave Hansen
2021-03-30 17:02                 ` Kuppuswamy, Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 14/26] ACPI: tables: Add multiprocessor wake-up support Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 15/26] x86/boot: Add a trampoline for APs booting in 64-bit mode Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 16/26] x86/boot: Avoid #VE during compressed boot for TDX platforms Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 17/26] x86/boot: Avoid unnecessary #VE during boot process Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 18/26] x86/topology: Disable CPU hotplug support for TDX platforms Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 19/26] x86/tdx: Forcefully disable legacy PIC for TDX guests Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 20/26] x86/tdx: Introduce INTEL_TDX_GUEST config option Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 21/26] x86/mm: Move force_dma_unencrypted() to common code Kuppuswamy Sathyanarayanan
2021-04-01 20:06   ` Dave Hansen
2021-04-06 15:37     ` Kirill A. Shutemov
2021-04-06 16:11       ` Dave Hansen
2021-04-06 16:37         ` Kirill A. Shutemov
2021-02-05 23:38 ` [RFC v1 22/26] x86/tdx: Exclude Shared bit from __PHYSICAL_MASK Kuppuswamy Sathyanarayanan
2021-04-01 20:13   ` Dave Hansen
2021-04-06 15:54     ` Kirill A. Shutemov
2021-04-06 16:12       ` Dave Hansen
2021-02-05 23:38 ` [RFC v1 23/26] x86/tdx: Make pages shared in ioremap() Kuppuswamy Sathyanarayanan
2021-04-01 20:26   ` Dave Hansen
2021-04-06 16:00     ` Kirill A. Shutemov
2021-04-06 16:14       ` Dave Hansen
2021-02-05 23:38 ` [RFC v1 24/26] x86/tdx: Add helper to do MapGPA TDVMALL Kuppuswamy Sathyanarayanan
2021-02-05 23:38 ` [RFC v1 25/26] x86/tdx: Make DMA pages shared Kuppuswamy Sathyanarayanan
2021-04-01 21:01   ` Dave Hansen
2021-04-06 16:31     ` Kirill A. Shutemov
2021-04-06 16:38       ` Dave Hansen
2021-04-06 17:16         ` Sean Christopherson
2021-02-05 23:38 ` [RFC v1 26/26] x86/kvm: Use bounce buffers for TD guest Kuppuswamy Sathyanarayanan
2021-04-01 21:17   ` Dave Hansen
2021-02-06  3:04 ` Test Email sathyanarayanan.kuppuswamy
2021-02-06  6:24 ` [RFC v1 00/26] Add TDX Guest Support sathyanarayanan.kuppuswamy
2021-03-31 21:38 ` Kuppuswamy, Sathyanarayanan
2021-04-02  0:02 ` Dave Hansen
2021-04-02  2:48   ` Andi Kleen
2021-04-02 15:27     ` Dave Hansen
2021-04-02 21:32       ` Andi Kleen
2021-04-03 16:26         ` Dave Hansen
2021-04-03 17:28           ` Andi Kleen
2021-04-04 15:02 ` Dave Hansen
2021-04-12 17:24   ` Dan Williams

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=ecbb771d8616e45cec8bf457a044c4233a50ad09.1612563142.git.sathyanarayanan.kuppuswamy@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=ak@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=knsathya@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=seanjc@google.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;
as well as URLs for NNTP newsgroup(s).