Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp499555lqr; Wed, 5 Jun 2024 12:01:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8191MHNNs3lMymo7BuZWHREEt1DWIcZC4PbOBzbyGGw6hpFGpuOKLm2dtkcrZBeRURyOtGEJL8LX8QX5yyRhQEwVPIDFbq9JVRu0Fbw== X-Google-Smtp-Source: AGHT+IFGtZMowSnHF7KF6ipvO+DC4UKBesMxoLx7+3IR0BjTbfNnn7uuojEnAWlzAsrMowAahQhA X-Received: by 2002:a05:6102:c89:b0:48a:39d1:711d with SMTP id ada2fe7eead31-48c0483e83amr4179305137.11.1717614066775; Wed, 05 Jun 2024 12:01:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717614066; cv=pass; d=google.com; s=arc-20160816; b=MnT9MCH6CYxIz+c3xzBV25GMh/3TDNG4h02Ps/q+eFchKUD6vXN4/B55WOmR24T7eu 4iaDwKVI8J81UOCja4vWxGRf51q9URKRgz8Vvd5og2L2kQ59WZ8qE4Ohbjlv2KKG1shB 9F9WSnsNN2ALDkgp+rEGH13d17GyGow4pf2pvO+PmpqScRUNwKL0XrZ/rTwpzlT3OcqQ jGmKtD+YVIyBThPP1VGuNkCX6Oe9PWpIcKd8yeMc+67mAfPkeoRrGuCU3I9mFmEN0GmC Tr6D3+tT7fqoLVlyJbakX5SCd+HJ2yqzZoZmJN34ZcK6nHyTtT+klbjHsI7L7anzohoI R53Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=CYhIOyPTOMDfxI0+KR+naWl8/lGKtywkm84N4Cz6eKM=; fh=Lnfc4eyO34jkUnhpVu62erp1G+sFnA/BcVWuRSoc4jI=; b=u27t3MzXcHSmhChQBDq3RV7s2uVdZ034IEZsD+CpkzpaWlES9KAo0iyQyLB+6rEEt2 ZiFAar2ho8ZR3qQ1PsrJR25eJ+X6TEeFJ8S79Nlmb4KgkWsW1D2FpJ6ylDKaABhcWU7V /oA1N1czHHEkjIPgYeh7N6MDzcYL9wZjGxea3W3iXUikpKKnc+tNyGz6flAwCzn2LCE7 X4TLbJxBSeHAD4yuekP96hARIchyzX9Cry0yLObJRq3DZIDM3xC9lQLGTPmxZMQYLP+Z ECJT//oMtf6kSYHs50/7kk+QlDmug5L/j1c5jqbJlugHSsjdcNkDgcqNSHGsltb6sT2o 0sEQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IZgeh4+s; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-crypto+bounces-4760-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4760-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ada2fe7eead31-48bbcfd2058si2781586137.436.2024.06.05.12.01.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4760-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=IZgeh4+s; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-crypto+bounces-4760-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4760-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6646E1C21CF3 for ; Wed, 5 Jun 2024 19:01:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66198262BE; Wed, 5 Jun 2024 19:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IZgeh4+s" X-Original-To: linux-crypto@vger.kernel.org Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B2E8E573 for ; Wed, 5 Jun 2024 19:00:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717614061; cv=none; b=T3jUKPFK6abULXqMMqw5isKB+ZQTCR3wHLDTwg1IfFrigzqsPWccYYwT9+b4ioxwpuF42P2CFNtFagoCB5IspddyzzGlvspjz6I+m95JJ+QUJ6tDAYYjoWmh8mKj0KiG/XccGwJtkQrh5P3Fc71pGI7ZUyDl8yCZO5CEX4R7GV8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717614061; c=relaxed/simple; bh=gqCSIzRysYcLX1mW1haocZgmshdPQ0djW6+REb56uQQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Z15mc5k8Xb2cJDHvXhEHUH19AGD0TaTXsQZkq48u9RcCvJNV0zYQTWnLb0omfQK8iZsImZDOZc6kO2vcHGQcu5aWKN5VRf50MBzaioVXmEaRSm0NDZiacdkNrzTpEH7QLM6chWx4F6ODp3lC4E+v32DOJY3fffNaqf2SP3tqHd4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IZgeh4+s; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-52b962c4bb6so256345e87.3 for ; Wed, 05 Jun 2024 12:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717614058; x=1718218858; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CYhIOyPTOMDfxI0+KR+naWl8/lGKtywkm84N4Cz6eKM=; b=IZgeh4+sLJlw/gBY08Jmsr1XXIxfekxF8kc1wRSGMd1HoeYaH9H7V17Gke0bfRI0t6 tXWmSJmSg7HLqruI1OXLxdDLR+QarZMqs0a0znE0edYZSex+SWow8lEe2qOb66bMLPeK 4ZkZ2K31LlgINwD0p/E48ARw4sZKr5aufX5ZlffhcS83rWgWkFTpx8KS3rf+AFmebqWX 0WTT24eLap9NZzqd688KVrg8EnDE5mmXiCytFgCP58XoJG/QIDrdGUThLqpQK7X6zpWw LBuyf8Vns4xPQ0dfitoBCDbG6PU3QHRBtJVfWZv6MKs2RC+Q3+J4iJ3OuFii6Q8AsxVo b2zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717614058; x=1718218858; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CYhIOyPTOMDfxI0+KR+naWl8/lGKtywkm84N4Cz6eKM=; b=CejVDnuuyyUBtTrB9fqkyoCo4Hvngde4i3a6Vk2ctq6WLxD3eHfqbxH6OBzLF/fWGO kUTntFYoV+4U+XXPml+rAzOd1F+ZqxI19Qy31Bd8iuIJ+3XU8YdkUJxhpMJEbJCewcQp xYrMYymg1BiTKGOU5j2ryWCsSteOc+4XjQYCkLXlXBAFgFST4Z2/4DfKrh3kQFbkWIcm SQJoKmASRReVXakCmdzZtCnIJOingm+QdUW66TBJg0jGLcTEe4TExVA8d0yToWXNYiUo tzABA1L4QmFjgTHDLYYTKfiW773upVPEAkI+p7XUa3vPg+aiyER/8h4nfdq/e62poKXN +xtg== X-Forwarded-Encrypted: i=1; AJvYcCX5CsM7pkPACxJcxVsTcxwJF57qABoXf5juK33L97RsTCMzUucQpOOhM+UBsbnExIh9lazbPLefLBEXDIC24ZDDLJrOaCAtrA8I/eW3 X-Gm-Message-State: AOJu0YxVp4pdjd3HRV5GMC2HXLJniYd5C/7VHZzdcnL++fz+gheGLfpt IRfSoqb4gyNb11S8Sk+7FdCNHZ9IXePm4OqQY9RU/cBNDjo4611MsIczLW/v7QgcC11MDLMrwwT PITIT2mDgPhSAdrmJgakvf5ljKHJT4X82 X-Received: by 2002:a05:6512:1285:b0:52b:7a44:e17b with SMTP id 2adb3069b0e04-52bab4ca4d2mr3449911e87.13.1717614057475; Wed, 05 Jun 2024 12:00:57 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240605161851.13911-1-kabel@kernel.org> <20240605161851.13911-7-kabel@kernel.org> In-Reply-To: <20240605161851.13911-7-kabel@kernel.org> From: Andy Shevchenko Date: Wed, 5 Jun 2024 22:00:20 +0300 Message-ID: Subject: Re: [PATCH v11 6/8] platform: cznic: turris-omnia-mcu: Add support for MCU provided TRNG To: =?UTF-8?B?TWFyZWsgQmVow7pu?= , Bartosz Golaszewski Cc: Gregory CLEMENT , Arnd Bergmann , soc@kernel.org, arm@kernel.org, Andy Shevchenko , Hans de Goede , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Olivia Mackall , Herbert Xu , Greg Kroah-Hartman , linux-crypto@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 5, 2024 at 7:19=E2=80=AFPM 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. +Cc: Bart for gpiochip_get_desc() usage. ... > +#include > +#include + errno.h > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include As per other patches. > +#include > + > +#include "turris-omnia-mcu.h" ... > + irq_idx =3D omnia_int_to_gpio_idx[__bf_shf(OMNIA_INT_TRNG)]; > + irq =3D gpiod_to_irq(gpiochip_get_desc(&mcu->gc, irq_idx)); > + if (irq < 0) > + return dev_err_probe(dev, irq, "Cannot get TRNG IRQ\n"); Okay, it's a bit more complicated than that. The gpiochip_get_desc() shouldn't be used. Bart, what can you suggest to do here? Opencoding it doesn't sound to me a (fully) correct approach in a long term. -- With Best Regards, Andy Shevchenko