From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 519C738838B for ; Wed, 13 May 2026 11:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778670533; cv=none; b=f3AwDuuk52ohvn5oC3tQWcqKdOa01nWc8J6kSi7+0/jBrhVRN4dtxXgCZKNDLhRWLcyJJ/KzxdWVT9R1NpymxHsob/HTN3Ng8vCjg1Q5WCzNr+5B2EmPBcenOPN1vnmsGW+19BEX1Leq3MSNN00ML23ir9gwvCFeTnADa3C1MmQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778670533; c=relaxed/simple; bh=maqtlKnUOZGrFSRyjOaYy2eO27H61t61DIbhg7jOchQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cHXA1RUBdjZy8QhwRMBJjAZUxYXWRx8sD/Wbuh8lZwQ3ezPzAYxFAKx90MSgeFSL/IZUh+RBsDLwbdpuV7ZucoB1SAHvNY2H6mksMtCsk/7wlTZb/M0Zl/+A7vn6Qcj/BelDfEnYaJJwRRelSYcGTy1rp4JJTfjBiRg3Pb/RtX0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=d9gCPEGZ; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Zr8hbpyh; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="d9gCPEGZ"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Zr8hbpyh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778670531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WCdmdOmMZW9gHjE/20zHllRfTLpIviKY45IRyXg7XHs=; b=d9gCPEGZ3sCrM0luZB91U81KTgu+a8Q3pN55nVdVQ3YvmfQFIWIQQIPGzU9PQOTptMERAB oywSr3PWxfT4j7s7VbX+Xpl3NuyWnZFUBv08PAe3A6exzzyGHoXYLtTU1PhyurI3cvJ/fq pvG7AX2/vNY2jH7qFEkKJG43hAUSaMQ= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-MZRwxvMzOAW9sUhmvG5oXA-1; Wed, 13 May 2026 07:08:50 -0400 X-MC-Unique: MZRwxvMzOAW9sUhmvG5oXA-1 X-Mimecast-MFC-AGG-ID: MZRwxvMzOAW9sUhmvG5oXA_1778670529 Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2bc6899bfb1so52518965ad.2 for ; Wed, 13 May 2026 04:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778670529; x=1779275329; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WCdmdOmMZW9gHjE/20zHllRfTLpIviKY45IRyXg7XHs=; b=Zr8hbpyhLxI8DwFa81qoJB1yzTyQ7OQqRkdmjmAA08sKDDMOwuORYy5S99HdmXiUuZ 5K7wvj+hpd21XJzKC3ZNSFD8LRou8H05t4J1ndJPRd1qn1ULpbsooCbhN8K1UA/swU/k d06v+M6NfEYlMNMMIBq9LEw+kk5aMSvL3/XBSz0Vcq9xvfafhrqCNb0PD38eCBz++G9M Bqk81wYHmCcYyt1NzR8gTp3pyp0skSir3GImhr0xHiToBgpnaeZd9RBjRUHUvGVQqn1M UYzShOWH5ift20NRkqsuwfhksouFT61D5T6p1vhp5DFqG9A1gLdlaw2+n0g5TWeq09S/ 0WXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778670529; x=1779275329; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WCdmdOmMZW9gHjE/20zHllRfTLpIviKY45IRyXg7XHs=; b=hOX/8pAojbBhSIGW1V6eYNtP68mCIvQKW4UpkRD52MPEq/iKl2VllSdV/D4UuowjR5 DPdl9IPcijSLcMoADTHEsaJ9A9fQoQ6wAbwiMKL+arPtuLQ4gdnM4ATrGLsTJ8WGbPfD 8E+3G6I6+IdX3jQ83uJEp9eBTvSFs8EmbQGqk3qCDS2yb1gKRmddccIf1lSzin1TxpuH e5mjHo+Ozpu5PSM/1wLvxrYpdTF7g3R/0OpEvP1zgd4exMSc7ZS2kO9/HgKOT1XzSd01 H+E1FZeipuk06VveA5KfRhE/hBhDA+i7ANzKj6JHGaBhfkWAbtmaq6oeLSOmTT2K2wUk xlLw== X-Gm-Message-State: AOJu0YxOYNthvpZLtB/hSN+Fo1iKyXz8UzX6Jy/dsTBxQQX6//XK0b8I lUCy7Hbj71vQ8qTarFbiDZ3BOQoA6woGz0R36dcbOucnvBR3vRl0aTJeXF1sUD8+pvaQyJyurk2 nsxHNSBuZlDdV064CcAuMipOMtvSK2ttH8rqBtrGyGQ65ziux7l5oS9jz1qPOKK0hvQ== X-Gm-Gg: Acq92OFeBpxMt5iZ3JlwuYxCi3wevTVW6qu6y95qBRSIXLoJfPmLMVrVGvmjTv3CwDe TAzXj2Mf+HGz+1NDjkaEPhsIwpsS70Ux8wx3S9wVC2iaT0BBcsfdpLOb0dx8cwqgzEz2OZreNW6 P3T9xrTV5Kzw//kDDYVLLwLWEkJEcakeQ6/HK1jpMWoU+nxQ1cpM+WGsFzooicY2d8gkeW9gD/m kMWQnfCEVzovlKFP6LqRVjyKu0xf6A+TuzRnq4h6tOYxRaw6q0QXajUV9tQezzE7MCI78ItMNx2 nul5XaCBZIf3W2Jy195Fb4WxRuCxUAFFKbpmAMa+Zat90YGbH7QDbPfsxkaUTJDYvkp78J4H7/a z+vveHLrFYNtE X-Received: by 2002:a17:902:ceca:b0:2bd:2de3:5181 with SMTP id d9443c01a7336-2bd2de353e8mr26474635ad.9.1778670528943; Wed, 13 May 2026 04:08:48 -0700 (PDT) X-Received: by 2002:a17:902:ceca:b0:2bd:2de3:5181 with SMTP id d9443c01a7336-2bd2de353e8mr26474345ad.9.1778670528460; Wed, 13 May 2026 04:08:48 -0700 (PDT) Received: from fedora ([49.36.106.210]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2baf1d40677sm165126325ad.33.2026.05.13.04.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 04:08:47 -0700 (PDT) Date: Wed, 13 May 2026 16:38:42 +0530 From: Arun Menon To: Jarkko Sakkinen Cc: linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, Peter Huewe , Jason Gunthorpe Subject: Re: [RFC v2 2/5] tpm_crb: Add new wrapper function to invoke start method Message-ID: References: <20260324181244.17741-1-armenon@redhat.com> <20260324181244.17741-3-armenon@redhat.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 Sat, May 09, 2026 at 05:43:10PM +0300, Jarkko Sakkinen wrote: > On Tue, Mar 24, 2026 at 11:42:41PM +0530, Arun Menon wrote: > > The current implementation handles different platform start methods > > (ACPI, ARM SMC, and ARM FFA) directly within crb_send(), but it is > > limited to triggering the CRB_START_INVOKE bit. > > > > To support cmd/rsp chunking, the driver must be able to send other > > control bits, like CRB_START_NEXT_CHUNK, using these same > > platform-specific paths. > > > > By moving this logic into a new helper function, crb_trigger_tpm(), > > the driver can now send any required control bit across all supported > > platforms. This prepares the driver for the upcoming chunking support. > > > > No functional change is intended. > > > > Signed-off-by: Arun Menon > > --- > > drivers/char/tpm/tpm_crb.c | 50 ++++++++++++++++++++------------------ > > 1 file changed, 27 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c > > index 67c0061d4cab7..922bcf7a69ad5 100644 > > --- a/drivers/char/tpm/tpm_crb.c > > +++ b/drivers/char/tpm/tpm_crb.c > > @@ -445,6 +445,32 @@ static int tpm_crb_smc_start(struct device *dev, unsigned long func_id) > > } > > #endif > > > > +static int crb_trigger_tpm(struct tpm_chip *chip, u32 start_cmd) > > tpm_crb_start? Yes, it can be renamed. On the qemu side also, its renamed and made consistent with the spec. > > I'd also split this into two commits: > > 1. One that splits the helper. > 2. Second that adds the new stuff. Yes. Will do. Thank you. > > > +{ > > + struct crb_priv *priv = dev_get_drvdata(&chip->dev); > > + int rc = 0; > > + /* The reason for the extra quirk is that the PTT in 4th Gen Core CPUs > > + * report only ACPI start but in practice seems to require both > > + * CRB start, hence invoking CRB start method if hid == MSFT0101. > > + */ > > + if (priv->sm == ACPI_TPM2_COMMAND_BUFFER || > > + priv->sm == ACPI_TPM2_MEMORY_MAPPED || > > + !strcmp(priv->hid, "MSFT0101")) > > + iowrite32(start_cmd, &priv->regs_t->ctrl_start); > > + if (priv->sm == ACPI_TPM2_START_METHOD || > > + priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD) > > + rc = crb_do_acpi_start(chip); > > + if (priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC) { > > + iowrite32(start_cmd, &priv->regs_t->ctrl_start); > > + rc = tpm_crb_smc_start(&chip->dev, priv->smc_func_id); > > + } > > + if (priv->sm == ACPI_TPM2_CRB_WITH_ARM_FFA) { > > + iowrite32(start_cmd, &priv->regs_t->ctrl_start); > > + rc = tpm_crb_ffa_start(CRB_FFA_START_TYPE_COMMAND, chip->locality); > > + } > > + return rc; > > +} > > + > > static int crb_send(struct tpm_chip *chip, u8 *buf, size_t bufsiz, size_t len) > > { > > struct crb_priv *priv = dev_get_drvdata(&chip->dev); > > @@ -470,29 +496,7 @@ static int crb_send(struct tpm_chip *chip, u8 *buf, size_t bufsiz, size_t len) > > /* Make sure that cmd is populated before issuing start. */ > > wmb(); > > > > - /* The reason for the extra quirk is that the PTT in 4th Gen Core CPUs > > - * report only ACPI start but in practice seems to require both > > - * CRB start, hence invoking CRB start method if hid == MSFT0101. > > - */ > > - if (priv->sm == ACPI_TPM2_COMMAND_BUFFER || > > - priv->sm == ACPI_TPM2_MEMORY_MAPPED || > > - !strcmp(priv->hid, "MSFT0101")) > > - iowrite32(CRB_START_INVOKE, &priv->regs_t->ctrl_start); > > - > > - if (priv->sm == ACPI_TPM2_START_METHOD || > > - priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD) > > - rc = crb_do_acpi_start(chip); > > - > > - if (priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC) { > > - iowrite32(CRB_START_INVOKE, &priv->regs_t->ctrl_start); > > - rc = tpm_crb_smc_start(&chip->dev, priv->smc_func_id); > > - } > > - > > - if (priv->sm == ACPI_TPM2_CRB_WITH_ARM_FFA) { > > - iowrite32(CRB_START_INVOKE, &priv->regs_t->ctrl_start); > > - rc = tpm_crb_ffa_start(CRB_FFA_START_TYPE_COMMAND, chip->locality); > > - } > > - > > + rc = crb_trigger_tpm(chip, CRB_START_INVOKE); > > if (rc) > > return rc; > > > > -- > > 2.53.0 > > > > BR, Jarkko > Regards, Arun Menon