Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7085716rwl; Mon, 9 Jan 2023 17:51:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXsKKXaZraRoPUqpcQWy4564rOODJWuxZmCjxnOASbg/fFH6pqBnjFaphc0vWJj6NDiVEWO4 X-Received: by 2002:a17:907:d302:b0:84d:34b0:e955 with SMTP id vg2-20020a170907d30200b0084d34b0e955mr7968621ejc.69.1673315498059; Mon, 09 Jan 2023 17:51:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673315498; cv=none; d=google.com; s=arc-20160816; b=zgmKOGz04pgbZBZ3B6OKNwTDiZp5D+67+vvHmE/jYvelkySHW1ER4h1CKQLMqsQSAw O9OigHg66BhxeRujzku+ho0i9qeqeofRT/k9uGEsCVGqIyn2TjeB8PRKrqB0X4ZiX7pI YDubkKNghY+FlJxSLmgIUOE1FszzKJrmBCqc/TH/cUDxrJO1Aj5rq72qMiUjac7o3kxa IJGDqCJqAWswq06I/WpHtTJC/CHNniefk5gm0NgluBkBg6Ct6NZP6cWieGUqgixUM4Yz gtQe/BRo9gugQYyAC4IfG6KYgyBxulmML4758pysTQa0acq1ausQEIH6iELyk9zWFjg+ E1qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:feedback-id:dkim-signature:dkim-signature; bh=zeB8Rjm8Q9ysFSyGBjwVWVghqqA5Z8exrt+ZdLm1v4Y=; b=qsZXYNoBgnrYAM+hGxzHcCIsKtTZmYK5eBANRBZZn4bmr7Slo019V0n/gXcL6DEJ2I KiZjK1/RB7w6wZwoTUTYHVopwwaEpJLdUYsjBBmh9Xcyqo4ob/ssyYp0XHN/G48Xr8D9 3vvI0mA+gI8zfraj9/Plu4cVlvR0zhm836S3Ou5xP5OuNnTjR3xjJV3PgRU617DMjE7f Rjspkm1355pCHJCG8NWZQPOlcDCFTyV7jCNqkZzujogWTNKu5OcJQPHSr4hTShn5gtSf VVImgHB0n/WbDbosp/Vdar19SoR0yQkohyZd7YPW/4C9jRWMVZgJIKWP9wAh0lPHF2bF HBQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@russell.cc header.s=fm1 header.b=AF+CTNwF; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=mSL813OJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc2-20020a170907074200b0078c3197bf86si11678473ejb.533.2023.01.09.17.51.25; Mon, 09 Jan 2023 17:51:38 -0800 (PST) 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=@russell.cc header.s=fm1 header.b=AF+CTNwF; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=mSL813OJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234571AbjAJB2G (ORCPT + 53 others); Mon, 9 Jan 2023 20:28:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230058AbjAJB2F (ORCPT ); Mon, 9 Jan 2023 20:28:05 -0500 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF70A395E3 for ; Mon, 9 Jan 2023 17:28:04 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 14E6F320025E; Mon, 9 Jan 2023 20:28:02 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 09 Jan 2023 20:28:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=russell.cc; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1673314081; x= 1673400481; bh=zeB8Rjm8Q9ysFSyGBjwVWVghqqA5Z8exrt+ZdLm1v4Y=; b=A F+CTNwF1+397YVLctQ8UFjga/E+HypkOFOFohjDGazzBZo6IktXplX+dStCLuwkJ 1Kd37/WpFE7Fg1BgstK13saN1ryE8pZUNF89A3xRzrBubuRY5u3DvOx7F4FBKxMZ zXXJgF8NeHkjw7JrwlYy2lbUeKPGE0SvxzkqNhdu7DeyMGnrYb+91NMZbsbZFZ9M XWp0WTuILTBaVvNpY4ZUG3zkA2tBSKI+J/g79Ye8YPYNYWGzY1D5bU8pqnsanbIz BagjdMbkWdcC7qkc9a7FCAyFLW1DvBh/wyPtFkMnhitPrCp7g+UrGok9Tu9pSlBD TGo2is2u4Sv7Meuoo94IQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1673314081; x= 1673400481; bh=zeB8Rjm8Q9ysFSyGBjwVWVghqqA5Z8exrt+ZdLm1v4Y=; b=m SL813OJ+ORX8ZjF+wmA02IBhtdPBLxgwU9KPPRU8IeddBFY74dk5CUxss7t/lQ6F DS+SA5SpPxrZavPEMLALfnXyV5rNetdw/yEXLrp0tAw6HrTYbQSrQg74JIKKlYLE fhcAQr8SIgEWMI9ee75Qlk9Vm0q6Hv42IOnPHKI8uxuAYiGCuRe+S6/NzBy22O3O AZjOJ58y3NKKEbDOjMYj0odYr++SzkicksQzlJ/Fs0jwFvP/ad+2Y5jvhSKXLkl2 6H7XK7nvH9PVBdpWA6rP6AbOj1kjBAIsHJYEjq+B4QlAq2WIVbFqHEClK3JtrCng D+WEJtw9uGxh7l3dcQ3eQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrkeejgdefhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdeftddmnecujfgurhepkffuhf fvveffjghftgfgfgggsehtqhertddtreejnecuhfhrohhmpeftuhhsshgvlhhlucevuhhr rhgvhicuoehruhhstghurhesrhhushhsvghllhdrtggtqeenucggtffrrghtthgvrhhnpe etgfeilefhueefvedvkeehieefjefgfeegheetudekiefguddutdeukeetveelleenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehruhhstghurh esrhhushhsvghllhdrtggt X-ME-Proxy: Feedback-ID: i4421424f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Jan 2023 20:27:58 -0500 (EST) Message-ID: Subject: Re: [PATCH v2 7/7] powerpc/pseries: Implement secvars for dynamic secure boot From: Russell Currey To: Andrew Donnellan , Michael Ellerman , linuxppc-dev@lists.ozlabs.org Cc: gregkh@linuxfoundation.org, gcwilson@linux.ibm.com, linux-kernel@vger.kernel.org, nayna@linux.ibm.com, zohar@linux.ibm.com Date: Tue, 10 Jan 2023 12:27:55 +1100 In-Reply-To: References: <20221230042014.154483-1-ruscur@russell.cc> <20221230042014.154483-8-ruscur@russell.cc> <87zgawgcpa.fsf@mpe.ellerman.id.au> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.2 (3.46.2-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, 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 Mon, 2023-01-09 at 16:20 +1100, Andrew Donnellan wrote: > On Mon, 2023-01-09 at 14:34 +1100, Russell Currey wrote: > >=20 > > > > +static int plpks_secvar_init(void) > > > > +{ > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (!plpks_is_available(= )) > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0return -ENODEV; > > > > + > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0set_secvar_ops(&plpks_se= cvar_ops); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0set_secvar_config_attrs(= config_attrs); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return 0; > > > > +} > > > > +device_initcall(plpks_secvar_init); > > >=20 > > > That must be a machine_device_initcall(pseries, ...), otherwise > > > we > > > will > > > blow up doing a hcall on powernv in plpks_is_available(). > >=20 > > OK, can do.=C2=A0 I don't understand your case of how powernv could hit > > this, but I think I to have to move plpks_is_available() into > > include/, > > so it's going to be even more possible anyway. >=20 > Kernels can be compiled with both pseries and powernv support, in > which > case plpks_secvar_init() will be called unconditionally even when > booting on a powernv machine. >=20 > I can confirm that as it is, booting this on powernv qemu causes a > panic. Of course, I'm not sure why I thought an initcall in a platform that wasn't active would magically not run on other platforms. >=20