Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2174316rwo; Thu, 3 Aug 2023 05:59:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlF5exeOS1+NEIy4faYSSj4qppwP4M76sy6nPUYdIy8oigCqcQfCEhN8ohmZaBGXAFcA845m X-Received: by 2002:a17:906:3299:b0:994:569b:61b8 with SMTP id 25-20020a170906329900b00994569b61b8mr7653115ejw.58.1691067561473; Thu, 03 Aug 2023 05:59:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691067561; cv=none; d=google.com; s=arc-20160816; b=Q2FlpLlVOIMaFFHBZCl4RcQToS8NadIaXKy9XPDL3rFUDHBXHJekVsv5BMGpvqRDMJ RHTa2nrgf45+RL/nA6pGuzLO1Ei92cIvQaTlf6iUa9mFgAcC0yJDj2rzL6XHkJzGMmH8 fFYSSmtg+iW2Cr6GGPC2g2+wChkn965cTKfLz1Zv6jkfSHSM4nYjnhssTZFC05xyIbOP g+W41LySjPMl2JPiDiwYOji8wr31XOMtC+kFOM7bKRD3gd+iZeF7+78DepO9+LGaG7Bm 3Mj65jqf2QCsxjIrJItS8JX29ftONUSKGjPcxi4KNqrxhlvexlG5EgcQA4xZlqGoS7nH Hg2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LTvjT0DQvcCDrs2gGL8aicGMrs38GE3EWkwzCeCV4A0=; fh=D8JJxOjBkRgGO4i8R+yZGJlBb8lVSrhJwOanxuAjkvk=; b=Xr/sf7b/6khsmmHpE3/51+ZcpR2/LfudFT6GM3BUF/+PuRQ3K6VHge5bkLxmMLoExM jxmxCulIVKKp1sOajDnQSpTnMNTnW6Nsq38HBpEXKEvxT7f2PJMZwT8Klg3Vrp9tISC9 /9xY0nyJY9uhHpOMbd2tA7d9lemRP4u4a/DwCuX+kCVvvw6wWGlOee3GNKicCc83iTiV qOpFLBZnI74jt2JkKKXXswR3C6UMzVfYNd7NORYq3xunfNAN0MJdSqXZdlDWYLvW78wi c7cI/B0AE2ZPNtmpoVyqd9CYJZCTjBeGvdcF/+54WlLJJjvbzeI4+qLTGqIrMG0lWH6F mWvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QXjLgghA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a1709064d8100b0099bcdfb188fsi11443284eju.743.2023.08.03.05.58.57; Thu, 03 Aug 2023 05:59:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QXjLgghA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235646AbjHCLqD (ORCPT + 99 others); Thu, 3 Aug 2023 07:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235489AbjHCLp7 (ORCPT ); Thu, 3 Aug 2023 07:45:59 -0400 Received: from mgamail.intel.com (unknown [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC0F935A4 for ; Thu, 3 Aug 2023 04:45:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691063153; x=1722599153; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=xEbhqq4qZmMZHeYJD5mYwHHsq6tkrYv3gIa6jEYvF5Y=; b=QXjLgghAmT5oj8/ZkbA8wACD2eej+qVEaEB5MGFcUOQ2Jy8FjXeGUHqm VNWD6JXGwwxiwYiqSyAspaEnInU3QlP0EEHyT5Bgs0FYK/qO6L6J0XfA6 H6n2dfYnukKvHbChPu2e9Eu8TSuwLAQTp2r06TKhKSO3xhhxtb+iY0b2k rnKAIjUuAUojkelpcuF9O9NdArAsUxZ23dl5ngY77k8nbb8EKvpgWCFog iVUDB6wEko6mav9Itrh0hJ+bwugKqVDORRSa52B2HOVOueAqV2TgaXZ+Z RORJV5HMtXh/LLwJusQP0M09tltJb9ea26MMWoOTlibzn+w3ZHeeZcbti A==; X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="400790303" X-IronPort-AV: E=Sophos;i="6.01,252,1684825200"; d="scan'208";a="400790303" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2023 04:45:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="759097971" X-IronPort-AV: E=Sophos;i="6.01,252,1684825200"; d="scan'208";a="759097971" Received: from gvarshne-mobl2.gar.corp.intel.com (HELO box.shutemov.name) ([10.252.63.106]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2023 04:45:49 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id B8E72109FCF; Thu, 3 Aug 2023 14:45:46 +0300 (+03) Date: Thu, 3 Aug 2023 14:45:46 +0300 From: "kirill.shutemov@linux.intel.com" To: "Huang, Kai" Cc: "Hansen, Dave" , "Christopherson,, Sean" , "x86@kernel.org" , "bp@alien8.de" , "peterz@infradead.org" , "hpa@zytor.com" , "mingo@redhat.com" , "tglx@linutronix.de" , "linux-kernel@vger.kernel.org" , "pbonzini@redhat.com" , "Yamahata, Isaku" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "n.borisov.lkml@gmail.com" Subject: Re: [PATCH v3 07/12] x86/tdx: Make TDX_HYPERCALL asm similar to TDX_MODULE_CALL Message-ID: <20230803114546.em5qsjs33i5b7ogh@box.shutemov.name> References: <6f92d08855491b3e9ff1221d2bb7af873d546afd.1690369495.git.kai.huang@intel.com> <20230727171008.aw3z6oxh4vfnahep@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 27, 2023 at 11:05:35PM +0000, Huang, Kai wrote: > On Thu, 2023-07-27 at 20:10 +0300, kirill.shutemov@linux.intel.com wrote: > > On Wed, Jul 26, 2023 at 11:25:09PM +1200, Kai Huang wrote: > > > > > > Remove the __tdx_hypercall_ret() as __tdx_hypercall() already does so. > > > > Hm. So we now update struct on all VMCALLs. Is it a good idea?? > > > > Do you mean we "unconditionally save output registers to the structure", right? > > > We give > > more control to VMM where it is not needed.? > > > > I don't quite follow this. Can you elaborate? > > Do you worry about VMM being malicious and putting malicious values to the > registers? Yes. Caller of the hypercall may expect that the register is in-only and re-use the field for other stuff. And it would work until VMM decide otherwise. > > I would rather keep the struct > > read-only where possible. > > > > We can achieve this if there's a clean way to do, but I don't see that. Keep _ret() and non-_ret() versions? -- Kiryl Shutsemau / Kirill A. Shutemov