From nobody Fri Oct 11 22:11:21 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 C704F1BC59 for ; Fri, 6 Sep 2024 00:25:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725582344; cv=none; b=PKxp5HPsHseUahuAeq6pi/VrhvJMtWuiADrnpAPA1PZNG62X6zpiMDUISLiV0XiJY6qZbonA5h6HFnJVjAVFw70CycbNtQhJbhrlfkzmT54n9w66FdF+cD46kW6b1XbwS8XoNLfNjQxv8F8fIZj08mMXUm9P667E0AUO+NlrjD8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725582344; c=relaxed/simple; bh=xeoEgQHWnJv9aAUQ7kLmifOvd3ou+ngyzhfdJVGfNH0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type:Content-type; b=XxiFmZ8VH4sfJOltR3olnLpwAoWI4p59nh2I0B0xk5ovaqU1gcuckNt9e+qePu4uu30kiOoFIGl0MOhOaoLFmePoQaQeNglQw01UHkfURLuz9jlRWWoBvDA53PttQoENmJpx4JGapV8LIXX4WTrnEZ6Ft5iHiQ6WJQW53IQ4k2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fh/IxRjP; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fh/IxRjP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725582341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zFmgUYgQ8XPCtLmWU1gSlO7qvWg2iDsHAEghO13whZ4=; b=fh/IxRjPTRKvkldNfcEVtXuStCo2od/UdnjTF3vK+FVqSqejLgknQEWIoEtQ78sLU7BknR uF8KMtx4GT8XL2x4dVuVVg2+CvRELvD4a2v0P1jXEjVrwaWrsxV6tSbGBIazXA08PUeAdl sb5/qahSypeY81ZMPrGN3Zhu17XNNyc= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-3eVIjHHXO_qTgYSEtWb3NA-1; Thu, 05 Sep 2024 20:25:38 -0400 X-MC-Unique: 3eVIjHHXO_qTgYSEtWb3NA-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7a80b9f8771so256612485a.3 for ; Thu, 05 Sep 2024 17:25:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725582338; x=1726187138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zFmgUYgQ8XPCtLmWU1gSlO7qvWg2iDsHAEghO13whZ4=; b=Hnz2vjj0fL+7QztOnlkhuiSf4iQyYxfaPjxuHhamQJ8s7XCbJ47FTpRJRYnJD1hH2g m9P278FVpSKAyTiej3KMK2GJjE83BLNfO2BDcmbf88zCQH+JTZ25pluDT+KWmmq6xEmI po5xBeH9YVmuko5oU54uE92XN5/Ele68R1ND6K/wRQ1FQYja6koWCFyMge7ug/7cR48D 6Wfw3m9AWTEegnrNRzeJiIgsqQ9GfLegi2AuArJJmcypmPq/T7mBBrEBZNaVljApgpQD afl10ik03G3tesHQSXuwS67Uxdv9xnwzS/Y29dvfMD2feX59pQsA8m2DlmachzxKQGtJ j3lg== X-Forwarded-Encrypted: i=1; AJvYcCUAokxHNylNTEsy81pBm4zWcte8Y2hdigsAQH9HcuhXoszB4dn5godaC2LE18+RU64Ay4rRnZDAN2Aoex8=@vger.kernel.org X-Gm-Message-State: AOJu0Yyz006VIORLtymkMzXsc+Xpgyoufp+Ms/4pSx61vjZiTOke0/OF qgSVh9zYyvfUZlgL6c3UA+HgIrc9XT1pFcteGrqS9UKHowxh5SSzst9wJVvh2a/53zAq0gdvpFn kDzLzwNXjMo2vuJ52mn4GFPOrO3jqEnAuMc9xJ6QxvsvZy28uhG5sfYGJNZlemA== X-Received: by 2002:a05:620a:2891:b0:79d:6d7d:e5b3 with SMTP id af79cd13be357-7a8041f4696mr3047811685a.42.1725582338088; Thu, 05 Sep 2024 17:25:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYQx7/fvvOSNZf5EqatDNkGRptl/2APlKW+uDWTwN3cDQR0sw3Wju0jKTNyuHCb5DTaeJ5tg== X-Received: by 2002:a05:620a:2891:b0:79d:6d7d:e5b3 with SMTP id af79cd13be357-7a8041f4696mr3047809285a.42.1725582337498; Thu, 05 Sep 2024 17:25:37 -0700 (PDT) Received: from x1.redhat.com (c-98-219-206-88.hsd1.pa.comcast.net. [98.219.206.88]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a98f026309sm120779185a.128.2024.09.05.17.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 17:25:35 -0700 (PDT) From: Brian Masney To: herbert@gondor.apana.org.au Cc: davem@davemloft.net, quic_omprsing@quicinc.com, neil.armstrong@linaro.org, quic_bjorande@quicinc.com, linux-arm-msm@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, ernesto.mnd.fernandez@gmail.com, quic_jhugo@quicinc.com Subject: [PATCH v3 1/2] crypto: qcom-rng: fix support for ACPI-based systems Date: Thu, 5 Sep 2024 20:25:20 -0400 Message-ID: <20240906002521.1163311-2-bmasney@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240906002521.1163311-1-bmasney@redhat.com> References: <20240906002521.1163311-1-bmasney@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-type: text/plain Content-Transfer-Encoding: quoted-printable The qcom-rng driver supports both ACPI and device tree-based systems. ACPI support was broken when the hw_random interface support was added. Let's go ahead and fix this by adding the appropriate driver data to the ACPI match table, and change the of_device_get_match_data() call to device_get_match_data() so that it will also work on ACPI-based systems. This fix was boot tested on a Qualcomm Amberwing server (ACPI based) and on a Qualcomm SA8775p Automotive Development Board (DT based). I also verified that qcom-rng shows up in /proc/crypto on both systems. Fixes: f29cd5bb64c2 ("crypto: qcom-rng - Add hw_random interface support") Reported-by: Ernesto A. Fern=C3=A1ndez Closes: https://lore.kernel.org/linux-arm-msm/20240828184019.GA21181@eaf/ Cc: stable@vger.kernel.org Signed-off-by: Brian Masney Reviewed-by: Bjorn Andersson Reviewed-by: Dmitry Baryshkov --- drivers/crypto/qcom-rng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c index c670d7d0c11e..6496b075a48d 100644 --- a/drivers/crypto/qcom-rng.c +++ b/drivers/crypto/qcom-rng.c @@ -196,7 +196,7 @@ static int qcom_rng_probe(struct platform_device *pdev) if (IS_ERR(rng->clk)) return PTR_ERR(rng->clk); =20 - rng->of_data =3D (struct qcom_rng_of_data *)of_device_get_match_data(&pde= v->dev); + rng->of_data =3D (struct qcom_rng_of_data *)device_get_match_data(&pdev->= dev); =20 qcom_rng_dev =3D rng; ret =3D crypto_register_rng(&qcom_rng_alg); @@ -247,7 +247,7 @@ static struct qcom_rng_of_data qcom_trng_of_data =3D { }; =20 static const struct acpi_device_id __maybe_unused qcom_rng_acpi_match[] = =3D { - { .id =3D "QCOM8160", .driver_data =3D 1 }, + { .id =3D "QCOM8160", .driver_data =3D (kernel_ulong_t)&qcom_prng_ee_of_d= ata }, {} }; MODULE_DEVICE_TABLE(acpi, qcom_rng_acpi_match); --=20 2.46.0 From nobody Fri Oct 11 22:11:21 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 C22C21CA94 for ; Fri, 6 Sep 2024 00:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725582345; cv=none; b=WvJp6PWkoWif9WMFpESqfvIPPMz1b427f6p1YK/wNyZTkc1ERS9+TbfHsaQiO0YcceWlNzF7LsNr+60rcwP88T+KHiSaNtuDJ4iTlXoRVg4zzxnNJiGzHacmLGWQO6U3mjYQlsSP+aQ8qje4M6ldO/NYQQ2VwzHvTKH6uWN/M2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725582345; c=relaxed/simple; bh=F9Uwhqqdr1QEO4Uf0e3N6m5hVQ48iQS/2mzlZua6pJU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=DxpdTyvdlmPItT3gxx7PF6huIPOSg26bcII6rfCYkUpdEojhFR1nMl6ITtwMWCpwob4WyAWnMzqLMlC/WREm9yPMM1rQCfkY+DQ8SVwySDrfCRd1xI9bx6z8hPZPiF6r7mCSCZGsHk0lhSUAhyP9YBm20v2/JU3O/dKQ8OqIfnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RtCqz4OX; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RtCqz4OX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725582342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AXs+sSHMxW4xLKVsJ3yX9bT40+qBEQlZQpspzwecfqg=; b=RtCqz4OXU/cMnTL3ATRlyTvwGb/mk0GJiNK/QQGfh/6QxujmqAT0pgM8c7pRA8h6DRpaip N1XuPKRKXOdl9l0mwg+GaB6ni0nXWHWSUyVDopBh/GWvlrls7PJm9iu2QFjrHUq8KvdU0l 5qUu8oZaTx6eSoN4Ki64tzD1umdwKMk= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-274-2EngIpVGNEWVgEePtDdRbQ-1; Thu, 05 Sep 2024 20:25:41 -0400 X-MC-Unique: 2EngIpVGNEWVgEePtDdRbQ-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7a81b8a55b0so211992185a.0 for ; Thu, 05 Sep 2024 17:25:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725582341; x=1726187141; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AXs+sSHMxW4xLKVsJ3yX9bT40+qBEQlZQpspzwecfqg=; b=w3WfY7KKDehY249A7bCNBwfkpl1duGkStOYDEFGnlSjkgIEQUpgsOipG/p0xqOi7UO /A0vIeRtI33AcrXLmWxlS9FN3+OVv92TSLL2u8NVkW2MtVblj6F+8TwmuTM8fdmnkVAF 6Ft6yAAYja1zDytvEpVH8D6iePGugGzahIn+W+JjG1aayv3XWYnWLiihr26axxi7KRZ3 FiSuNHzvcKKxHZf5bwuyot9zUtyLXzYu8eUpVZ7HBStvgyev+vq395yHaqrELh6rUBEF TgW/NvO3GI9yKfRJ3EfH5WTacTTARc4ETEK1ERmABTJgsHP5DdQbRu83sqo/q3b9DZjr kg3A== X-Forwarded-Encrypted: i=1; AJvYcCWCweNE0N9M1xFLu8LnjLqE+8x/3hLrZA71z6UjR50CG5jmRpGAU+QolLVsvkJZjiE6CBFl0GYnDuQOAxQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyhdnHMnQLw8t4e1X7ATqU8bmJiReqi21KawkOqtLe1ph14GP7j jDiGGA4ZqvpOAgcYEk45yskMPtb+ch4q9vNjGcLBVIbf9lUzliftBXSU0Ft+ELW80zDAnK/gBbe v+VUClnEZlE0Y6Vn9WO2EdLPfHs9TjPamMi1/kjXc9Ae0sr3/40FOkFwInsThDg== X-Received: by 2002:a05:620a:44d6:b0:79f:78a:f7b4 with SMTP id af79cd13be357-7a99738053cmr92039385a.42.1725582341057; Thu, 05 Sep 2024 17:25:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtgm5o2cQmEAwVZpksxYurvLL3zktTO4nmhdmHXqyWN7CwpD6yac08Ur1BLlemaReX6WXNvg== X-Received: by 2002:a05:620a:44d6:b0:79f:78a:f7b4 with SMTP id af79cd13be357-7a99738053cmr92037685a.42.1725582340701; Thu, 05 Sep 2024 17:25:40 -0700 (PDT) Received: from x1.redhat.com (c-98-219-206-88.hsd1.pa.comcast.net. [98.219.206.88]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a98f026309sm120779185a.128.2024.09.05.17.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 17:25:38 -0700 (PDT) From: Brian Masney To: herbert@gondor.apana.org.au Cc: davem@davemloft.net, quic_omprsing@quicinc.com, neil.armstrong@linaro.org, quic_bjorande@quicinc.com, linux-arm-msm@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, ernesto.mnd.fernandez@gmail.com, quic_jhugo@quicinc.com Subject: [PATCH v3 2/2] crypto: qcom-rng: rename *_of_data to *_match_data Date: Thu, 5 Sep 2024 20:25:21 -0400 Message-ID: <20240906002521.1163311-3-bmasney@redhat.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240906002521.1163311-1-bmasney@redhat.com> References: <20240906002521.1163311-1-bmasney@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The qcom-rng driver supports both ACPI and device tree based systems. Let's rename all instances of *of_data to *match_data so that it's not implied that this driver only supports device tree-based systems. Signed-off-by: Brian Masney Reviewed-by: Bjorn Andersson Reviewed-by: Dmitry Baryshkov --- drivers/crypto/qcom-rng.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c index 6496b075a48d..09419e79e34c 100644 --- a/drivers/crypto/qcom-rng.c +++ b/drivers/crypto/qcom-rng.c @@ -36,14 +36,14 @@ struct qcom_rng { void __iomem *base; struct clk *clk; struct hwrng hwrng; - struct qcom_rng_of_data *of_data; + struct qcom_rng_match_data *match_data; }; =20 struct qcom_rng_ctx { struct qcom_rng *rng; }; =20 -struct qcom_rng_of_data { +struct qcom_rng_match_data { bool skip_init; bool hwrng_support; }; @@ -155,7 +155,7 @@ static int qcom_rng_init(struct crypto_tfm *tfm) =20 ctx->rng =3D qcom_rng_dev; =20 - if (!ctx->rng->of_data->skip_init) + if (!ctx->rng->match_data->skip_init) return qcom_rng_enable(ctx->rng); =20 return 0; @@ -196,7 +196,7 @@ static int qcom_rng_probe(struct platform_device *pdev) if (IS_ERR(rng->clk)) return PTR_ERR(rng->clk); =20 - rng->of_data =3D (struct qcom_rng_of_data *)device_get_match_data(&pdev->= dev); + rng->match_data =3D (struct qcom_rng_match_data *)device_get_match_data(&= pdev->dev); =20 qcom_rng_dev =3D rng; ret =3D crypto_register_rng(&qcom_rng_alg); @@ -206,7 +206,7 @@ static int qcom_rng_probe(struct platform_device *pdev) return ret; } =20 - if (rng->of_data->hwrng_support) { + if (rng->match_data->hwrng_support) { rng->hwrng.name =3D "qcom_hwrng"; rng->hwrng.read =3D qcom_hwrng_read; rng->hwrng.quality =3D QCOM_TRNG_QUALITY; @@ -231,31 +231,31 @@ static void qcom_rng_remove(struct platform_device *p= dev) qcom_rng_dev =3D NULL; } =20 -static struct qcom_rng_of_data qcom_prng_of_data =3D { +static struct qcom_rng_match_data qcom_prng_match_data =3D { .skip_init =3D false, .hwrng_support =3D false, }; =20 -static struct qcom_rng_of_data qcom_prng_ee_of_data =3D { +static struct qcom_rng_match_data qcom_prng_ee_match_data =3D { .skip_init =3D true, .hwrng_support =3D false, }; =20 -static struct qcom_rng_of_data qcom_trng_of_data =3D { +static struct qcom_rng_match_data qcom_trng_match_data =3D { .skip_init =3D true, .hwrng_support =3D true, }; =20 static const struct acpi_device_id __maybe_unused qcom_rng_acpi_match[] = =3D { - { .id =3D "QCOM8160", .driver_data =3D (kernel_ulong_t)&qcom_prng_ee_of_d= ata }, + { .id =3D "QCOM8160", .driver_data =3D (kernel_ulong_t)&qcom_prng_ee_matc= h_data }, {} }; MODULE_DEVICE_TABLE(acpi, qcom_rng_acpi_match); =20 static const struct of_device_id __maybe_unused qcom_rng_of_match[] =3D { - { .compatible =3D "qcom,prng", .data =3D &qcom_prng_of_data }, - { .compatible =3D "qcom,prng-ee", .data =3D &qcom_prng_ee_of_data }, - { .compatible =3D "qcom,trng", .data =3D &qcom_trng_of_data }, + { .compatible =3D "qcom,prng", .data =3D &qcom_prng_match_data }, + { .compatible =3D "qcom,prng-ee", .data =3D &qcom_prng_ee_match_data }, + { .compatible =3D "qcom,trng", .data =3D &qcom_trng_match_data }, {} }; MODULE_DEVICE_TABLE(of, qcom_rng_of_match); --=20 2.46.0