From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 DECE242F701 for ; Tue, 7 Jul 2026 15:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783439152; cv=none; b=QXhDjb17j24fIkGcd6mht7RVF0FGHMvUDHNneF6aZhFLQXmg5uMvaoelmgtM5BKZAJJLD95AzzfUH+SauOGWfeU6BWoL+kTmBNfdzTYSkdZlh9SSiLCN7KSJomjQO52c4XeG9kxPBpXpW/SZJtJ324EwAUbB3OsDfXzDZcn6MQI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783439152; c=relaxed/simple; bh=OLF4hmmf+Tc3sRZQ1Zn/zpMeXWlzqueZGfFai3lxUS4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TzNv3RvbjBUd8mixPxDxhl2ACwF4U5BGvGAwFinTXHwult+5KfM0TQiT+A0TuiOKzmIr+eeSFIMmGoGDv5t3VEBuXr4spMQSmhzqncLwbxUczWtK8HRszrL9glgyP8fUWYEcfnVvIBz2CFOL6TYZHeAhbhl22FnFyElWmKW0Yr4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GGBUCuYD; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GGBUCuYD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783439143; x=1814975143; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=OLF4hmmf+Tc3sRZQ1Zn/zpMeXWlzqueZGfFai3lxUS4=; b=GGBUCuYDi3RYjH2mK6ceZcg5nSBRZ3m0v/jWDDhzad8/KfLtZzVKyaca dw/VmGRF4funS/O0EswHdRjyEdAe2XZ/Y3g3Uy8bNKJKdgw4vEJKH4oQA xuHGAWsE0dHzXcUGb3WXlEN/xL24WaLyGL0Iya1K2/FjdICKBe0NRNa41 vAo7vToBUmFwz94PYbD6NnbWSe4bTBo9lAvZJdmHKF9sSnEHrHsGyt+ex fgLPANV3f9/Md1N0rvHSdbhZESoxbmEchuiT98sGc5jTdM9di3tU/huBf pqNpGAUdvKKktVmr4XIBlgguA0YluHldYfe2ApFn9c64ZfBRQo/Zy4FUu A==; X-CSE-ConnectionGUID: htKojzFqTQCZrFnVWv27QQ== X-CSE-MsgGUID: nwk/idzMT/C5KVxVDw3S6w== X-IronPort-AV: E=McAfee;i="6800,10657,11840"; a="83066439" X-IronPort-AV: E=Sophos;i="6.25,153,1779174000"; d="scan'208";a="83066439" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2026 08:45:37 -0700 X-CSE-ConnectionGUID: MQL0LnQXR1id52jn/IouIg== X-CSE-MsgGUID: WiASptY7QHKl5InA4nxNwA== X-ExtLoop1: 1 Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by fmviesa003.fm.intel.com with ESMTP; 07 Jul 2026 08:45:35 -0700 Date: Tue, 7 Jul 2026 23:45:33 +0800 From: Xu Yilun To: Xiaoyao Li Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kas@kernel.org, rick.p.edgecombe@intel.com, dave.hansen@intel.com, dave.hansen@linux.intel.com, yilun.xu@intel.com, chao.gao@intel.com, djbw@kernel.org, linux-coco@lists.linux.dev, peter.fang@intel.com Subject: Re: [PATCH] x86/virt/tdx: Formalize SEAMCALL version encoding support Message-ID: References: <20260702144614.59464-1-yilun.xu@linux.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=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jul 03, 2026 at 08:00:38AM +0800, Xiaoyao Li wrote: > On 7/2/2026 10:46 PM, Xu Yilun wrote: > > +/* > > + * SEAMCALL leaf: > > + * > > + * Bit 15:0 Leaf number > > + * Bit 23:16 Version number > > + */ > > +#define SEAMCALL_VERSION_MASK GENMASK_U64(23, 16) > > + > > +static __always_inline u64 __seamcall_encode_fn(sc_func_t func, u64 fn, > > + struct tdx_module_args *args) > > +{ > > + FIELD_MODIFY(SEAMCALL_VERSION_MASK, &fn, args->version); > > + > > + return func(fn, args); > > +} > > + > > static __always_inline u64 __seamcall_dirty_cache(sc_func_t func, u64 fn, > > struct tdx_module_args *args) > > { > > @@ -39,7 +56,7 @@ static __always_inline u64 __seamcall_dirty_cache(sc_func_t func, u64 fn, > > */ > > this_cpu_write(cache_state_incoherent, true); > > - return func(fn, args); > > + return __seamcall_encode_fn(func, fn, args); > > } > > Can we drop the new wrapper? I don't see why we need it. The wrapper makes > the code harder to read. OK, will call FIELD_MODIFY() directly in __seamcall_dirty_cache() > >