Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp3422069rwo; Fri, 4 Aug 2023 04:53:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZNCq/sCDm7LB3xxwo7r7vQCtT/GdqZDT+8iNmIxEBfECBdbDbOK1UER/JtR9J9TjrylBc X-Received: by 2002:aa7:d049:0:b0:522:1f09:dde3 with SMTP id n9-20020aa7d049000000b005221f09dde3mr1420896edo.3.1691150014463; Fri, 04 Aug 2023 04:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691150014; cv=none; d=google.com; s=arc-20160816; b=Rp9bqQpLfmOQ4NihiQGzljq1q2z11lbZT3Ctr9Kdl6y0FfXkH8ikElN5NU4Zu/vxJV mo6Uz2niMJKCvjjjiTT7NwpAKV6waHehlZoe6u0faUaf2bAdpiQOwMbNWRRzsvd/P43C RI3GiyZ6Xg6oyzcpBKM9IvN+nUwLjUm73bAiAixNP4WaIYrni97Or8uu5ovTiXhP6APY mP1ZrLPZTb8aFummtklV/hlrMNcIFNNey1zSbkHhksTlEkrBV/c6ShZmnyiIPfGi8Gkj PSSPWlyQ8fEiMSrlzgySUAXbM9s2bhC5ZuxexgsVXf/ua9KBGsIQmvhWOiRIPWZPnIIa ztwg== 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=hms/5La5w2JQHo94XJNbs7aPXcJudNXDv/QQ/CraGQk=; fh=ktDWMsHAouJHQg1cu4mEaEdu4ufEPzFxCE4FTweEHsM=; b=l5osEhmHJzf85Qd1He8mzIkL/8bphLZc2/7k7662PBvf+p4D/9tKvD391IABXXN/l+ +yp2YABExompzQctpACr/epRUGzSeJpf1AsIL/qUc7+wcP47E9lf9VQXY8wgI2TwSbYz q/Pt+3W7JbPmbPW6M9K9YcD/rZSIvp+Id1h+Mj2sVw64Jq72XnucRR0zKhiUGhncsPVN a0OGlC5Jm8i1mmgwV7JqspQ8vlE0PCXevhYUGhJHqcSTejwXxa6r9CLwZcPfB3iq+676 A7vbbtdsYA3iDWcrZI4d9yYCkttsrp9y7N+pXPQZ7zK1JDwxwXiXFhYvyXxeG/D/m1Dh mzRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ElMIgrdm; 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 s25-20020aa7d799000000b0052227f13c0csi1498838edq.394.2023.08.04.04.53.09; Fri, 04 Aug 2023 04:53:34 -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=ElMIgrdm; 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 S229541AbjHDK6j (ORCPT + 99 others); Fri, 4 Aug 2023 06:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231799AbjHDK55 (ORCPT ); Fri, 4 Aug 2023 06:57:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E09D49C5; Fri, 4 Aug 2023 03:57:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF1B361F9C; Fri, 4 Aug 2023 10:57:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AB21C433CD; Fri, 4 Aug 2023 10:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691146629; bh=lbZSdb+lLKV7Au60KMEayyUewgOND9KVkB1sK/VtkaI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ElMIgrdmQPa8MNuUwQEyj7DYZJlNj2Fsni842WjWaDpm4IwKqLGpXUcFoKWYvOtaD UWXKg/aA3e8tu1i2k0WHTzze42dGsJobD7kbcYNsnqVRHYl3SplcjpwKe5HxT7x9QA JMaOx9/uTuKxk0De+9tgQEvnJ08g5e3ajvleUVsxBj6W5pPrlcDswKoDtZCnFbOvB+ rQlMW3iaADwiQmZFdGJ90g7YT+EsobmZc4OzTS7spZnAiV/6BsSi+HK6A5ATMkHtOO zKU7C9gXJTGWlygb4MwbcVXMK2bmm7h0TXeKEVefBB/R5DOyedd11b7rv1V/NYsZPu sByOUmtKlPYKQ== Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-4fe3c7f16bbso3332203e87.0; Fri, 04 Aug 2023 03:57:09 -0700 (PDT) X-Gm-Message-State: AOJu0YzLKY/XlDa5cJs14AHu49a43+uRNlrugcjHSAjJ+h2WtS5Sbygp VM++KvMk/PydKjnHdNND7X6EoRFDQmluRQ0wnNg= X-Received: by 2002:a05:6512:1cd:b0:4fb:8f79:631 with SMTP id f13-20020a05651201cd00b004fb8f790631mr942049lfp.46.1691146626978; Fri, 04 Aug 2023 03:57:06 -0700 (PDT) MIME-Version: 1.0 References: <20230730161906.606163-1-luzmaximilian@gmail.com> <20230730161906.606163-4-luzmaximilian@gmail.com> In-Reply-To: From: Ard Biesheuvel Date: Fri, 4 Aug 2023 12:56:55 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 3/3] firmware: Add support for Qualcomm UEFI Secure Application To: Maximilian Luz Cc: Bjorn Andersson , Andy Gross , Konrad Dybcio , Ilias Apalodimas , Srinivas Kandagatla , Sudeep Holla , Johan Hovold , Steev Klimaszewski , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org 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 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 Thu, 3 Aug 2023 at 19:09, Maximilian Luz wrote: > > On 8/3/23 17:44, Ard Biesheuvel wrote: > > On Sun, 30 Jul 2023 at 18:19, Maximilian Luz wrote: > > [...] > > >> +/* -- Driver setup. --------------------------------------------------------- */ > >> + > >> +static int qcom_uefisecapp_probe(struct auxiliary_device *aux_dev, > >> + const struct auxiliary_device_id *aux_dev_id) > >> +{ > >> + struct qcuefi_client *qcuefi; > >> + int status; > >> + > >> + qcuefi = devm_kzalloc(&aux_dev->dev, sizeof(*qcuefi), GFP_KERNEL); > >> + if (!qcuefi) > >> + return -ENOMEM; > >> + > >> + qcuefi->client = container_of(aux_dev, struct qseecom_client, aux_dev); > >> + > >> + auxiliary_set_drvdata(aux_dev, qcuefi); > >> + status = qcuefi_set_reference(qcuefi); > >> + if (status) > >> + return status; > >> + > >> + status = efivars_register(&qcuefi->efivars, &qcom_efivar_ops); > > > > Will this also work if the EFI runtime services were already > > registered by the time we reach this point? > > That's actually a good question. In short: No. However, let me explain > that a bit: > > First, we assume that we're the only other non-generic provider > (arguably, multiple non-generic providers don't make much sense on a > single platform anyway, so I'd say in that case it's okay to fail here). > > Second, we assume that the generic ops are not going to be registered at > all on the platforms that this implementation is used. In particular, on > the platforms I've tested and heard reports from so far, "standard" > efivars either aren't actively advertised as "supported" or they return > EFI_UNSUPPORTED for all calls. So we assume that either the check in > efisubsys_init() or in generic_ops_supported() prevents registration > of the generic ops. > > Further, I'd hope that the uefisecapp would not be loaded if generic ops > would be supported on such a platform, thus preventing instantiation of > the respective client device. > > So the only issue that I can see is that if uefisecapp is loaded and > generic ops are supported, we would need a way to choose one over the > other. But I think that is fairly unlikely to happen and I think it > would probably be best to sort that out then (e.g. by refusing to load > this new driver with some additional check). > > Apart from that case, there should not be any timing issues that could > cause registration to fail spuriously. > Fair enough. The series looks good to me. Acked-by: Ard Biesheuvel I take it this will go via the QCOM tree?