From: Zack Rusin <zack.rusin@broadcom.com>
To: Borislav Petkov <bp@alien8.de>,
Ajay Kaher <ajay.kaher@broadcom.com>,
Alexey Makhalov <alexey.makhalov@broadcom.com>,
x86@kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
virtualization@lists.linux.dev,
bcm-kernel-feedback-list@broadcom.com,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Kiryl Shutsemau <kas@kernel.org>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
linux-coco@lists.linux.dev, kvm@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Zack Rusin <zack.rusin@broadcom.com>
Subject: [PATCH v3 1/3] x86/vmware: Move high-bandwidth hypercalls out of line
Date: Tue, 3 Nov 2026 02:14:56 -0500 [thread overview]
Message-ID: <5c509e51a3e04b95a6447fabc9db20d72152a8f3.1793685318.git.zack.rusin@broadcom.com> (raw)
In-Reply-To: <cover.1793685318.git.zack.rusin@broadcom.com>
The high-bandwidth helpers contain inline assembly which temporarily uses
%bp as a VMware ABI register. Keeping that assembly in vmware.h duplicates
it in callers.
Move both helpers to vmware.c and export them for the vmwgfx module.
Preserve their unwind hints and remove the redundant caller-wide objtool
annotations from vmwgfx.
Preserve the argument sequence from commit e0e022004bbe ("x86/vmware:
Fix i386 high-bandwidth hypercall arguments").
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
---
arch/x86/include/asm/vmware.h | 62 +-------------------------
arch/x86/kernel/cpu/vmware.c | 68 +++++++++++++++++++++++++++++
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 3 --
3 files changed, 70 insertions(+), 63 deletions(-)
diff --git a/arch/x86/include/asm/vmware.h b/arch/x86/include/asm/vmware.h
index fb011cef01e7..f3ffe358d2a3 100644
--- a/arch/x86/include/asm/vmware.h
+++ b/arch/x86/include/asm/vmware.h
@@ -253,12 +253,6 @@ unsigned long vmware_hypercall7(unsigned long cmd, unsigned long in1,
return out0;
}
-#ifdef CONFIG_X86_64
-#define VMW_BP_CONSTRAINT "r"
-#else
-#define VMW_BP_CONSTRAINT "m"
-#endif
-
/*
* High bandwidth calls are not supported on encrypted memory guests.
* The caller should check cc_platform_has(CC_ATTR_MEM_ENCRYPT) and use
@@ -266,66 +260,14 @@ unsigned long vmware_hypercall7(unsigned long cmd, unsigned long in1,
* This assumption simplifies HB hypercall implementation to just I/O port
* based approach without alternative patching.
*/
-static inline
unsigned long vmware_hypercall_hb_out(unsigned long cmd, unsigned long in2,
unsigned long in3, unsigned long in4,
unsigned long in5, unsigned long in6,
- u32 *out1)
-{
- unsigned long out0;
-
- asm_inline volatile (
- UNWIND_HINT_SAVE
- "mov %[in6], %%" _ASM_AX "\n\t"
- "push %%" _ASM_BP "\n\t"
- UNWIND_HINT_UNDEFINED
- "mov %%" _ASM_AX ", %%" _ASM_BP "\n\t"
- "mov %[magic], %%eax\n\t"
- "rep outsb\n\t"
- "pop %%" _ASM_BP "\n\t"
- UNWIND_HINT_RESTORE
- : "=&a" (out0), "=b" (*out1)
- : "b" (cmd),
- "c" (in2),
- "d" (in3 | VMWARE_HYPERVISOR_PORT_HB),
- "S" (in4),
- "D" (in5),
- [in6] VMW_BP_CONSTRAINT(in6),
- [magic] "i" (VMWARE_HYPERVISOR_MAGIC)
- : "cc", "memory");
- return out0;
-}
-
-static inline
+ u32 *out1);
unsigned long vmware_hypercall_hb_in(unsigned long cmd, unsigned long in2,
unsigned long in3, unsigned long in4,
unsigned long in5, unsigned long in6,
- u32 *out1)
-{
- unsigned long out0;
-
- asm_inline volatile (
- UNWIND_HINT_SAVE
- "mov %[in6], %%" _ASM_AX "\n\t"
- "push %%" _ASM_BP "\n\t"
- UNWIND_HINT_UNDEFINED
- "mov %%" _ASM_AX ", %%" _ASM_BP "\n\t"
- "mov %[magic], %%eax\n\t"
- "rep insb\n\t"
- "pop %%" _ASM_BP "\n\t"
- UNWIND_HINT_RESTORE
- : "=&a" (out0), "=b" (*out1)
- : "b" (cmd),
- "c" (in2),
- "d" (in3 | VMWARE_HYPERVISOR_PORT_HB),
- "S" (in4),
- "D" (in5),
- [in6] VMW_BP_CONSTRAINT(in6),
- [magic] "i" (VMWARE_HYPERVISOR_MAGIC)
- : "cc", "memory");
- return out0;
-}
-#undef VMW_BP_CONSTRAINT
+ u32 *out1);
#undef VMWARE_HYPERCALL
#endif
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index f7ab9e7902cf..7cfc894f0663 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -30,12 +30,14 @@
#include <linux/reboot.h>
#include <linux/static_call.h>
#include <linux/sched/cputime.h>
+#include <asm/asm.h>
#include <asm/div64.h>
#include <asm/x86_init.h>
#include <asm/hypervisor.h>
#include <asm/cpuid/api.h>
#include <asm/timer.h>
#include <asm/apic.h>
+#include <asm/unwind_hints.h>
#include <asm/vmware.h>
#include <asm/svm.h>
@@ -67,6 +69,72 @@ struct vmware_steal_time {
static unsigned long vmware_tsc_khz __ro_after_init;
static u8 vmware_hypercall_mode __ro_after_init;
+#ifdef CONFIG_X86_64
+#define VMW_BP_CONSTRAINT "r"
+#else
+#define VMW_BP_CONSTRAINT "m"
+#endif
+
+unsigned long vmware_hypercall_hb_out(unsigned long cmd, unsigned long in2,
+ unsigned long in3, unsigned long in4,
+ unsigned long in5, unsigned long in6,
+ u32 *out1)
+{
+ unsigned long out0;
+
+ asm volatile(UNWIND_HINT_SAVE
+ "mov %[in6], %%" _ASM_AX "\n\t"
+ "push %%" _ASM_BP "\n\t"
+ UNWIND_HINT_UNDEFINED
+ "mov %%" _ASM_AX ", %%" _ASM_BP "\n\t"
+ "mov %[magic], %%eax\n\t"
+ "rep outsb\n\t"
+ "pop %%" _ASM_BP "\n\t"
+ UNWIND_HINT_RESTORE
+ : "=&a" (out0), "=b" (*out1)
+ : "b" (cmd),
+ "c" (in2),
+ "d" (in3 | VMWARE_HYPERVISOR_PORT_HB),
+ "S" (in4),
+ "D" (in5),
+ [in6] VMW_BP_CONSTRAINT(in6),
+ [magic] "i" (VMWARE_HYPERVISOR_MAGIC)
+ : "cc", "memory");
+ return out0;
+}
+EXPORT_SYMBOL_GPL(vmware_hypercall_hb_out);
+
+unsigned long vmware_hypercall_hb_in(unsigned long cmd, unsigned long in2,
+ unsigned long in3, unsigned long in4,
+ unsigned long in5, unsigned long in6,
+ u32 *out1)
+{
+ unsigned long out0;
+
+ asm volatile(UNWIND_HINT_SAVE
+ "mov %[in6], %%" _ASM_AX "\n\t"
+ "push %%" _ASM_BP "\n\t"
+ UNWIND_HINT_UNDEFINED
+ "mov %%" _ASM_AX ", %%" _ASM_BP "\n\t"
+ "mov %[magic], %%eax\n\t"
+ "rep insb\n\t"
+ "pop %%" _ASM_BP "\n\t"
+ UNWIND_HINT_RESTORE
+ : "=&a" (out0), "=b" (*out1)
+ : "b" (cmd),
+ "c" (in2),
+ "d" (in3 | VMWARE_HYPERVISOR_PORT_HB),
+ "S" (in4),
+ "D" (in5),
+ [in6] VMW_BP_CONSTRAINT(in6),
+ [magic] "i" (VMWARE_HYPERVISOR_MAGIC)
+ : "cc", "memory");
+ return out0;
+}
+EXPORT_SYMBOL_GPL(vmware_hypercall_hb_in);
+
+#undef VMW_BP_CONSTRAINT
+
unsigned long vmware_hypercall_slow(unsigned long cmd,
unsigned long in1, unsigned long in3,
unsigned long in4, unsigned long in5,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index fd77ab6568cb..20ab4019680c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -24,7 +24,6 @@
*
*/
-#include <linux/objtool.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
@@ -289,7 +288,6 @@ static int vmw_send_msg(struct rpc_channel *channel, const char *msg)
return -EINVAL;
}
-STACK_FRAME_NON_STANDARD_FP(vmw_send_msg);
/**
@@ -384,7 +382,6 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
return 0;
}
-STACK_FRAME_NON_STANDARD(vmw_recv_msg);
/**
next prev parent reply other threads:[~2026-11-03 7:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 7:14 [PATCH v3 0/3] x86/vmware: Clean up the hypercall code Zack Rusin
2026-11-03 7:14 ` Zack Rusin [this message]
2026-11-03 7:14 ` [PATCH v3 2/3] x86/vmware: Route low-bandwidth hypercalls through a static call Zack Rusin
2026-11-03 7:14 ` [PATCH v3 3/3] x86/cpufeatures: Remove unused VMware hypercall feature bits Zack Rusin
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=5c509e51a3e04b95a6447fabc9db20d72152a8f3.1793685318.git.zack.rusin@broadcom.com \
--to=zack.rusin@broadcom.com \
--cc=airlied@gmail.com \
--cc=ajay.kaher@broadcom.com \
--cc=alexey.makhalov@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=kas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mingo@redhat.com \
--cc=mripard@kernel.org \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=simona@ffwll.ch \
--cc=tglx@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tzimmermann@suse.de \
--cc=virtualization@lists.linux.dev \
--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
all inboxes | Powered by JetHome®