All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Dimitar Dimitrov <dinuxbg@gmail.com>
Cc: ohad@wizery.com, bjorn.andersson@linaro.org, tony@atomide.com,
	robh+dt@kernel.org, bcousson@baylibre.com, ssantosh@kernel.org,
	s-anna@ti.com, nsekhar@ti.com, t-kristo@ti.com, nsaulnier@ti.com,
	jreeder@ti.com, m-karicheri2@ti.com, woods.technical@gmail.com,
	linux-omap@vger.kernel.org, linux-remoteproc@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	David Lechner <david@lechnology.com>
Subject: Re: [PATCH 04/16] remoteproc/pru: Add PRU remoteproc driver
Date: Fri, 14 Dec 2018 11:53:56 +0200	[thread overview]
Message-ID: <5C137DB4.9070602@ti.com> (raw)
In-Reply-To: <308735274.C9ZyqtqOL8@tpdeb>

Hi Dimitar,

On 30/11/18 23:39, Dimitar Dimitrov wrote:
> On Monday, 12/26/2018, 9:52:37 EET Roger Quadros wrote:
>> +/*
>> + * Convert PRU device address (instruction space) to kernel virtual address
>> + *
>> + * A PRU does not have an unified address space. Each PRU has its very own
>> + * private Instruction RAM, and its device address is identical to that of
>> + * its primary Data RAM device address.
>> + */
>> +static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, int len)
>> +{
>> +       u32 offset;
>> +       void *va = NULL;
>> +
>> +       if (len <= 0)
>> +               return NULL;
> 
> Could you please clear the upper 4 bits the of IRAM device address, in order 
> to support binutils ELF images? Here is an example line to add here:
> 
> +       /* GNU binutils do not support multiple address spaces. The 
> +        * default linker script from the official GNU pru-ld places 
> +        * IRAM at an arbitrary high offset, in order to differentiate it 
> +        * from DRAM. Hence we need to strip the artificial offset 
> +        * from the IRAM address. 
> +        */ 
> +       da &= ~0xf0000000u; 
> +
> 

After some more thought I'm not very sure how to proceed.

I'll be using the below 2 patches in the next patch spin in place of
patch 1 in the current series.
https://lore.kernel.org/lkml/20180623210810.21232-2-david@lechnology.com/
https://lore.kernel.org/lkml/20180623210810.21232-3-david@lechnology.com/

They figure out the PAGE (IRAM vs DRAM) by looking at TI specific section
attributes.

e.g.
[18] .TI.phattrs LOPROC+f000004 00000000 000e08 000010 00 0 0 4
[19] .TI.section.flags LOPROC+f000005 00000000 000e68 00002a 00 0 0 0
[20] .TI.section.page LOPROC+f000007 00000000 000e92 00002a 00 0 0 0

AFAIK the ELF by GNU pru-ld won't contain these sections.

We need to support ELF generated by both tools (TI clpru and GNU pru-ld).
Is it safe to assume that if the ELF doesn't have the TI specific sections
then it was generated by gnupru?

Is there a more straight forward way of differentiating the two. e.g. by looking
at something in the ELF header?

> 
>> +
>> +       if (da >= pru->iram_da &&
>> +           da + len <= pru->iram_da + pru->mem_regions[PRU_MEM_IRAM].size { 
>> +               offset = da - pru->iram_da;
>> +               va = (__force void *)(pru->mem_regions[PRU_MEM_IRAM].va +
>> +                                     offset);
>> +       }
>> +
>> +       return va;
>> +}
> 
> 

cheers,
-roger
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com>
To: Dimitar Dimitrov <dinuxbg@gmail.com>
Cc: <ohad@wizery.com>, <bjorn.andersson@linaro.org>,
	<tony@atomide.com>, <robh+dt@kernel.org>, <bcousson@baylibre.com>,
	<ssantosh@kernel.org>, <s-anna@ti.com>, <nsekhar@ti.com>,
	<t-kristo@ti.com>, <nsaulnier@ti.com>, <jreeder@ti.com>,
	<m-karicheri2@ti.com>, <woods.technical@gmail.com>,
	<linux-omap@vger.kernel.org>, <linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	David Lechner <david@lechnology.com>
Subject: Re: [PATCH 04/16] remoteproc/pru: Add PRU remoteproc driver
Date: Fri, 14 Dec 2018 11:53:56 +0200	[thread overview]
Message-ID: <5C137DB4.9070602@ti.com> (raw)
In-Reply-To: <308735274.C9ZyqtqOL8@tpdeb>

Hi Dimitar,

On 30/11/18 23:39, Dimitar Dimitrov wrote:
> On Monday, 12/26/2018, 9:52:37 EET Roger Quadros wrote:
>> +/*
>> + * Convert PRU device address (instruction space) to kernel virtual address
>> + *
>> + * A PRU does not have an unified address space. Each PRU has its very own
>> + * private Instruction RAM, and its device address is identical to that of
>> + * its primary Data RAM device address.
>> + */
>> +static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, int len)
>> +{
>> +       u32 offset;
>> +       void *va = NULL;
>> +
>> +       if (len <= 0)
>> +               return NULL;
> 
> Could you please clear the upper 4 bits the of IRAM device address, in order 
> to support binutils ELF images? Here is an example line to add here:
> 
> +       /* GNU binutils do not support multiple address spaces. The 
> +        * default linker script from the official GNU pru-ld places 
> +        * IRAM at an arbitrary high offset, in order to differentiate it 
> +        * from DRAM. Hence we need to strip the artificial offset 
> +        * from the IRAM address. 
> +        */ 
> +       da &= ~0xf0000000u; 
> +
> 

After some more thought I'm not very sure how to proceed.

I'll be using the below 2 patches in the next patch spin in place of
patch 1 in the current series.
https://lore.kernel.org/lkml/20180623210810.21232-2-david@lechnology.com/
https://lore.kernel.org/lkml/20180623210810.21232-3-david@lechnology.com/

They figure out the PAGE (IRAM vs DRAM) by looking at TI specific section
attributes.

e.g.
[18] .TI.phattrs LOPROC+f000004 00000000 000e08 000010 00 0 0 4
[19] .TI.section.flags LOPROC+f000005 00000000 000e68 00002a 00 0 0 0
[20] .TI.section.page LOPROC+f000007 00000000 000e92 00002a 00 0 0 0

AFAIK the ELF by GNU pru-ld won't contain these sections.

We need to support ELF generated by both tools (TI clpru and GNU pru-ld).
Is it safe to assume that if the ELF doesn't have the TI specific sections
then it was generated by gnupru?

Is there a more straight forward way of differentiating the two. e.g. by looking
at something in the ELF header?

> 
>> +
>> +       if (da >= pru->iram_da &&
>> +           da + len <= pru->iram_da + pru->mem_regions[PRU_MEM_IRAM].size { 
>> +               offset = da - pru->iram_da;
>> +               va = (__force void *)(pru->mem_regions[PRU_MEM_IRAM].va +
>> +                                     offset);
>> +       }
>> +
>> +       return va;
>> +}
> 
> 

cheers,
-roger
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  parent reply	other threads:[~2018-12-14  9:53 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26  7:52 [PATCH 00/16] remoteproc: Add support for TI PRU Roger Quadros
2018-11-26  7:52 ` Roger Quadros
2018-11-26  7:52 ` [PATCH 01/16] remoteproc: Extend rproc_da_to_va() API with a flags parameter Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26 21:29   ` David Lechner
2018-11-29 10:29     ` Roger Quadros
2018-11-29 10:29       ` Roger Quadros
2018-11-29 16:12       ` David Lechner
2018-12-04 10:03         ` Roger Quadros
2018-12-04 10:03           ` Roger Quadros
2019-02-14  3:35           ` Suman Anna
2019-02-14  3:35             ` Suman Anna
2018-11-26  7:52 ` [PATCH 02/16] remoteproc: Add a rproc_set_firmware() API Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26 21:41   ` David Lechner
2018-11-29  8:51     ` Roger Quadros
2018-11-29  8:51       ` Roger Quadros
2018-11-26  7:52 ` [PATCH 03/16] remoteproc: Add support to handle device specific resource types Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 04/16] remoteproc/pru: Add PRU remoteproc driver Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26 22:32   ` David Lechner
2018-11-29  9:26     ` Roger Quadros
2018-11-29  9:26       ` Roger Quadros
2018-11-30 21:39   ` Dimitar Dimitrov
2018-12-04  8:47     ` Roger Quadros
2018-12-04  8:47       ` Roger Quadros
2018-12-14  9:53     ` Roger Quadros [this message]
2018-12-14  9:53       ` Roger Quadros
2018-12-15 13:43       ` Dimitar Dimitrov
2018-11-26  7:52 ` [PATCH 05/16] remoteproc/pru: Add pru-specific debugfs support Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26 22:37   ` David Lechner
2018-11-29 10:17     ` Roger Quadros
2018-11-29 10:17       ` Roger Quadros
2018-12-18 15:51       ` Roger Quadros
2018-12-18 15:51         ` Roger Quadros
2018-12-19 12:38         ` Mark Brown
2018-12-19 15:43           ` Roger Quadros
2018-12-19 15:43             ` Roger Quadros
2018-12-19 15:48             ` David Lechner
2018-12-19 17:07               ` Mark Brown
2018-12-19 17:18                 ` Tony Lindgren
2018-12-20  8:45                   ` Roger Quadros
2018-12-20  8:45                     ` Roger Quadros
2018-11-26  7:52 ` [PATCH 06/16] dt-bindings: remoteproc: ti-pruss: Update bindings for supporting rpmsg Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 07/16] remoteproc/pru: Add support for virtio rpmsg stack Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 08/16] remoteproc/pru: Add pru_rproc_set_ctable() function Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 09/16] remoteproc/pru: add APIs to get and put the PRU cores Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 10/16] remoteproc/pru: add pru_rproc_get_id() API to retrieve the PRU id Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 11/16] soc: ti: pruss: add helper functions to set GPI mode, MII_RT_event and XFR Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 12/16] dt-bindings: remoteproc: ti-pruss: Document application node bindings Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26 23:27   ` David Lechner
2018-11-29 10:07     ` Roger Quadros
2018-11-29 10:07       ` Roger Quadros
2018-11-29 16:33       ` David Lechner
2018-11-30 11:42         ` Roger Quadros
2018-11-30 11:42           ` Roger Quadros
2018-12-11 22:06   ` Rob Herring
2018-12-17 16:03     ` Roger Quadros
2018-12-17 16:03       ` Roger Quadros
2018-11-26  7:52 ` [PATCH 13/16] remoteproc/pru: add support for configuring GPMUX based on client setup Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 14/16] remoteproc/pru: configure firmware " Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 15/16] remoteproc/pru: add support for parsing pru interrupt mapping from DT Roger Quadros
2018-11-26  7:52   ` Roger Quadros
2018-11-26  7:52 ` [PATCH 16/16] remoteproc/pru: Add support for INTC Interrupt map resource Roger Quadros
2018-11-26  7:52   ` Roger Quadros

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=5C137DB4.9070602@ti.com \
    --to=rogerq@ti.com \
    --cc=bcousson@baylibre.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=david@lechnology.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dinuxbg@gmail.com \
    --cc=jreeder@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=nsaulnier@ti.com \
    --cc=nsekhar@ti.com \
    --cc=ohad@wizery.com \
    --cc=robh+dt@kernel.org \
    --cc=s-anna@ti.com \
    --cc=ssantosh@kernel.org \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    --cc=woods.technical@gmail.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 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.