All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
	Andy Gross <andy.gross@linaro.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-remoteproc@vger.kernel.org, linux-soc@vger.kernel.org,
	Bjorn Andersson <bjorn.andersson@sonymobile.com>
Subject: Re: [PATCH v2 2/4] remoteproc: Introduce Qualcomm ADSP PIL
Date: Tue, 23 Aug 2016 09:38:12 -0700	[thread overview]
Message-ID: <20160823163812.GB15161@tuxbot> (raw)
In-Reply-To: <ae9f06c0-6e5e-8c33-f239-2fd60e2e6682@linaro.org>

On Tue 23 Aug 08:14 PDT 2016, Stanimir Varbanov wrote:

> Hi Bjorn,
> 
> On 08/23/2016 08:57 AM, Bjorn Andersson wrote:
> > From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> > 
> > The Qualcomm ADSP Peripheral Image Loader is used on a variety of
> > different Qualcomm platforms for loading firmware into and controlling
> > the Hexagon based ADSP.
> > 
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> > 
> > Changes since v1:
> > - Added platform names to compatibility
> > - Removed some incorrect quirks that tried to handle older platforms
> > 
> 
> <cut>
> 
> > +
> > +static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
> > +{
> > +	struct device_node *node;
> > +	struct resource r;
> > +	int ret;
> > +
> > +	node = of_parse_phandle(adsp->dev->of_node, "memory-region", 0);
> > +	if (!node) {
> > +		dev_err(adsp->dev, "no memory-region specified\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	ret = of_address_to_resource(node, 0, &r);
> > +	if (ret)
> > +		return ret;
> > +
> 
> I think that the parsing of memory-region and subsequent
> address_to_resource is not so good. I had the same issue with Venus
> remoteproc driver and come to the more standard way by using
> of_reserved_mem_device_init() and dma_alloc_coherent.
> 

I tried this in an earlier version. But on 8974 the adsp is supposed to
be loaded at 0xdc00000, where we have a chunk that's 0x1900000 (25.6MB).

The problem is that dma_alloc_coherent(25.6MB) will fail, because there
is not 32MB free in that 25.6MB region. This stems from how
dma_alloc_coherent() is implemented, so some work would need to be done
there.


Further more, in remoteproc you are expected to provide a resource table
detailing carveout regions like this - a table that's supposed to come
from the ELF. We are currently looking into ways of injecting individual
resource requests from a remoteproc driver, so I hope to replace this
with a "rproc_add_carveout()".

But then this shows another issue with using dma_alloc_coherent(), it
suddenly requires us to create dummy devices for each memory region; to
be able to control which dma_mem should be used for each operation.


So, I intend to move most of this handling into the remoteproc core, but
I'm still uncertain if I we will not just have the same logic, but
shared in the core...

> Could you review "[PATCH 0/4] Venus remoteproc driver" patchset in this
> regard?
> 

I will, sorry for the delays.

> > +	adsp->mem_phys = adsp->mem_reloc = r.start;
> > +	adsp->mem_size = resource_size(&r);
> > +	adsp->mem_region = devm_ioremap_wc(adsp->dev, adsp->mem_phys, adsp->mem_size);
> > +	if (!adsp->mem_region) {
> > +		dev_err(adsp->dev, "unable to map memory region: %pa+%zx\n",
> > +			&r.start, adsp->mem_size);
> > +		return -EBUSY;
> > +	}
> > +
> > +	return 0;
> > +}
> > +

Regards,
Bjorn

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
	Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rob Herring <robh+dt@kernel.org>,
	Bjorn Andersson <bjorn.andersson@sonymobile.com>,
	Andy Gross <andy.gross@linaro.org>,
	linux-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/4] remoteproc: Introduce Qualcomm ADSP PIL
Date: Tue, 23 Aug 2016 09:38:12 -0700	[thread overview]
Message-ID: <20160823163812.GB15161@tuxbot> (raw)
In-Reply-To: <ae9f06c0-6e5e-8c33-f239-2fd60e2e6682@linaro.org>

On Tue 23 Aug 08:14 PDT 2016, Stanimir Varbanov wrote:

> Hi Bjorn,
> 
> On 08/23/2016 08:57 AM, Bjorn Andersson wrote:
> > From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> > 
> > The Qualcomm ADSP Peripheral Image Loader is used on a variety of
> > different Qualcomm platforms for loading firmware into and controlling
> > the Hexagon based ADSP.
> > 
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> > 
> > Changes since v1:
> > - Added platform names to compatibility
> > - Removed some incorrect quirks that tried to handle older platforms
> > 
> 
> <cut>
> 
> > +
> > +static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
> > +{
> > +	struct device_node *node;
> > +	struct resource r;
> > +	int ret;
> > +
> > +	node = of_parse_phandle(adsp->dev->of_node, "memory-region", 0);
> > +	if (!node) {
> > +		dev_err(adsp->dev, "no memory-region specified\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	ret = of_address_to_resource(node, 0, &r);
> > +	if (ret)
> > +		return ret;
> > +
> 
> I think that the parsing of memory-region and subsequent
> address_to_resource is not so good. I had the same issue with Venus
> remoteproc driver and come to the more standard way by using
> of_reserved_mem_device_init() and dma_alloc_coherent.
> 

I tried this in an earlier version. But on 8974 the adsp is supposed to
be loaded at 0xdc00000, where we have a chunk that's 0x1900000 (25.6MB).

The problem is that dma_alloc_coherent(25.6MB) will fail, because there
is not 32MB free in that 25.6MB region. This stems from how
dma_alloc_coherent() is implemented, so some work would need to be done
there.


Further more, in remoteproc you are expected to provide a resource table
detailing carveout regions like this - a table that's supposed to come
from the ELF. We are currently looking into ways of injecting individual
resource requests from a remoteproc driver, so I hope to replace this
with a "rproc_add_carveout()".

But then this shows another issue with using dma_alloc_coherent(), it
suddenly requires us to create dummy devices for each memory region; to
be able to control which dma_mem should be used for each operation.


So, I intend to move most of this handling into the remoteproc core, but
I'm still uncertain if I we will not just have the same logic, but
shared in the core...

> Could you review "[PATCH 0/4] Venus remoteproc driver" patchset in this
> regard?
> 

I will, sorry for the delays.

> > +	adsp->mem_phys = adsp->mem_reloc = r.start;
> > +	adsp->mem_size = resource_size(&r);
> > +	adsp->mem_region = devm_ioremap_wc(adsp->dev, adsp->mem_phys, adsp->mem_size);
> > +	if (!adsp->mem_region) {
> > +		dev_err(adsp->dev, "unable to map memory region: %pa+%zx\n",
> > +			&r.start, adsp->mem_size);
> > +		return -EBUSY;
> > +	}
> > +
> > +	return 0;
> > +}
> > +

Regards,
Bjorn

WARNING: multiple messages have this Message-ID (diff)
From: bjorn.andersson@linaro.org (Bjorn Andersson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/4] remoteproc: Introduce Qualcomm ADSP PIL
Date: Tue, 23 Aug 2016 09:38:12 -0700	[thread overview]
Message-ID: <20160823163812.GB15161@tuxbot> (raw)
In-Reply-To: <ae9f06c0-6e5e-8c33-f239-2fd60e2e6682@linaro.org>

On Tue 23 Aug 08:14 PDT 2016, Stanimir Varbanov wrote:

> Hi Bjorn,
> 
> On 08/23/2016 08:57 AM, Bjorn Andersson wrote:
> > From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> > 
> > The Qualcomm ADSP Peripheral Image Loader is used on a variety of
> > different Qualcomm platforms for loading firmware into and controlling
> > the Hexagon based ADSP.
> > 
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> > 
> > Changes since v1:
> > - Added platform names to compatibility
> > - Removed some incorrect quirks that tried to handle older platforms
> > 
> 
> <cut>
> 
> > +
> > +static int adsp_alloc_memory_region(struct qcom_adsp *adsp)
> > +{
> > +	struct device_node *node;
> > +	struct resource r;
> > +	int ret;
> > +
> > +	node = of_parse_phandle(adsp->dev->of_node, "memory-region", 0);
> > +	if (!node) {
> > +		dev_err(adsp->dev, "no memory-region specified\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	ret = of_address_to_resource(node, 0, &r);
> > +	if (ret)
> > +		return ret;
> > +
> 
> I think that the parsing of memory-region and subsequent
> address_to_resource is not so good. I had the same issue with Venus
> remoteproc driver and come to the more standard way by using
> of_reserved_mem_device_init() and dma_alloc_coherent.
> 

I tried this in an earlier version. But on 8974 the adsp is supposed to
be loaded at 0xdc00000, where we have a chunk that's 0x1900000 (25.6MB).

The problem is that dma_alloc_coherent(25.6MB) will fail, because there
is not 32MB free in that 25.6MB region. This stems from how
dma_alloc_coherent() is implemented, so some work would need to be done
there.


Further more, in remoteproc you are expected to provide a resource table
detailing carveout regions like this - a table that's supposed to come
from the ELF. We are currently looking into ways of injecting individual
resource requests from a remoteproc driver, so I hope to replace this
with a "rproc_add_carveout()".

But then this shows another issue with using dma_alloc_coherent(), it
suddenly requires us to create dummy devices for each memory region; to
be able to control which dma_mem should be used for each operation.


So, I intend to move most of this handling into the remoteproc core, but
I'm still uncertain if I we will not just have the same logic, but
shared in the core...

> Could you review "[PATCH 0/4] Venus remoteproc driver" patchset in this
> regard?
> 

I will, sorry for the delays.

> > +	adsp->mem_phys = adsp->mem_reloc = r.start;
> > +	adsp->mem_size = resource_size(&r);
> > +	adsp->mem_region = devm_ioremap_wc(adsp->dev, adsp->mem_phys, adsp->mem_size);
> > +	if (!adsp->mem_region) {
> > +		dev_err(adsp->dev, "unable to map memory region: %pa+%zx\n",
> > +			&r.start, adsp->mem_size);
> > +		return -EBUSY;
> > +	}
> > +
> > +	return 0;
> > +}
> > +

Regards,
Bjorn

  reply	other threads:[~2016-08-23 16:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23  5:57 [PATCH v2 1/4] dt-binding: remoteproc: Introduce ADSP loader binding Bjorn Andersson
2016-08-23  5:57 ` Bjorn Andersson
2016-08-23  5:57 ` [PATCH v2 2/4] remoteproc: Introduce Qualcomm ADSP PIL Bjorn Andersson
2016-08-23  5:57   ` Bjorn Andersson
2016-08-23 15:14   ` Stanimir Varbanov
2016-08-23 15:14     ` Stanimir Varbanov
2016-08-23 15:14     ` Stanimir Varbanov
2016-08-23 16:38     ` Bjorn Andersson [this message]
2016-08-23 16:38       ` Bjorn Andersson
2016-08-23 16:38       ` Bjorn Andersson
2016-08-23  5:57 ` [PATCH v2 3/4] ARM: dts: msm8974: Add ADSP smp2p and smd nodes Bjorn Andersson
2016-08-23  5:57   ` Bjorn Andersson
2016-08-23  5:57 ` [PATCH v2 4/4] ARM: dts: msm8974: Add ADSP PIL node Bjorn Andersson
2016-08-23  5:57   ` Bjorn Andersson
2016-08-23 18:31 ` [PATCH v2 1/4] dt-binding: remoteproc: Introduce ADSP loader binding Rob Herring
2016-08-23 18:31   ` Rob Herring
2016-08-23 18:31   ` Rob Herring
2016-08-23 18:57   ` Bjorn Andersson
2016-08-23 18:57     ` Bjorn Andersson
2016-08-30 23:47     ` Bjorn Andersson
2016-08-30 23:47       ` Bjorn Andersson
2016-08-30 23:47       ` Bjorn Andersson

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=20160823163812.GB15161@tuxbot \
    --to=bjorn.andersson@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=bjorn.andersson@sonymobile.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ohad@wizery.com \
    --cc=robh+dt@kernel.org \
    --cc=stanimir.varbanov@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.