Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 0/4 RESEND] Avoid build error, clean up numa.c and add /proc/boardinfo
@ 2020-10-10 23:47 Tiezhu Yang
  2020-10-10 23:47 ` [PATCH v2 1/4 RESEND] MIPS: Loongson64: Select SMP in Kconfig to avoid build error Tiezhu Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Tiezhu Yang @ 2020-10-10 23:47 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Jonathan Corbet, Huacai Chen, Jiaxun Yang
  Cc: linux-mips, linux-kernel, linux-doc, Xuefeng Li

[RESEND due to the following reason:
Can not connect to recipient's server because of unstable
network or firewall filter. rcpt handle timeout,last handle
info: Host vger.kernel.org(23.128.96.18) command RCPT TO
respond timeout or disconnected]

v2: add patch #4 suggested by Jiaxun 

Tiezhu Yang (4):
  MIPS: Loongson64: Select SMP in Kconfig to avoid build error
  MIPS: Loongson64: Clean up numa.c
  MIPS: Loongson64: Add /proc/boardinfo
  docs: fs: proc.rst: Add boardinfo description for Loongson64

 Documentation/filesystems/proc.rst                 |  1 +
 arch/mips/Kconfig                                  |  1 +
 arch/mips/configs/loongson3_defconfig              |  1 -
 arch/mips/include/asm/mach-loongson64/boot_param.h |  4 +++
 arch/mips/include/asm/mach-loongson64/mmzone.h     |  6 +---
 arch/mips/loongson64/Makefile                      |  2 +-
 arch/mips/loongson64/boardinfo.c                   | 40 ++++++++++++++++++++++
 arch/mips/loongson64/env.c                         | 10 ++++++
 arch/mips/loongson64/numa.c                        | 29 ++--------------
 9 files changed, 61 insertions(+), 33 deletions(-)
 create mode 100644 arch/mips/loongson64/boardinfo.c

-- 
2.1.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/4 RESEND] MIPS: Loongson64: Select SMP in Kconfig to avoid build error
  2020-10-10 23:47 [PATCH v2 0/4 RESEND] Avoid build error, clean up numa.c and add /proc/boardinfo Tiezhu Yang
@ 2020-10-10 23:47 ` Tiezhu Yang
  2020-10-12 10:34   ` Thomas Bogendoerfer
  2020-10-10 23:47 ` [PATCH v2 2/4 RESEND] MIPS: Loongson64: Clean up numa.c Tiezhu Yang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Tiezhu Yang @ 2020-10-10 23:47 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Jonathan Corbet, Huacai Chen, Jiaxun Yang
  Cc: linux-mips, linux-kernel, linux-doc, Xuefeng Li

In the current code, CONFIG_SMP can be set as N by user on the Loongson
platform, then there exists the following build error under !CONFIG_SMP:

  CC      arch/mips/kernel/asm-offsets.s
In file included from ./include/linux/gfp.h:9:0,
                 from ./include/linux/xarray.h:14,
                 from ./include/linux/radix-tree.h:18,
                 from ./include/linux/fs.h:15,
                 from ./include/linux/compat.h:17,
                 from arch/mips/kernel/asm-offsets.c:12:
./include/linux/topology.h: In function 'numa_node_id':
./include/linux/topology.h:119:2: error: implicit declaration of function 'cpu_logical_map' [-Werror=implicit-function-declaration]
  return cpu_to_node(raw_smp_processor_id());
  ^
cc1: some warnings being treated as errors
scripts/Makefile.build:117: recipe for target 'arch/mips/kernel/asm-offsets.s' failed
make[1]: *** [arch/mips/kernel/asm-offsets.s] Error 1

Select SMP in Kconfig to avoid the above build error and then remove
CONFIG_SMP=y in loongson3_defconfig.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---

v2: no changes

 arch/mips/Kconfig                     | 1 +
 arch/mips/configs/loongson3_defconfig | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b557fa5..75f26d1 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -488,6 +488,7 @@ config MACH_LOONGSON64
 	select SYS_SUPPORTS_ZBOOT
 	select ZONE_DMA32
 	select NUMA
+	select SMP
 	select COMMON_CLK
 	select USE_OF
 	select BUILTIN_DTB
diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig
index a5005c8..38a817e 100644
--- a/arch/mips/configs/loongson3_defconfig
+++ b/arch/mips/configs/loongson3_defconfig
@@ -30,7 +30,6 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_MACH_LOONGSON64=y
 CONFIG_CPU_HAS_MSA=y
-CONFIG_SMP=y
 CONFIG_NR_CPUS=16
 CONFIG_HZ_256=y
 CONFIG_KEXEC=y
-- 
2.1.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 2/4 RESEND] MIPS: Loongson64: Clean up numa.c
  2020-10-10 23:47 [PATCH v2 0/4 RESEND] Avoid build error, clean up numa.c and add /proc/boardinfo Tiezhu Yang
  2020-10-10 23:47 ` [PATCH v2 1/4 RESEND] MIPS: Loongson64: Select SMP in Kconfig to avoid build error Tiezhu Yang
@ 2020-10-10 23:47 ` Tiezhu Yang
  2020-10-12 10:35   ` Thomas Bogendoerfer
  2020-10-10 23:47 ` [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo Tiezhu Yang
  2020-10-10 23:47 ` [PATCH v2 4/4 RESEND] docs: fs: proc.rst: Add boardinfo description for Loongson64 Tiezhu Yang
  3 siblings, 1 reply; 11+ messages in thread
From: Tiezhu Yang @ 2020-10-10 23:47 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Jonathan Corbet, Huacai Chen, Jiaxun Yang
  Cc: linux-mips, linux-kernel, linux-doc, Xuefeng Li

(1) Replace nid_to_addroffset() with nid_to_addrbase() and then remove the
related useless code.

(2) Since end_pfn = start_pfn + node_psize, use "node_psize" instead of
"end_pfn - start_pfn" to avoid the redundant calculation.

(3) After commit 6fbde6b492df ("MIPS: Loongson64: Move files to the
top-level directory"), CONFIG_ZONE_DMA32 is always set for Loongson64
due to MACH_LOONGSON64 selects ZONE_DMA32, so no need to use ifdef any
more, just remove it.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---

v2: no changes, just add Reviewed-by tag

 arch/mips/include/asm/mach-loongson64/mmzone.h |  6 +-----
 arch/mips/loongson64/numa.c                    | 29 +++-----------------------
 2 files changed, 4 insertions(+), 31 deletions(-)

diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h
index 3a25dbd..c3f0f7a 100644
--- a/arch/mips/include/asm/mach-loongson64/mmzone.h
+++ b/arch/mips/include/asm/mach-loongson64/mmzone.h
@@ -11,13 +11,9 @@
 
 #include <boot_param.h>
 #define NODE_ADDRSPACE_SHIFT 44
-#define NODE0_ADDRSPACE_OFFSET 0x000000000000UL
-#define NODE1_ADDRSPACE_OFFSET 0x100000000000UL
-#define NODE2_ADDRSPACE_OFFSET 0x200000000000UL
-#define NODE3_ADDRSPACE_OFFSET 0x300000000000UL
 
 #define pa_to_nid(addr)  (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT)
-#define nid_to_addrbase(nid) ((nid) << NODE_ADDRSPACE_SHIFT)
+#define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT)
 
 extern struct pglist_data *__node_data[];
 
diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index ea8bb1b..cf9459f 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -98,27 +98,6 @@ static void __init init_topology_matrix(void)
 	}
 }
 
-static unsigned long nid_to_addroffset(unsigned int nid)
-{
-	unsigned long result;
-	switch (nid) {
-	case 0:
-	default:
-		result = NODE0_ADDRSPACE_OFFSET;
-		break;
-	case 1:
-		result = NODE1_ADDRSPACE_OFFSET;
-		break;
-	case 2:
-		result = NODE2_ADDRSPACE_OFFSET;
-		break;
-	case 3:
-		result = NODE3_ADDRSPACE_OFFSET;
-		break;
-	}
-	return result;
-}
-
 static void __init szmem(unsigned int node)
 {
 	u32 i, mem_type;
@@ -146,7 +125,7 @@ static void __init szmem(unsigned int node)
 			pr_info("       start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
 				start_pfn, end_pfn, num_physpages);
 			memblock_add_node(PFN_PHYS(start_pfn),
-				PFN_PHYS(end_pfn - start_pfn), node);
+				PFN_PHYS(node_psize), node);
 			break;
 		case SYSTEM_RAM_HIGH:
 			start_pfn = ((node_id << 44) + mem_start) >> PAGE_SHIFT;
@@ -158,7 +137,7 @@ static void __init szmem(unsigned int node)
 			pr_info("       start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
 				start_pfn, end_pfn, num_physpages);
 			memblock_add_node(PFN_PHYS(start_pfn),
-				PFN_PHYS(end_pfn - start_pfn), node);
+				PFN_PHYS(node_psize), node);
 			break;
 		case SYSTEM_RAM_RESERVED:
 			pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
@@ -175,7 +154,7 @@ static void __init node_mem_init(unsigned int node)
 	unsigned long node_addrspace_offset;
 	unsigned long start_pfn, end_pfn;
 
-	node_addrspace_offset = nid_to_addroffset(node);
+	node_addrspace_offset = nid_to_addrbase(node);
 	pr_info("Node%d's addrspace_offset is 0x%lx\n",
 			node, node_addrspace_offset);
 
@@ -242,9 +221,7 @@ void __init paging_init(void)
 	unsigned long zones_size[MAX_NR_ZONES] = {0, };
 
 	pagetable_init();
-#ifdef CONFIG_ZONE_DMA32
 	zones_size[ZONE_DMA32] = MAX_DMA32_PFN;
-#endif
 	zones_size[ZONE_NORMAL] = max_low_pfn;
 	free_area_init(zones_size);
 }
-- 
2.1.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo
  2020-10-10 23:47 [PATCH v2 0/4 RESEND] Avoid build error, clean up numa.c and add /proc/boardinfo Tiezhu Yang
  2020-10-10 23:47 ` [PATCH v2 1/4 RESEND] MIPS: Loongson64: Select SMP in Kconfig to avoid build error Tiezhu Yang
  2020-10-10 23:47 ` [PATCH v2 2/4 RESEND] MIPS: Loongson64: Clean up numa.c Tiezhu Yang
@ 2020-10-10 23:47 ` Tiezhu Yang
  2020-10-12 10:38   ` Thomas Bogendoerfer
  2020-10-10 23:47 ` [PATCH v2 4/4 RESEND] docs: fs: proc.rst: Add boardinfo description for Loongson64 Tiezhu Yang
  3 siblings, 1 reply; 11+ messages in thread
From: Tiezhu Yang @ 2020-10-10 23:47 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Jonathan Corbet, Huacai Chen, Jiaxun Yang
  Cc: linux-mips, linux-kernel, linux-doc, Xuefeng Li

Add /proc/boardinfo to get mainboard and BIOS info easily on the Loongson
platform, this is useful to point out the current used mainboard type and
BIOS version when there exists problems related with hardware or firmware.

E.g. with this patch:

[loongson@linux ~]$ cat /proc/boardinfo
Board Info
Manufacturer            : LEMOTE
Board Name              : LEMOTE-LS3A4000-7A1000-1w-V01-pc
Family                  : LOONGSON3

BIOS Info
Vendor                  : Kunlun
Version                 : Kunlun-A1901-V4.1.3-20200414093938
ROM Size                : 4 KB
Release Date            : 2020-04-14

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---

v2: no changes

 arch/mips/include/asm/mach-loongson64/boot_param.h |  4 +++
 arch/mips/loongson64/Makefile                      |  2 +-
 arch/mips/loongson64/boardinfo.c                   | 40 ++++++++++++++++++++++
 arch/mips/loongson64/env.c                         | 10 ++++++
 4 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/loongson64/boardinfo.c

diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
index afc92b7..4592841 100644
--- a/arch/mips/include/asm/mach-loongson64/boot_param.h
+++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
@@ -228,6 +228,10 @@ struct loongson_system_configuration {
 extern struct efi_memory_map_loongson *loongson_memmap;
 extern struct loongson_system_configuration loongson_sysconf;
 
+extern struct board_devices *eboard;
+extern struct interface_info *einter;
+extern struct loongson_special_attribute *especial;
+
 extern u32 node_id_offset;
 extern void ls7a_early_config(void);
 extern void rs780e_early_config(void);
diff --git a/arch/mips/loongson64/Makefile b/arch/mips/loongson64/Makefile
index 39c06f5..bc77b5a 100644
--- a/arch/mips/loongson64/Makefile
+++ b/arch/mips/loongson64/Makefile
@@ -3,7 +3,7 @@
 # Makefile for Loongson-3 family machines
 #
 obj-$(CONFIG_MACH_LOONGSON64) += cop2-ex.o platform.o dma.o \
-				setup.o init.o env.o time.o reset.o \
+				setup.o init.o env.o time.o reset.o boardinfo.o\
 
 obj-$(CONFIG_SMP)	+= smp.o
 obj-$(CONFIG_NUMA)	+= numa.o
diff --git a/arch/mips/loongson64/boardinfo.c b/arch/mips/loongson64/boardinfo.c
new file mode 100644
index 0000000..2e8086b
--- /dev/null
+++ b/arch/mips/loongson64/boardinfo.c
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <linux/module.h>
+#include <boot_param.h>
+
+static int loongson_boardinfo_proc_show(struct seq_file *m, void *v)
+{
+	char board_manufacturer[64] = {0};
+	char *tmp_board_manufacturer = board_manufacturer;
+	char bios_vendor[64] = {0};
+	char *tmp_bios_vendor = bios_vendor;
+
+	strcpy(board_manufacturer, eboard->name);
+	strcpy(bios_vendor, einter->description);
+
+	seq_puts(m, "Board Info\n");
+	seq_printf(m, "Manufacturer\t\t: %s\n", strsep(&tmp_board_manufacturer, "-"));
+	seq_printf(m, "Board Name\t\t: %s\n", eboard->name);
+	seq_puts(m, "Family\t\t\t: LOONGSON3\n");
+	seq_puts(m, "\n");
+
+	seq_puts(m, "BIOS Info\n");
+	seq_printf(m, "Vendor\t\t\t: %s\n", strsep(&tmp_bios_vendor, "-"));
+	seq_printf(m, "Version\t\t\t: %s\n", einter->description);
+	seq_printf(m, "ROM Size\t\t: %d KB\n", einter->size);
+	seq_printf(m, "Release Date\t\t: %s\n", especial->special_name);
+
+	return 0;
+}
+
+static int __init proc_boardinfo_init(void)
+{
+	proc_create_single("boardinfo", 0, NULL, loongson_boardinfo_proc_show);
+	return 0;
+}
+
+module_init(proc_boardinfo_init);
diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
index 134cb8e..51a5d05 100644
--- a/arch/mips/loongson64/env.c
+++ b/arch/mips/loongson64/env.c
@@ -28,6 +28,10 @@ EXPORT_SYMBOL(cpu_clock_freq);
 struct efi_memory_map_loongson *loongson_memmap;
 struct loongson_system_configuration loongson_sysconf;
 
+struct board_devices *eboard;
+struct interface_info *einter;
+struct loongson_special_attribute *especial;
+
 u64 loongson_chipcfg[MAX_PACKAGES] = {0xffffffffbfc00180};
 u64 loongson_chiptemp[MAX_PACKAGES];
 u64 loongson_freqctrl[MAX_PACKAGES];
@@ -57,6 +61,12 @@ void __init prom_init_env(void)
 		((u64)loongson_p + loongson_p->system_offset);
 	ecpu = (struct efi_cpuinfo_loongson *)
 		((u64)loongson_p + loongson_p->cpu_offset);
+	eboard = (struct board_devices *)
+		((u64)loongson_p + loongson_p->boarddev_table_offset);
+	einter = (struct interface_info *)
+		((u64)loongson_p + loongson_p->interface_offset);
+	especial = (struct loongson_special_attribute *)
+		((u64)loongson_p + loongson_p->special_offset);
 	eirq_source = (struct irq_source_routing_table *)
 		((u64)loongson_p + loongson_p->irq_offset);
 	loongson_memmap = (struct efi_memory_map_loongson *)
-- 
2.1.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 4/4 RESEND] docs: fs: proc.rst: Add boardinfo description for Loongson64
  2020-10-10 23:47 [PATCH v2 0/4 RESEND] Avoid build error, clean up numa.c and add /proc/boardinfo Tiezhu Yang
                   ` (2 preceding siblings ...)
  2020-10-10 23:47 ` [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo Tiezhu Yang
@ 2020-10-10 23:47 ` Tiezhu Yang
  3 siblings, 0 replies; 11+ messages in thread
From: Tiezhu Yang @ 2020-10-10 23:47 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Jonathan Corbet, Huacai Chen, Jiaxun Yang
  Cc: linux-mips, linux-kernel, linux-doc, Xuefeng Li

Add a description for /proc/boardinfo on the Loongson platform.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---

v2: new added patch

 Documentation/filesystems/proc.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst
index 533c79e..3c4cb65 100644
--- a/Documentation/filesystems/proc.rst
+++ b/Documentation/filesystems/proc.rst
@@ -664,6 +664,7 @@ files are there, and which are missing.
  File         Content
  ============ ===============================================================
  apm          Advanced power management info
+ boardinfo    Mainboard and BIOS info for Loongson64
  buddyinfo    Kernel memory allocator information (see text)	(2.5)
  bus          Directory containing bus specific information
  cmdline      Kernel command line
-- 
2.1.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 1/4 RESEND] MIPS: Loongson64: Select SMP in Kconfig to avoid build error
  2020-10-10 23:47 ` [PATCH v2 1/4 RESEND] MIPS: Loongson64: Select SMP in Kconfig to avoid build error Tiezhu Yang
@ 2020-10-12 10:34   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Bogendoerfer @ 2020-10-12 10:34 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Jonathan Corbet, Huacai Chen, Jiaxun Yang, linux-mips,
	linux-kernel, linux-doc, Xuefeng Li

On Sun, Oct 11, 2020 at 07:47:51AM +0800, Tiezhu Yang wrote:
> In the current code, CONFIG_SMP can be set as N by user on the Loongson
> platform, then there exists the following build error under !CONFIG_SMP:
> 
>   CC      arch/mips/kernel/asm-offsets.s
> In file included from ./include/linux/gfp.h:9:0,
>                  from ./include/linux/xarray.h:14,
>                  from ./include/linux/radix-tree.h:18,
>                  from ./include/linux/fs.h:15,
>                  from ./include/linux/compat.h:17,
>                  from arch/mips/kernel/asm-offsets.c:12:
> ./include/linux/topology.h: In function 'numa_node_id':
> ./include/linux/topology.h:119:2: error: implicit declaration of function 'cpu_logical_map' [-Werror=implicit-function-declaration]
>   return cpu_to_node(raw_smp_processor_id());
>   ^
> cc1: some warnings being treated as errors
> scripts/Makefile.build:117: recipe for target 'arch/mips/kernel/asm-offsets.s' failed
> make[1]: *** [arch/mips/kernel/asm-offsets.s] Error 1
> 
> Select SMP in Kconfig to avoid the above build error and then remove
> CONFIG_SMP=y in loongson3_defconfig.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
> 
> v2: no changes
> 
>  arch/mips/Kconfig                     | 1 +
>  arch/mips/configs/loongson3_defconfig | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 2/4 RESEND] MIPS: Loongson64: Clean up numa.c
  2020-10-10 23:47 ` [PATCH v2 2/4 RESEND] MIPS: Loongson64: Clean up numa.c Tiezhu Yang
@ 2020-10-12 10:35   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Bogendoerfer @ 2020-10-12 10:35 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Jonathan Corbet, Huacai Chen, Jiaxun Yang, linux-mips,
	linux-kernel, linux-doc, Xuefeng Li

On Sun, Oct 11, 2020 at 07:47:52AM +0800, Tiezhu Yang wrote:
> (1) Replace nid_to_addroffset() with nid_to_addrbase() and then remove the
> related useless code.
> 
> (2) Since end_pfn = start_pfn + node_psize, use "node_psize" instead of
> "end_pfn - start_pfn" to avoid the redundant calculation.
> 
> (3) After commit 6fbde6b492df ("MIPS: Loongson64: Move files to the
> top-level directory"), CONFIG_ZONE_DMA32 is always set for Loongson64
> due to MACH_LOONGSON64 selects ZONE_DMA32, so no need to use ifdef any
> more, just remove it.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> 
> v2: no changes, just add Reviewed-by tag
> 
>  arch/mips/include/asm/mach-loongson64/mmzone.h |  6 +-----
>  arch/mips/loongson64/numa.c                    | 29 +++-----------------------
>  2 files changed, 4 insertions(+), 31 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo
  2020-10-10 23:47 ` [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo Tiezhu Yang
@ 2020-10-12 10:38   ` Thomas Bogendoerfer
  2020-10-12 12:02     ` Tiezhu Yang
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Bogendoerfer @ 2020-10-12 10:38 UTC (permalink / raw)
  To: Tiezhu Yang
  Cc: Jonathan Corbet, Huacai Chen, Jiaxun Yang, linux-mips,
	linux-kernel, linux-doc, Xuefeng Li

On Sun, Oct 11, 2020 at 07:47:53AM +0800, Tiezhu Yang wrote:
> Add /proc/boardinfo to get mainboard and BIOS info easily on the Loongson
> platform, this is useful to point out the current used mainboard type and
> BIOS version when there exists problems related with hardware or firmware.
> 
> E.g. with this patch:
> 
> [loongson@linux ~]$ cat /proc/boardinfo
> Board Info
> Manufacturer            : LEMOTE
> Board Name              : LEMOTE-LS3A4000-7A1000-1w-V01-pc
> Family                  : LOONGSON3
> 
> BIOS Info
> Vendor                  : Kunlun
> Version                 : Kunlun-A1901-V4.1.3-20200414093938
> ROM Size                : 4 KB
> Release Date            : 2020-04-14

Why does Loongson64 need this extra file no other architecture or MIPS
platform need ? Do others provide this information via a different method ?
If yes, why can't Loongson64 do the same ?

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo
  2020-10-12 10:38   ` Thomas Bogendoerfer
@ 2020-10-12 12:02     ` Tiezhu Yang
  2020-10-13  0:15       ` Jiaxun Yang
  0 siblings, 1 reply; 11+ messages in thread
From: Tiezhu Yang @ 2020-10-12 12:02 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Jonathan Corbet, Huacai Chen, Jiaxun Yang, linux-mips,
	linux-kernel, linux-doc, Xuefeng Li

On 10/12/2020 06:38 PM, Thomas Bogendoerfer wrote:
> On Sun, Oct 11, 2020 at 07:47:53AM +0800, Tiezhu Yang wrote:
>> Add /proc/boardinfo to get mainboard and BIOS info easily on the Loongson
>> platform, this is useful to point out the current used mainboard type and
>> BIOS version when there exists problems related with hardware or firmware.
>>
>> E.g. with this patch:
>>
>> [loongson@linux ~]$ cat /proc/boardinfo
>> Board Info
>> Manufacturer            : LEMOTE
>> Board Name              : LEMOTE-LS3A4000-7A1000-1w-V01-pc
>> Family                  : LOONGSON3
>>
>> BIOS Info
>> Vendor                  : Kunlun
>> Version                 : Kunlun-A1901-V4.1.3-20200414093938
>> ROM Size                : 4 KB
>> Release Date            : 2020-04-14
> Why does Loongson64 need this extra file no other architecture or MIPS
> platform need ? Do others provide this information via a different method ?
> If yes, why can't Loongson64 do the same ?

Hi Thomas,

This is related with the implementation of firmware.

Using dmidecode command can get the similar info if there exists SMBIOS
in firmware, but the fact is there is no SMBIOS on some machines, we can
see nothing when execute dmidecode, like this:

[root@linux loongson]# dmidecode
# dmidecode 2.12
# No SMBIOS nor DMI entry point found, sorry.

The following three structures are already defined in the interface
specification about firmware and kernel on the Loongson platform,
this is common requirement and specific for Loongson64, so add a
new boardinfo.c file in arch/mips/loongson64.

arch/mips/include/asm/mach-loongson64/boot_param.h
struct interface_info {
     u16 vers; /* version of the specificition */
     u16 size;
     u8  flag;
     char description[64];
} __packed;

struct board_devices {
     char name[64];    /* hold the device name */
     u32 num_resources; /* number of device_resource */
     /* for each device's resource */
     struct resource_loongson resource[MAX_RESOURCE_NUMBER];
     /* arch specific additions */
     struct archdev_data archdata;
};

struct loongson_special_attribute {
     u16 vers;     /* version of this special */
     char special_name[64]; /* special_atribute_name */
     u32 loongson_special_type; /* type of special device */
     /* for each device's resource */
     struct resource_loongson resource[MAX_RESOURCE_NUMBER];
};

Thanks,
Tiezhu

>
> Thomas.
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo
  2020-10-12 12:02     ` Tiezhu Yang
@ 2020-10-13  0:15       ` Jiaxun Yang
  2020-10-13  4:36         ` Tiezhu Yang
  0 siblings, 1 reply; 11+ messages in thread
From: Jiaxun Yang @ 2020-10-13  0:15 UTC (permalink / raw)
  To: Tiezhu Yang, Thomas Bogendoerfer
  Cc: Jonathan Corbet, Huacai Chen, linux-mips, linux-kernel,
	linux-doc, Xuefeng Li



于 2020年10月12日 GMT+08:00 下午8:02:25, Tiezhu Yang <yangtiezhu@loongson.cn> 写到:
>On 10/12/2020 06:38 PM, Thomas Bogendoerfer wrote:
>> On Sun, Oct 11, 2020 at 07:47:53AM +0800, Tiezhu Yang wrote:
>>> Add /proc/boardinfo to get mainboard and BIOS info easily on the Loongson
>>> platform, this is useful to point out the current used mainboard type and
>>> BIOS version when there exists problems related with hardware or firmware.
>>>
>>> E.g. with this patch:
>>>
>>> [loongson@linux ~]$ cat /proc/boardinfo
>>> Board Info
>>> Manufacturer            : LEMOTE
>>> Board Name              : LEMOTE-LS3A4000-7A1000-1w-V01-pc
>>> Family                  : LOONGSON3
>>>
>>> BIOS Info
>>> Vendor                  : Kunlun
>>> Version                 : Kunlun-A1901-V4.1.3-20200414093938
>>> ROM Size                : 4 KB
>>> Release Date            : 2020-04-14
>> Why does Loongson64 need this extra file no other architecture or MIPS
>> platform need ? Do others provide this information via a different method ?
>> If yes, why can't Loongson64 do the same ?
>
>Hi Thomas,
>
>This is related with the implementation of firmware.
>
>Using dmidecode command can get the similar info if there exists SMBIOS
>in firmware, but the fact is there is no SMBIOS on some machines, we can
>see nothing when execute dmidecode, like this:
>
>[root@linux loongson]# dmidecode
># dmidecode 2.12
># No SMBIOS nor DMI entry point found, sorry.
>
>The following three structures are already defined in the interface
>specification about firmware and kernel on the Loongson platform,
>this is common requirement and specific for Loongson64, so add a
>new boardinfo.c file in arch/mips/loongson64.
>
>arch/mips/include/asm/mach-loongson64/boot_param.h
>struct interface_info {
>     u16 vers; /* version of the specificition */
>     u16 size;
>     u8  flag;
>     char description[64];
>} __packed;
>
>struct board_devices {
>     char name[64];    /* hold the device name */
>     u32 num_resources; /* number of device_resource */
>     /* for each device's resource */
>     struct resource_loongson resource[MAX_RESOURCE_NUMBER];
>     /* arch specific additions */
>     struct archdev_data archdata;
>};
>
>struct loongson_special_attribute {
>     u16 vers;     /* version of this special */
>     char special_name[64]; /* special_atribute_name */
>     u32 loongson_special_type; /* type of special device */
>     /* for each device's resource */
>     struct resource_loongson resource[MAX_RESOURCE_NUMBER];
>};

Hi Tiezhu,

Through I don't think touching top level of proc would be a good idea. It's all about API consistency.

If you intend to provide user an interface then I guess /sys/firmware/lefi
like what DMI did or somewhere less critical is better.

There is no guarantee that Loongson64 device would come with LEFI,
although it's mandatory for now.

Thanks.

- Jiaxun

>
>Thanks,
>Tiezhu
>
>>
>> Thomas.
>>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo
  2020-10-13  0:15       ` Jiaxun Yang
@ 2020-10-13  4:36         ` Tiezhu Yang
  0 siblings, 0 replies; 11+ messages in thread
From: Tiezhu Yang @ 2020-10-13  4:36 UTC (permalink / raw)
  To: Jiaxun Yang, Thomas Bogendoerfer
  Cc: Jonathan Corbet, Huacai Chen, linux-mips, linux-kernel,
	linux-doc, Xuefeng Li

On 10/13/2020 08:15 AM, Jiaxun Yang wrote:
>
> 于 2020年10月12日 GMT+08:00 下午8:02:25, Tiezhu Yang <yangtiezhu@loongson.cn> 写到:
>> On 10/12/2020 06:38 PM, Thomas Bogendoerfer wrote:
>>> On Sun, Oct 11, 2020 at 07:47:53AM +0800, Tiezhu Yang wrote:
>>>> Add /proc/boardinfo to get mainboard and BIOS info easily on the Loongson
>>>> platform, this is useful to point out the current used mainboard type and
>>>> BIOS version when there exists problems related with hardware or firmware.
>>>>
>>>> E.g. with this patch:
>>>>
>>>> [loongson@linux ~]$ cat /proc/boardinfo
>>>> Board Info
>>>> Manufacturer            : LEMOTE
>>>> Board Name              : LEMOTE-LS3A4000-7A1000-1w-V01-pc
>>>> Family                  : LOONGSON3
>>>>
>>>> BIOS Info
>>>> Vendor                  : Kunlun
>>>> Version                 : Kunlun-A1901-V4.1.3-20200414093938
>>>> ROM Size                : 4 KB
>>>> Release Date            : 2020-04-14
>>> Why does Loongson64 need this extra file no other architecture or MIPS
>>> platform need ? Do others provide this information via a different method ?
>>> If yes, why can't Loongson64 do the same ?
>> Hi Thomas,
>>
>> This is related with the implementation of firmware.
>>
>> Using dmidecode command can get the similar info if there exists SMBIOS
>> in firmware, but the fact is there is no SMBIOS on some machines, we can
>> see nothing when execute dmidecode, like this:
>>
>> [root@linux loongson]# dmidecode
>> # dmidecode 2.12
>> # No SMBIOS nor DMI entry point found, sorry.
>>
>> The following three structures are already defined in the interface
>> specification about firmware and kernel on the Loongson platform,
>> this is common requirement and specific for Loongson64, so add a
>> new boardinfo.c file in arch/mips/loongson64.
>>
>> arch/mips/include/asm/mach-loongson64/boot_param.h
>> struct interface_info {
>>      u16 vers; /* version of the specificition */
>>      u16 size;
>>      u8  flag;
>>      char description[64];
>> } __packed;
>>
>> struct board_devices {
>>      char name[64];    /* hold the device name */
>>      u32 num_resources; /* number of device_resource */
>>      /* for each device's resource */
>>      struct resource_loongson resource[MAX_RESOURCE_NUMBER];
>>      /* arch specific additions */
>>      struct archdev_data archdata;
>> };
>>
>> struct loongson_special_attribute {
>>      u16 vers;     /* version of this special */
>>      char special_name[64]; /* special_atribute_name */
>>      u32 loongson_special_type; /* type of special device */
>>      /* for each device's resource */
>>      struct resource_loongson resource[MAX_RESOURCE_NUMBER];
>> };
> Hi Tiezhu,
>
> Through I don't think touching top level of proc would be a good idea. It's all about API consistency.
>
> If you intend to provide user an interface then I guess /sys/firmware/lefi
> like what DMI did or somewhere less critical is better.
>
> There is no guarantee that Loongson64 device would come with LEFI,
> although it's mandatory for now.

Hi Jiaxun,

Thank you very much.

Let us add /sys/firmware/lefi/boardinfo, I will do it and then send a 
new patch.

Thanks,
Tiezhu

>
> Thanks.
>
> - Jiaxun
>
>> Thanks,
>> Tiezhu
>>
>>> Thomas.
>>>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-10 23:47 [PATCH v2 0/4 RESEND] Avoid build error, clean up numa.c and add /proc/boardinfo Tiezhu Yang
2020-10-10 23:47 ` [PATCH v2 1/4 RESEND] MIPS: Loongson64: Select SMP in Kconfig to avoid build error Tiezhu Yang
2020-10-12 10:34   ` Thomas Bogendoerfer
2020-10-10 23:47 ` [PATCH v2 2/4 RESEND] MIPS: Loongson64: Clean up numa.c Tiezhu Yang
2020-10-12 10:35   ` Thomas Bogendoerfer
2020-10-10 23:47 ` [PATCH v2 3/4 RESEND] MIPS: Loongson64: Add /proc/boardinfo Tiezhu Yang
2020-10-12 10:38   ` Thomas Bogendoerfer
2020-10-12 12:02     ` Tiezhu Yang
2020-10-13  0:15       ` Jiaxun Yang
2020-10-13  4:36         ` Tiezhu Yang
2020-10-10 23:47 ` [PATCH v2 4/4 RESEND] docs: fs: proc.rst: Add boardinfo description for Loongson64 Tiezhu Yang

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org
	public-inbox-index linux-mips

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git