From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7809C433F5 for ; Wed, 3 Nov 2021 15:09:40 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 12262600EF for ; Wed, 3 Nov 2021 15:09:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 12262600EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 74B5B835B3; Wed, 3 Nov 2021 16:09:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ThSW7jX/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB415835AF; Wed, 3 Nov 2021 16:09:35 +0100 (CET) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 98FD782DB4 for ; Wed, 3 Nov 2021 16:09:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wm1-x330.google.com with SMTP id z11-20020a1c7e0b000000b0030db7b70b6bso4887936wmc.1 for ; Wed, 03 Nov 2021 08:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=l00nRgvAwLslnvqOLPWwF4xGSyAWhlUOn79eLOKtOBQ=; b=ThSW7jX/YzAQpzTQemwCW4wTos6VYKctpmQQAw13xsmK9RMrGwhVOAKM7cPiS0qB6S F4nButwxClLIWbzPlNX5gFz4/rMYsZVx8lZ1/gHgb+OW2UpmcDaIsJPfnKwFzc7AGt+b j1zfJ47FDDm/1ZX+3lVMXZRnNRIHTsnltiVp56H7COeicHtsRC8K+hAH5zBkNCw4dAll A/vXRFBm5pSXtKEOJ7fuZJt8sIl+ZUT/Nq6duKasSRvfsmUjH96DYlrWl5IiukZpOnsI Sf7598da9Qn32PbbkvKPrWrtAmTjvFM5CKbjDMwH91ES9YuqeesdM+Y6FcJuK/jlFAv5 1hKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=l00nRgvAwLslnvqOLPWwF4xGSyAWhlUOn79eLOKtOBQ=; b=NpKjIpLBZ4pxVp9fPpxm/WlCQ6cRNtQHdwm86GfTm1oouchz2BEZHY8ns6qcB6ltHG V+LzOWAZUBYO+rQb136afXY9xHgUvgjzhTpEWcbaReqv6m+luH4eSC4etTsvlmYoTxgD nviOKkHaNaa9i6XPmZdVqGJQbcNR0TmY90WGsxyMzZwpNT3bXY9LjHgHp3iIzVIgMy8N 7FC+59Sl1TXvdioQQKBlP38ya0K9PvcrMmk/yk+hnUNvH1+viBXB9EWCBfIR1QA8y7rU 9fnjZquukjGANtmDXRRYvCR+Ee3ZWfkJ0eT8Lj+hpNdgGeVdcaNpvgruZW3RQdDgpz/b +PmQ== X-Gm-Message-State: AOAM533ndWvgT9+3EtUxUyRqzyEpLAHC55bkGRsDRl8k42LWwEn7kmUi RnlpclHZOTxuIw6vSm2jE3RQRpJopD7BLg== X-Google-Smtp-Source: ABdhPJxm81+nzAItMwXoYxl0/KqgXPPn7IjSdO2/zzJzK9NLAfPhcYzS/rYTaMGGM+A/pcg1hocOxw== X-Received: by 2002:a1c:2386:: with SMTP id j128mr16183393wmj.8.1635952171121; Wed, 03 Nov 2021 08:09:31 -0700 (PDT) Received: from apalos.home ([2a02:587:4682:26e0:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id f19sm2094947wmq.34.2021.11.03.08.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 08:09:30 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: trini@konsulko.com, Ilias Apalodimas , Rick Chen , Sean Anderson , Simon Glass , Heinrich Schuchardt , Masahisa Kojima Subject: [PATCH 0/6 v4] TPM cleanups and MMIO driver Date: Wed, 3 Nov 2021 17:09:03 +0200 Message-Id: <20211103150910.69732-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi! This is the followup series on the TPM cleanup and driver additions. The major change since v3 [1] is that I implemented Simon's request and converted an existing driver using the API. We now have two consumers of the API, MMIO and SPI TPMs. It's worth noting that using the API reduces the code duplication in the SPI TPM driver a lot. I've tested the SPI TPM on an RPI4 with [2]. As far as I can tell everything seems to be working fine, including the EFI TCG2 protocol. The MMIO one was tested with QEMU and SWTPM [3] and I've added documentation on how to reproduce that. There was also a discussion on v2 [4] regarding the MMIO accesses and if we should convert those to a uclass. But the MMIO functions are just calling io(read|write), so after considering it for a while, I couldn't find any reasonable abstraction that would justify another uclass. [1] https://lore.kernel.org/u-boot/20210708082310.87540-1-ilias.apalodimas@linaro.org/ [2] https://buyzero.de/en/products/letstrust-hardware-tpm-trusted-platform-module [3] https://github.com/stefanberger/swtpm [4] https://lore.kernel.org/u-boot/CAPnjgZ1U6VgeOcTuy-G=nbYFTNnu_8MqGf-o6LF6ivk=TwE4iQ@mail.gmail.com/ Changes since v3: - Coverted SPI TPM to use the API as well - moved some log_info to log_debug - Added documentation on how to run QEMU and enabled TPM by default on arm qemu builds Changes since v2: - Add myself as a maintainer on TPM drivers Changes since v1: - split off the tis core code into a different file Ilias Apalodimas (6): tpm2: Introduce TIS tpm core tpm2: Add a TPMv2 MMIO TIS driver tpm: Use the new API on tpm2 spi driver configs: Enable tpmv2 mmio on qemu for arm/arm64 doc: qemu: Add instructions for swtpm usage MAINTAINERS: Add entry for TPM drivers MAINTAINERS | 5 + configs/qemu_arm64_defconfig | 2 + configs/qemu_arm_defconfig | 2 + doc/board/emulation/qemu-arm.rst | 25 ++ drivers/tpm/Kconfig | 9 + drivers/tpm/Makefile | 3 +- drivers/tpm/tpm2_tis_core.c | 523 +++++++++++++++++++++++++++++++ drivers/tpm/tpm2_tis_mmio.c | 152 +++++++++ drivers/tpm/tpm2_tis_spi.c | 440 ++------------------------ drivers/tpm/tpm_tis.h | 39 +++ include/tpm-v2.h | 1 + 11 files changed, 791 insertions(+), 410 deletions(-) create mode 100644 drivers/tpm/tpm2_tis_core.c create mode 100644 drivers/tpm/tpm2_tis_mmio.c -- 2.33.1