mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anvesh Jain P <anvesh.p@oss.qualcomm.com>
To: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sibi Sankar <sibi.sankar@oss.qualcomm.com>
Subject: Re: [PATCH v2 3/4] remoteproc: qcom: pas: Add coredump support for secondary processors
Date: Wed, 18 Nov 2026 15:59:18 +0530	[thread overview]
Message-ID: <cc64e5f0-fb82-41eb-8f26-6dfab7cd0791@oss.qualcomm.com> (raw)
In-Reply-To: <20261117081011.jcuxog7ixwbfbyce@hu-mojha-hyd.qualcomm.com>



On 11/17/2026 1:40 PM, Mukesh Ojha wrote:
> On Thu, Oct 15, 2026 at 11:25:51AM +0530, Anvesh Jain P wrote:
>> Add coredump support for PAS remoteproc instances with a secondary
>> processor by registering fixed dump segments for both primary and
>> secondary carveouts at probe time and mapping them during collection.
>> The attached-state path is for debug dump collection and does not
>> provide operational device recovery.
>>
>> Signed-off-by: Anvesh Jain P <anvesh.p@oss.qualcomm.com>
>> ---
>>  drivers/remoteproc/qcom_q6v5_pas.c | 102 +++++++++++++++++++++++++++++++++----
>>  1 file changed, 91 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
>> index 0bce2f0d5b4a..374cafd04b62 100644
>> --- a/drivers/remoteproc/qcom_q6v5_pas.c
>> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
>> @@ -117,6 +117,7 @@ struct qcom_pas {
>>  	phys_addr_t region_assign_phys[MAX_ASSIGN_COUNT];
>>  
>>  	void __iomem *mem_region;
>> +	void __iomem *secondary_mem_region;
>>  
>>  	size_t mem_size;
>>  	size_t dtb_mem_size;
>> @@ -162,6 +163,28 @@ static void qcom_pas_segment_dump(struct rproc *rproc,
>>  	memcpy_fromio(dest, pas->mem_region + total_offset, size);
>>  }
>>  
>> +static bool qcom_pas_has_secondary(const struct qcom_pas *pas)
>> +{
>> +	return pas->secondary_pas_id && pas->secondary_dtb_pas_id;
>> +}
>> +
>> +static int qcom_pas_register_dump_segments(struct rproc *rproc,
>> +					   struct qcom_pas *pas)
>> +{
>> +	int ret;
>> +
>> +	ret = rproc_coredump_add_segment(rproc, pas->mem_phys, pas->mem_size);
>> +	if (ret)
>> +		return ret;
> 
> Why qcom_register_dump_segments() already does this ? why need to
> add entire region ? please modify qcom_register_dump_segments()
> according to your need.
>

Ack, I will remove the whole-carveout segment and use
qcom_register_dump_segments() for the firmware segments.

>> +
>> +	ret = rproc_coredump_add_segment(rproc, pas->secondary_mem_phys,
>> +					 pas->secondary_mem_size);
>> +	if (ret)
>> +		rproc_coredump_cleanup(rproc);
>> +
>> +	return ret;
>> +}
>> +
>>  static void qcom_pas_minidump(struct rproc *rproc)
>>  {
>>  	struct qcom_pas *pas = rproc->priv;
>> @@ -577,16 +600,38 @@ static int qcom_pas_stop(struct rproc *rproc)
>>  static void *qcom_pas_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *is_iomem)
>>  {
>>  	struct qcom_pas *pas = rproc->priv;
>> -	int offset;
>> +	phys_addr_t base;
>> +	void __iomem *region;
>> +
>> +	if (da >= pas->mem_reloc && len <= pas->mem_size &&
>> +	    da - pas->mem_reloc <= pas->mem_size - len) {
>> +		base = pas->mem_reloc;
>> +		region = pas->mem_region;
>> +	} else if (da >= pas->mem_phys && len <= pas->mem_size &&
>> +		   da - pas->mem_phys <= pas->mem_size - len) {
>> +		base = pas->mem_phys;
>> +		region = pas->mem_region;
>> +	} else if (da >= pas->secondary_mem_reloc &&
>> +		   len <= pas->secondary_mem_size &&
>> +		   da - pas->secondary_mem_reloc <= pas->secondary_mem_size - len) {
>> +		base = pas->secondary_mem_reloc;
>> +		region = pas->secondary_mem_region;
>> +	} else if (da >= pas->secondary_mem_phys &&
>> +		   len <= pas->secondary_mem_size &&
>> +		   da - pas->secondary_mem_phys <= pas->secondary_mem_size - len) {
>> +		base = pas->secondary_mem_phys;
>> +		region = pas->secondary_mem_region;
>> +	} else {
>> +		return NULL;
>> +	}
>>  
>> -	offset = da - pas->mem_reloc;
>> -	if (offset < 0 || offset + len > pas->mem_size)
>> +	if (!region)
>>  		return NULL;
>>  
>>  	if (is_iomem)
>>  		*is_iomem = true;
>>  
>> -	return (__force void *)pas->mem_region + offset;
>> +	return (__force void *)region + (da - base);
>>  }
>>  
>>  static int qcom_pas_parse_firmware(struct rproc *rproc, const struct firmware *fw)
>> @@ -598,10 +643,21 @@ static int qcom_pas_parse_firmware(struct rproc *rproc, const struct firmware *f
>>  	size_t table_sz;
>>  	int ret;
>>  
>> -	ret = qcom_register_dump_segments(rproc, fw);
>> -	if (ret) {
>> -		dev_err(pas->dev, "Error in registering dump segments\n");
>> -		return ret;
>> +	if (qcom_pas_has_secondary(pas)) {
>> +		if (list_empty(&rproc->dump_segments)) {
>> +			ret = qcom_pas_register_dump_segments(rproc, pas);
>> +			if (ret) {
>> +				dev_err(pas->dev,
>> +					"failed to register dump segments: %d\n", ret);
>> +				return ret;
>> +			}
>> +		}
>> +	} else {
>> +		ret = qcom_register_dump_segments(rproc, fw);
>> +		if (ret) {
>> +			dev_err(pas->dev, "Error in registering dump segments\n");
>> +			return ret;
>> +		}
>>  	}
>>  
>>  	if (!rproc->has_iommu)
>> @@ -716,13 +772,21 @@ static void qcom_pas_coredump(struct rproc *rproc)
>>  {
>>  	struct qcom_pas *pas = rproc->priv;
>>  
>> -	pas->mem_region = qcom_pas_ctx_map(pas->pas_ctx);
>> +	if (!pas->mem_region)
>> +		pas->mem_region = qcom_pas_ctx_map(pas->pas_ctx);
>>  	if (!pas->mem_region)
>>  		return;
>>  
>> +	if (qcom_pas_has_secondary(pas) && !pas->secondary_mem_region) {
>> +		pas->secondary_mem_region =
>> +			qcom_pas_ctx_map(pas->secondary_pas_ctx);
>> +		if (!pas->secondary_mem_region) {
>> +			dev_err(pas->dev, "unable to map secondary memory for coredump\n");
>> +			return;
>> +		}
>> +	}
>> +
>>  	rproc_coredump(rproc);
>> -	iounmap(pas->mem_region);
> 
> There was a region it was unmapped once done to avoid speculative fetch access.. we can't keep
> it mapped all the time..
>
>

Ack, I’ll unmap the PAS region after coredump collection.

>> -	pas->mem_region = NULL;
>>  }
>>  
>>  static const struct rproc_ops qcom_pas_ops = {
>> @@ -1133,6 +1197,12 @@ static int qcom_pas_probe(struct platform_device *pdev)
>>  	if (desc->early_boot)
>>  		pas->rproc->state = RPROC_DETACHED;
>>  
>> +	if (qcom_pas_has_secondary(pas)) {
>> +		ret = qcom_pas_register_dump_segments(rproc, pas);
>> +		if (ret)
>> +			goto remove_ssr_sysmon;
>> +	}
> 
> For early boot, we don't even have support for the primary image
> itself for the first crash as we did not load for its first boot
> up. So, this is new and you don't have check why do we need it in
> probe whether it is early booted subsystem or loaded by linux
> Also, not sure if it is right to dump entire memory region.
>


Ack, I will remove probe-time registration and add only firmware-derived
dump segments when the firmware is available.

>> +
>>  	ret = rproc_add(rproc);
>>  	if (ret)
>>  		goto remove_ssr_sysmon;
>> @@ -1144,6 +1214,7 @@ static int qcom_pas_probe(struct platform_device *pdev)
>>  	return 0;
>>  
>>  remove_ssr_sysmon:
>> +	rproc_coredump_cleanup(rproc);
>>  	qcom_remove_ssr_subdev(rproc, &pas->ssr_subdev);
>>  	qcom_remove_sysmon_subdev(pas->sysmon);
>>  deinit_remove_pdm_smd_glink:
>> @@ -1169,6 +1240,15 @@ static void qcom_pas_remove(struct platform_device *pdev)
>>  		of_platform_device_destroy(&pas->bam_dmux->dev, NULL);
>>  
>>  	rproc_del(pas->rproc);
>> +	rproc_coredump_cleanup(pas->rproc);
>> +	if (pas->secondary_mem_region) {
>> +		iounmap(pas->secondary_mem_region);
>> +		pas->secondary_mem_region = NULL;
>> +	}
>> +	if (pas->mem_region) {
>> +		iounmap(pas->mem_region);
>> +		pas->mem_region = NULL;
>> +	}
>>  
>>  	qcom_q6v5_deinit(&pas->q6v5);
>>  	qcom_pas_unassign_memory_region(pas);
>>
>> -- 
>> 2.34.1
>>
> 

-- 
Best Regards,
Anvesh


  reply	other threads:[~2026-11-18 10:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  5:55 [PATCH v2 0/4] Add Glymur OOBMSS support Anvesh Jain P
2026-10-15  5:55 ` [PATCH v2 1/4] dt-bindings: remoteproc: qcom: Add Glymur OOBMSS PAS Anvesh Jain P
2026-10-15 10:34   ` Krzysztof Kozlowski
2026-11-16 18:02   ` Mukesh Ojha
2026-11-17  6:47     ` Anvesh Jain P
2026-10-15  5:55 ` [PATCH v2 2/4] remoteproc: qcom: pas: Support secondary images Anvesh Jain P
2026-11-16 18:44   ` Mukesh Ojha
2026-11-17  9:29     ` Anvesh Jain P
2026-10-15  5:55 ` [PATCH v2 3/4] remoteproc: qcom: pas: Add coredump support for secondary processors Anvesh Jain P
2026-11-17  8:10   ` Mukesh Ojha
2026-11-18 10:29     ` Anvesh Jain P [this message]
2026-10-15  5:55 ` [PATCH v2 4/4] remoteproc: qcom: pas: Add Glymur OOBMSS PAS parameters Anvesh Jain P
2026-11-16 18:47   ` Mukesh Ojha
2026-11-17  9:42     ` Anvesh Jain P

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=cc64e5f0-fb82-41eb-8f26-6dfab7cd0791@oss.qualcomm.com \
    --to=anvesh.p@oss.qualcomm.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mukesh.ojha@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sibi.sankar@oss.qualcomm.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

all inboxes | Powered by JetHome®