Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2404500rwd; Fri, 26 May 2023 06:15:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4OcNJ8DRc/Q4boZC/FO0yeGT4kpf0R80uiqCNVNJwEya9qOIh24xbRL8BogfH8L+eg/SoC X-Received: by 2002:a17:902:e886:b0:1ae:5916:9f12 with SMTP id w6-20020a170902e88600b001ae59169f12mr2916611plg.13.1685106906140; Fri, 26 May 2023 06:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685106906; cv=none; d=google.com; s=arc-20160816; b=vzRtmi/EGVt5E0l5u6deDpJ3IuimLDSs8UKuZd16ncrDneIc+oOFzF6aBU6VGe6VV6 FVy7Ycmf2H9SKTnjbM4L9IYTxDfxS2gZgq91wc/+QkHzE3bkfKC1DtWVVpNcCHJqg/WL DUX7n5Ft1F14emMmkCRt4zmeI7gi7h7wE1LdZMR6NqAyZRpT0lVSWde2PYbVWESFrAH3 fJASCB3Xb4RpNS3IV6rry85JY7EfgpjH4wLnsMtQDhRkEaxLnkzBMuD/72NQjLjr9Lix 90D4+VmIJRE7/0CG6HzvVW38F08np9ygoSAywAm0rc1QVZjX8asKnQgn2GDzGPG7oWl4 7uaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1y105upkzgt5PGt90diQFfUPnDnlH2JgZ1plWX3qWl8=; b=YEIUyN5Gab6Jc+HYSpjyjSg4QsVHkRAV2vCsGqxjbdU7wzZKSMsIFk1le5w4EA2ey0 geioSh95bEofCCF0NkOd9YtImKjeIy3OP35UFGPHd/Bd1Ezm8ET7XXAeeKmrHOGGGNTK +4JbPzq26s2Vpn95jq0SU0F5k8wVuyqOYLQsLdFZb27ryKLksCdasZxadRCoHwEUV7vq xJSaMdCLZ42iNgkFkFRHgjN1z8Nz1/aihFXWxEYoRHjIKI5H5AY7+wF+j94FhZKrPUut I8i8IiZ7tY0gVPDLuS1a+nT7XTIMeGQwlyzd5jPbpt3kvLOsfTCWBEyIUc4idwm7qJ0R X9Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SsnusJ0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a170902ea0d00b001a1be5ca65asi4145869plg.528.2023.05.26.06.14.52; Fri, 26 May 2023 06:15:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SsnusJ0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236978AbjEZNKS (ORCPT + 99 others); Fri, 26 May 2023 09:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243407AbjEZNKQ (ORCPT ); Fri, 26 May 2023 09:10:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F09D13A for ; Fri, 26 May 2023 06:10:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 242E364FAC for ; Fri, 26 May 2023 13:10:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43DA5C433EF for ; Fri, 26 May 2023 13:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685106611; bh=k2BJ0HikbjM2TWyiQ0EXj0kBBlObywlG1rbIpGgKzNU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=SsnusJ0cFLd5bvMz0Sam5z3CUNM2k8dG7A34E85D+JOoaU6X3jYkWIRIDbBON4+61 PcgGy4DTRpEsdEf9P2X2LMY9NLAvh+nkldBlrbefHUkOVjqjtEnv9gr6FoN90t8HVc f/erV8v1EodUVntx6HlHq/cGHcAb6mW0v30na6qaaNvHowev7EGYqiZJoLkwAtydHu XRPLE/Kj3z9bkj/CbF9P7bZczVN1B557p5C8GVptdo1G9i+AZrzGd2NrFZ6WycryrP ppz9hL1bu1h5zbH77Kghcjyh6GPdCN1lqrf7b4JRxGmovplwdRW/00Ro2yR5s1sbTP GMeIbXXC+p31A== Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2af2d092d7aso7604081fa.2 for ; Fri, 26 May 2023 06:10:11 -0700 (PDT) X-Gm-Message-State: AC+VfDyLBFQfVEmH9zJzOYs+AohIwCeYkOL0xrB5eYuDEfDNTbqLj8RF tJYnxMjiDt6hjjGDQ3+5okvJHgYHCB7n68q7Brk= X-Received: by 2002:a2e:3206:0:b0:2ad:d6cd:efe0 with SMTP id y6-20020a2e3206000000b002add6cdefe0mr630827ljy.37.1685106609205; Fri, 26 May 2023 06:10:09 -0700 (PDT) MIME-Version: 1.0 References: <20230526010748.1222-1-masahisa.kojima@linaro.org> In-Reply-To: <20230526010748.1222-1-masahisa.kojima@linaro.org> From: Ard Biesheuvel Date: Fri, 26 May 2023 15:09:57 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 0/3] introduce tee-based EFI Runtime Variable Service To: Masahisa Kojima Cc: Jens Wiklander , Sumit Garg , linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, Ilias Apalodimas , Johan Hovold Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 May 2023 at 03:08, Masahisa Kojima wrote: > > This series introduces the tee based EFI Runtime Variable Service. > > The eMMC device is typically owned by the non-secure world(linux in > this case). There is an existing solution utilizing eMMC RPMB partition > for EFI Variables, it is implemented by interacting with > OP-TEE, StandaloneMM(as EFI Variable Service Pseudo TA), eMMC driver > and tee-supplicant. The last piece is the tee-based variable access > driver to interact with OP-TEE and StandaloneMM. > > Changelog: > v4 -> v5 > - rebase to efi-next based on v6.4-rc1 > - set generic_ops.query_variable_info, it works as expected as follows. > $ df -h /sys/firmware/efi/efivars/ > Filesystem Size Used Avail Use% Mounted on > efivarfs 16K 1.3K 15K 8% /sys/firmware/efi/efivars Excellent, thanks a lot for double checking that. Jens, did you have any feedback on this? If not, I intend to queue it up for v6.5 Thanks, > > v3 -> v4: > - replace the reference from EDK2 to PI Specification > - remove EDK2 source code reference comments > - prepare nonblocking variant of set_variable, it just returns > EFI_UNSUPPORTED > - remove redundant buffer size check > - argument name change in mm_communicate > - function interface changes in setup_mm_hdr to remove (void **) cast > > v2 -> v3: > - add CONFIG_EFI dependency to TEE_STMM_EFI > - add missing return code check for tee_client_invoke_func() > - directly call efivars_register/unregister from tee_stmm_efi.c > > rfc v1 -> v2: > - split patch into three patches, one for drivers/tee, > one for include/linux/efi.h, and one for the driver/firmware/efi/stmm > - context/session management into probe() and remove() same as other tee > client driver > - StMM variable driver is moved from driver/tee/optee to driver/firmware/efi > - use "tee" prefix instead of "optee" in driver/firmware/efi/stmm/tee_stmm_efi.c, > this file does not contain op-tee specific code, abstracted by tee layer and > StMM variable driver will work on other tee implementation. > - PTA_STMM_CMD_COMMUNICATE -> PTA_STMM_CMD_COMMUNICATE > - implement query_variable_store() but currently not used > - no use of TEEC_SUCCESS, it is defined in driver/tee/optee/optee_private.h. > Other tee client drivers use 0 instead of using TEEC_SUCCESS > - remove TEEC_ERROR_EXCESS_DATA status, it is referred just to output > error message > > Masahisa Kojima (3): > efi: expose efivar generic ops register function > efi: Add EFI_ACCESS_DENIED status code > efi: Add tee-based EFI variable driver > > drivers/firmware/efi/Kconfig | 15 + > drivers/firmware/efi/Makefile | 1 + > drivers/firmware/efi/efi.c | 12 + > drivers/firmware/efi/stmm/mm_communication.h | 236 +++++++ > drivers/firmware/efi/stmm/tee_stmm_efi.c | 638 +++++++++++++++++++ > include/linux/efi.h | 4 + > 6 files changed, 906 insertions(+) > create mode 100644 drivers/firmware/efi/stmm/mm_communication.h > create mode 100644 drivers/firmware/efi/stmm/tee_stmm_efi.c > > -- > 2.30.2 >