From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.13 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796293390; b=Qhndx/PQE+oJUXaC5I2QqUnEjY6VMveaCaxclqJPtjUv6jut3MaeAPLZqwcT+YN4S2J6 wE1IQSvhPGFBHEEk40ej2tOK3kTuHwK5l/PFmCTxJVm2APs8zLxfIvtWw7UCS0awVCQtN OZL/AWfE9x48yHUr/nWYgoQN+FzMdQf9RsOu6zHpDKeh0Xc33wfwP8PS5EUTzHxoFC40p bnDpmVafkc5YlrMPmdhVNYq/o9PllHw0/6gc5YlSZPzVIhdoQrdsLBJFLYTBjn5zXDCTt mtriabO1DKp3J2OVeUZCv1aP/M6M0pT3XGsmwNkdV2pKaShVluf4OxZNV3+yaY5VUwA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796293390; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=RU484H9OqMJ7VhvtMCgvWDMS19FgKB4zQYXWFcIj7/U=; b=TYoLp8oPlOEDcafLek8EaFhRYP3Hayjw0vG0m3qDNCWvMN+bF6tLCWlVH+gGQCjUzaIv mu65YwB1AJDpUQ9X7K68TTUwQd2JikfeJgu01fPxhus0L9w0tvY0p/vQRAFZCELFA2E0F hN1rsgy+y3iCfQusFQDNMiW1Jo45qFMZhUzszwne0JDsoEZWjEKh7x/8Uj0xYcta6urkk krsxw0RUJyiAX7e97jDM9OQ5d35D2xLbBqwWfOdMHl1jI6UEvMaJlm0cqMyGpi1J17vDR GD+/aAr1e5G6RJl9b+xdkzkjIl9I8wrL2ZTBw6HkrAhi0INFSEHMVSfJz9Mc0fa71+A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=KFu3zwZ2; arc=none smtp.remote-ip=198.175.65.13 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4C72606A32D; Thu, 3 Dec 2026 10:23:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B4C72606A32D 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, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=KFu3zwZ2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796293386; x=1827829386; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=RU484H9OqMJ7VhvtMCgvWDMS19FgKB4zQYXWFcIj7/U=; b=KFu3zwZ2dwXFlHZFgTY88w8REkzYDzJgjOcnD84MSBB7mKpKC6WDXxpe LduLqGopELGpzsBr+tVt/ILb5wMBV9Pw0Lysq7Gl63WOa91Ec2UZ4rEd0 N6ntIUCHuM+mCk02gKI2mS3xcdZY31TPWJ5wiUYLde/gF7RONJI5TTaKn rCWWE1xELUFLdL/2KnuPFZI3P7zmqu1xecSZ71VlGV011nG5lx/WtlTYT gBo0NhQZ0oCQoNjkxvwUVXQn+jz7XcgUHWH1+1a9TchZuczupq8cixzeC WZcjZ9q/cjbUx7ye+nckSR2V/wrVJGu5cFoRP6W3Zwl8VMgTypebWekU0 w==; X-CSE-ConnectionGUID: ObDHSyPcRIWoE6M2PO9Dew== X-CSE-MsgGUID: ce37GLcuRDGTU39YIPSbrQ== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5159028" X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="5159028" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 02:23:05 -0800 X-CSE-ConnectionGUID: PRpF4Uz8Qgq3NZNNhcLNSw== X-CSE-MsgGUID: lBVzgC4WR9GGrJVU2Q+6bQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="13756114" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.47.46]) by orviesa002.jf.intel.com with ESMTP; 03 Dec 2026 02:23:02 -0800 Date: Thu, 3 Dec 2026 18:11:58 +0800 From: Xu Yilun To: Chao Gao Cc: "Edgecombe, Rick P" , "kvm@vger.kernel.org" , "linux-coco@lists.linux.dev" , "linux-kernel@vger.kernel.org" , "Xu, Yilun" , "dave.hansen@linux.intel.com" , "baolu.lu@linux.intel.com" , "Peng, Chao P" , "bp@alien8.de" , "mingo@redhat.com" , "x86@kernel.org" , "tglx@kernel.org" , "Tian, Kevin" , "hpa@zytor.com" , "kas@kernel.org" Subject: Re: [RFC PATCH 1/7] coco/tdx-host: Create metadata for an SPDM session Message-ID: References: <20261116111037.3478844-1-chao.gao@intel.com> <20261116111037.3478844-2-chao.gao@intel.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Nov 30, 2026 at 10:50:00AM +0800, Chao Gao wrote: > On Sat, Nov 21, 2026 at 10:05:50AM +0800, Edgecombe, Rick P wrote: > >On Mon, 2026-11-16 at 03:10 -0800, Chao Gao wrote: > >> The TDX module talks to the device over a Security Protocol and Data > >> Model (SPDM) session. It needs host memory for each session's metadata, > >> and reports the number of pages required in its global metadata. > > > >Since we usually talk about metadata and mean the global metadata, we will > >probably need to explain what session metadata is. Is it just data? > > Yes. It is used to keep the TDX module's own state for one SPDM > session, for example, the session keys. > > >> > >> When setting up an SPDM session, allocate the memory and hand it to the > >> TDX module with TDH.SPDM.CREATE. Keep the returned session ID for later > >> SEAMCALLs. > >> > > > >This is getting to be a pretty familiar concept. TDX needs per-something scoped > >memory. Give it to the TDX module per some seamcall. Can we make it sounds > >especially ordinary and then just call out any thing that is different? > > How about: > > To set up link encryption, the TDX module talks to the device over > a Security Protocol and Data Model (SPDM) session. > > An SPDM session is an object like a TD or a vCPU. This sentence alone is quite confusing. > They are managed > by the TDX module in the same way. How about: The TDX module manages an SPDM session in the same way as a TD or a vCPU. > Each has SEAMCALLs to create and > delete it, and the TDX module keeps its state for the object in > memory provided by the host. > > Allocate the memory when setting up a session and give it to the > TDX module. Get it back when tearing the session down. > > Creating a session returns a session ID, which later SEAMCALLs use > to identify the session. Store it. > [...] > >> +#define TDISP_FUNC_ID_SEG_VALID BIT(24) > >> + > >> +static inline u32 tdisp_func_id(struct pci_dev *pdev) > >> +{ > >> + u32 func_id; > >> + > >> + func_id = FIELD_PREP(TDISP_FUNC_ID_SEGMENT, pci_domain_nr(pdev->bus)); > >> + if (func_id) > >> + func_id |= TDISP_FUNC_ID_SEG_VALID; > >> + func_id |= FIELD_PREP(TDISP_FUNC_ID, > >> + PCI_DEVID(pdev->bus->number, pdev->devfn)); > >> + > >> + return func_id; > >> +} > > > >Is this TDISP specific encoding or a TDX-TDISP specific encoding? I think TDISP. > >There isn't a more general place to put it? > > TDISP defines it. There is no TDISP header for such definitions yet. > AMD passes the segment and the BDF to its firmware separately. So it > looks like TDX is the first user of this encoding. I will add a > pci-tdisp.h for it. BTW: another patch [*] also adds standard TDISP definitions (device interface report) in drivers/pci/tsm.c, also suggest gather them in pci-tdisp.h? [*] https://lore.kernel.org/all/20261105152909.53452-2-ankita@nvidia.com/