Message ID | 1662643422-14909-5-git-send-email-quic_srivasam@quicinc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Update ADSP pil loader for SC7280 platform | expand |
Quoting Srinivasa Rao Mandadapu (2022-09-08 06:23:38) > diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c > index 02d17b4..207270d4 100644 > --- a/drivers/remoteproc/qcom_q6v5_adsp.c > +++ b/drivers/remoteproc/qcom_q6v5_adsp.c > @@ -447,7 +447,7 @@ static unsigned long adsp_panic(struct rproc *rproc) > return qcom_q6v5_panic(&adsp->q6v5); > } > > -static const struct rproc_ops adsp_ops = { > +static struct rproc_ops adsp_ops = { This is sad. > .start = adsp_start, > .stop = adsp_stop, > .da_to_va = adsp_da_to_va, > @@ -590,6 +590,9 @@ static int adsp_probe(struct platform_device *pdev) > return ret; > } > > + if (desc->has_iommu) > + adsp_ops.parse_fw = rproc_elf_load_rsc_table; > + Why not have two different set of ops so that the function pointer table can't be hijacked? One for the parse_fw callback? Or simply return from rproc_elf_load_rsc_table() when has_iommu is false? > rproc = rproc_alloc(&pdev->dev, pdev->name, &adsp_ops,
On 9/8/22 6:53 PM, Srinivasa Rao Mandadapu wrote: > Change parse_fw callback in rproc ops from qcom_register_dump_segments > to rproc_elf_load_rsc_table, as section header to be parsed for memory > sandboxing required platforms. > > Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com> > --- > drivers/remoteproc/qcom_q6v5_adsp.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c > index 02d17b4..207270d4 100644 > --- a/drivers/remoteproc/qcom_q6v5_adsp.c > +++ b/drivers/remoteproc/qcom_q6v5_adsp.c > @@ -447,7 +447,7 @@ static unsigned long adsp_panic(struct rproc *rproc) > return qcom_q6v5_panic(&adsp->q6v5); > } > > -static const struct rproc_ops adsp_ops = { > +static struct rproc_ops adsp_ops = { > .start = adsp_start, > .stop = adsp_stop, > .da_to_va = adsp_da_to_va, > @@ -590,6 +590,9 @@ static int adsp_probe(struct platform_device *pdev) > return ret; > } > > + if (desc->has_iommu) > + adsp_ops.parse_fw = rproc_elf_load_rsc_table; > + The parse_fw would still need to perform the register_dump_segments in addition to elf_load_rsc_table, otherwise you'll lose coredump functionality for ADSP on SC7280. You could perhaps just follow qcom_q6v5_mss parse_fw i.e. have a static func internal to adsp doing both and have it assigned to both wpss/adsp with the pre-existing has_iommu flag to differentiate between the two. With this you wouldn't need to remove the const in adsp_ops as well. > rproc = rproc_alloc(&pdev->dev, pdev->name, &adsp_ops, > firmware_name, sizeof(*adsp)); > if (!rproc) { >
On 9/12/2022 4:25 AM, Stephen Boyd wrote: Thanks for your time Stephen!!! > Quoting Srinivasa Rao Mandadapu (2022-09-08 06:23:38) >> diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c >> index 02d17b4..207270d4 100644 >> --- a/drivers/remoteproc/qcom_q6v5_adsp.c >> +++ b/drivers/remoteproc/qcom_q6v5_adsp.c >> @@ -447,7 +447,7 @@ static unsigned long adsp_panic(struct rproc *rproc) >> return qcom_q6v5_panic(&adsp->q6v5); >> } >> >> -static const struct rproc_ops adsp_ops = { >> +static struct rproc_ops adsp_ops = { > This is sad. > >> .start = adsp_start, >> .stop = adsp_stop, >> .da_to_va = adsp_da_to_va, >> @@ -590,6 +590,9 @@ static int adsp_probe(struct platform_device *pdev) >> return ret; >> } >> >> + if (desc->has_iommu) >> + adsp_ops.parse_fw = rproc_elf_load_rsc_table; >> + > Why not have two different set of ops so that the function pointer table > can't be hijacked? One for the parse_fw callback? Or simply return from > rproc_elf_load_rsc_table() when has_iommu is false? Okay. Will change accordingly. > >> rproc = rproc_alloc(&pdev->dev, pdev->name, &adsp_ops,
On 9/14/2022 3:05 PM, Sibi Sankar wrote: Thanks for Your time and valuable inputs Sibi Sankar!!! > > On 9/8/22 6:53 PM, Srinivasa Rao Mandadapu wrote: >> Change parse_fw callback in rproc ops from qcom_register_dump_segments >> to rproc_elf_load_rsc_table, as section header to be parsed for memory >> sandboxing required platforms. >> >> Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com> >> --- >> drivers/remoteproc/qcom_q6v5_adsp.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c >> b/drivers/remoteproc/qcom_q6v5_adsp.c >> index 02d17b4..207270d4 100644 >> --- a/drivers/remoteproc/qcom_q6v5_adsp.c >> +++ b/drivers/remoteproc/qcom_q6v5_adsp.c >> @@ -447,7 +447,7 @@ static unsigned long adsp_panic(struct rproc *rproc) >> return qcom_q6v5_panic(&adsp->q6v5); >> } >> -static const struct rproc_ops adsp_ops = { >> +static struct rproc_ops adsp_ops = { >> .start = adsp_start, >> .stop = adsp_stop, >> .da_to_va = adsp_da_to_va, >> @@ -590,6 +590,9 @@ static int adsp_probe(struct platform_device *pdev) >> return ret; >> } >> + if (desc->has_iommu) >> + adsp_ops.parse_fw = rproc_elf_load_rsc_table; >> + > > The parse_fw would still need to perform the register_dump_segments > in addition to elf_load_rsc_table, otherwise you'll lose coredump > functionality for ADSP on SC7280. You could perhaps just follow > qcom_q6v5_mss parse_fw i.e. have a static func internal to adsp > doing both and have it assigned to both wpss/adsp with the > pre-existing has_iommu flag to differentiate between the two. With > this you wouldn't need to remove the const in adsp_ops as well. Okay. Will update accordingly and re spin the patches. > >> rproc = rproc_alloc(&pdev->dev, pdev->name, &adsp_ops, >> firmware_name, sizeof(*adsp)); >> if (!rproc) { >>
diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 02d17b4..207270d4 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -447,7 +447,7 @@ static unsigned long adsp_panic(struct rproc *rproc) return qcom_q6v5_panic(&adsp->q6v5); } -static const struct rproc_ops adsp_ops = { +static struct rproc_ops adsp_ops = { .start = adsp_start, .stop = adsp_stop, .da_to_va = adsp_da_to_va, @@ -590,6 +590,9 @@ static int adsp_probe(struct platform_device *pdev) return ret; } + if (desc->has_iommu) + adsp_ops.parse_fw = rproc_elf_load_rsc_table; + rproc = rproc_alloc(&pdev->dev, pdev->name, &adsp_ops, firmware_name, sizeof(*adsp)); if (!rproc) {
Change parse_fw callback in rproc ops from qcom_register_dump_segments to rproc_elf_load_rsc_table, as section header to be parsed for memory sandboxing required platforms. Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com> --- drivers/remoteproc/qcom_q6v5_adsp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)