* qemu initrd and ide support
@ 2006-10-12 21:12 Daniel Jacobowitz
2006-10-13 13:40 ` Aurelien Jarno
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-10-12 21:12 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 531 bytes --]
These patches for qemu let IDE and initrd work in the defconfig.
It seems to function - I was able to get as far as partitioning
the drive in the debian installer and the next time I started qemu
the new partitions were found. But the installer hangs up trying
to format swap.
Of course, what would be really nice would be a PCI controller.
I'm not brave enough to try.
I'm not going to submit the qemu change until I have some better
evidence that it all works right (or someone else does).
--
Daniel Jacobowitz
CodeSourcery
[-- Attachment #2: mips-qemu-ide-and-initrd.patch --]
[-- Type: text/plain, Size: 2950 bytes --]
--- Makefile.target (revision 151367)
+++ Makefile.target (local)
@@ -350,8 +350,8 @@ VL_OBJS+= grackle_pci.o prep_pci.o unin_
DEFINES += -DHAS_AUDIO
endif
ifeq ($(TARGET_ARCH), mips)
-VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o
-#VL_OBJS+= #ide.o pckbd.o fdc.o m48t59.o
+VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o ide.o
+#VL_OBJS+= #pckbd.o fdc.o m48t59.o
endif
ifeq ($(TARGET_BASE_ARCH), sparc)
ifeq ($(TARGET_ARCH), sparc64)
--- hw/mips_r4k.c (revision 151367)
+++ hw/mips_r4k.c (local)
@@ -7,6 +7,10 @@
#define VIRT_TO_PHYS_ADDEND (-0x80000000LL)
+static const int ide_iobase[2] = { 0x1f0, 0x170 };
+static const int ide_iobase2[2] = { 0x3f6, 0x376 };
+static const int ide_irq[2] = { 14, 15 };
+
extern FILE *logfile;
static PITState *pit;
@@ -117,7 +121,8 @@ void mips_r4k_init (int ram_size, int vg
unsigned long bios_offset;
int ret;
CPUState *env;
- long kernel_size;
+ long kernel_size, initrd_size;
+ int i;
env = cpu_init();
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
@@ -158,21 +163,29 @@ void mips_r4k_init (int ram_size, int vg
}
/* load initrd */
+ initrd_size = 0;
if (initrd_filename) {
- if (load_image(initrd_filename,
- phys_ram_base + INITRD_LOAD_ADDR + VIRT_TO_PHYS_ADDEND)
- == (target_ulong) -1) {
+ initrd_size = load_image(initrd_filename,
+ phys_ram_base + INITRD_LOAD_ADDR + VIRT_TO_PHYS_ADDEND);
+ if (initrd_size == (target_ulong) -1) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
initrd_filename);
exit(1);
}
}
- /* Store command line. */
+ /* Store command line. */
strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline);
/* FIXME: little endian support */
- *(int *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678);
- *(int *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);
+ if (initrd_size > 0) {
+ *(int *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345679);
+ *(int *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);
+ *(int *)(phys_ram_base + (16 << 20) - 268) = tswap32 (INITRD_LOAD_ADDR);
+ *(int *)(phys_ram_base + (16 << 20) - 272) = tswap32 (initrd_size);
+ } else {
+ *(int *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678);
+ *(int *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);
+ }
}
/* Init internal devices */
@@ -198,6 +211,10 @@ void mips_r4k_init (int ram_size, int vg
exit (1);
}
}
+
+ for(i = 0; i < 2; i++)
+ isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
+ bs_table[2 * i], bs_table[2 * i + 1]);
}
QEMUMachine mips_machine = {
[-- Attachment #3: mips-qemu-initrd-kernel.patch --]
[-- Type: text/plain, Size: 8280 bytes --]
Update QEmu configuration for IDE, initrd, and basic functionality.
Also recognize the location of an initrd as provided by qemu.
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index 9b0dab8..d15de9f 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18-rc1
-# Thu Jul 6 10:04:18 2006
+# Linux kernel version: 2.6.19-rc1
+# Thu Oct 12 16:25:39 2006
#
CONFIG_MIPS=y
@@ -25,8 +25,6 @@ # CONFIG_BASLER_EXCITE is not set
# CONFIG_MIPS_COBALT is not set
# CONFIG_MACH_DECSTATION is not set
# CONFIG_MIPS_EV64120 is not set
-# CONFIG_MIPS_IVR is not set
-# CONFIG_MIPS_ITE8172 is not set
# CONFIG_MACH_JAZZ is not set
# CONFIG_LASAT is not set
# CONFIG_MIPS_ATLAS is not set
@@ -67,6 +65,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_TIME=y
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
CONFIG_DMA_COHERENT=y
CONFIG_GENERIC_ISA_DMA=y
@@ -74,6 +73,7 @@ CONFIG_I8259=y
CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_LITTLE_ENDIAN is not set
CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
CONFIG_SWAP_IO_SPACE=y
CONFIG_MIPS_L1_CACHE_SHIFT=5
CONFIG_HAVE_STD_PC_SERIAL_PORT=y
@@ -117,8 +117,8 @@ # CONFIG_PAGE_SIZE_16KB is not set
# CONFIG_PAGE_SIZE_64KB is not set
CONFIG_CPU_HAS_PREFETCH=y
CONFIG_MIPS_MT_DISABLED=y
-# CONFIG_MIPS_MT_SMTC is not set
# CONFIG_MIPS_MT_SMP is not set
+# CONFIG_MIPS_MT_SMTC is not set
# CONFIG_MIPS_VPE_LOADER is not set
# CONFIG_64BIT_PHYS_ADDR is not set
CONFIG_CPU_HAS_LLSC=y
@@ -130,7 +130,7 @@ CONFIG_ARCH_FLATMEM_ENABLE=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPARSEMEM_STATIC=y
CONFIG_SPLIT_PTLOCK_CPUS=4
# CONFIG_RESOURCES_64BIT is not set
# CONFIG_HZ_48 is not set
@@ -162,28 +162,33 @@ #
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
# CONFIG_SWAP is not set
-# CONFIG_SYSVIPC is not set
+CONFIG_SYSVIPC=y
+# CONFIG_IPC_NS is not set
# CONFIG_BSD_PROCESS_ACCT is not set
-CONFIG_SYSCTL=y
+# CONFIG_TASKSTATS is not set
+# CONFIG_UTS_NS is not set
# CONFIG_AUDIT is not set
# CONFIG_IKCONFIG is not set
CONFIG_RELAY=y
CONFIG_INITRAMFS_SOURCE=""
+CONFIG_SYSCTL=y
CONFIG_EMBEDDED=y
+# CONFIG_SYSCTL_SYSCALL is not set
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
-# CONFIG_HOTPLUG is not set
+CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
-# CONFIG_BUG is not set
+CONFIG_BUG=y
CONFIG_ELF_CORE=y
-# CONFIG_BASE_FULL is not set
-# CONFIG_FUTEX is not set
-# CONFIG_EPOLL is not set
-# CONFIG_SHMEM is not set
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SHMEM=y
CONFIG_SLAB=y
CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_TINY_SHMEM=y
-CONFIG_BASE_SMALL=1
+CONFIG_RT_MUTEXES=y
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
# CONFIG_SLOB is not set
#
@@ -194,6 +199,7 @@ # CONFIG_MODULES is not set
#
# Block layer
#
+CONFIG_BLOCK=y
# CONFIG_LBD is not set
# CONFIG_BLK_DEV_IO_TRACE is not set
# CONFIG_LSF is not set
@@ -268,10 +274,12 @@ # CONFIG_INET_XFRM_TUNNEL is not set
# CONFIG_INET_TUNNEL is not set
CONFIG_INET_XFRM_MODE_TRANSPORT=y
CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_TCP_CONG_ADVANCED is not set
-CONFIG_TCP_CONG_BIC=y
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_IPV6 is not set
# CONFIG_INET6_XFRM_TUNNEL is not set
# CONFIG_INET6_TUNNEL is not set
@@ -335,23 +343,55 @@ #
# Block devices
#
# CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
+CONFIG_BLK_DEV_INITRD=y
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
#
# ATA/ATAPI/MFM/RLL support
#
-# CONFIG_IDE is not set
+CONFIG_IDE=y
+CONFIG_IDE_MAX_HWIFS=4
+CONFIG_BLK_DEV_IDE=y
+
+#
+# Please see Documentation/ide.txt for help/info on IDE drives
+#
+# CONFIG_BLK_DEV_IDE_SATA is not set
+CONFIG_BLK_DEV_IDEDISK=y
+CONFIG_IDEDISK_MULTI_MODE=y
+CONFIG_BLK_DEV_IDECD=y
+# CONFIG_BLK_DEV_IDEFLOPPY is not set
+# CONFIG_IDE_TASK_IOCTL is not set
+
+#
+# IDE chipset support/bugfixes
+#
+CONFIG_IDE_GENERIC=y
+# CONFIG_IDE_ARM is not set
+# CONFIG_IDE_CHIPSETS is not set
+# CONFIG_BLK_DEV_IDEDMA is not set
+# CONFIG_IDEDMA_AUTO is not set
+# CONFIG_BLK_DEV_HD is not set
#
# SCSI device support
#
# CONFIG_RAID_ATTRS is not set
# CONFIG_SCSI is not set
+# CONFIG_SCSI_NETLINK is not set
+
+#
+# Serial ATA (prod) and Parallel ATA (experimental) drivers
+#
+# CONFIG_ATA is not set
#
# Old CD-ROM drivers (not SCSI, not IDE)
@@ -459,6 +499,7 @@ #
# Input device support
#
CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
#
# Userland interfaces
@@ -565,7 +606,6 @@ #
# Multimedia devices
#
# CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
#
# Digital Video Broadcasting Devices
@@ -585,6 +625,7 @@ CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
# CONFIG_MDA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
#
# Sound
@@ -654,13 +695,20 @@ #
# File systems
#
# CONFIG_EXT2_FS is not set
-# CONFIG_EXT3_FS is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
# CONFIG_FS_POSIX_ACL is not set
# CONFIG_XFS_FS is not set
+# CONFIG_OCFS2_FS is not set
# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+CONFIG_ROMFS_FS=y
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
@@ -687,8 +735,10 @@ # Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
+CONFIG_PROC_SYSCTL=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
# CONFIG_HUGETLB_PAGE is not set
CONFIG_RAMFS=y
@@ -696,7 +746,7 @@ #
# Miscellaneous filesystems
#
# CONFIG_HFSPLUS_FS is not set
-# CONFIG_CRAMFS is not set
+CONFIG_CRAMFS=y
# CONFIG_VXFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
@@ -709,6 +759,7 @@ #
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
+# CONFIG_NFS_DIRECTIO is not set
# CONFIG_NFSD is not set
CONFIG_ROOT_NFS=y
CONFIG_LOCKD=y
@@ -717,7 +768,6 @@ CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
# CONFIG_SMB_FS is not set
# CONFIG_CIFS is not set
-# CONFIG_CIFS_DEBUG2 is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
@@ -737,12 +787,14 @@ # Kernel hacking
#
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
# CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_MUST_CHECK=y
# CONFIG_MAGIC_SYSRQ is not set
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_DEBUG_KERNEL is not set
CONFIG_LOG_BUF_SHIFT=14
# CONFIG_DEBUG_FS is not set
# CONFIG_UNWIND_INFO is not set
+# CONFIG_HEADERS_CHECK is not set
CONFIG_CROSSCOMPILE=y
CONFIG_CMDLINE=""
@@ -758,13 +810,11 @@ #
# CONFIG_CRYPTO is not set
#
-# Hardware crypto devices
-#
-
-#
# Library routines
#
# CONFIG_CRC_CCITT is not set
# CONFIG_CRC16 is not set
CONFIG_CRC32=y
# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_PLIST=y
diff --git a/arch/mips/qemu/q-firmware.c b/arch/mips/qemu/q-firmware.c
index fb2a867..e1e77aa 100644
--- a/arch/mips/qemu/q-firmware.c
+++ b/arch/mips/qemu/q-firmware.c
@@ -12,6 +12,13 @@ void __init prom_init(void)
if (*(char *)(cmdline + 1))
strcpy (arcs_cmdline, (char *)(cmdline + 1));
add_memory_region(0x0<<20, cmdline[-1], BOOT_MEM_RAM);
+ } else if (*cmdline == 0x12345679) {
+ extern unsigned long initrd_start, initrd_end;
+ if (*(char *)(cmdline + 1))
+ strcpy (arcs_cmdline, (char *)(cmdline + 1));
+ add_memory_region(0x0<<20, cmdline[-1], BOOT_MEM_RAM);
+ initrd_start = cmdline[-2];
+ initrd_end = initrd_start + cmdline[-3];
} else {
add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM);
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: qemu initrd and ide support
2006-10-12 21:12 qemu initrd and ide support Daniel Jacobowitz
@ 2006-10-13 13:40 ` Aurelien Jarno
2006-10-20 15:48 ` Aurelien Jarno
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Aurelien Jarno @ 2006-10-13 13:40 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: linux-mips
Hi!
Daniel Jacobowitz a écrit :
> These patches for qemu let IDE and initrd work in the defconfig.
> It seems to function - I was able to get as far as partitioning
> the drive in the debian installer and the next time I started qemu
> the new partitions were found. But the installer hangs up trying
> to format swap.
>
> Of course, what would be really nice would be a PCI controller.
> I'm not brave enough to try.
>
> I'm not going to submit the qemu change until I have some better
> evidence that it all works right (or someone else does).
>
First of all, thanks a lot for your work, that makes QEMU mips more usable.
The IDE part works very well, though there seems to be some problems
with userland tools (mke2fs), an instruction is probably not/bad
emulated. I now have a system with the root on the IDE drive and with swap.
The initrd seems to works well, but it generates a strange failure
during the boot:
[...]
Mount-cache hash table entries: 512
Checking for 'wait' instruction... available.
checking if image is initramfs...it isn't (bad gzip magic numbers);
looks like an initrd
Bad page state in process 'swapper'
page:81010000 flags:0x00080000 mapping:00000000 mapcount:0 count:0
Trying to fix it up, but a reboot is needed
Backtrace:
Call Trace:
[<8005c748>] bad_page+0x68/0xa8
[<8005ccf0>] free_hot_cold_page+0x1a4/0x1b4
[<802a0000>] ic_bootp_recv+0x238/0x6a0
[<80080138>] __fput+0x14c/0x1cc
[<8001b094>] free_init_pages+0xa4/0xfc
[<802a0000>] ic_bootp_recv+0x238/0x6a0
[<802a0000>] ic_bootp_recv+0x238/0x6a0
[<802a0000>] ic_bootp_recv+0x238/0x6a0
[<80288d98>] free_initrd+0x28/0x44
[<80288e80>] populate_rootfs+0xcc/0x110
[<80292860>] spawn_softlockup_task+0x30/0x50
[<80010498>] init+0x54/0x300
[<80010498>] init+0x54/0x300
[<80013074>] kernel_thread_helper+0x10/0x18
[<80013064>] kernel_thread_helper+0x0/0x18
Freeing initrd memory: 2520k freed
NET: Registered protocol family 16
NET: Registered protocol family 2
[...]
This message is not present when initrd is not used, and it also does
not appear with the previous way of passing the size and location of the
initrd.
I don't have time to look more now, I will give you some more details
when/if I found some time to work on that.
Bye,
Aurelien
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: qemu initrd and ide support
2006-10-13 13:40 ` Aurelien Jarno
@ 2006-10-20 15:48 ` Aurelien Jarno
2006-10-23 11:45 ` Aurelien Jarno
2006-10-24 13:08 ` Aurelien Jarno
2 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2006-10-20 15:48 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: linux-mips
Aurelien Jarno a écrit :
> The initrd seems to works well, but it generates a strange failure
> during the boot:
>
> [...]
> Mount-cache hash table entries: 512
> Checking for 'wait' instruction... available.
> checking if image is initramfs...it isn't (bad gzip magic numbers);
> looks like an initrd
> Bad page state in process 'swapper'
> page:81010000 flags:0x00080000 mapping:00000000 mapcount:0 count:0
> Trying to fix it up, but a reboot is needed
> Backtrace:
> Call Trace:
> [<8005c748>] bad_page+0x68/0xa8
> [<8005ccf0>] free_hot_cold_page+0x1a4/0x1b4
> [<802a0000>] ic_bootp_recv+0x238/0x6a0
> [<80080138>] __fput+0x14c/0x1cc
> [<8001b094>] free_init_pages+0xa4/0xfc
> [<802a0000>] ic_bootp_recv+0x238/0x6a0
> [<802a0000>] ic_bootp_recv+0x238/0x6a0
> [<802a0000>] ic_bootp_recv+0x238/0x6a0
> [<80288d98>] free_initrd+0x28/0x44
> [<80288e80>] populate_rootfs+0xcc/0x110
> [<80292860>] spawn_softlockup_task+0x30/0x50
> [<80010498>] init+0x54/0x300
> [<80010498>] init+0x54/0x300
> [<80013074>] kernel_thread_helper+0x10/0x18
> [<80013064>] kernel_thread_helper+0x0/0x18
>
> Freeing initrd memory: 2520k freed
> NET: Registered protocol family 16
> NET: Registered protocol family 2
> [...]
>
> This message is not present when initrd is not used, and it also does
> not appear with the previous way of passing the size and location of the
> initrd.
>
> I don't have time to look more now, I will give you some more details
> when/if I found some time to work on that.
>
This failure is due to the fact that initrd_reserve_bootmem is not set
anymore to 1 in arch/mips/kernel/setup.c. It is set to 1 when the initrd
location and size are read from the command line arguments, but not when
read from the place where QEMU put it.
Setting this value to 1 fixes the problem, but it is rather a big hack
than a fix.
About the patch itself, another comment: you should add a #ifdef
CONFIG_BLK_DEV_INITRD #endif for the block concerning the initrd in
arch/mips/qemu/q-firmware.c
Bye,
Aurelien
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: qemu initrd and ide support
2006-10-13 13:40 ` Aurelien Jarno
2006-10-20 15:48 ` Aurelien Jarno
@ 2006-10-23 11:45 ` Aurelien Jarno
2006-10-24 13:08 ` Aurelien Jarno
2 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2006-10-23 11:45 UTC (permalink / raw)
To: linux-mips; +Cc: Daniel Jacobowitz
[-- Attachment #1: Type: text/plain, Size: 2628 bytes --]
On Fri, Oct 13, 2006 at 03:40:20PM +0200, Aurelien Jarno wrote:
> Hi!
Hi!
> Daniel Jacobowitz a écrit :
> >These patches for qemu let IDE and initrd work in the defconfig.
> >It seems to function - I was able to get as far as partitioning
> >the drive in the debian installer and the next time I started qemu
> >the new partitions were found. But the installer hangs up trying
> >to format swap.
> >
> >Of course, what would be really nice would be a PCI controller.
> >I'm not brave enough to try.
> >
> >I'm not going to submit the qemu change until I have some better
> >evidence that it all works right (or someone else does).
> >
>
> First of all, thanks a lot for your work, that makes QEMU mips more usable.
>
> The IDE part works very well, though there seems to be some problems
> with userland tools (mke2fs), an instruction is probably not/bad
> emulated. I now have a system with the root on the IDE drive and with swap.
>
> The initrd seems to works well, but it generates a strange failure
> during the boot:
>
> [...]
> Mount-cache hash table entries: 512
> Checking for 'wait' instruction... available.
> checking if image is initramfs...it isn't (bad gzip magic numbers);
> looks like an initrd
> Bad page state in process 'swapper'
> page:81010000 flags:0x00080000 mapping:00000000 mapcount:0 count:0
> Trying to fix it up, but a reboot is needed
> Backtrace:
> Call Trace:
> [<8005c748>] bad_page+0x68/0xa8
> [<8005ccf0>] free_hot_cold_page+0x1a4/0x1b4
> [<802a0000>] ic_bootp_recv+0x238/0x6a0
> [<80080138>] __fput+0x14c/0x1cc
> [<8001b094>] free_init_pages+0xa4/0xfc
> [<802a0000>] ic_bootp_recv+0x238/0x6a0
> [<802a0000>] ic_bootp_recv+0x238/0x6a0
> [<802a0000>] ic_bootp_recv+0x238/0x6a0
> [<80288d98>] free_initrd+0x28/0x44
> [<80288e80>] populate_rootfs+0xcc/0x110
> [<80292860>] spawn_softlockup_task+0x30/0x50
> [<80010498>] init+0x54/0x300
> [<80010498>] init+0x54/0x300
> [<80013074>] kernel_thread_helper+0x10/0x18
> [<80013064>] kernel_thread_helper+0x0/0x18
>
> Freeing initrd memory: 2520k freed
> NET: Registered protocol family 16
> NET: Registered protocol family 2
> [...]
As discussed on IRC, it seems the oops does not occurs on all system,
but we don't know what trigger it.
Alternatively, please find attached a patch to QEMU to pass the initrd
arguments directly in text, so that no modifications are needed in the
kernel.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
[-- Attachment #2: mips-qemu-initrd.patch --]
[-- Type: text/plain, Size: 1974 bytes --]
Index: hw/mips_r4k.c
===================================================================
RCS file: /sources/qemu/qemu/hw/mips_r4k.c,v
retrieving revision 1.20
diff -u -d -p -r1.20 mips_r4k.c
--- hw/mips_r4k.c 18 Sep 2006 01:15:29 -0000 1.20
+++ hw/mips_r4k.c 23 Oct 2006 10:35:54 -0000
@@ -117,7 +117,7 @@ void mips_r4k_init (int ram_size, int vg
unsigned long bios_offset;
int ret;
CPUState *env;
- long kernel_size;
+ long kernel_size, initrd_size;
env = cpu_init();
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
@@ -158,10 +158,11 @@ void mips_r4k_init (int ram_size, int vg
}
/* load initrd */
+ initrd_size = 0;
if (initrd_filename) {
- if (load_image(initrd_filename,
- phys_ram_base + INITRD_LOAD_ADDR + VIRT_TO_PHYS_ADDEND)
- == (target_ulong) -1) {
+ initrd_size = load_image(initrd_filename,
+ phys_ram_base + INITRD_LOAD_ADDR + VIRT_TO_PHYS_ADDEND);
+ if (initrd_size == (target_ulong) -1) {
fprintf(stderr, "qemu: could not load initial ram disk '%s'\n",
initrd_filename);
exit(1);
@@ -169,7 +170,17 @@ void mips_r4k_init (int ram_size, int vg
}
/* Store command line. */
- strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline);
+ if (initrd_size > 0) {
+ ret = sprintf(phys_ram_base + (16 << 20) - 256,
+ "rd_start=0x%08x rd_size=%li ",
+ INITRD_LOAD_ADDR,
+ initrd_size);
+ strcpy (phys_ram_base + (16 << 20) - 256 + ret, kernel_cmdline);
+ }
+ else {
+ strcpy (phys_ram_base + (16 << 20) - 256, kernel_cmdline);
+ }
+
/* FIXME: little endian support */
*(int *)(phys_ram_base + (16 << 20) - 260) = tswap32 (0x12345678);
*(int *)(phys_ram_base + (16 << 20) - 264) = tswap32 (ram_size);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: qemu initrd and ide support
2006-10-13 13:40 ` Aurelien Jarno
2006-10-20 15:48 ` Aurelien Jarno
2006-10-23 11:45 ` Aurelien Jarno
@ 2006-10-24 13:08 ` Aurelien Jarno
2006-10-24 15:17 ` Daniel Jacobowitz
2 siblings, 1 reply; 6+ messages in thread
From: Aurelien Jarno @ 2006-10-24 13:08 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: linux-mips
[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]
On Fri, Oct 13, 2006 at 03:40:20PM +0200, Aurelien Jarno wrote:
> Hi!
>
> Daniel Jacobowitz a écrit :
> >These patches for qemu let IDE and initrd work in the defconfig.
> >It seems to function - I was able to get as far as partitioning
> >the drive in the debian installer and the next time I started qemu
> >the new partitions were found. But the installer hangs up trying
> >to format swap.
> >
> >Of course, what would be really nice would be a PCI controller.
> >I'm not brave enough to try.
> >
> >I'm not going to submit the qemu change until I have some better
> >evidence that it all works right (or someone else does).
> >
>
> First of all, thanks a lot for your work, that makes QEMU mips more usable.
>
> The IDE part works very well, though there seems to be some problems
> with userland tools (mke2fs), an instruction is probably not/bad
> emulated. I now have a system with the root on the IDE drive and with swap.
>
After a week of test, I can say that the IDE part is working correctly
(at least for me, and I suppose for you), I am using it on an emulated
system with ext3 as the root partition, and with swap. There are some
problems related to the userland tools (mke2fs) though.
Therefore I propose to submit the IDE part to QEMU. I have extracted it
from your patch, which also contains initrd support.
Care to send it?
Thanks,
Aurelien
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
[-- Attachment #2: mips-qemu-ide.patch --]
[-- Type: text/plain, Size: 1758 bytes --]
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.130
diff -u -d -p -r1.130 Makefile.target
--- Makefile.target 22 Oct 2006 00:18:54 -0000 1.130
+++ Makefile.target 24 Oct 2006 04:58:51 -0000
@@ -357,8 +357,8 @@ VL_OBJS+= grackle_pci.o prep_pci.o unin_
DEFINES += -DHAS_AUDIO
endif
ifeq ($(TARGET_ARCH), mips)
-VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o
-#VL_OBJS+= #ide.o pckbd.o fdc.o m48t59.o
+VL_OBJS+= mips_r4k.o dma.o vga.o serial.o i8254.o i8259.o ide.o
+#VL_OBJS+= #pckbd.o fdc.o m48t59.o
endif
ifeq ($(TARGET_BASE_ARCH), sparc)
ifeq ($(TARGET_ARCH), sparc64)
Index: hw/mips_r4k.c
===================================================================
RCS file: /sources/qemu/qemu/hw/mips_r4k.c,v
retrieving revision 1.20
diff -u -d -p -r1.20 mips_r4k.c
--- hw/mips_r4k.c 18 Sep 2006 01:15:29 -0000 1.20
+++ hw/mips_r4k.c 24 Oct 2006 04:58:51 -0000
@@ -7,6 +7,10 @@
#define VIRT_TO_PHYS_ADDEND (-0x80000000LL)
+static const int ide_iobase[2] = { 0x1f0, 0x170 };
+static const int ide_iobase2[2] = { 0x3f6, 0x376 };
+static const int ide_irq[2] = { 14, 15 };
+
extern FILE *logfile;
static PITState *pit;
@@ -118,6 +122,7 @@ void mips_r4k_init (int ram_size, int vg
int ret;
CPUState *env;
long kernel_size;
+ int i;
env = cpu_init();
register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
@@ -198,6 +203,10 @@ void mips_r4k_init (int ram_size, int vg
exit (1);
}
}
+
+ for(i = 0; i < 2; i++)
+ isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
+ bs_table[2 * i], bs_table[2 * i + 1]);
}
QEMUMachine mips_machine = {
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: qemu initrd and ide support
2006-10-24 13:08 ` Aurelien Jarno
@ 2006-10-24 15:17 ` Daniel Jacobowitz
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2006-10-24 15:17 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: linux-mips
On Tue, Oct 24, 2006 at 03:08:32PM +0200, Aurelien Jarno wrote:
> After a week of test, I can say that the IDE part is working correctly
> (at least for me, and I suppose for you), I am using it on an emulated
> system with ext3 as the root partition, and with swap. There are some
> problems related to the userland tools (mke2fs) though.
>
> Therefore I propose to submit the IDE part to QEMU. I have extracted it
> from your patch, which also contains initrd support.
>
> Care to send it?
Could you do it? Since you've tested them more, and separated them,
you might as well :-) I think that both this and the rd_size patch
are good to submit.
I hope that I can find the time at some point to fix the problems
blocking a Debian installer, but right at the moment I don't know when
I'll have time.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-10-24 15:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-12 21:12 qemu initrd and ide support Daniel Jacobowitz
2006-10-13 13:40 ` Aurelien Jarno
2006-10-20 15:48 ` Aurelien Jarno
2006-10-23 11:45 ` Aurelien Jarno
2006-10-24 13:08 ` Aurelien Jarno
2006-10-24 15:17 ` Daniel Jacobowitz
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.