[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Preliminary 2.6.19 support for PetaLinux



Hello,

I have tested the 2.6 kernel on our Xilinx microblaze platform. I made
the following experiences:

- The kernel boots and a login is possible. See the attached boot log
  file. I provide a small bash script which converts an auto-config.in
  file to the new Kconfig.auto format. This way it is very easy to adapt
  the kernel to your platform.

- "System V IPC" was not implemented. I had done some enhancements to
  get this thing compiled (but not tested yet if IPC really works!).
  PATCH ATTACHED.

- File /proc/cpuinfo is empty
  PATCH ATTACHED.

- Missing function for initrd/initramfs support added (didn't compile
  before -- not for all configurations relevant)
  On my latest builds I use the initramfs mechanism instead of the
  initrd method (Advantage no additional filesystem support (romfs or
  cramfs) inside kernel needed + 1 file includes already everything;
  Disadvantage: cpio fs archive must be unpacked from RAM to RAM).
  PATCH ATTACHED.

- I detected a slow down of the system performance during the boot
  phase.
  Until the boot message
  "io scheduler cfq registered (default)"
  the kernel seems to run with normal speed. But before/after the boot step
  "ttyS0 at MMIO 0xffff2000 (irq = 1) is a Xilinx OPB UART Lite"
  every action progresses less fast.

- After login every access to the filesystems seems to be very slow. But
  browsing the shell history with the cursor keys works at normal speed.

- I have switched on the
  General setup --->
   Configure standard kernel features (for small systems)  --->
     BUG() support
  debug feature and got the following warning/error:
  BUG: warning at kernel/softirq.c:144/local_bh_enable()

  Stack:
    80281d6c 00000001 00000020 00000000 8012b0d0 00000000 0000000a 80140004 
    8011b1c4 00000001 800b5300 80123acc 80123ae8 00000090 80123b10 80fe6858 
    8035f800 ffffffff ffffffff 80281e64 00000001 00000001 80e79074 80fcfe30

  The system still runs (slow but it runs).
  Some investigation of the stack trace showed that this error seems to
  appear in the network layer (but not 100% sure). Nevertheless there
  seems to be some problem with the interrupt/exception handling. There is a bit
  MSR_IE set (I think IE means interrupt enable) which should not be set
  in this situation. It is bit 1 in the MSR register.

The design runs at 50MHz with 16MB RAM.
All patches are against "petalinux-2.6-devel-sw-r2218.patch".

So long!
  Johann Pfefferl

John Williams <jwilliams@xxxxxxxxxxxxxx> wrote:
> Hi folks,
> 
> Preliminary patchsets and build instructions for 2.6.19 MicroBlaze 
> support can be found here:
> 
> http://developer.petalogix.com/wiki/MicroBlaze-2.6-Kernel
> 
> Please direct any questions, problems etc to this list.
> 
> Right now the best thing people can do is try it out, and let us know 
> what's missing, what works and what doesn't.  We will release regular 
> updates of our internal development trees as this progresses.
> 
> Ultimately this will be folded out into the standard petalinux 
> distribution, and also upstream towards kernel.org.
> 
> Cheers,
> 
> John
> 
> 
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@xxxxxxxxxxxxxx
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : 
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/

-- 
Dr. Johann Pfefferl   ------------   mailto j.pfefferl at eubus dot net
Eubus GmbH            http://www.eubus.net +++++ http://www.hydraxc.com
Phone: +49 (0)89 45 22 578-67
Fax:   +49 (0)89 45 22 578-55
==
 -o)   A computer program does what you tell it to do,
 /\\        not what you want it to do.               
_\_v-                                                 

			FPGA Loader 0.9.5

M25P64 SPI-Flash from ST Microelectronics found!
TQM HS3-AB RK REV.300

Press ESC for Menu
FPGA-Konfiguration

			OS Loader v0.1
SPI-Flash M25P64 von ST Microlectonics gefunden!
Magic-Number gefunden!
Kopieren von uclinux-26x for HydraXC (2628752 Byte) fertig
Found romfs @ 0x8014e08c (0x00134000)
#### klimit 8015a000 ####
Moving 0x00134000 bytes from 0x8014e08c to 0x80159a10
New klimit: 0x8028e000
Linux version 2.6.19-uc0 (pfefferl@ibmr51) (gcc version 3.4.1 ( Xilinx EDK 8.1 Build EDK_I.17 090206 )) #7 Mon Feb 26 16:21:13 CET 2007
setup_memory: max_mapnr: 0x80fff
setup_memory: min_low_pfn: 0x80000
setup_memory: max_low_pfn: 0x1000
On node 0 totalpages: 4096
  DMA zone: 32 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 4064 pages, LIFO batch:0
  Normal zone: 0 pages used for memmap
Built 1 zonelists.  Total pages: 4064
Kernel command line: 
OPB INTC #0 at 0xFFFF3000
PID hash table entries: 64 (order: 6, 256 bytes)
Console: Xilinx OPB UART Lite
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 13620k/16384k available
Calibrating delay loop... 24.42 BogoMIPS (lpj=122112)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
ttyS0 at MMIO 0xffff2000 (irq = 1) is a Xilinx OPB UART Lite
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
uclinux[mtd]: RAM probe address=0x80159a10 size=0x134000
Creating 1 MTD partitions on "RAM":
0x00000000-0x00134000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
VFS: Mounted root (romfs filesystem) readonly.
Freeing unused kernel memory: 72k freed
Mounting proc: 
Mounting var: 
Populating /var: 
Running local start scripts.
Mounting /etc/config: 
Populating /etc/config: 
flatfsd: Nonexistent or bad flatfs (-114), creating new one...
/bin/flatfsd: mtd.c: 156: flat_dev_close: Assertion `flatinfo.fd != -1' failed.
flatfsd: mtd.c: 156: flat_dev_close: Assertion `flatinfo.fd != -1' failed.

Abort
Setting hostname: 
Setting up interface lo: 
Setup of the HW MAC address: 
/dev/xspi3: No such device or address
Starting DHCP client: 
/dev/xgpio: No such device
Starting portmap:
Jan  1 00:01:45 dhcpcd[45]: dhcpStart: ioctl SIOCGIFHWADDR: No such device


uclinux-26x login: root
Password: 


BusyBox v1.00 (2007.01.15-17:08+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

# 

Attachment: gen-kconfig-auto.sh.gz
Description: Binary data

Attachment: Kconfig.auto.gz
Description: Binary data

"System V IPC" was not implemented

I had done some enhancements to get this thing compiled (but not tested yet
if IPC really works!).

---
commit 75eb64d643c09726e3a7a5924c105c72637aa109
tree 6d19c35fde05ce582f911fda7c4686efccb231c6
parent 8e08d01bb7f76ce102d866e5ce7f64f8642243e0
author Dr. Johann Pfefferl <pfefferl@xxxxxxx> Tue, 27 Feb 2007 16:55:39 +0100
committer Dr. Johann Pfefferl <pfefferl@xxxxxxxxxxxxxxx> Tue, 27 Feb 2007 16:55:39 +0100

 include/asm-microblaze/ipcbuf.h   |   25 ++++++++++++++++++++++++
 include/asm-microblaze/msgbuf.h   |   27 ++++++++++++++++++++++++++
 include/asm-microblaze/sembuf.h   |   21 ++++++++++++++++++++
 include/asm-microblaze/shmbuf.h   |   38 +++++++++++++++++++++++++++++++++++++
 include/asm-microblaze/shmparam.h |    1 +
 5 files changed, 112 insertions(+), 0 deletions(-)

diff --git a/include/asm-microblaze/ipcbuf.h b/include/asm-microblaze/ipcbuf.h
index d89367e..a26da0e 100644
--- a/include/asm-microblaze/ipcbuf.h
+++ b/include/asm-microblaze/ipcbuf.h
@@ -11,5 +11,30 @@
 #ifndef _ASM_IPCBUF_H
 #define _ASM_IPCBUF_H
 
+/*
+ * The user_ipc_perm structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 32-bit mode_t and seq
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct ipc64_perm
+{
+	__kernel_key_t		key;
+	__kernel_uid32_t	uid;
+	__kernel_gid32_t	gid;
+	__kernel_uid32_t	cuid;
+	__kernel_gid32_t	cgid;
+	__kernel_mode_t		mode;
+	unsigned short		__pad1;
+	unsigned short		seq;
+	unsigned short		__pad2;
+	unsigned long		__unused1;
+	unsigned long		__unused2;
+};
+
 
 #endif /* _ASM_IPCBUF_H */
diff --git a/include/asm-microblaze/msgbuf.h b/include/asm-microblaze/msgbuf.h
index 32bf9fc..44c83dc 100644
--- a/include/asm-microblaze/msgbuf.h
+++ b/include/asm-microblaze/msgbuf.h
@@ -11,4 +11,31 @@
 #ifndef _ASM_MSGBUF_H
 #define _ASM_MSGBUF_H
 
+/*
+ * The msqid64_ds structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct msqid64_ds {
+	struct ipc64_perm msg_perm;
+	__kernel_time_t msg_stime;	/* last msgsnd time */
+	unsigned long	__unused1;
+	__kernel_time_t msg_rtime;	/* last msgrcv time */
+	unsigned long	__unused2;
+	__kernel_time_t msg_ctime;	/* last change time */
+	unsigned long	__unused3;
+	unsigned long  msg_cbytes;	/* current number of bytes on queue */
+	unsigned long  msg_qnum;	/* number of messages in queue */
+	unsigned long  msg_qbytes;	/* max number of bytes on queue */
+	__kernel_pid_t msg_lspid;	/* pid of last msgsnd */
+	__kernel_pid_t msg_lrpid;	/* last receive pid */
+	unsigned long  __unused4;
+	unsigned long  __unused5;
+};
+
 #endif /* _ASM_MSGBUF_H */
diff --git a/include/asm-microblaze/sembuf.h b/include/asm-microblaze/sembuf.h
index 03d04a5..da7e5a2 100644
--- a/include/asm-microblaze/sembuf.h
+++ b/include/asm-microblaze/sembuf.h
@@ -11,5 +11,26 @@
 #ifndef _ASM_SEMBUF_H
 #define _ASM_SEMBUF_H
 
+/*
+ * The semid64_ds structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct semid64_ds {
+	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
+	__kernel_time_t	sem_otime;		/* last semop time */
+	unsigned long	__unused1;
+	__kernel_time_t	sem_ctime;		/* last change time */
+	unsigned long	__unused2;
+	unsigned long	sem_nsems;		/* no. of semaphores in array */
+	unsigned long	__unused3;
+	unsigned long	__unused4;
+};
+
 
 #endif /* _ASM_SEMBUF_H */
diff --git a/include/asm-microblaze/shmbuf.h b/include/asm-microblaze/shmbuf.h
index 640be40..e8f4af4 100644
--- a/include/asm-microblaze/shmbuf.h
+++ b/include/asm-microblaze/shmbuf.h
@@ -11,4 +11,42 @@
 #ifndef _ASM_SHMBUF_H
 #define _ASM_SHMBUF_H
 
+/*
+ * The shmid64_ds structure for m68k architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ *
+ * Pad space is left for:
+ * - 64-bit time_t to solve y2038 problem
+ * - 2 miscellaneous 32-bit values
+ */
+
+struct shmid64_ds {
+	struct ipc64_perm	shm_perm;	/* operation perms */
+	size_t			shm_segsz;	/* size of segment (bytes) */
+	__kernel_time_t		shm_atime;	/* last attach time */
+	unsigned long		__unused1;
+	__kernel_time_t		shm_dtime;	/* last detach time */
+	unsigned long		__unused2;
+	__kernel_time_t		shm_ctime;	/* last change time */
+	unsigned long		__unused3;
+	__kernel_pid_t		shm_cpid;	/* pid of creator */
+	__kernel_pid_t		shm_lpid;	/* pid of last operator */
+	unsigned long		shm_nattch;	/* no. of current attaches */
+	unsigned long		__unused4;
+	unsigned long		__unused5;
+};
+
+struct shminfo64 {
+	unsigned long	shmmax;
+	unsigned long	shmmin;
+	unsigned long	shmmni;
+	unsigned long	shmseg;
+	unsigned long	shmall;
+	unsigned long	__unused1;
+	unsigned long	__unused2;
+	unsigned long	__unused3;
+	unsigned long	__unused4;
+};
+
 #endif /* _ASM_SHMBUF_H */
diff --git a/include/asm-microblaze/shmparam.h b/include/asm-microblaze/shmparam.h
index 7ee9c9f..98b0c33 100644
--- a/include/asm-microblaze/shmparam.h
+++ b/include/asm-microblaze/shmparam.h
@@ -11,5 +11,6 @@
 #ifndef _ASM_SHMPARAM_H
 #define _ASM_SHMPARAM_H
 
+#define	SHMLBA PAGE_SIZE		 /* attach addr a multiple of this */
 
 #endif /* _ASM_SHMPARAM_H */
Added function free_initrd_mem to microblaze platform

---
commit d99507a8dc2ff0cd8f23c731313a5bb61486b401
tree d292fe011b0abe72712266eea7b87683fb301b50
parent 75eb64d643c09726e3a7a5924c105c72637aa109
author Dr. Johann Pfefferl <pfefferl@xxxxxxx> Tue, 27 Feb 2007 17:00:20 +0100
committer Dr. Johann Pfefferl <pfefferl@xxxxxxxxxxxxxxx> Tue, 27 Feb 2007 17:00:20 +0100

 arch/microblaze/mm/init.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index abf2fa7..a637ad4 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -11,6 +11,7 @@
 #include <linux/autoconf.h>
 #include <linux/init.h>
 #include <linux/mm.h>
+#include "../../../mm/internal.h"
 #include <linux/swap.h>
 #include <linux/bootmem.h>
 #include <linux/pfn.h>
@@ -81,6 +82,21 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
 	printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
 }
 
+#ifdef CONFIG_BLK_DEV_INITRD
+void free_initrd_mem(unsigned long start, unsigned long end)
+{
+	int pages = 0;
+	for (; start < end; start += PAGE_SIZE) {
+		ClearPageReserved(virt_to_page(start));
+		set_page_count(virt_to_page(start), 1);
+		free_page(start);
+		totalram_pages++;
+		pages++;
+	}
+	printk (KERN_NOTICE "Freeing initrd memory: %dk freed\n", pages);
+}
+#endif
+
 void free_initmem(void)
 {
 	free_init_pages("unused kernel memory",
Added /proc/cpuinfo support

---
commit 54bc1b3412fc8f0043ffd119bd26dc0b6c3391f6
tree cef257683d31179cc994cc49f956f4c4e026bfe7
parent c8ffef0a88c7d424bcb85edae5220fabbb5c61cf
author Dr. Johann Pfefferl <pfefferl@xxxxxxx> Wed, 28 Feb 2007 18:15:04 +0100
committer Dr. Johann Pfefferl <pfefferl@xxxxxxxxxxxxxxx> Wed, 28 Feb 2007 18:15:04 +0100

 arch/microblaze/kernel/setup.c |   72 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 2652f63..9c6b7c9 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -19,6 +19,7 @@
 #include <asm/page.h>
 #include <asm/io.h>
 #include <asm/bug.h>
+#include <asm/param.h>
 
 #if defined CONFIG_MTD_ATTACHED_ROMFS
 #include <linux/romfs_fs.h>
@@ -87,8 +88,10 @@ inline unsigned get_romfs_len(unsigned *addr)
 void machine_early_init(const char *cmdline)
 {
 	unsigned long *src, *dst = (unsigned long *)0x0;
+#ifdef CONFIG_BLUECAT_RFS
 	unsigned char buf[4];
 	unsigned long temp_buf[2];
+#endif
 
 #ifdef __bluecat__
 	cmdline = (char *)_stext - 0x200 - 0x6c00 + 12;
@@ -195,17 +198,78 @@ void machine_power_off(void)
 	BUG();
 }
 
-int show_cpuinfo(struct seq_file *m, void *v)
-{
 /* TBD (used by procfs) */
-	return 0;
+#ifdef CONFIG_XILINX_MICROBLAZE0_INSTANCE
+static int show_cpuinfo (struct seq_file *m, void *v)
+{
+  extern unsigned long loops_per_jiffy;
+  int count=0;
+  count = seq_printf (m,
+      "CPU-Family:	Microblaze\n"
+      "FPGA-Arch:	%s\n"
+      "CPU-Ver:	%s\n"
+      "CPU-MHz:   %d.%02d\n"
+      "BogoMips:	%lu.%02lu\n",
+      CONFIG_XILINX_MICROBLAZE0_FAMILY,
+      CONFIG_XILINX_MICROBLAZE0_HW_VER,
+      CONFIG_XILINX_CPU_CLOCK_FREQ/1000000,
+      CONFIG_XILINX_CPU_CLOCK_FREQ % 1000000,
+      loops_per_jiffy/(500000/HZ),
+      (loops_per_jiffy/(5000/HZ)) % 100);
+
+  count += seq_printf(m,
+      "HW-Div:         %s\n"
+      "HW-Shift:       %s\n",
+      CONFIG_XILINX_MICROBLAZE0_USE_DIV ? "yes":"no",
+      CONFIG_XILINX_MICROBLAZE0_USE_BARREL ? "yes":"no");
+
+  if(CONFIG_XILINX_MICROBLAZE0_USE_ICACHE)
+    count +=seq_printf (m,
+        "Icache:        %ukB\n",
+        CONFIG_XILINX_MICROBLAZE0_CACHE_BYTE_SIZE >> 10);
+  else
+    count +=seq_printf (m,
+        "Icache:         no\n");
+
+  if(CONFIG_XILINX_MICROBLAZE0_USE_DCACHE)
+    count +=seq_printf (m,
+        "Dcache:       %ukB\n",
+        CONFIG_XILINX_MICROBLAZE0_DCACHE_BYTE_SIZE >> 10);
+  else
+    count +=seq_printf (m,
+        "Dcache:         no\n");
+
+  count += seq_printf(m,
+      "HW-Debug:       %s\n",
+      CONFIG_XILINX_MICROBLAZE0_DEBUG_ENABLED ? "yes":"no");
+
+  return 0;
+}
+#else
+static int show_cpuinfo (struct seq_file *m, void *v)
+{
+  extern unsigned long loops_per_jiffy;
+  seq_printf (m,
+      "CPU-Family:	microblaze\n"
+      "CPU-Arch:	%s\n"
+      "CPU-Model:	%s\n"
+      "CPU-MHz:   %d.%02d\n"
+      "BogoMips:	%lu.%02lu\n",
+      CPU_ARCH,
+      CPU_MODEL,
+      CONFIG_XILINX_CPU_CLOCK_FREQ/1000000,
+      CONFIG_XILINX_CPU_CLOCK_FREQ % 1000000,
+      loops_per_jiffy/(500000/HZ),
+      (loops_per_jiffy/(5000/HZ)) % 100);
+  return 0;
 }
+#endif
 
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
 	int i = *pos;
 
-	return i <= NR_CPUS? (void *) (i + 1): NULL;
+	return i < NR_CPUS? (void *) (i + 1): NULL;
 }
 
 static void *c_next(struct seq_file *m, void *v, loff_t *pos)