Skip to contentSkip to conversation

SPARC - host support in vl.c

Qemu-devel Bochnig, Martin 3 participants 7 messages Aug 31, 2004 – Sep 1, 2004

lore
Share & tools
lore
#0 lore raw

Here my patch suggestions to add SPARC host support to vl.c :

#elif defined(__sparc__)

/* Derived from: "m68k updates #2" by Richard Zidlicky "crude hack to get some sort of rdtsc support" */

#include <sys/time.h>
static int64_t cputicks=0;
static struct timeval lastcptcall={0,0};

// assume 5 MHz Pentium, min 80 ticks between rdtsc calls

int64_t cpu_get_real_ticks(void)

{
     struct timeval tp;
     gettimeofday(&tp,(void*)0);
     if (tp.tv_sec == lastcptcall.tv_sec &&
        tp.tv_usec == lastcptcall.tv_usec ){
       cputicks += 1;
     } else {
       cputicks=0;
       lastcptcall=tp;
     }
     return ((int64_t)tp.tv_sec*1000000+tp.tv_usec)*5+cputicks;
}

#elif defined(__sparc64__)

/* I'm not sure it was worth it, personally.
*
*UltraSparc:
*
* unsigned long x;
* asm volatile ("rd %tick, %0" : "=r"(x));
*
* Earlier Sparcs do not have this feature.
*
*
*/

int64_t cpu_get_real_ticks(void)

{
    int64_t val;
   asm volatile ("rd %%tick, %0" : "=r"(val));
    return val;
}

#else
#error unsupported CPU
#endif

Any ideas would be appreciated.

Martin

#1 lore raw
Quoted 3 lines · Martin

Here my patch suggestions to add SPARC host support to vl.c :

#elif defined(__sparc__)

Why conditionalize this to __sparc__? Seems like a generally sensible fallback.

Signature · 1 line
	Falk
#2 lore raw
Quoted 7 lines
Quoted 2 lines

#elif defined(__sparc__)

Why conditionalize this to __sparc__? Seems like a generally sensible fallback.

Huh?

It is to be conditionalized among powerpc, i386, x86_64 and so.

SPARC32's didn't support the UltraSPARC specific %tick instruction.

What do you mean?

--
Martin

#3 lore raw
Quoted 9 lines · Martin
Quoted 3 lines
Quoted 1 line

#elif defined(__sparc__)

Why conditionalize this to __sparc__? Seems like a generally sensible fallback.

It is to be conditionalized among powerpc, i386, x86_64 and so.

SPARC32's didn't support the UltraSPARC specific %tick instruction.

What do you mean?

I mean that what is now for __sparc__ should just be a global #else, since it should work everywhere if a more specialized version is not available.

Signature · 1 line
	Falk
#4 lore raw
Quoted 4 lines · Falk Hueffner

I mean that what is now for __sparc__ should just be a global #else, since it should work everywhere if a more specialized version is not available.

Oh, of course - that's true.

#5 lore raw
In reply to Falk Hueffner
Quoted 8 lines · Falk Hueffner
Quoted 3 lines · Martin

Here my patch suggestions to add SPARC host support to vl.c :

#elif defined(__sparc__)

Why conditionalize this to __sparc__? Seems like a generally sensible fallback.

Fabrice had plans to do this properly, by counting executed instructions.

Any idea what happened with this plan?

Richard

#6 lore raw

[Qemu-devel] The very best I can get on SPARC

In reply to Bochnig, Martin

Please see my recent postings first.

The very best I can get on SPARC (compiled on UltraSPARC IIi for SPARC32) :

debian:~/QEMU/qemu-0.6.0# uname -a
Linux debian 2.4.18 #2 Thu Apr 11 14:37:17 EDT 2002 sparc64 unknown
debian:~/QEMU/qemu-0.6.0#
debian:~/QEMU/qemu-0.6.0# file /usr/local/bin/qemu
/usr/local/bin/qemu: ELF 32-bit MSB executable, SPARC, version 1 (SYSV), statically linked, stripped
debian:~/QEMU/qemu-0.6.0#
debian:~/QEMU/qemu-0.6.0# /usr/local/bin/qemu -nographic -hda hd10meg.img -kernel vmlinuz-2.6.5-1.358 -append "console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"
warning: could not open /dev/net/tun: no virtual network emulation
Linux version 2.6.5-1.358 ([email protected]) (gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)) #1 Sat May 8 09:04:50 EDT 2004
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 0000000000100000 - 0000000008000000 (usable)
0MB HIGHMEM available.
128MB LOWMEM available.
zapping low mappings.
On node 0 totalpages: 32768
  DMA zone: 4096 pages, LIFO batch:1
  Normal zone: 28672 pages, LIFO batch:7
  HighMem zone: 0 pages, LIFO batch:1
DMI not present.
ACPI: Unable to locate RSDP
Built 1 zonelists
Kernel command line: console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe
ide_setup: ide2=noprobe
ide_setup: ide3=noprobe
ide_setup: ide4=noprobe
ide_setup: ide5=noprobe
mapped 4G/4G trampoline to ffff3000.
Initializing CPU#0
CPU 0 irqstacks, hard=02345000 soft=02344000
PID hash table entries: 1024 (order 10: 8192 bytes)
Detected 5.036 MHz processor.
Using tsc for high-res timesource
Console: colour VGA+ 80x25
Losing too many ticks!
TSC cannot be used as a timesource.
Possible reasons for this are:
  You're running with Speedstep,
  You don't have DMA enabled for your hard disk (see hdparm),
  Incorrect TSC synchronization on an SMP system (see dmesg).
Falling back to a sane timesource now.
Memory: 126804k/131072k available (1540k kernel code, 3696k reserved, 599k data, 144k init, 0k highmem)
Calibrating delay loop... 142.33 BogoMIPS
Security Scaffold v1.0.0 initialized
SELinux:  Initializing.
SELinux:  Starting in permissive mode
There is already a security framework initialized, register_security failed.
Failure registering capabilities with the kernel
selinux_register_security:  Registering secondary module capability
Capability LSM initialized
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
CPU: L1 I cache: 8K
CPU: L2 cache: 128K
CPU: Intel Pentium Pro stepping 03
Unable to handle kernel paging request at virtual address fffffc01
 printing eip:
023180c4
*pde = 00002067
Oops: 0002 [#1]
CPU:    0
EIP:    0060:[<023180c4>]    Not tainted
EFLAGS: 00000246   (2.6.5-1.358)
EIP is at check_fpu+0x91/0xcb
eax: 0000000d   ebx: 02378d00   ecx: 00000000   edx: 000003f8
esi: 0000000d   edi: 0000270f   ebp: 02349c03   esp: 02317f54
ds: 007b   es: 007b   ss: 0068
Process swapper (pid: 0, threadinfo=02317000 task=022c5aa0)
Stack: 00000060 02191439 021d7b4a 0000000d 00000000 0000000d 022d9380 021d79d4
       022d9380 021d79d4 02118726 00000964 fffff69c 00000964 00000964 
02118840
       00000246 fffff69c 00000246 fffff69c 00000246 02348e8d 00000246 
021189cd
Call Trace:
 [<02191439>] __delay+0x9/0xa
 [<021d7b4a>] serial8250_console_write+0x176/0x1bc
 [<021d79d4>] serial8250_console_write+0x0/0x1bc
 [<021d79d4>] serial8250_console_write+0x0/0x1bc
 [<02118726>] __call_console_drivers+0x36/0x42
 [<02118840>] call_console_drivers+0xbe/0xe3
 [<021189cd>] printk+0x106/0x113
 [<0231cf7f>] print_cpu_info+0x94/0xa8
 [<02318176>] check_bugs+0x28/0x50
 [<023185f2>] start_kernel+0x154/0x176
Code: db e3 dd 05 a0 ff 32 02 dc 35 a8 ff 32 02 dc 0d a8 ff 32 02
 <0>Kernel panic: Attempted to kill the idle task!

In idle task - not syncing
Killed