Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3079146lqt; Tue, 23 Apr 2024 09:43:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBUZGhhlyQkSF1SZb5oSeORvZ2SoxDElBaRy30XqIy+aSfoqVmAqmhg4qfexO6R/IExM9pQTFUl+c+p0gOVDOkpihKqpXM7TmuJQqorQ== X-Google-Smtp-Source: AGHT+IGwCmPpC5Ni73x5fblR9UsvueEP+2E/HCNe2oyAMLhu1Tl8SrQrCIqSxnL5ppBcTn5KFa3l X-Received: by 2002:a17:90a:a791:b0:2a8:1fdf:b1b0 with SMTP id f17-20020a17090aa79100b002a81fdfb1b0mr11761367pjq.29.1713890582546; Tue, 23 Apr 2024 09:43:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713890582; cv=pass; d=google.com; s=arc-20160816; b=opmNZg1etMdz6gX5w+ttqqkRpH8aby9k2TENwkIcyAat1jKUHiFU/BinWY+dpcMWkS GaG7lpAt8asCozmLcqpmrcUHA4rSUevHX2PHVWsIGYXTpgiolAgVG+syvpdgJ11IF9kJ oT52xhwlFwAs38XmziJd/0sLwl87yLYXK/ttUf6mwLcpwzH3Xr5SJEtciiajaoprLlnZ LuZT4TarNxJtIM6H48D3sflpoDt6/uPsd0+GMKzlLw8V0V6bSTuQGlGXhLyRw3ATVa+z NYp9PO2ffaPAZ3MFhqz1+TDu2TZG98WmeGzXNrTuEZ9EcXzSwdFp09EFd5/UiBEwEtWq WQTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=YMm9eUZ8iBP02amR/gDZ+7LKHHT0h53QeL1Rp8gKPB8=; fh=DdZ/LLJIHBs/iPcgtDInVXXtEog0LZ0rYZo8IBLj2mQ=; b=mSrjxAAsMWnJQC/CAY0NhUTMBISElg5h6NOas8zuU6EIIbbGyx2RrGmRpssNwGZw05 qvYUzVjePFFvmpzdI4dXp7BmKNICR34kLw5VJFKeFisC3OSiWKoHYjgyxsn/4h2Bk0HM iT9bBp8o48ADfh4BwcDiahl2X+a10h5UToJLVc+GTZSdQdfBzpNAzYHXrw9/Bo1FsiyU ZetvIll7051T+uP+KUv1akmpVi9d2qFExoar4W0vZY/OnpKlQJybRSN388zm0kXVPA1h Lpb7YwJEelUEmrKkIoDTnv9ye8mv4sDvqbxjxTlNf87iMhedkY3157L48K10APfFxHHV fIQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=A6bvRFub; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-3805-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3805-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s8-20020a17090a1c0800b002a2e618912csi7597921pjs.27.2024.04.23.09.43.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 09:43:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3805-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=A6bvRFub; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-3805-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3805-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A92DC2880A2 for ; Tue, 23 Apr 2024 16:33:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3166160; Tue, 23 Apr 2024 16:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A6bvRFub" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2C513217 for ; Tue, 23 Apr 2024 16:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713889977; cv=none; b=dDE5DUK2IV5ktsv4pG2/phO5JV1uI63RDZnzYL1BpBuzxnTVzWTZ5TeyLkz7JQU6spCpkmffQR4KRiUqHqEB+Na90Lc0PGBiY9wLRD/B62KHh2+lZ6waBeyvwb++JvTrJTfWuh7mnmIkWNaWY9bBTEJnR2GKx8A/TLrOyfSrwh8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713889977; c=relaxed/simple; bh=Me1MiIwDSiRo4TXmDOcSQJGJ8gYkeYRCW6xsRrmX9T0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JWcpieS57PKWQ18hRD5v4g4NNK3WKJodKpVK4I/74LGjoxry1TeO2NC/XvkwnS5RHu53U4KguJ9WNtUZ6Z44vWb4cV7s5Rdo5u8IQg0yFEEaRPqCBY6WrsA0VMVeV2dNWmwX2Dcn16LOM0li3F2HtS/apE+TCEMq4FUFncFswG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A6bvRFub; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58FE4C116B1; Tue, 23 Apr 2024 16:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713889977; bh=Me1MiIwDSiRo4TXmDOcSQJGJ8gYkeYRCW6xsRrmX9T0=; h=Date:From:To:List-Id:Cc:Subject:In-Reply-To:References:From; b=A6bvRFubDq/QplV53zNBVqI2+qKeIvR6VWBREohWyLoH3Td2B9OjZaJA5ITbibRPc xHhwiFkm841mDUB6prl7ylhuJ8viEBnp3CHenlIWOtEGl0za0Lk8s9P2znJWEPtZF1 AdRrqbgU/2HYAE9/HHsM9H5NGod7TNH3XmXzTCLikPHdookIDmPm48iiH5nTOw7Bni flFGBB/1DSbwUYDKud4hM36cJ9rDGQAIl/XlLe5mCAGBA3jAzYI4pV/Au283O3Yp+d W0//2c1prPAgevdgtrMa3EuXDmJ9Ti2dDHAy4vqzZlGWObw7f8Mi779ky7bEi5+2j1 1vbeJGn1exYpg== Date: Tue, 23 Apr 2024 18:32:25 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Andy Shevchenko Cc: Gregory CLEMENT , Arnd Bergmann , soc@kernel.org, Olivia Mackall , Herbert Xu , Greg Kroah-Hartman , linux-crypto@vger.kernel.org, arm@kernel.org Subject: Re: [PATCH v6 07/11] platform: cznic: turris-omnia-mcu: Add support for MCU provided TRNG Message-ID: <20240423183225.6e4f90a7@thinkpad> In-Reply-To: References: <20240418121116.22184-1-kabel@kernel.org> <20240418121116.22184-8-kabel@kernel.org> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 23 Apr 2024 18:58:19 +0300 Andy Shevchenko wrote: > On Thu, Apr 18, 2024 at 02:11:12PM +0200, Marek Beh=C3=BAn wrote: > > Add support for true random number generator provided by the MCU. > > New Omnia boards come without the Atmel SHA204-A chip. Instead the > > crypto functionality is provided by new microcontroller, which has > > a TRNG peripheral. =20 >=20 > ... >=20 > > +int omnia_mcu_register_trng(struct omnia_mcu *mcu) > > +{ > > + struct device *dev =3D &mcu->client->dev; > > + int irq, err; > > + u8 irq_idx; > > + > > + if (!(mcu->features & FEAT_TRNG)) > > + return 0; =20 >=20 > > + irq_idx =3D omnia_int_to_gpio_idx[__bf_shf(INT_TRNG)]; > > + irq =3D devm_irq_create_mapping(dev, mcu->gc.irq.domain, irq_idx); > > + if (irq < 0) > > + return dev_err_probe(dev, irq, "Cannot map TRNG IRQ\n"); =20 >=20 > This looks like some workaround against existing gpiod_to_irq(). Why do y= ou > need this? Hmmm, I thought that would not work because that line is only valid as an IRQ, not as a GPIO (this is enforced via the valid_mask member of gpio_chip and gpio_irq_chip). But looking at the code of gpiolib, if I do irq =3D gpiod_to_irq(gpiochip_get_desc(gc, irq_idx)); the valid_mask is not enforced anywhere. Is this semantically right to do even in spite of the fact that the line is not a valid GPIO line? Marek