Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Eugen Hristev <eugen.hristev@linaro.org>
To: linux-arm-msm@vger.kernel.org, linux-hardening@vger.kernel.org,
	kees@kernel.org
Cc: linux-kernel@vger.kernel.org, johannes@sipsolutions.net,
	gregkh@linuxfoundation.org, rafael@kernel.org, dakr@kernel.org,
	andersson@kernel.org, konradybcio@kernel.org,
	tony.luck@intel.com, gpiccoli@igalia.com, pmladek@suse.com,
	rostedt@goodmis.org, john.ogness@linutronix.de,
	senozhatsky@chromium.org, quic_mojha@quicinc.com,
	linux-arm-kernel@lists.infradead.org, kernel@quicinc.com,
	Eugen Hristev <eugen.hristev@linaro.org>
Subject: [RFC][PATCH 10/10] rng: qcom_rng: EXAMPLE: registering dev structure
Date: Mon, 17 Feb 2025 12:17:06 +0200	[thread overview]
Message-ID: <20250217101706.2104498-11-eugen.hristev@linaro.org> (raw)
In-Reply-To: <20250217101706.2104498-1-eugen.hristev@linaro.org>

Proof of concept on how devcd register core area works.

Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org>
---
 drivers/crypto/qcom-rng.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c
index 0685ba122e8a..a1509609f50c 100644
--- a/drivers/crypto/qcom-rng.c
+++ b/drivers/crypto/qcom-rng.c
@@ -7,6 +7,7 @@
 #include <linux/acpi.h>
 #include <linux/clk.h>
 #include <linux/crypto.h>
+#include <linux/devcoredump.h>
 #include <linux/hw_random.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
@@ -32,11 +33,13 @@
 #define QCOM_TRNG_QUALITY	1024
 
 struct qcom_rng {
+	char start[10];
 	struct mutex lock;
 	void __iomem *base;
 	struct clk *clk;
 	struct hwrng hwrng;
 	struct qcom_rng_match_data *match_data;
+	char end[10];
 };
 
 struct qcom_rng_ctx {
@@ -192,6 +195,10 @@ static int qcom_rng_probe(struct platform_device *pdev)
 	if (IS_ERR(rng->base))
 		return PTR_ERR(rng->base);
 
+	/* Setting some markers to easily recognize them afterwards */
+	strcpy(rng->start, "MD_RNG_ST");
+	strcpy(rng->end, "MD_RNG_en");
+
 	rng->clk = devm_clk_get_optional(&pdev->dev, "core");
 	if (IS_ERR(rng->clk))
 		return PTR_ERR(rng->clk);
@@ -218,6 +225,8 @@ static int qcom_rng_probe(struct platform_device *pdev)
 		}
 	}
 
+	devcd_register_core_area(&pdev->dev, rng, sizeof(*rng));
+
 	return ret;
 fail:
 	crypto_unregister_rng(&qcom_rng_alg);
@@ -228,6 +237,8 @@ static void qcom_rng_remove(struct platform_device *pdev)
 {
 	crypto_unregister_rng(&qcom_rng_alg);
 
+	devcd_unregister_core_area(&pdev->dev, qcom_rng_dev,
+				   sizeof(*qcom_rng_dev));
 	qcom_rng_dev = NULL;
 }
 
-- 
2.43.0


  parent reply	other threads:[~2025-02-17 10:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17 10:16 [RFC][PATCH 00/10] pstore: directly mapped regions Eugen Hristev
2025-02-17 10:16 ` [RFC][PATCH 01/10] pstore/zone: move pstore_device_info into zone header Eugen Hristev
2025-02-17 10:16 ` [RFC][PATCH 02/10] pstore/smem: add new pstore/smem type of pstore Eugen Hristev
2025-02-17 10:16 ` [RFC][PATCH 03/10] pstore/zone: introduce directly mapped zones Eugen Hristev
2025-02-17 10:17 ` [RFC][PATCH 04/10] qcom: smem: add pstore smem backend Eugen Hristev
2025-02-17 10:17 ` [RFC][PATCH 05/10] pstore: implement core area registration Eugen Hristev
2025-02-17 10:17 ` [RFC][PATCH 06/10] qcom: smem: enable smem pstore backend Eugen Hristev
2025-02-17 10:17 ` [RFC][PATCH 07/10] printk: export symbols for buffer address and length functions Eugen Hristev
2025-02-18  8:26   ` Christoph Hellwig
2025-02-18  8:58     ` Sergey Senozhatsky
2025-02-18  9:11       ` Eugen Hristev
2025-02-17 10:17 ` [RFC][PATCH 08/10] pstore: register kmsg into directly mapped zones if available Eugen Hristev
2025-02-17 10:17 ` [RFC][PATCH 09/10] devcoredump: add devcd_{un}register_core_area API Eugen Hristev
2025-02-17 10:17 ` Eugen Hristev [this message]
2025-02-17 10:23 ` [RFC][PATCH 00/10] pstore: directly mapped regions Johannes Berg
2025-02-17 10:44   ` Eugen Hristev
2025-02-17 11:19     ` Johannes Berg
2025-02-17 11:39       ` Eugen Hristev
2025-02-17 11:43         ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250217101706.2104498-11-eugen.hristev@linaro.org \
    --to=eugen.hristev@linaro.org \
    --cc=andersson@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gpiccoli@igalia.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes@sipsolutions.net \
    --cc=john.ogness@linutronix.de \
    --cc=kees@kernel.org \
    --cc=kernel@quicinc.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=quic_mojha@quicinc.com \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox