2015-12-24 14:01:27

by Ivaylo Dimitrov

[permalink] [raw]
Subject: [PATCH 0/3] OMAP: RX51: save atags data to be exported on /proc/atags

Nokia N900 legacy userspace needs ATAGS passed by the bootloder to be
available in /proc/atags. With DT booted kernel this information is
no longer availabe. Fix that by saving ATAGS data early in the boot
stage so it can be exported in /proc/atags later

Ivaylo Dimitrov (3):
ARM: ATAGS: move atags.h to include/asm so it can be included by files
outside kernel/
ARM: ATAGS: Fix declaration of function save_atags
OMAP: RX51: save ATAGS data in the early boot stage

arch/arm/include/asm/atags.h | 20 ++++++++++++++++++++
arch/arm/kernel/atags.h | 20 --------------------
arch/arm/kernel/atags_parse.c | 3 +--
arch/arm/kernel/setup.c | 3 +--
arch/arm/mach-omap2/board-generic.c | 12 +++++++++++-
5 files changed, 33 insertions(+), 25 deletions(-)
create mode 100644 arch/arm/include/asm/atags.h
delete mode 100644 arch/arm/kernel/atags.h

--
1.9.1


2015-12-24 14:02:00

by Ivaylo Dimitrov

[permalink] [raw]
Subject: [PATCH 1/3] ARM: ATAGS: move atags.h to include/asm so it can be included by files outside kernel/

This is needed by a follow-up patch that saves atags on RX51 device

Signed-off-by: Ivaylo Dimitrov <[email protected]>
---
arch/arm/include/asm/atags.h | 20 ++++++++++++++++++++
arch/arm/kernel/atags.h | 20 --------------------
arch/arm/kernel/atags_parse.c | 3 +--
arch/arm/kernel/setup.c | 3 +--
4 files changed, 22 insertions(+), 24 deletions(-)
create mode 100644 arch/arm/include/asm/atags.h
delete mode 100644 arch/arm/kernel/atags.h

diff --git a/arch/arm/include/asm/atags.h b/arch/arm/include/asm/atags.h
new file mode 100644
index 0000000..ec4164d
--- /dev/null
+++ b/arch/arm/include/asm/atags.h
@@ -0,0 +1,20 @@
+#ifdef CONFIG_ATAGS_PROC
+extern void save_atags(struct tag *tags);
+#else
+static inline void save_atags(struct tag *tags) { }
+#endif
+
+void convert_to_tag_list(struct tag *tags);
+
+#ifdef CONFIG_ATAGS
+const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer,
+ unsigned int machine_nr);
+#else
+static inline const struct machine_desc *
+setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
+{
+ early_print("no ATAGS support: can't continue\n");
+ while (true);
+ unreachable();
+}
+#endif
diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h
deleted file mode 100644
index ec4164d..0000000
--- a/arch/arm/kernel/atags.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifdef CONFIG_ATAGS_PROC
-extern void save_atags(struct tag *tags);
-#else
-static inline void save_atags(struct tag *tags) { }
-#endif
-
-void convert_to_tag_list(struct tag *tags);
-
-#ifdef CONFIG_ATAGS
-const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer,
- unsigned int machine_nr);
-#else
-static inline const struct machine_desc *
-setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
-{
- early_print("no ATAGS support: can't continue\n");
- while (true);
- unreachable();
-}
-#endif
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c
index 68c6ae0..faac2d1 100644
--- a/arch/arm/kernel/atags_parse.c
+++ b/arch/arm/kernel/atags_parse.c
@@ -28,8 +28,7 @@
#include <asm/system_info.h>
#include <asm/page.h>
#include <asm/mach/arch.h>
-
-#include "atags.h"
+#include <asm/atags.h>

static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 20edd34..aa0193a 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -60,8 +60,7 @@
#include <asm/unwind.h>
#include <asm/memblock.h>
#include <asm/virt.h>
-
-#include "atags.h"
+#include <asm/atags.h>


#if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE)
--
1.9.1

2015-12-24 14:01:30

by Ivaylo Dimitrov

[permalink] [raw]
Subject: [PATCH 2/3] ARM: ATAGS: Fix declaration of function save_atags

In file atags_proc.c function save_atags() expect const argument, but in
atags.h file is declarated as non const. Fix declaration in atags.h file to
match what is expected.

Signed-off-by: Ivaylo Dimitrov <[email protected]>
---
arch/arm/include/asm/atags.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/atags.h b/arch/arm/include/asm/atags.h
index ec4164d..2dfc30f 100644
--- a/arch/arm/include/asm/atags.h
+++ b/arch/arm/include/asm/atags.h
@@ -1,7 +1,7 @@
#ifdef CONFIG_ATAGS_PROC
-extern void save_atags(struct tag *tags);
+extern void save_atags(const struct tag *tags);
#else
-static inline void save_atags(struct tag *tags) { }
+static inline void save_atags(const struct tag *tags) { }
#endif

void convert_to_tag_list(struct tag *tags);
--
1.9.1

2015-12-24 14:01:39

by Ivaylo Dimitrov

[permalink] [raw]
Subject: [PATCH 3/3] OMAP: RX51: save ATAGS data in the early boot stage

Nokia N900 (RX51) legacy userspace needs various ATAGS passed by the
bootloader (boot reason, device serial, boot mode, various GPIO swithes,
etc). Save that data early enough in the boot process, so it can be
exported later in /proc/atags

Signed-off-by: Ivaylo Dimitrov <[email protected]>
---
arch/arm/mach-omap2/board-generic.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 04a56cc..594eefe 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -17,6 +17,7 @@
#include <linux/irqdomain.h>

#include <asm/mach/arch.h>
+#include <asm/atags.h>

#include "common.h"

@@ -76,8 +77,17 @@ static const char *const n900_boards_compat[] __initconst = {
NULL,
};

+/* Legacy userspace on Nokia N900 needs ATAGS exported in /proc/atags,
+ * save them while the data is still there
+ */
+static void __init rx51_reserve(void)
+{
+ save_atags((const struct tag *)(PAGE_OFFSET + 0x100));
+ omap_reserve();
+}
+
DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
- .reserve = omap_reserve,
+ .reserve = rx51_reserve,
.map_io = omap3_map_io,
.init_early = omap3430_init_early,
.init_machine = omap_generic_init,
--
1.9.1

2015-12-24 15:35:52

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH 1/3] ARM: ATAGS: move atags.h to include/asm so it can be included by files outside kernel/

On Thu, Dec 24, 2015 at 04:00:56PM +0200, Ivaylo Dimitrov wrote:
> This is needed by a follow-up patch that saves atags on RX51 device
>
> Signed-off-by: Ivaylo Dimitrov <[email protected]>
> ---
> arch/arm/include/asm/atags.h | 20 ++++++++++++++++++++
> arch/arm/kernel/atags.h | 20 --------------------

Please generate diffs with -M so that it can detect renames and provide
a more sensible diffstat and patch output (so we can see any changes
through the rename.) However...

> arch/arm/kernel/atags_parse.c | 3 +--
> arch/arm/kernel/setup.c | 3 +--
> 4 files changed, 22 insertions(+), 24 deletions(-)
> create mode 100644 arch/arm/include/asm/atags.h
> delete mode 100644 arch/arm/kernel/atags.h
>
> diff --git a/arch/arm/include/asm/atags.h b/arch/arm/include/asm/atags.h
> new file mode 100644
> index 0000000..ec4164d
> --- /dev/null
> +++ b/arch/arm/include/asm/atags.h
> @@ -0,0 +1,20 @@
> +#ifdef CONFIG_ATAGS_PROC
> +extern void save_atags(struct tag *tags);
> +#else
> +static inline void save_atags(struct tag *tags) { }
> +#endif
> +
> +void convert_to_tag_list(struct tag *tags);
> +
> +#ifdef CONFIG_ATAGS
> +const struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer,
> + unsigned int machine_nr);
> +#else
> +static inline const struct machine_desc *
> +setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
> +{
> + early_print("no ATAGS support: can't continue\n");
> + while (true);
> + unreachable();
> +}
> +#endif
> diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h
> deleted file mode 100644
> index ec4164d..0000000
> --- a/arch/arm/kernel/atags.h
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -#ifdef CONFIG_ATAGS_PROC
> -extern void save_atags(struct tag *tags);
> -#else
> -static inline void save_atags(struct tag *tags) { }
> -#endif

I'd think I'd prefer moving just the above save_atags declaration to
arch/arm/include/asm/setup.h so we're not allowing the rest of this
to be exposed to anyone who includes asm/atags.h.

Thanks.

--
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

2015-12-24 15:51:24

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 0/3] OMAP: RX51: save atags data to be exported on /proc/atags

On Thursday 24 December 2015, Ivaylo Dimitrov wrote:
> Nokia N900 legacy userspace needs ATAGS passed by the bootloder to be
> available in /proc/atags. With DT booted kernel this information is
> no longer availabe. Fix that by saving ATAGS data early in the boot
> stage so it can be exported in /proc/atags later

Looks ok to me.

Acked-by: Arnd Bergmann <[email protected]>

Arnd

2015-12-24 16:40:57

by Ivaylo Dimitrov

[permalink] [raw]
Subject: [PATCH 0/2] OMAP: RX51: save atags data to be exported on /proc/atags

Nokia N900 legacy userspace needs ATAGS passed by the bootloder to be
available in /proc/atags. With DT booted kernel this information is
no longer availabe. Fix that by saving ATAGS data early in the boot
stage so it can be exported in /proc/atags later

Ivaylo Dimitrov (2):
ARM: ATAGS: move save_atags() to include/asm
arch/arm/include/asm/setup.h
OMAP: RX51: save ATAGS data in the early boot stage

arch/arm/include/asm/setup.h | 6 ++++++
arch/arm/kernel/atags.h | 6 ------
arch/arm/mach-omap2/board-generic.c | 12 +++++++++++-
3 files changed, 17 insertions(+), 7 deletions(-)

--
1.9.1

2015-12-24 16:40:59

by Ivaylo Dimitrov

[permalink] [raw]
Subject: [PATCH 1/2] ARM: ATAGS: move save_atags() to include/asm arch/arm/include/asm/setup.h

So it can be used by code outside arch/arm/kernel/. Fix save_atags()
declaration to match its definition while at it.

Signed-off-by: Ivaylo Dimitrov <[email protected]>
---
arch/arm/include/asm/setup.h | 6 ++++++
arch/arm/kernel/atags.h | 6 ------
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index e0adb9f..3613d7e 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -25,4 +25,10 @@ extern int arm_add_memory(u64 start, u64 size);
extern void early_print(const char *str, ...);
extern void dump_machine_table(void);

+#ifdef CONFIG_ATAGS_PROC
+extern void save_atags(const struct tag *tags);
+#else
+static inline void save_atags(const struct tag *tags) { }
+#endif
+
#endif
diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h
index ec4164d..edfa226 100644
--- a/arch/arm/kernel/atags.h
+++ b/arch/arm/kernel/atags.h
@@ -1,9 +1,3 @@
-#ifdef CONFIG_ATAGS_PROC
-extern void save_atags(struct tag *tags);
-#else
-static inline void save_atags(struct tag *tags) { }
-#endif
-
void convert_to_tag_list(struct tag *tags);

#ifdef CONFIG_ATAGS
--
1.9.1

2015-12-24 16:41:19

by Ivaylo Dimitrov

[permalink] [raw]
Subject: [PATCH 2/2] OMAP: RX51: save ATAGS data in the early boot stage

Nokia N900 (RX51) legacy userspace needs various ATAGS passed by the
bootloader (boot reason, device serial, boot mode, various GPIO swithes,
etc). Save that data early enough in the boot process, so it can be
exported later in /proc/atags

Signed-off-by: Ivaylo Dimitrov <[email protected]>
---
arch/arm/mach-omap2/board-generic.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 04a56cc..8098272 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -16,6 +16,7 @@
#include <linux/of_platform.h>
#include <linux/irqdomain.h>

+#include <asm/setup.h>
#include <asm/mach/arch.h>

#include "common.h"
@@ -76,8 +77,17 @@ static const char *const n900_boards_compat[] __initconst = {
NULL,
};

+/* Legacy userspace on Nokia N900 needs ATAGS exported in /proc/atags,
+ * save them while the data is still not overwritten
+ */
+static void __init rx51_reserve(void)
+{
+ save_atags((const struct tag *)(PAGE_OFFSET + 0x100));
+ omap_reserve();
+}
+
DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
- .reserve = omap_reserve,
+ .reserve = rx51_reserve,
.map_io = omap3_map_io,
.init_early = omap3430_init_early,
.init_machine = omap_generic_init,
--
1.9.1

2015-12-24 17:48:28

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 1/2] ARM: ATAGS: move save_atags() to include/asm arch/arm/include/asm/setup.h

On Thursday 24 December 2015 17:37:55 Ivaylo Dimitrov wrote:
> So it can be used by code outside arch/arm/kernel/. Fix save_atags()
> declaration to match its definition while at it.
>
> Signed-off-by: Ivaylo Dimitrov <[email protected]>

Tested-by: Pali Rohár <[email protected]>

--
Pali Rohár
[email protected]


Attachments:
signature.asc (198.00 B)
This is a digitally signed message part.

2015-12-24 17:49:16

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 2/2] OMAP: RX51: save ATAGS data in the early boot stage

On Thursday 24 December 2015 17:37:56 Ivaylo Dimitrov wrote:
> Nokia N900 (RX51) legacy userspace needs various ATAGS passed by the
> bootloader (boot reason, device serial, boot mode, various GPIO
> swithes, etc). Save that data early enough in the boot process, so
> it can be exported later in /proc/atags
>
> Signed-off-by: Ivaylo Dimitrov <[email protected]>

Working fine in qemu.

Tested-by: Pali Rohár <[email protected]>

--
Pali Rohár
[email protected]


Attachments:
signature.asc (198.00 B)
This is a digitally signed message part.

2015-12-24 18:53:25

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH 1/2] ARM: ATAGS: move save_atags() to include/asm arch/arm/include/asm/setup.h

* Pali Rohár <[email protected]> [151224 09:48]:
> On Thursday 24 December 2015 17:37:55 Ivaylo Dimitrov wrote:
> > So it can be used by code outside arch/arm/kernel/. Fix save_atags()
> > declaration to match its definition while at it.
> >
> > Signed-off-by: Ivaylo Dimitrov <[email protected]>
>
> Tested-by: Pali Rohár <[email protected]>

Nice, please upload both to Russell's patch system after no
more comments:

Acked-by: Tony Lindgren <[email protected]>

2015-12-24 18:56:10

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH 2/2] OMAP: RX51: save ATAGS data in the early boot stage

* Pali Rohár <[email protected]> [151224 09:49]:
> On Thursday 24 December 2015 17:37:56 Ivaylo Dimitrov wrote:
> > Nokia N900 (RX51) legacy userspace needs various ATAGS passed by the
> > bootloader (boot reason, device serial, boot mode, various GPIO
> > swithes, etc). Save that data early enough in the boot process, so
> > it can be exported later in /proc/atags
> >
> > Signed-off-by: Ivaylo Dimitrov <[email protected]>
>
> Working fine in qemu.
>
> Tested-by: Pali Rohár <[email protected]>

Maybe update the description to say "This fixes a regression with
device tree based booting compared to legacy booting for n900 to
make the n900 legacy user space to also work with device tree based
booting".

It would be nice to get these two in as fixes after -rc1 assuming
people have no objections to it. So please upload this one also
into Russell's patch system after no more comments:

Acked-by: Tony Lindgren <[email protected]>

2015-12-24 19:02:48

by Ivaylo Dimitrov

[permalink] [raw]
Subject: Re: [PATCH 1/2] ARM: ATAGS: move save_atags() to include/asm arch/arm/include/asm/setup.h



On 24.12.2015 20:53, Tony Lindgren wrote:
> * Pali Rohár <[email protected]> [151224 09:48]:
>> On Thursday 24 December 2015 17:37:55 Ivaylo Dimitrov wrote:
>>> So it can be used by code outside arch/arm/kernel/. Fix save_atags()
>>> declaration to match its definition while at it.
>>>
>>> Signed-off-by: Ivaylo Dimitrov <[email protected]>
>>
>> Tested-by: Pali Rohár <[email protected]>
>
> Nice, please upload both to Russell's patch system after no
> more comments:
>
> Acked-by: Tony Lindgren <[email protected]>
>

Hi Tony,

Could you elaborate on that patch system? Where it is and do I need some
special account/access?

Regards,
Ivo

2015-12-25 02:31:31

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/3] ARM: ATAGS: move atags.h to include/asm so it can be included by files outside kernel/

[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
Hi Ivaylo,

[auto build test ERROR on omap/for-next]
[also build test ERROR on v4.4-rc6 next-20151223]

url: https://github.com/0day-ci/linux/commits/Ivaylo-Dimitrov/OMAP-RX51-save-atags-data-to-be-exported-on-proc-atags/20151224-220541
base: https://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git for-next
config: arm-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

>> arch/arm/kernel/atags_compat.c:29:19: fatal error: atags.h: No such file or directory
#include "atags.h"
^
compilation terminated.

vim +29 arch/arm/kernel/atags_compat.c

^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 13 * NOTE:
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 14 * The old struct param_struct is deprecated, but it will be kept in
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 15 * the kernel for 5 years from now (2001). This will allow boot loaders
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 16 * to convert to the new struct tag way.
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 17 */
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 18 #include <linux/types.h>
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 19 #include <linux/kernel.h>
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 20 #include <linux/string.h>
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 21 #include <linux/init.h>
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 22
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 23 #include <asm/setup.h>
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 24 #include <asm/mach-types.h>
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 25 #include <asm/page.h>
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 26
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 27 #include <asm/mach/arch.h>
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 28
aa783b6f arch/arm/kernel/atags_compat.c Nicolas Pitre 2012-09-01 @29 #include "atags.h"
0fc1c832 arch/arm/kernel/compat.c Ben Dooks 2006-03-15 30
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 31 /*
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 32 * Usage:
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 33 * - do not go blindly adding fields, add them at the end
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 34 * - when adding fields, don't rely on the address until
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 35 * a patch from me has been released
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 36 * - unused fields should be zero (for future expansion)
^1da177e arch/arm/kernel/compat.c Linus Torvalds 2005-04-16 37 * - this structure is relatively short-lived - only

:::::: The code at line 29 was first introduced by commit
:::::: aa783b6fd60b3844e199b1c2d2f4068f3caa1358 ARM: 7505/1: split out ATAGS parsing

:::::: TO: Nicolas Pitre <[email protected]>
:::::: CC: Russell King <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (3.77 kB)
.config.gz (52.66 kB)
Download all attachments