Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp238406rdb; Tue, 19 Dec 2023 15:23:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IH03+/bTP/JVNvAI+7uwS/8F8HY2na3eoBIpyLTLAlYGcIV5ywU66cVlNYBUh6MBD/6zb3H X-Received: by 2002:a0c:c784:0:b0:67a:a721:7838 with SMTP id k4-20020a0cc784000000b0067aa7217838mr19494333qvj.93.1703028226967; Tue, 19 Dec 2023 15:23:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703028226; cv=none; d=google.com; s=arc-20160816; b=CBTDnPSKE0aOS0b6hJO10YiexpEui94g25BgTSFCBl52lg+pHDp4+1fU7zlgLDXlqq zhR/eVS3GViOEP3aozbL8IpuPrOJa5tFOYCpH2gpehfOxlQs5wllSISWhI0KQIc7lam2 3UbXHHjBkU8uqM3EeY5iQ3FOKy5D1Bayn286p9+gq5XzFlNoK/cT64mqVCMK1r7jnN1A d1hNJqkXEpuSLDSZozUZBAjb/Yx6s2iV/TiJerY+GpW4P2RdzPCVy6Uoroe5ereY8DGc /4bRmSubmQIJ2bDlp2Ins9p6gVgTuu8ZW1Thz/1+T9x9j8Co3YjIq3+Vy09hs0GpJdgz M2OA== 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=pAgEGS8fSzXmUpJLVIUjZn4WnwhV5/BZcYiffNLMRjE=; fh=DIGxkKWDPqysVkw0/lYdZd9nJzo7LI1eQXAnhcfqgP8=; b=eyZJH6Vk+mOMzUZwUcJCU7hT0Y4wPWekXfhdg46oDAf7+As/z8OpNRu1D4WJdEHpFg 3I84ZBjm2Oo2WZZ2FhFRQ/+dkZJiKbJwpKbZYAOR8RyvSwryaCiUUuKy8Nr0mWaTfEGD 6CGVjEDYJ2H0CWzI18W0vhuM5Q9tma5IkAbvykd1cAVb0IX/onCIqbbVnK03EdBv54Xs loQEp2YdeMb8kCBQOKOCz0Ndvd5NyYhCRf8eEMmL7nmyVV+C/Uu7aP8EdspJIqX1nxeB ZE2aLn6qU/OtH8ULjBrZM6C5tUg/eX7YDL89y2OxA1Q3S71KjwAxPWzxbU5KLiR6KgVW OvNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lgIdbIZ7; spf=pass (google.com: domain of linux-kernel+bounces-6090-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6090-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id pa29-20020a05620a831d00b0078111e505a7si73593qkn.532.2023.12.19.15.23.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 15:23:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6090-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lgIdbIZ7; spf=pass (google.com: domain of linux-kernel+bounces-6090-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6090-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A04FB1C24AC7 for ; Tue, 19 Dec 2023 23:23:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EC003DBA3; Tue, 19 Dec 2023 23:23:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lgIdbIZ7" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (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 3C0F33D0CA; Tue, 19 Dec 2023 23:23:32 +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=1703028212; x=1734564212; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vS5AE7N9nQ3SlnVS08m4qPs43i9JpvyT0LdsYgBIZjI=; b=lgIdbIZ7ew6czjd6kxX4fknJ0sYdBUk5SZu5eacEcjDShbkQd8L5aYGJ k+LHxwz2cHuZZU3GbyRzPcyeNs/1XZ9/Ny/mdQzC06gOqbwPH7qEpMFHK KG7hn9ntEsGbYtXqQ6R5mF3Eqi5a06E1CbBe474Vza+H42fzHVDkH8RCn x3AyWVG1DgMAIRnsuW7yTBfbQ3jdMHji/uPrhTb/70Dc85QEoOQQUgFrC yAcU+F+EKknS2khAsjqzB4xNdhKTA9JFhPEsXUJQ4m04ra3IeIw2s7Wwh oujEbJYCY20N19eqjj3fjWntqAvC51FECYT9zGJbArHjglRY3keCfXaEh A==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="9196787" X-IronPort-AV: E=Sophos;i="6.04,289,1695711600"; d="scan'208";a="9196787" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 15:23:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,289,1695711600"; d="scan'208";a="10561229" Received: from lveltman-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.33.252]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 15:23:26 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 1DC2210A43B; Wed, 20 Dec 2023 02:23:23 +0300 (+03) Date: Wed, 20 Dec 2023 02:23:23 +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: <20231219232323.euweerulgsgbodx5@box.shutemov.name> References: <20231219215751.9445-1-alexey.makhalov@broadcom.com> <20231219215751.9445-7-alexey.makhalov@broadcom.com> 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: <20231219215751.9445-7-alexey.makhalov@broadcom.com> 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; > + > + 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? > + } > + > + args->r10 = VMWARE_TDX_VENDOR_LEAF; > + args->r11 = VMWARE_TDX_HCALL_FUNC; > + args->r12 = VMWARE_HYPERVISOR_MAGIC; > + args->r13 = cmd; > + > + __tdx_hypercall(args); > + > + return args->r12; > +} > +EXPORT_SYMBOL_GPL(vmware_tdx_hypercall); > +#endif > + > #ifdef CONFIG_AMD_MEM_ENCRYPT > static void vmware_sev_es_hcall_prepare(struct ghcb *ghcb, > struct pt_regs *regs) > -- > 2.39.0 > -- Kiryl Shutsemau / Kirill A. Shutemov