From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.225 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794984024; b=UOu2WuUzWf5P+68KsFicnbrnQGjn3lxszXv9jWCpNFXoyYwApZxNE6k46mXlnu2xfxh3 UoQnDfmjZEZWiVmcTUTpfg7AdyP4S434eUSDNHWX/Pjw+cksxMnYzj+GR3wjeJDy0IK3t DpiMm6hJ3f99pwr86p0OMUmSk0/qwNxMOXUWptsAIJ3dDGCsVAQFlVmxR+jWMzYYyPMPa fPPnbRbbw8wM0wJAYDRD6nuSuJ/DvwWRnX/dt41kDFlyQ+K8xZ2VLnj/6Cjfnj6/+6God uxezhKDeRJps0CyozJn7hC5dalrmLL8OmDfqOu9OZo5reHJrh9YIKskGypnfU4I6KBA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794984024; h=DMARC-Filter:Received:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:X-Relaying-Domain: X-CFilter-Loop:Received:DKIM-Signature:X-Forwarded-Encrypted: X-Received:X-Received:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-DetectorID-Processed; bh=1wn8B8AtBDch11Kn2VubYj0NKMdWprvKTv7qKouH7kM=; b=XUXxF2fHdfEGX5D4VLeQnZnKTF7j922DG/FHYtP2B62jn/gMxVQbScioDD0ExO4T5VtC 9yuQOMIHqIkVRwnvasAb3/ogouKIqQzzgmtKSBtGBCG12warC3+4TRfXoiEVH+P1xJzEi Vl3TKRPWvDFiVK4DAb2RXomNDMQR9HK7FwlHBicGLZ0S8ARwqyH3Tlo2aUCfq+es5Eig8 EqoDPgl42HE8RG3odVIHczdOwzfIqIJZBYL2qInRAuV/hQlNfzLqvUOI5E/Dozvg+Z3h5 zkh+3x0bxyCaBnKFr2uLDO+spDejqgOn2jEJlBCaSmMY+O3vgRyLvD3NgyD7Iz5OZvA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=google header.b=TYqoI0e+; arc=none smtp.remote-ip=209.85.215.225 Received: from mail-pg1-f225.google.com (mail-pg1-f225.google.com [209.85.215.225]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73CCB606A325 for ; Wed, 18 Nov 2026 06:40:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 73CCB606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=google header.b=TYqoI0e+ Received: by mail-pg1-f225.google.com with SMTP id 41be03b00d2f7-cde0daf3a2aso375662a12.3 for ; Tue, 17 Nov 2026 22:40:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794984024; x=1795588824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=1wn8B8AtBDch11Kn2VubYj0NKMdWprvKTv7qKouH7kM=; b=w+a7/3Y8dk8C6et8+h+GKxIPCbtAbIGXzZOj2nsAt35DKlLV+jMc8Ha2lUlaUc4Vfh nuKLwjeNaT29SvWZFJSBQwzQtw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En6/6IXUd759ysyFJ+6khfyaNGygakJicv+piO4tVHO wsMYlaZZZakCz0XJhzo6eX31V92PS0J7xe X-Received: by 2002:a17:90b:5890:b0:3ac:ffb8:1809 with SMTP id 98e67ed59e1d1-3b3d07d40d6mr1593883a91.39.1794984023781; Tue, 17 Nov 2026 22:40:23 -0800 (PST) Received: from smtp-us-east1-p01-i01-si01.dlp.protect.broadcom.com (address-144-49-247-28.dlp.protect.broadcom.com. [144.49.247.28]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-3b3d42f2953sm470587a91.3.2026.11.17.22.40.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Nov 2026 22:40:23 -0800 (PST) X-Relaying-Domain: broadcom.com X-CFilter-Loop: Reflected Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-542fc61841eso12021911cf.0 for ; Tue, 17 Nov 2026 22:40:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1794984020; x=1795588820; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1wn8B8AtBDch11Kn2VubYj0NKMdWprvKTv7qKouH7kM=; b=TYqoI0e+ML2t4xTIOQQbRL5GEWXaKZWk8mgw3Aiynv5YLV3kIaoaAOk/ieXCc5z6If lZfS8lrjpekoaPWpV4YS0Wf8gnd3aP63o7RLNmc6WFMikmTPHzvcfXIIi+h8oCWjm4rC x1n/nl0uWp+wz811FlsucBIj8fE9zLyUNFm7w= X-Forwarded-Encrypted: i=1; AL+hErHiFdvexPUH1A6/DqqI5F/AcpQjyg9ETqcCzzJRFPKZgBF7SlQLX2YBTTfoslj6lpSAqHNKI+cTg0n/XXA=@vger.kernel.org X-Received: by 2002:a05:622a:528c:b0:533:8b99:fcd2 with SMTP id d75a77b69052e-55d5a668644mr25275581cf.40.1794984019868; Tue, 17 Nov 2026 22:40:19 -0800 (PST) X-Received: by 2002:a05:622a:528c:b0:533:8b99:fcd2 with SMTP id d75a77b69052e-55d5a668644mr25275241cf.40.1794984019244; Tue, 17 Nov 2026 22:40:19 -0800 (PST) Received: from vertex.localdomain (pool-173-49-113-140.phlapa.fios.verizon.net. [173.49.113.140]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d61cf3b56sm2078141cf.13.2026.11.17.22.40.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 22:40:18 -0800 (PST) From: Zack Rusin To: Borislav Petkov , Ajay Kaher , Alexey Makhalov , x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Dave Hansen , "H. Peter Anvin" , virtualization@lists.linux.dev, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, Linus Torvalds , Peter Zijlstra , Josh Poimboeuf , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Kiryl Shutsemau , Rick Edgecombe , linux-coco@lists.linux.dev, kvm@vger.kernel.org, dri-devel@lists.freedesktop.org, Zack Rusin Subject: [PATCH v4 1/3] x86/vmware: Move high-bandwidth hypercalls out of line Date: Wed, 18 Nov 2026 01:40:11 -0500 Message-ID: <59bf54707b78e2a4d2072c1aff6bcf72cb35e6b2.1794206170.git.zack.rusin@broadcom.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-DetectorID-Processed: b00c1d49-9d2e-4205-b15f-d015386d3d5e 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 --- 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 #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -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 #include #include #include @@ -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); /**