Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp273715rdb; Tue, 19 Dec 2023 17:00:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGju4DPIcmmhJk+sVDmWpVKHy8dynQPyfWp1UOjdIcrUUFFpLJcR3Eq9YP1BSho4baR43QZ X-Received: by 2002:a05:6a21:609:b0:18c:770:4578 with SMTP id ll9-20020a056a21060900b0018c07704578mr20214635pzb.30.1703034024503; Tue, 19 Dec 2023 17:00:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703034024; cv=none; d=google.com; s=arc-20160816; b=qSpRmnW1TqNVdaAOWHTUEA9cmdtAIneirCqjkXc4SLBEcVouOfqQK9D9AVNhrNVZKx gKZjnA/8vt1zXblpjXiyh30gr8EnjSgwnQfXXtCVld5rYL8dVU1d7UIPBXw1OHimaNx9 vOBxJffzwbiI8wOooJ2M5X3Sb7nvkNKmpXwNIVPSgkURV3EIZjuzefE6a8xRhxi1THB9 6KnjoM5RM+ETnpTsAMopF+AOHSaJoaN70BPBuNGEyt1C+mIbEnWhC50wxkcEdUAQbMJW uHP0fWCUCbD/lRjPOJdKv6582mIZOcl/q/61FConnO/5MvHXLIkdg8bpNYZJ/8kHHvyb m5mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MjB8amN0dBVeYcArOhWxdJBnv6gL4CzqD7XMeY0ePpA=; fh=DIGxkKWDPqysVkw0/lYdZd9nJzo7LI1eQXAnhcfqgP8=; b=yqWeE2AVFQIPlqwkja12PJ88cz3pigQqRtSKg5pKXBYWi6b8a2bNtjfWk8gNs+m/gf aOOSZDHAKiP/y94SRvVk7m/TxaxQodgxC6y0ajIi90CKnNOpVYpVssA+CitQ/OUCvAcC 4w8xapI9Q5WfD6qbywajLxwFSZAOn/BnqHtw4JdAr575sv1HE3k8Mgd1Hw1QkJ01j46E CsiqClv+Y2nGAwTIJCLo5Q40lUoDcFZDUN8HIpgx8Pc3y5F5VzejJKl5sn1M9BntTeoq vJ9g/fAdBZPgvfXlVNx3qL1B7EMsseUJ8lb6+nnIK57MRx/JGWoarx1f+8hXJfAPfXnn QKww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="er1d/tGh"; spf=pass (google.com: domain of linux-kernel+bounces-6218-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p10-20020a056a000a0a00b006d5bc38f93esi5301959pfh.192.2023.12.19.17.00.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 17:00:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6218-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="er1d/tGh"; spf=pass (google.com: domain of linux-kernel+bounces-6218-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4DC76B219D9 for ; Wed, 20 Dec 2023 01:00:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F07BF5241; Wed, 20 Dec 2023 01:00:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="er1d/tGh" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7723BA2B; Wed, 20 Dec 2023 01:00:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703034009; x=1734570009; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gIKef6p2pnRwDgZPaAPbr3bSEyMzw577pOdpYRM0VGo=; b=er1d/tGhfDLuuaPgN1BFWmLPqYWd7FGILvBsEizAPPXNHVu6+GLKPMjN yl0qwNr1GBqKCn4SPAIZ7rEdzAKtv7yGdTXCykJ7gM2MIhJdb/SdrR0sZ Lmgxezjm0W4nYCXUhf654ZJU33qz1lLPiJl1hCElZtkiyj7Eqp7Eg+Kfy 2CcVmVMDEwkKYhO8VWb4OnSgoSu3a0TGEXhsamUkBKCYYIqbZw2CUhH1g W0slSN1ag56izcefMws8J75aUarRuL48y/VNLC6u3JEwVSvAs8LLd3heb M322DR1W4FeHB0exJZBdJ9srxKmGlQhTy0e+w91GwWZ9MHyNIpYwXLytO g==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="392914596" X-IronPort-AV: E=Sophos;i="6.04,290,1695711600"; d="scan'208";a="392914596" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 17:00:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="846534858" X-IronPort-AV: E=Sophos;i="6.04,290,1695711600"; d="scan'208";a="846534858" Received: from lveltman-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.33.252]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 17:00:03 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 9C43A10A43B; Wed, 20 Dec 2023 04:00:00 +0300 (+03) Date: Wed, 20 Dec 2023 04:00:00 +0300 From: kirill.shutemov@linux.intel.com To: Alexey Makhalov 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 Subject: Re: [PATCH v3 6/6] x86/vmware: Add TDX hypercall support Message-ID: <20231220010000.y5ybey76xjckvh6y@box.shutemov.name> References: <20231219215751.9445-1-alexey.makhalov@broadcom.com> <20231219215751.9445-7-alexey.makhalov@broadcom.com> <20231219232323.euweerulgsgbodx5@box.shutemov.name> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Dec 19, 2023 at 04:27:51PM -0800, Alexey Makhalov wrote: > > > On 12/19/23 3:23 PM, kirill.shutemov@linux.intel.com wrote: > > On Tue, Dec 19, 2023 at 01:57:51PM -0800, Alexey Makhalov wrote: > > > diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c > > > index 3aa1adaed18f..ef07ab7a07e1 100644 > > > --- a/arch/x86/kernel/cpu/vmware.c > > > +++ b/arch/x86/kernel/cpu/vmware.c > > > @@ -428,6 +428,30 @@ static bool __init vmware_legacy_x2apic_available(void) > > > (eax & BIT(VCPU_LEGACY_X2APIC)); > > > } > > > +#ifdef CONFIG_INTEL_TDX_GUEST > > > +unsigned long vmware_tdx_hypercall(unsigned long cmd, > > > + struct tdx_module_args *args) > > > +{ > > > + if (!hypervisor_is_type(X86_HYPER_VMWARE)) > > > + return 0; BTW, don't you want to warn here to? We don't expect vmware hypercalls to be called by non-vmware guest, do we? > > > + > > > + if (cmd & ~VMWARE_CMD_MASK) { > > > + pr_warn("Out of range command %x\n", cmd); > > > + return 0; > > > > Is zero success? Shouldn't it be an error? > > VMware hypercalls do not have a standard way of signalling an error. > To generalize expectations from the caller perspective of any existing > hypercalls: error (including hypercall is not supported or disabled) is when > return value is 0 and out1/2 are unchanged or equal to in1/in2. You are talking about signaling errors over hypercall transport. But if kernel can see that something is wrong why cannot it signal the issue clearly to caller. It is going to be in-kernel convention. And to very least, it has to be pr_warn_once(). -- Kiryl Shutsemau / Kirill A. Shutemov