[Qemu-devel] adding a new PCI device support in QEMU

2008-01-01 Thread Vinod E
Hi,
   I have a special kind of PCI device on my system. 
I want QEMU to emulate that device and have Guest VM
see that.  Can someone point me to any documentation
available on how I/O device handling is done in QEMU?

Thanks,
Vinod


  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs




Re: [Qemu-devel] adding a new PCI device support in QEMU

2008-01-01 Thread Paul Brook
On Tuesday 01 January 2008, Vinod E wrote:
 Hi,
I have a special kind of PCI device on my system.
 I want QEMU to emulate that device and have Guest VM
 see that.  Can someone point me to any documentation
 available on how I/O device handling is done in QEMU?

Read the source. There are plenty of examples of PCI devices (e.g. USB host 
adapters, LSI scsi adapter and various network cards).

Paul




[Qemu-devel] qemu/hw iommu.c sun4m.c sun4m.h

2008-01-01 Thread Blue Swirl
CVSROOT:/cvsroot/qemu
Module name:qemu
Changes by: Blue Swirl blueswir1  08/01/01 17:04:45

Modified files:
hw : iommu.c sun4m.c sun4m.h 

Log message:
 DVMA translation errors raise a module error irq (NMI)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/iommu.c?cvsroot=qemur1=1.23r2=1.24
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sun4m.c?cvsroot=qemur1=1.77r2=1.78
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sun4m.h?cvsroot=qemur1=1.7r2=1.8




[Qemu-devel] qemu/hw eccmemctl.c esp.c fdc.c iommu.c pcnet.c...

2008-01-01 Thread Blue Swirl
CVSROOT:/cvsroot/qemu
Module name:qemu
Changes by: Blue Swirl blueswir1  08/01/01 17:06:39

Modified files:
hw : eccmemctl.c esp.c fdc.c iommu.c pcnet.c sbi.c 
 slavio_intctl.c slavio_misc.c slavio_serial.c 
 slavio_timer.c sparc32_dma.c sun4c_intctl.c 
 tcx.c 

Log message:
 Register only valid register access widths

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/eccmemctl.c?cvsroot=qemur1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/esp.c?cvsroot=qemur1=1.32r2=1.33
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/fdc.c?cvsroot=qemur1=1.36r2=1.37
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/iommu.c?cvsroot=qemur1=1.24r2=1.25
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/pcnet.c?cvsroot=qemur1=1.22r2=1.23
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sbi.c?cvsroot=qemur1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_intctl.c?cvsroot=qemur1=1.27r2=1.28
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_misc.c?cvsroot=qemur1=1.16r2=1.17
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_serial.c?cvsroot=qemur1=1.31r2=1.32
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_timer.c?cvsroot=qemur1=1.27r2=1.28
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sparc32_dma.c?cvsroot=qemur1=1.10r2=1.11
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sun4c_intctl.c?cvsroot=qemur1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/tcx.c?cvsroot=qemur1=1.25r2=1.26




[Qemu-devel] [PATCH] (resend) Allow setting the vendor and model_id strings with x86's -cpu option

2008-01-01 Thread Dan Kenigsberg
Would you consider the following patch, that allows users to set two
important x86 cpu options from the command line? (the vendor and
model_id strings)

Regards,
Dan.

commit 04433bad959a7a4c1b8a0c22bd50eab9bf181b32
Author: Dan Kenigsberg [EMAIL PROTECTED]
Date:   Thu Dec 20 15:43:15 2007 +0200

Change vendor string and model id from the -cpu command line option

diff --git a/target-i386/helper2.c b/target-i386/helper2.c
index 551a0d8..b59bf92 100644
--- a/target-i386/helper2.c
+++ b/target-i386/helper2.c
@@ -121,6 +121,7 @@ typedef struct x86_def_t {
 const char *name;
 uint32_t level;
 uint32_t vendor1, vendor2, vendor3;
+char model_id[48];
 int family;
 int model;
 int stepping;
@@ -262,7 +263,21 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, 
const char *cpu_model)
 goto error;
 }
 x86_cpu_def-stepping = stepping;
-} else {
+} else if (!strcmp(featurestr, vendor)) {
+if (strlen(val) != 12) {
+fprintf(stderr, vendor string must be 12 chars long\n);
+x86_cpu_def = 0;
+goto error;
+}
+x86_cpu_def-vendor1 = x86_cpu_def-vendor2 = 
x86_cpu_def-vendor3 = 0;
+for(i = 0; i  4; i++) {
+x86_cpu_def-vendor1 |= ((unsigned char)val[i])  (8 
* i);
+x86_cpu_def-vendor2 |= ((unsigned char)val[i + 4])  (8 
* i);
+x86_cpu_def-vendor3 |= ((unsigned char)val[i + 8])  (8 
* i);
+}
+} else if (!strcmp(featurestr, model_id))
+strncpy(x86_cpu_def-model_id, val, 48);
+else {
 fprintf(stderr, unrecognized feature %s\n, featurestr);
 x86_cpu_def = 0;
 goto error;
@@ -323,13 +338,14 @@ static int cpu_x86_register (CPUX86State *env, const char 
*cpu_model)
 env-cpuid_ext3_features = def-ext3_features;
 {
 const char *model_id = QEMU Virtual CPU version  QEMU_VERSION;
-int c, len, i;
-len = strlen(model_id);
+int c = -1, i;
+   
+if (def-model_id[0] != '\0')
+model_id = def-model_id;
+
 for(i = 0; i  48; i++) {
-if (i = len)
-c = '\0';
-else
-c = model_id[i];
+if (c != '\0')
+c = (unsigned char)model_id[i];
 env-cpuid_model[i  2] |= c  (8 * (i  3));
 }
 }




Re: [Qemu-devel] qemu/hw slavio_intctl.c slavio_timer.c sun4m.c

2008-01-01 Thread Blue Swirl
On 1/1/08, Aurelien Jarno [EMAIL PROTECTED] wrote:
 On Sat, Dec 29, 2007 at 08:09:57PM +, Blue Swirl wrote:
  CVSROOT:  /cvsroot/qemu
  Module name:  qemu
  Changes by:   Blue Swirl blueswir1  07/12/29 20:09:57
 
  Modified files:
hw : slavio_intctl.c slavio_timer.c sun4m.c
 
  Log message:
 Fix CPU timer interrupts
 
  CVSWeb URLs:
  http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_intctl.c?cvsroot=qemur1=1.26r2=1.27
  http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_timer.c?cvsroot=qemur1=1.26r2=1.27
  http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sun4m.c?cvsroot=qemur1=1.76r2=1.77
 

 Unfortunately this commit has broken SS-5 running Linux:

Thanks for the report, I can reproduce the bug. What a strange error!

The following patch hides the problem, but it also un-fixes the CPU
timer. I have to think of a better solution.

diff -u -r1.28 slavio_intctl.c
--- hw/slavio_intctl.c  1 Jan 2008 17:06:38 -   1.28
+++ hw/slavio_intctl.c  1 Jan 2008 19:52:22 -
@@ -257,7 +257,7 @@
 if (pending  (1  j))
 pil_pending |= 1  s-intbit_to_level[j];
 }
-pil_pending |= s-intreg_pending[i]  CPU_HARDIRQ_MASK;
+//pil_pending |= s-intreg_pending[i]  CPU_HARDIRQ_MASK;
 }
 pil_pending |= (s-intreg_pending[i]  CPU_SOFTIRQ_MASK)  16;




Re: [Qemu-devel] qemu/hw slavio_intctl.c slavio_timer.c sun4m.c

2008-01-01 Thread Andreas Färber


Am 01.01.2008 um 20:25 schrieb Aurelien Jarno:


On Sat, Dec 29, 2007 at 08:09:57PM +, Blue Swirl wrote:

CVSROOT:/cvsroot/qemu
Module name:qemu
Changes by: Blue Swirl blueswir107/12/29 20:09:57

Modified files:
hw : slavio_intctl.c slavio_timer.c sun4m.c

Log message:
 Fix CPU timer interrupts

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_intctl.c?cvsroot=qemur1=1.26r2=1.27
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_timer.c?cvsroot=qemur1=1.26r2=1.27
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sun4m.c?cvsroot=qemur1=1.76r2=1.77



Unfortunately this commit has broken SS-5 running Linux:


[sparc] Booting file 'disk' with parameters ''
Not a bootable ELF image
Not a Linux kernel image
Loading a.out image...
Loaded 7680 bytes
entry point is 0x4000
Jumping to entry point...
SILO Version 1.4.13
boot:
Uncompressing image...
Loaded kernel version 2.6.18
Loading initial ramdisk (3205804 bytes at 0x300 phys, 0x6000  
virt)...

PROMLIB: obio_ranges 1
Booting Linux...
PROMLIB: Sun Boot Prom Version 3 Revision 2
Linux version 2.6.18-5-sparc32 (Debian 2.6.18.dfsg.1-13etch3) ([EMAIL PROTECTED] 
) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 Wed  
Sep 26 17:37:21 UTC 2007

ARCH: SUN4M
TYPE: SPARCstation 5
Ethernet address: 0:16:3e:0:11:12
Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek ([EMAIL PROTECTED]).  
Patching kernel for srmmu[Fujitsu TurboSparc]/iommu

63MB HIGHMEM available.
PROM: Built device tree with 21328 bytes of memory.
Power off control detected.
Built 1 zonelists.  Total pages: 63944
Kernel command line: root=/dev/sda4 ro
PID hash table entries: 1024 (order: 10, 4096 bytes)
start_kernel(): bug: interrupts were enabled early
Console: colour dummy device 80x25
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 250220k/261292k available (1640k kernel code, 10876k  
reserved, 404k data, 136k init, 64684k highmem)

Mount-cache hash table entries: 512
checking if image is initramfs... it is
Freeing initrd memory: 3130k freed
NET: Registered protocol family 16
IOMMU: impl 0 vers 5 table 0xf07c[262144 B] map [65536 b]
sbus0: Clock 21.1250 MHz
dma0: Revision 2
dma1: Revision 0
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 8192 bind 4096)
TCP reno registered
ioremap: done with statics, switching to malloc
apc: power management initialized
highmem bounce pool size: 64 pages
VFS: Disk quotas dquot_6.5.1
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 128x48
/[EMAIL PROTECTED],1000/[EMAIL PROTECTED],10001000/SUNW,[EMAIL PROTECTED],80: TCX at  
0:5080, 8-bit only

ffd57454: ttyS0 at MMIO 0x7110 (irq = 44) is a zs
Console: ttyS0 (SunZilog zs0)
qemu: fatal: Trap 0x29 while interrupts disabled, Error state
pc: f0011c98  npc: f0011c9c
General Registers:
%g0:    %g1: f01d2400   %g2: f022d070   %g3: f0229c68
%g4: f001aea0   %g5: 05327f80   %g6: f332   %g7: 
Current Register Window:
%o0: 0032   %o1:    %o2: f022d110   %o3: f33200a8
%o4:    %o5:    %o6: f331fff0   %o7: f0030144
%l0: f022d000   %l1:    %l2: f022d938   %l3: 
%l4: f022d538   %l5: 4000   %l6: f332   %l7: 
%i0: f01a6398   %i1: f0012f5c   %i2: f0012f60   %i3: f33201e0
%i4: 0010   %i5:    %i6: f3320060   %i7: f001306c

Floating Point Registers:
%f00: 0.00 0.00 0.00  
0.00
%f04: 0.00 0.00 0.00  
0.00
%f08: 0.00 0.00 0.00  
0.00
%f12: 0.00 0.00 0.00  
0.00
%f16: 0.00 0.00 0.00  
0.00
%f20: 0.00 0.00 0.00  
0.00
%f24: 0.00 0.00 0.00  
0.00
%f28: 0.00 0.00 0.00  
0.00

psr: 0x04001fc3 -  SP- wim: 0x0008
fsr: 0x0008


On Solaris/amd64 it continues until Starting periodic command  
scheduler: crond. and then hangs.
(previously I got a lot of esp0 issues during fsck, this is now fixed,  
thanks)





[Qemu-devel] qemu/hw slavio_intctl.c sun4m.c

2008-01-01 Thread Blue Swirl
CVSROOT:/cvsroot/qemu
Module name:qemu
Changes by: Blue Swirl blueswir1  08/01/01 20:57:25

Modified files:
hw : slavio_intctl.c sun4m.c 

Log message:
 Fix Debian serial console boot problem reported by Aurelien Jarno

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_intctl.c?cvsroot=qemur1=1.28r2=1.29
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sun4m.c?cvsroot=qemur1=1.78r2=1.79




Re: [Qemu-devel] qemu/hw slavio_intctl.c slavio_timer.c sun4m.c

2008-01-01 Thread Blue Swirl
On 1/1/08, Aurelien Jarno [EMAIL PROTECTED] wrote:
 On Sat, Dec 29, 2007 at 08:09:57PM +, Blue Swirl wrote:
  CVSROOT:  /cvsroot/qemu
  Module name:  qemu
  Changes by:   Blue Swirl blueswir1  07/12/29 20:09:57
 
  Modified files:
hw : slavio_intctl.c slavio_timer.c sun4m.c
 
  Log message:
 Fix CPU timer interrupts
 
  CVSWeb URLs:
  http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_intctl.c?cvsroot=qemur1=1.26r2=1.27
  http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_timer.c?cvsroot=qemur1=1.26r2=1.27
  http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sun4m.c?cvsroot=qemur1=1.76r2=1.77
 

 Unfortunately this commit has broken SS-5 running Linux:

The fix is now in CVS, please give it a test.




Re: [Qemu-devel] qemu/hw slavio_intctl.c slavio_timer.c sun4m.c

2008-01-01 Thread Aurelien Jarno
On Tue, Jan 01, 2008 at 11:00:46PM +0200, Blue Swirl wrote:
 On 1/1/08, Aurelien Jarno [EMAIL PROTECTED] wrote:
  On Sat, Dec 29, 2007 at 08:09:57PM +, Blue Swirl wrote:
   CVSROOT:  /cvsroot/qemu
   Module name:  qemu
   Changes by:   Blue Swirl blueswir1  07/12/29 20:09:57
  
   Modified files:
 hw : slavio_intctl.c slavio_timer.c sun4m.c
  
   Log message:
  Fix CPU timer interrupts
  
   CVSWeb URLs:
   http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_intctl.c?cvsroot=qemur1=1.26r2=1.27
   http://cvs.savannah.gnu.org/viewcvs/qemu/hw/slavio_timer.c?cvsroot=qemur1=1.26r2=1.27
   http://cvs.savannah.gnu.org/viewcvs/qemu/hw/sun4m.c?cvsroot=qemur1=1.76r2=1.77
  
 
  Unfortunately this commit has broken SS-5 running Linux:
 
 The fix is now in CVS, please give it a test.
 

I confirm that it works. Thanks a lot for the quick fix.

-- 
  .''`.  Aurelien Jarno | GPG: 1024D/F1BCDB73
 : :' :  Debian developer   | Electrical Engineer
 `. `'   [EMAIL PROTECTED] | [EMAIL PROTECTED]
   `-people.debian.org/~aurel32 | www.aurel32.net




Re: [Qemu-devel] qemu cpu-all.h exec.c

2008-01-01 Thread Fabrice Bellard
Blue Swirl wrote:
 CVSROOT:  /cvsroot/qemu
 Module name:  qemu
 Changes by:   Blue Swirl blueswir1  08/01/01 16:57:19
 
 Modified files:
   .  : cpu-all.h exec.c 
 
 Log message:
Support for registering address space only for some access widths
 
 CVSWeb URLs:
 http://cvs.savannah.gnu.org/viewcvs/qemu/cpu-all.h?cvsroot=qemur1=1.80r2=1.81
 http://cvs.savannah.gnu.org/viewcvs/qemu/exec.c?cvsroot=qemur1=1.120r2=1.121

This patch breaks the behaviour of the memory callbacks if the callbacks
are changed dynamically (see cirrus_update_memory_access() to see what I
mean). You are lucky that no one does that in the subpage case !

Regards,

Fabrice.





[Qemu-devel] bug in qemu last win32 snapshot (12132007)

2008-01-01 Thread Sebastien WILLEMIJNS
(cc to the windows dev port)

hello,

happy new year

C:\qemu4windows\qemu-0.9.0-windowsif exist
..\qemusave\kqemu-1.3.0pre11.tar.gz
qemu -kernel-kqemu -soundhw all -m 256 -L
\qemu4windows\qemu-0.9.0-windows -cdro
m e:\knoppix.iso -boot d -hda ..\toto.img -net nic,vlan=0,model=rtl8139
-net use
r,vlan=0,hostname=foo
qemu: could not open disk image ..toto.img



-hda ..\toto.img does not works
moving toto.img to the directory and modify commandline to -hda
toto.img works !


config: XP SP2 French 100% patched.



--- 
 
  Sébastien WILLEMIJNS
  





[Qemu-devel] bug in qemu last win32 snapshot (12132007)

2008-01-01 Thread Sebastien WILLEMIJNS
(cc to the windows dev port)

hello,

happy new year

C:\qemu4windows\qemu-0.9.0-windowsif exist
..\qemusave\kqemu-1.3.0pre11.tar.gz
qemu -kernel-kqemu -soundhw all -m 256 -L
\qemu4windows\qemu-0.9.0-windows -cdro
m e:\knoppix.iso -boot d -hda ..\toto.img -net nic,vlan=0,model=rtl8139
-net use
r,vlan=0,hostname=foo
qemu: could not open disk image ..toto.img



-hda ..\toto.img does not works
moving toto.img to the directory and modify commandline to -hda
toto.img works !


config: XP SP2 French 100% patched.







[Qemu-devel] [PATCH] Rearm timer more often

2008-01-01 Thread Anders
The timer must be rearmed if a new timeout is added at the start of
the timeout list (or the new timeout will be expired too late.) 
However, as the rearming always happens after servicing expired
timers, do not rearm in that case.

Also, move the setting of the dirty flag outside conditional in
host_alarm_handler(), to make sure it is always done. This broke kvm.


Cheers,
Anders.

diff --git a/vl.c b/vl.c
index 129166d..a7d9021 100644
--- a/vl.c
+++ b/vl.c
@@ -822,7 +822,7 @@ struct qemu_alarm_timer {
 };
 
 #define ALARM_FLAG_DYNTICKS  0x1
-#define ALARM_FLAG_MODIFIED  0x2
+#define ALARM_FLAG_EXPIRED   0x2
 
 static inline int alarm_has_dynticks(struct qemu_alarm_timer *t)
 {
@@ -834,11 +834,6 @@ static void qemu_rearm_alarm_timer(struct qemu_alarm_timer *t)
 if (!alarm_has_dynticks(t))
 return;
 
-if (!(t-flags  ALARM_FLAG_MODIFIED))
-return;
-
-t-flags = ~(ALARM_FLAG_MODIFIED);
-
 t-rearm(t);
 }
 
@@ -1001,8 +996,6 @@ void qemu_del_timer(QEMUTimer *ts)
 {
 QEMUTimer **pt, *t;
 
-alarm_timer-flags |= ALARM_FLAG_MODIFIED;
-
 /* NOTE: this code must be signal safe because
qemu_timer_expired() can be called from a signal. */
 pt = active_timers[ts-clock-type];
@@ -1041,6 +1034,12 @@ void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time)
 ts-expire_time = expire_time;
 ts-next = *pt;
 *pt = ts;
+
+/* Rearm if necessary  */
+if ((alarm_timer-flags  ALARM_FLAG_EXPIRED) == 0
+ pt == active_timers[ts-clock-type]) {
+qemu_rearm_alarm_timer(alarm_timer);
+}
 }
 
 int qemu_timer_pending(QEMUTimer *ts)
@@ -1193,8 +1192,9 @@ static void host_alarm_handler(int host_signum)
 #endif
 CPUState *env = next_cpu;
 
+alarm_timer-flags |= ALARM_FLAG_EXPIRED;
+
 if (env) {
-alarm_timer-flags |= ALARM_FLAG_MODIFIED;
 /* stop the currently executing cpu because a timer occured */
 cpu_interrupt(env, CPU_INTERRUPT_EXIT);
 #ifdef USE_KQEMU
@@ -7396,7 +7396,10 @@ void main_loop_wait(int timeout)
 qemu_run_timers(active_timers[QEMU_TIMER_REALTIME],
 qemu_get_clock(rt_clock));
 
-qemu_rearm_alarm_timer(alarm_timer);
+if (alarm_timer-flags  ALARM_FLAG_EXPIRED) {
+alarm_timer-flags = ~(ALARM_FLAG_EXPIRED);
+qemu_rearm_alarm_timer(alarm_timer);
+}
 
 /* Check bottom-halves last in case any of the earlier events triggered
them.  */


Re: [Qemu-devel] bug in qemu last win32 snapshot (12132007)

2008-01-01 Thread Sebastien WILLEMIJNS
i complete my last message to write qemu-0.9.0-windows directory
contains of course latest build ;)
--- 
 
  Sébastien WILLEMIJNS