Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1107707lqb; Wed, 29 May 2024 23:43:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUHdwcTBn4g2LfL8re5uVRMjCb/5hgcHHREzw64r453YvQaC832x+LYuy5SxM2b0xRID5x1PYlZbMijJinDCkLS4KJ9dtwvCZEJqfV29A== X-Google-Smtp-Source: AGHT+IEAL+FGnkp7xAHeA/9NkgLG6/lP2/omBzh0fNsS1/l95B69iVr2jBySHbMIb63N0n7v788B X-Received: by 2002:a05:6402:214e:b0:578:5cbb:7296 with SMTP id 4fb4d7f45d1cf-57a17960fcemr869172a12.36.1717051380508; Wed, 29 May 2024 23:43:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717051380; cv=pass; d=google.com; s=arc-20160816; b=0Y+Yf5wN3qafMyRR3Qeru+USZdFzKCQsW223ze0pnnI12E3bEX+eHLfMBWeDc9yzBA GKE+/0tGGxUy44Z1J5l+wlnS+4jM1CR1x2vb40shxCYGUti7DBJGIGl6OGR45wUWeG0F yRh422AQhUbu4BK6+xJrHNIZVFUXniSukeMOxH6oGejW7DTwoR+0Nsbl5ev+xfFXY/oY Y/IB/euPsxR8fa2MEzGu+cjHsnB9bamTGjjqdw8hs7cDzIhnal8Ln1u/EkeUjaB7dhJt KqAIfnsm1BJWTZm8Tzoof8NtAHaKttaA92E6wtFb45tHdoKtsju9X9K2KTCsXF0n3F1q y5mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=rCzRJkj1CS92P5UL4N6EIOsMjdv4mGiz9WlXzg9a4rQ=; fh=ZBKRUoX8UR6NDDrN2fI/3jvm7S/No/QIkR1AcJSnkYI=; b=mq6MXee3lYezZJSk6zbU8zpL7obWa9Gt16BeebCXlMtfZ6ojPJv+h8yG6Itqs+FlJq niBvYtis0iLbPKskEgsFXWlFwcMt2wpdF3Pq0VIZiSEoGzplybQiWp7hm087l3Dtc9LD 7KkTua2RZV+b8F8sE50O5Ug+8l0wujCwM/1uPfWwQ5VjfVDxN9IBKMHjH3B7ECO0KKSE i6nNWySLMKfaQyoR2LNp9Ce1p7Iyxk3thHyowN5+sRFlCr2/JHOqre3TiBtTvvu47ulw oaxsLGzCJmw9BtE3ryZh3XMIplbTdPlNaaPqz2HEa0jb5mMRb7h8funlBhaJ6I1naXgW qP/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=V3K1UvYD; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-194815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194815-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57864b38394si6410653a12.661.2024.05.29.23.43.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 23:43:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=V3K1UvYD; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-194815-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194815-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 579161F23345 for ; Thu, 30 May 2024 00:44:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4478BE57E; Thu, 30 May 2024 00:44:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="V3K1UvYD" Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 657678C1A for ; Thu, 30 May 2024 00:44:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717029881; cv=none; b=t5sf0xbRmalYwj+stOoZ8tPV0v4M9ilqYPyW9RXonDPw467nOuUDwYnKzfjAxieQasSLXmnCbY3aHmCFzi0IEDTbqPYl7rUW1mlDVbFSGBsOCadeWG3SzPj4CTSYWjox5tzzVmzDZiEdA5PAe8F4zbgJvAHH+omFR4gb6RZgVO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717029881; c=relaxed/simple; bh=dah9ppjnlzlo+61Dpp9M5zKL7GqTZ2DyDyqODY0DSRA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dG5zQj3E82S/Uvq6rG8280oZeNJjP8rJEN6wBLo93let69KMkugmy081sw6iRYt2/rxp8om+B3ldB+hqUvYM+f2fW+EWU1gKvdy0IP9yW6ImX6FARF96LWRDSLP21oS2cHsLPWUzhGPjg9wseLA6cuhS8LPQDHpcAl6pmaVUJKg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=V3K1UvYD; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6fbbd937719so315589b3a.0 for ; Wed, 29 May 2024 17:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1717029879; x=1717634679; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=rCzRJkj1CS92P5UL4N6EIOsMjdv4mGiz9WlXzg9a4rQ=; b=V3K1UvYDe+L++cky8ZEcuukY3Uh6PWTVmMJg+La1kpUqzwNvBgfjOVbxwNvhXcEZaW L26/4MvOrkGeWkRu0YZZajDKVEDaWYTLL/6SE9Q4bzX/tY4TTqzVlumY1CKeESGwU77M w9RK7jvvOyJU9ZFRP/v52BN8MDVa5aApIahiY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717029879; x=1717634679; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rCzRJkj1CS92P5UL4N6EIOsMjdv4mGiz9WlXzg9a4rQ=; b=CjHc2ba9SXp2ZkUz1QZVWWFfLDb86FOmGIOb59Vm11vi5vJABpR27P3cVJMuKpOmwG Iit+nDaIYv6zO9hM7dcD+CPO1ybx6vYDWWP7wz3qdXkZFsAn+0lqwHrW9/UGpwFpbc3a oXFLeAyVj8AXrHeu80szXPEe6/Xs8/pqZxNGWJoera6m/72jJwBLA94qWgCdLc/A4yZ5 sXVwya8sq2GwmTtkFvxd+WiKMTMG2cI/s0NaEl7vdL3K4qmY3WsYbn6nXnL39z744SkG Ot3GP+2Tf7N42rRxM+iGckSe0UoY02znws5joB0/FArUQZm5Q+bKKUDEwn8C8/2elJbb T5zw== X-Gm-Message-State: AOJu0YwzlaYu8iVSxAmqvb3pmoedY/xXIH1/7DFAXiXVtEnnxT55pkHi Ze/LJHwFGT5ZVJ4vwFNX9+CQczGLfcxSOBRc7oSHqmZligo6L8m0Qq+9gD9ibg== X-Received: by 2002:a05:6a20:9752:b0:1b1:f6a9:6b31 with SMTP id adf61e73a8af0-1b26460c771mr556508637.61.1717029878514; Wed, 29 May 2024 17:44:38 -0700 (PDT) Received: from [10.66.192.68] ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f93d308732sm8304742b3a.101.2024.05.29.17.44.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 May 2024 17:44:38 -0700 (PDT) Message-ID: <9ca6230c-740c-4f1a-8fdf-73f74cf025a1@broadcom.com> Date: Wed, 29 May 2024 17:44:32 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 1/8] x86/vmware: Introduce VMware hypercall API To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, hpa@zytor.com, dave.hansen@linux.intel.com, mingo@redhat.com, tglx@linutronix.de, x86@kernel.org, netdev@vger.kernel.org, richardcochran@gmail.com, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com, zackr@vmware.com, linux-graphics-maintainer@vmware.com, pv-drivers@vmware.com, timothym@vmware.com, akaher@vmware.com, dri-devel@lists.freedesktop.org, daniel@ffwll.ch, airlied@gmail.com, tzimmermann@suse.de, mripard@kernel.org, maarten.lankhorst@linux.intel.com, horms@kernel.org, kirill.shutemov@linux.intel.com References: <20240523191446.54695-1-alexey.makhalov@broadcom.com> <20240523191446.54695-2-alexey.makhalov@broadcom.com> <20240527170734.GCZlS91uXD68HRN1na@fat_crate.local> Content-Language: en-US From: Alexey Makhalov Autocrypt: addr=alexey.makhalov@broadcom.com; keydata= xsFNBGVo9lkBEACeouRIm6Q3QTvjcnPczfBqgLffURstVJz5nqjnrNR4T+8dwNrZB8PTgOWA QdGV4bIyqtNG7UHQuZ7sVKr2tx0gYJyQ5uZgncEHB5YIuhQ/CyAHrVmO+5/0/xWCLI0g44rF ZJqsYw2JQ2+vayTWbR65rkOiKL8GOVFNZanDg80BRh6qCmCEMXd/tymxvgnvWpHtxMgukexk 4vV9nV4XhxRVYdpLk8mBxsh+AEbHE+nbWgIuJDrmrZDGI2Dha7JFoB0Mi6hbbYd9BdkcHKQ7 6c+S1xOrZL3jX7OIFhb4NNnEOhh8/+BDlyby478p6YsimNa7TgAUbrygGyfVG8usrZy8SvO+ vUbVQwqjcJaCK1xazK12dfuZm2kSMJUrJqa9ng6OMjkE2/WrtnK8ruFNSCdytzbuheT0nYUJ Uwy84cU4p2K/N2C4vYjcn+IT+l1BFr5FViKYruoRLVH6zK/WOoZjA+Fc6tdM5nC1pgSB9c7h XLQqDSzYPzk3nqeHWG1qJ0Hu7pscIrjxyNTIZ5le0TlpblJdoRcL5maDNw22yle8m4D18ERF VrqNoqwW8fObMCHbd6C3m75lzerq1HhrSvLyU4UfprEyAcjOI1C0319SXfYlXDjKXRQyaDZP wxln8uShSitSSnx0AsSAjcUa8Cc7km81+G2WSK3S2wVIAN11awARAQABzS5BbGV4ZXkgTWF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xUBxQwmhRPZRW+37vS2OLpyrTtBj3/tEM9 m9GMmTZqaJFeK7WCpprJV4jNHpWZuNAsQrdK1MrceIxb0/6wYe0xK79lScxms+zs9pGTrO4U 5RoS4gXK65ECcBH8/mumV6oBmLrNxKUrzTczdo9PnkmRyZcAa6AndbjmQDznwxvTZu2LjMPC EuY0 In-Reply-To: <20240527170734.GCZlS91uXD68HRN1na@fat_crate.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/27/24 10:07 AM, Borislav Petkov wrote: > On Thu, May 23, 2024 at 12:14:39PM -0700, Alexey Makhalov wrote: >> +#define VMWARE_HYPERCALL \ >> + ALTERNATIVE_3("", \ >> + "jmp .Lport_call%=", X86_FEATURE_HYPERVISOR, \ >> + "jmp .Lvmcall%=", X86_FEATURE_VMCALL, \ >> + "vmmcall\n\t" \ >> + "jmp .Lend%=", X86_FEATURE_VMW_VMMCALL) \ >> + "cmpb $" \ >> + __stringify(CPUID_VMWARE_FEATURES_ECX_VMMCALL) \ >> + ", %[mode]\n\t" \ >> + "jg .Lvmcall%=\n\t" \ >> + "je .Lvmmcall%=\n\t" \ >> + ".Lport_call%=: movw %[port], %%dx\n\t" \ >> + "inl (%%dx), %%eax\n\t" \ >> + "jmp .Lend%=\n\t" \ >> + ".Lvmmcall%=: vmmcall\n\t" \ >> + "jmp .Lend%=\n\t" \ >> + ".Lvmcall%=: vmcall\n\t" \ >> + ".Lend%=:" > > So applied (and with minor fixups for the proper indentation, see end of > this mail) this looks like this: > > .pushsection .altinstructions,"a" > .long 661b - . > .long 6641f - . > .4byte ( 4*32+31) > .byte 663b-661b > .byte 6651f-6641f > .long 661b - . > .long 6642f - . > .4byte ( 8*32+18) > .byte 663b-661b > .byte 6652f-6642f > .long 661b - . > .long 6643f - . > .4byte ( 8*32+19) > .byte 663b-661b > .byte 6653f-6643f > .popsection > .pushsection .altinstr_replacement, "ax" > # ALT: replacement 1 > 6641: > jmp .Lport_call72 > 6651: > # ALT: replacement 2 > 6642: > jmp .Lvmcall72 > 6652: > # ALT: replacement 3 > 6643: > vmmcall > jmp .Lend72 > 6653: > .popsection > cmpb $((((1UL))) << (0)), vmware_hypercall_mode(%rip) # vmware_hypercall_mode > jg .Lvmcall72 > je .Lvmmcall72 > .Lport_call72: > movw $22104, %dx # > inl (%dx), %eax > jmp .Lend72 > .Lvmmcall72: > vmmcall > jmp .Lend72 > .Lvmcall72: > vmcall > .Lend72: > > --- > > so AFAICT, you want three things: > > 1. X86_FEATURE_HYPERVISOR - that is always set when running as a guest. > For that it should do: > > movw $22104, %dx # > inl (%dx), %eax > > 2. X86_FEATURE_VMCALL: > > vmcall > > 3. X86_FEATURE_VMW_VMMCALL: > > vmmcall > > So why don't you simply do that? > > vmware_set_capabilities() sets vmware_hypercall_mode *and* those feature > flags at the same time. > > And you either support VMCALL or VMMCALL so the first thing should be the > fallback for some ancient crap. > > IOW, your hypercall alternative should simply be: > > ALTERNATIVE_2("vmcall", "vmmcall", X86_FEATURE_VMW_VMMCALL, "movw %[port], %%dx; "inl (%%dx), %%eax", X86_FEATURE_HYPERVISOR); > > without any more silly dance? While most of the vmware_hypercall callers are executed after alternative patching applied, there are small amount of hypercalls running before that. Only for them we have the logic of analyzing vmware_hypercall_mode as a default alternative code. And there are 2 constraints: 1. vmcall/vmmcall are not supported by old ESXi/Workstation/Fusion. We have to use in/out instructions. After the end of support of old hypervisors the alternative can be simplified as follow: ALTERNATIVE("vmcall", "vmmcall", X86_FEATURE_VMW_VMMCALL); 2. SEV-ES enabled VMs should use _only_ vmcall/vmmcall as in/out instructions cause faults. Another approach that we discussed internally was to use ALTERNATIVE_2("movw %[port], %%dx; "inl (%%dx), %%eax", "vmcall", X86_FEATURE_VMW_VMCALL, "vmmcall", X86_FEATURE_VMW_VMMCALL) for vmware_hypercallX family of functions, _and_ to have a separate API vmware_sev_hypercallX, with the silly dance without an alternative inside, to be used only by early boot code, before alternative application. But, it's error prone when things come to boot time related code movements or rearrangements as it puts additional requirement for SEV-ES understanding/testing for VMware guests. So, we picked a safe solution until a deprecation of port based hypercalls, which was mentioned above. See also a commit bac7b4e843232 ("x86/vmware: Update platform detection code for VMCALL/VMMCALL hypercalls") where silly dance was introduced with VMWARE_CMD macro. > > Hmmm? > > --- > > Fixup indentation for proper .s output: > > diff --git a/arch/x86/include/asm/vmware.h b/arch/x86/include/asm/vmware.h > index 5114f4c75c54..8be877d8bb7c 100644 > --- a/arch/x86/include/asm/vmware.h > +++ b/arch/x86/include/asm/vmware.h > @@ -70,17 +70,18 @@ extern u8 vmware_hypercall_mode; > "jmp .Lvmcall%=", X86_FEATURE_VMCALL, \ > "vmmcall\n\t" \ > "jmp .Lend%=", X86_FEATURE_VMW_VMMCALL) \ > - "cmpb $" \ > - __stringify(CPUID_VMWARE_FEATURES_ECX_VMMCALL) \ > - ", %[mode]\n\t" \ > + "\tcmpb $" __stringify(CPUID_VMWARE_FEATURES_ECX_VMMCALL) ", %[mode]\n\t" \ Noted \t prefix before cmpb, but will keep original 3 lines to fit in 80 columns limit. > "jg .Lvmcall%=\n\t" \ > - "je .Lvmmcall%=\n\t" \ > - ".Lport_call%=: movw %[port], %%dx\n\t" \ > + "je .Lvmmcall%=\n" \ > + ".Lport_call%=:\n\t" \ > + "movw %[port], %%dx\n\t" \ Noted having labels on a separate line. > "inl (%%dx), %%eax\n\t" \ > - "jmp .Lend%=\n\t" \ > - ".Lvmmcall%=: vmmcall\n\t" \ > - "jmp .Lend%=\n\t" \ > - ".Lvmcall%=: vmcall\n\t" \ > + "jmp .Lend%=\n" \ > + ".Lvmmcall%=:\n\t" \ > + "vmmcall\n\t" \ > + "jmp .Lend%=\n" \ > + ".Lvmcall%=:\n\t" \ > + "vmcall\n" \ > ".Lend%=:" > > static inline > > Best regards, --Alexey