Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp324444rdb; Tue, 19 Dec 2023 19:30:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoFdYAnZoMDVELrG/j47j894AyPh5RrrWTVrsDfImGWakuwzU33QLDCQOQl/MJ22J0AxBV X-Received: by 2002:a05:6870:4402:b0:1fb:75a:6d43 with SMTP id u2-20020a056870440200b001fb075a6d43mr22189468oah.106.1703043021686; Tue, 19 Dec 2023 19:30:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703043021; cv=none; d=google.com; s=arc-20160816; b=EN/aufX9EqYASqFyeKqnPfsY+Ob3ubKP2MXGyzvyAfeeLP/TxIbJawRAUBYwUkp9h/ ru7dxwcFUhNjBMqme2Yh/9sHHrDjH3Dt4GbTpJFfbMkFyz8xPSvQKipAMrkA9iQQue+I wAxvsSDHahdpsc7wDiccrq+KSDMfiRLTaTrK4+MTI7zGzz6kIjWE6jGhZA3TPK9LrFOW Ad2//V31Qa3LJLiv54Rmi52MCmQfJy/vreza97GA3IN/3+QhXjFfMFB5xi7JxH3YMdM5 BP+VBDavKgo2qOr++Sx/+7drfAJZ47uc3cW4Sj2CzqGxB8ufPv3A71s6IfC3m1aBFq+Z vi/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=sUq2OM1li7CxkIrkWDtdEiY2oiOCTUFA1jYnFMugiCM=; fh=YshqjfBnQkyYX0Zvf2xQdq6oVKcxwTuvToAhaR0LT58=; b=iFL9vufSlr4Tdg6RUcC/JSxM3ybM/vGqWcNfdpL7QfgM8kV/XB/+ZwFb+c05hMaEiC ANV+Yu6wlYcDRUVcRnpOX2Go9U69MffHI6MVObKVHpfuWgtGBIkHxSSc49EL49HYANRp TYCZiGGM5Uif4xJsnZuV5Pvn5CcL4PpS0ioYA4i8ag1bBLZro1ALn8X1WqqTgy3VEv+M fZdgp71pe4zFfCnqjWRqAM9dW6cLTLISeZPLg3wO6Fhf2pYVfFbHwwCah24787ifwG/T 4w4OYsKrIxfYbLjFfd997MqgJSzxZcXwG5CS4NlzHNexkJX4w8nBrE1YOUMaF1RfjgXB 0KgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=cXVOzxbg; spf=pass (google.com: domain of linux-kernel+bounces-6320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6320-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z2-20020a63e102000000b005aa83686f32si21101837pgh.42.2023.12.19.19.30.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 19:30:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=cXVOzxbg; spf=pass (google.com: domain of linux-kernel+bounces-6320-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6320-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4C67228714D for ; Wed, 20 Dec 2023 03:30:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B123BE6F; Wed, 20 Dec 2023 03:30:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="cXVOzxbg" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 3A8728BF6 for ; Wed, 20 Dec 2023 03:30:06 +0000 (UTC) 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-pj1-f42.google.com with SMTP id 98e67ed59e1d1-28b71490fbbso1719439a91.0 for ; Tue, 19 Dec 2023 19:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1703043005; x=1703647805; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sUq2OM1li7CxkIrkWDtdEiY2oiOCTUFA1jYnFMugiCM=; b=cXVOzxbgih73++d5wcPrCVc2qsLgBxmovP11/hdJKm0a+YVR6sLiu64pug3jwsknkf /HV/kphaJhQCMN+uYLD+s4R8+d7UYgj/jU38Pyf8U8jJSjXoYa+Is8WEeMfoDcdN50sf kM1ZN6Ni5TJh2FKjzrT4+d4khQQ4X/xUewcyM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703043005; x=1703647805; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sUq2OM1li7CxkIrkWDtdEiY2oiOCTUFA1jYnFMugiCM=; b=wQzzoaf4JTxzPraaM9IlAvYRGPMlfB4rojCrkVD6FAGjWtQKlWXDjG9QTOhE1kyRfB JBAKVGl9TdYx05ufEExwKqDuQ32QXILyxA58RxJYJvx6VMD84k2gInUF8VEqdmiyAJRM MlV3cQxAk+o83ekvkbMUxBpbQb6WpD/p+/hwKXkb6/KqfcECGRJE99URJn6IphY4e0R1 na9APVOiaI+yVWF2ufKNrsU5nJE0r6qb70RqUOUrSzTqkFKTW1Aw//n0InPNMTnFfrcI 0cDUWq+HMDdt0GSdOhnsZfjXj3Xg2F6CBfeMoZb+xD7IDxzoybtVQ+Rj92uK+iYLdgkz PXCw== X-Gm-Message-State: AOJu0YyOo3Urb0CWqTdPxrvdG85Z4RpP3wjXLL77VXiylfgINYUJhMyT KF/eSoOHz857XYVMc0hNkMnRzg== X-Received: by 2002:a17:902:d491:b0:1d3:6a11:1fbd with SMTP id c17-20020a170902d49100b001d36a111fbdmr7432822plg.118.1703043005517; Tue, 19 Dec 2023 19:30:05 -0800 (PST) Received: from [192.168.0.111] (d-174-140-102-53.fl.cpe.atlanticbb.net. [174.140.102.53]) by smtp.gmail.com with ESMTPSA id n16-20020a170903111000b001d3320f6143sm14934478plh.269.2023.12.19.19.30.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Dec 2023 19:30:05 -0800 (PST) Message-ID: Date: Tue, 19 Dec 2023 19:30:00 -0800 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 v3 2/6] x86/vmware: Introduce vmware_hypercall API Content-Language: en-US To: kirill.shutemov@linux.intel.com Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, bp@alien8.de, 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, namit@vmware.com, timothym@vmware.com, akaher@vmware.com, jsipek@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 References: <20231219215751.9445-1-alexey.makhalov@broadcom.com> <20231219215751.9445-3-alexey.makhalov@broadcom.com> <20231219232023.u4dyuvbzbh565grk@box.shutemov.name> <75eed318-2d22-429d-ab95-80610ba82934@broadcom.com> <20231220005156.2rymnxu5bv6wdwlx@box.shutemov.name> 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 XLQqDSzYPzk3nqeHWG1qJ0Hu7pscIrjxyNTIZ5le0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JatOkkwkw5PZseqdwcAk5+wcCbdYy8J8ttR04iV1FzrdQp8HbVxGNo7 AlDn1qtoHzvJHSQG51tbXWfLIi1ek3tpwJWj08+Zo+M47X6B65g7wdrwCiiFfclhXhI1eJNy fqqZgi3rxgu4sc5lmR846emZ/Tx85/nizqWCv7xUBxQwmhRPZRW+37vS2OLpyrTtBj3/tEM9 m9GMmTZqaJFeK7WCpprJV4jNHpWZuNAsQrdK1MrceIxb0/6wYe0xK79lScxms+zs9pGTrO4U 5RoS4gXK65ECcBH8/mumV6oBmLrNxKUrzTczdo9PnkmRyZcAa6AndbjmQDznwxvTZu2LjMPC EuY0 In-Reply-To: <20231220005156.2rymnxu5bv6wdwlx@box.shutemov.name> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/19/23 4:51 PM, kirill.shutemov@linux.intel.com wrote: > On Tue, Dec 19, 2023 at 04:17:40PM -0800, Alexey Makhalov wrote: >> >> >> On 12/19/23 3:20 PM, kirill.shutemov@linux.intel.com wrote: >>> On Tue, Dec 19, 2023 at 01:57:47PM -0800, Alexey Makhalov wrote: >>>> +static inline >>>> +unsigned long vmware_hypercall1(unsigned long cmd, unsigned long in1) >>> ... >>>> +static inline >>>> +unsigned long vmware_hypercall3(unsigned long cmd, unsigned long in1, >>>> + uint32_t *out1, uint32_t *out2) >>> ... >>>> +static inline >>>> +unsigned long vmware_hypercall4(unsigned long cmd, unsigned long in1, >>>> + uint32_t *out1, uint32_t *out2, >>>> + uint32_t *out3) >>> ... >>>> +static inline >>>> +unsigned long vmware_hypercall5(unsigned long cmd, unsigned long in1, >>>> + unsigned long in3, unsigned long in4, >>>> + unsigned long in5, uint32_t *out2) >>> ... >>>> +static inline >>>> +unsigned long vmware_hypercall6(unsigned long cmd, unsigned long in1, >>>> + unsigned long in3, uint32_t *out2, >>>> + uint32_t *out3, uint32_t *out4, >>>> + uint32_t *out5) >>> ... >>>> +static inline >>>> +unsigned long vmware_hypercall7(unsigned long cmd, unsigned long in1, >>>> + unsigned long in3, unsigned long in4, >>>> + unsigned long in5, uint32_t *out1, >>>> + uint32_t *out2, uint32_t *out3) >>> >>> Naming is weird. The number in the name doesn't help much as there seems >>> no system on how many of the parameters are ins and outs. >> >> There was internal discussion on hypercall API naming. One of proposals was >> using 2 digits - number of input and number of output arguments. >> And it definitely looked weird. So, we agreed to have just single number - >> total number of arguments excluding cmd. > > Have you considered naming them by number of input parameters? Number of > output parameters as demanded by users. > > So vmware_hypercall4() will become vmware_hypercall1() and current > vmware_hypercall1() and vmware_hypercall3() will go away. > > It is still awful, but /maybe/ better that this, I donno. > Deprecating vmware_hypercall1 and vmware_hypercall3 in favor of vmware_hypercall4 will generate less efficient code for the caller of first ones. Using current vmware_hypercall4 instead of vmware_hypercall1 will force the caller to allocate additional variables (register or on stack memory) for hypercall asm inline to put additional output registers on. And specifically to 'usage' of *out3 - compiler will unnecessary 'clobber' useful rdx, when hypervisor will keep it unchanged. Unfortunately VMware hypercall ABI is not as beautiful as KVM one, especially in number of output arguments and their ordering. rbp register usage as an argument is a separate bummer((. So we have to work with what we have. Current set of functions includes only 6 functions (for LB), which is the optimum between readability, maintainability and performance. It covers all current kernel callers and all new callers from yet to be upstreamed patches that we have in Photon OS including 2 patches for x86 and arm64 guest support. Regards, --Alexey