Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2823261lqz; Wed, 3 Apr 2024 09:30:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXp+U4W+oebJKacFsZSk9rL4N80dFiFgFWpl/xLujU04KqMU0I/psfcUZBJzML0Dkr1wT6jEXgwHNPYXAP6gkvp485qwgoXt78aYe0K9A== X-Google-Smtp-Source: AGHT+IEki+VBvHAexcBLoJ22Xy0QJ4IxcHzznItGKq7LkcfH9B9HrlPBqgkq+pdoe11CjWapZjwn X-Received: by 2002:a05:6a21:271f:b0:1a7:2e4b:7af with SMTP id rm31-20020a056a21271f00b001a72e4b07afmr145243pzb.23.1712161857545; Wed, 03 Apr 2024 09:30:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712161857; cv=pass; d=google.com; s=arc-20160816; b=L9kQKMLO1Nj5Kw+b319qDqWcfRlKkyeEDSjoYpXNi1AVNGD2VUjNLlYh1MPt2P2xMo YxXxn+uynOCtADwzu3loKjC1eO1xI3KkosG/kBZJe8uBJ++w0MRG7ZY4S9LqI8O2uCE+ 74FywLUuvYFAEKkhw9rBlcCs3AbVm2tu0X98ZAjh0f85WYSSVE45M257//gt2c8kyF5V E1u3Smuvp6Rj9t+cqzP3Q263Zy+pyt/TIRSpNJGUTdb+I5IGpLr/uHkvRiREqKABvRp2 sJqIFuGuK1HnyJ/JIzM8l/hmmT9vGDKec7+gQ0jssXEL/h8R2w42gBmoi/gc0yD5kX/3 fymw== ARC-Message-Signature: i=2; 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=h7W99tMJh4ELviWV6vn5NkwlhdmWN3+BkiRCIgc2dUo=; fh=NE7YDMnPfuWdWsozfZymgfXU9J2EzyHgm4w66itct7o=; b=KUc53OMV4frjAP4bW0hnFQQPR/PIsBmwVdVQLmp57VLACnZ4R/S6SAWRzet8Ph364s mJ6KjLOfLf1GUmisNrAKWMNQiqJPirAw1qvVNwERx8rMPMIHgvrZBgxlk/wOW4Vxdgy1 jhzaYjIot40NZ2uJLZIfniSEyEPdPj57t+Houjjp1z6/g5YcrN1qsQdBnttyJgnUqW58 QD4zDFXguvsD5F2zMAhbY6dE4UsUfvNiTF9fAjU+0XXWLlyRntcH64961B3uJNiSUVOt x6Ibx9nOxV377tT6aTX9kzV0YBrmXuXNM0jrhnqhgwaYp/ufnDP1/6onLHTAyYUdqHm2 Y1Nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dHbiiKvv; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-130197-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130197-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h20-20020a631214000000b005f3c8f1f441si4445606pgl.640.2024.04.03.09.30.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130197-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dHbiiKvv; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-130197-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130197-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7774528F485 for ; Wed, 3 Apr 2024 16:30:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5486152197; Wed, 3 Apr 2024 16:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="dHbiiKvv" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) (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 DB103152182; Wed, 3 Apr 2024 16:30:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712161815; cv=none; b=ThumbPQzsZYs3TMdpDH9s8PQAxQzMPoC0sBGS0Pupc7h+qxnXhdD2y7WSFwMS4bpu6c8/C240Gt5EaqTybD9mDbHt8oVGhcfEcU/ljGAk38aVVSAsJvooc3RG0+yAeZ8jZDVTWiwd0cTxBMaWAf65eCk16CJ41BPBP5BtsZuVBY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712161815; c=relaxed/simple; bh=vbDpGSoI9EPAI1uhODCTMNPVWnAKTin6hpwpvwV3kck=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sNau3/CKMvSn/nf3FqYL0tzhEagJ0UiO03cca5G/wDqAkcMi65YXAAdlMlEQMp5BdzsOkSS+46aEKy/3Z4KJX1Hyx1Qg4MIPVUkxwhakv39+aC5hq0iDdt/6Wc7OkvABowDKffRv4gJ6Vic2FAphacQQwc3W50bHPv5wEvPZdzU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dHbiiKvv; arc=none smtp.client-ip=192.198.163.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712161813; x=1743697813; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vbDpGSoI9EPAI1uhODCTMNPVWnAKTin6hpwpvwV3kck=; b=dHbiiKvv8+nlK376RzEgLmsBq9FCRjtu6qokn4CTmtVYzLdGZJwunaw4 Ta/V4chrM62TRKUVkdpzkx3tDKlTKNkzgfhm5QLA5TXJw81cvCElpRyXL GsSO21730V1uIkhXa8ibDQi5uFmSwdxDYVV9PX9EXUYcw3/ZYsf3R2xRN hhn0MnLyhxDivz9Ja3Jt1z51Abd3uhaWdoDPcrkf9JBrzLE1GFNoPAGuZ yliGB0R+XDuQH3JV537t+DCMAUHG32Mkn9MGi9Xzn1vr6iNneBSMbWZsy oAu2m0OakG2nH4LgiRqA1l/fazik1LkA8i7g+FxcvDoobAxDYPrMcFD8V g==; X-CSE-ConnectionGUID: KrkKMjRhQmmi13895Pwjyg== X-CSE-MsgGUID: S1qXJ0W1Rh2K6Xe1RxhG9A== X-IronPort-AV: E=McAfee;i="6600,9927,11033"; a="7640303" X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="7640303" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2024 09:30:12 -0700 X-CSE-ConnectionGUID: aEmPxBAXSnCVVM0ZIFzQHg== X-CSE-MsgGUID: +uZpr5OLSNWg4mGpW3HMRg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,177,1708416000"; d="scan'208";a="22959547" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2024 09:30:12 -0700 Date: Wed, 3 Apr 2024 09:30:11 -0700 From: Isaku Yamahata To: Sean Christopherson Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sagi Shahar , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, Sean Christopherson , Xiaoyao Li , isaku.yamahata@linux.intel.com Subject: Re: [PATCH v19 027/130] KVM: TDX: Define TDX architectural definitions Message-ID: <20240403163011.GD2444378@ls.amr.corp.intel.com> References: <522cbfe6e5a351f88480790fe3c3be36c82ca4b1.1708933498.git.isaku.yamahata@intel.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=utf-8 Content-Disposition: inline In-Reply-To: On Wed, Apr 03, 2024 at 08:04:03AM -0700, Sean Christopherson wrote: > On Mon, Feb 26, 2024, isaku.yamahata@intel.com wrote: > > +union tdx_vcpu_state_details { > > + struct { > > + u64 vmxip : 1; > > + u64 reserved : 63; > > + }; > > + u64 full; > > +}; > > No unions please. KVM uses unions in a few places where they are the lesser of > all evils, but in general, unions are frowned upon. Bitfields in particular are > strongly discourage, as they are a nightmare to read/review and tend to generate > bad code. > > E.g. for this one, something like (names aren't great) > > static inline bool tdx_has_pending_virtual_interrupt(struct kvm_vcpu *vcpu) > { > return & TDX_VCPU_STATE_VMXIP; > } Sure, let me replace them with mask and shift. -- Isaku Yamahata