Re: [Qemu-devel] Re: 2.6.24 says serial8250: too much work for irq4 a lot.

2008-02-10 Thread Blue Swirl
On 2/9/08, H. Peter Anvin [EMAIL PROTECTED] wrote:
 Blue Swirl wrote:
 
  If you look at the patch, there are no timing dependencies; the only
  parameter is the depth of the virtual queue.  The exhaustion is
  completely controlled by target OS access patterns.
 
  Thanks, this clarified the difference. But I'll rephrase my original 
  comment:
 
  The patch looks OK, but the simulated FIFO exhaustion should benefit
  all devices, as
  discussed here:
  http://lists.gnu.org/archive/html/qemu-devel/2007-12/msg00283.html

 The difference is you *can't* do that in a general layer.

What makes you think that is impossible? Just move the
serial_clear_burst to vl.c under name chr_clear_burst, move burst_len
to CharDriverState and introduce a new function in vl.c that contains
the burst length check. This is functionally identical to your patch.
For 100% compatibility, the init functions could be changed so that
only PC serial is affected, but I think all character devices would
benefit from this.

Also win2k install hack in ide.c seems to be related to this problem,
so even more generic solution would be desirable.




[Qemu-devel] Re: [PATCH 2/6] Use correct types to enable 2G support (v2)

2008-02-10 Thread Avi Kivity

Izik Eidus wrote:



Index: qemu/cpu-all.h
===
--- qemu.orig/cpu-all.h 2008-02-01 15:24:45.0 -0600
+++ qemu/cpu-all.h  2008-02-01 15:28:48.0 -0600
@@ -695,7 +695,7 @@
 
 /* page related stuff */
 
-#define TARGET_PAGE_SIZE (1  TARGET_PAGE_BITS)

+#define TARGET_PAGE_SIZE (1ul  TARGET_PAGE_BITS)
 #define TARGET_PAGE_MASK ~(TARGET_PAGE_SIZE - 1)
 #define TARGET_PAGE_ALIGN(addr) (((addr) + TARGET_PAGE_SIZE - 1)  
TARGET_PAGE_MASK
  
Do you recall what this change fixed?  As Paul pointed out in IRC, using 
the host type here doesn't really fix the problem (target_ulong would be 
more appropriate).  However, we're both curious what problem it's 
actually fixing since sign extending the int should just work.



ok the commit say:

   kvm: qemu: change the type of the various page masks to unsigned long

   prevents truncation with =4GB of guest physical memory



as far as i remember it was used to address something with
cpu_physical_memory_rw() probably related to TARGET_PAGE_SIZE
or ~TARGET_PAGE_SIZE,

the fact is that i dont know if it ever fixed anything
  


It fixes TARGET_PAGE_MASK, defined one line downscreen.  I agree it 
should be changed to ((target_ulong)1  TARGET_PAGE_BITS).


--
error compiling committee.c: too many arguments to function





Re: [Qemu-devel] Re: 2.6.24 says serial8250: too much work for irq4 a lot.

2008-02-10 Thread Paul Brook
On Sunday 10 February 2008, Blue Swirl wrote:
 On 2/9/08, H. Peter Anvin [EMAIL PROTECTED] wrote:
  Blue Swirl wrote:
   If you look at the patch, there are no timing dependencies; the only
   parameter is the depth of the virtual queue.  The exhaustion is
   completely controlled by target OS access patterns.
  
   Thanks, this clarified the difference. But I'll rephrase my original
   comment:
  
   The patch looks OK, but the simulated FIFO exhaustion should benefit
   all devices, as
   discussed here:
   http://lists.gnu.org/archive/html/qemu-devel/2007-12/msg00283.html
 
  The difference is you *can't* do that in a general layer.

 What makes you think that is impossible? 

IIUC the proposed patch makes the serial driver return an empty FIFO exactly 
once, them immediately continue receiving data. Throughput should be 
approximately the same, you've just got a bit of extra overhead to process 
the additional interrupts.  This is very different to the previous patch 
which did time-based throughput limiting.

You can't do this in generic code because there's no way to guess when the 
guest os has seen the FIFO empty condition. The best you can do is pause for 
some arbitrary length of time, which is both unreliable (the guest OS may not 
have got to far enough yet, especially if the host machine is heavily 
loaded), and has a significant negative impact on throughput.

 Also win2k install hack in ide.c seems to be related to this problem,
 so even more generic solution would be desirable.

IIUC the win2k hack is an actual timing problem. The win2k IDE drivers are 
buggy, and fall over if the drive responds too soon.

Paul




RE: [Qemu-devel] USB support

2008-02-10 Thread Arnon Gilboa
The multi-config patch is already merged in Qemu 9.1 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Marek Zelem
Sent: Saturday, February 09, 2008 5:34 PM
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] USB support


Hi

I want to inform you that I successfully attached my Canon MP830
(printer, scanner, fax) to Qemu via USB.
It was not easy, I had to pass though two stoppages.

1. There is no support for multi port/config (do not know proper term
for that) USB devices in Qemu. Meaning that if single USB device
provides multiple functionalities (like printer, scanner, fax) it will
be rejected by Qemu.
Fortunately there is patch for that available on internet page
http://www.wina.at/uni/html/linux-qemu.html
(qemu-0.9.0-usb-multi-configs.patch).

2. When I applied the patch I hit another issue. When the USB device is
not ready it is automatically switched to HALT state (if I understood it
correctly) and additional ioctl USBDEVFS_CLEAR_HALT is required to give
device another chance. Thus, I have written patch for that issue. The
patch I am sending as attachment.

When I applied both patches, everything worked fine. I suggest to
include those two patches in Qemu.

Best regards

Marek Zelem

--
  e-mail: [EMAIL PROTECTED]
  web: http://marek.terminus.sk/
  pgp key: http://marek.terminus.sk/gpg.txt





[Qemu-devel] qemu vl.c hw/e1000.c

2008-02-10 Thread Andrzej Zaborowski
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Andrzej Zaborowski balrog 08/02/10 13:21:25

Modified files:
.  : vl.c 
hw : e1000.c 

Log message:
Remove unused boolean_t, should fix building for Solaris.
Fix a typo (Stuart Brady).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/vl.c?cvsroot=qemur1=1.403r2=1.404
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/e1000.c?cvsroot=qemur1=1.1r2=1.2




[Qemu-devel] qemu/linux-user syscall.c

2008-02-10 Thread Andrzej Zaborowski
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Andrzej Zaborowski balrog 08/02/10 13:28:08

Modified files:
linux-user : syscall.c 

Log message:
Don't error out on zero-length chunks in writev, as to mimic Linux 
(Kirill A. Shutemov).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/linux-user/syscall.c?cvsroot=qemur1=1.162r2=1.163




[Qemu-devel] qemu/hw e1000.c parallel.c

2008-02-10 Thread Andrzej Zaborowski
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Andrzej Zaborowski balrog 08/02/10 13:34:48

Modified files:
hw : e1000.c parallel.c 

Log message:
Fix parallel port software emulation (Hervé Poussineau).
Remove __iomem, also unused.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/e1000.c?cvsroot=qemur1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/parallel.c?cvsroot=qemur1=1.12r2=1.13




[Qemu-devel] qemu/hw pckbd.c

2008-02-10 Thread Andrzej Zaborowski
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Andrzej Zaborowski balrog 08/02/10 13:39:24

Modified files:
hw : pckbd.c 

Log message:
Enhance PC kbd debugging (patch from Hervé Poussineau)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/pckbd.c?cvsroot=qemur1=1.26r2=1.27




[Qemu-devel] qemu/hw serial.c

2008-02-10 Thread Andrzej Zaborowski
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Andrzej Zaborowski balrog 08/02/10 13:40:52

Modified files:
hw : serial.c 

Log message:
Add serial loopback mode (patch from Hervé Poussineau).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/serial.c?cvsroot=qemur1=1.22r2=1.23




[Qemu-devel] qemu translate-all.c tcg/tcg.c tcg/tcg.h tcg/i3...

2008-02-10 Thread Paul Brook
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Paul Brook pbrook 08/02/10 14:09:09

Modified files:
.  : translate-all.c 
tcg: tcg.c tcg.h 
tcg/i386   : tcg-target.c 
tcg/x86_64 : tcg-target.c 

Log message:
Simplify TCG relocation bugfix.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/translate-all.c?cvsroot=qemur1=1.26r2=1.27
http://cvs.savannah.gnu.org/viewcvs/qemu/tcg/tcg.c?cvsroot=qemur1=1.5r2=1.6
http://cvs.savannah.gnu.org/viewcvs/qemu/tcg/tcg.h?cvsroot=qemur1=1.4r2=1.5
http://cvs.savannah.gnu.org/viewcvs/qemu/tcg/i386/tcg-target.c?cvsroot=qemur1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/qemu/tcg/x86_64/tcg-target.c?cvsroot=qemur1=1.2r2=1.3




[Qemu-devel] qemu qemu-img.c

2008-02-10 Thread Andrzej Zaborowski
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Andrzej Zaborowski balrog 08/02/10 14:10:32

Modified files:
.  : qemu-img.c 

Log message:
Correct qemu-img usage hint (Andreas Färber).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/qemu-img.c?cvsroot=qemur1=1.28r2=1.29




Re: [Qemu-devel] Re: [PATCH 2/6] Use correct types to enable 2G support (v2)

2008-02-10 Thread Paul Brook
  as far as i remember it was used to address something with
  cpu_physical_memory_rw() probably related to TARGET_PAGE_SIZE
  or ~TARGET_PAGE_SIZE,
 
  the fact is that i dont know if it ever fixed anything

 It fixes TARGET_PAGE_MASK, defined one line downscreen. 

That doesn't really answer the question. What was wrong with the original 
definition?

Paul




Re: [Qemu-devel] [PATCH] loadvm for read-only snapshot files

2008-02-10 Thread andrzej zaborowski
On 03/02/2008, Eddie Kohler [EMAIL PROTECTED] wrote:
 The following patch, against cvs, supports read-only snapshots on read-only
 qcow2 image files.  Snapshots can be loaded, but not saved.  This is really
 useful in my context, which is operating systems projects; a read-only memory
 snapshot allows students to share a snapshot that skips the boot process,
 allowing them to run their code right away.

 Please let me know if anything needs changing.

Instead of including block_int.h in vl.c you should use the provided
functions from block.h (bs-drv can be checked with _is_inserted).
-- 
Please do not print this email unless absolutely necessary. Spread
environmental awareness.




Re: [Qemu-devel] Re: [PATCH 2/6] Use correct types to enable 2G support (v2)

2008-02-10 Thread Avi Kivity

Paul Brook wrote:

as far as i remember it was used to address something with
cpu_physical_memory_rw() probably related to TARGET_PAGE_SIZE
or ~TARGET_PAGE_SIZE,

the fact is that i dont know if it ever fixed anything
  
It fixes TARGET_PAGE_MASK, defined one line downscreen. 



That doesn't really answer the question. What was wrong with the original 
definition?
  


There are many instances of ((physical address)  TARGET_PAGE_MASK) 
scattered throughout the code.  With 64-bit physical addresses, this 
causes truncation.


Are suggesting to fix TARGET_PAGE_MASK directly?  I think fixing 
TARGET_PAGE_SIZE is better as everything else is defined in terms of it.


--
error compiling committee.c: too many arguments to function





Re: [Qemu-devel] Re: [PATCH 2/6] Use correct types to enable 2G support (v2)

2008-02-10 Thread Paul Brook
On Sunday 10 February 2008, Avi Kivity wrote:
 Paul Brook wrote:
  as far as i remember it was used to address something with
  cpu_physical_memory_rw() probably related to TARGET_PAGE_SIZE
  or ~TARGET_PAGE_SIZE,
 
  the fact is that i dont know if it ever fixed anything
 
  It fixes TARGET_PAGE_MASK, defined one line downscreen.
 
  That doesn't really answer the question. What was wrong with the original
  definition?

 There are many instances of ((physical address)  TARGET_PAGE_MASK)
 scattered throughout the code.  With 64-bit physical addresses, this
 causes truncation.

No it doesn't. TARGET_PAGE_MASK will be sign extended to the width of 
physical_address. This is why I asked for a concrete example of something 
that broke.

Paul




Re: [Qemu-devel] Re: [PATCH 2/6] Use correct types to enable 2G support (v2)

2008-02-10 Thread Avi Kivity

Paul Brook wrote:

On Sunday 10 February 2008, Avi Kivity wrote:
  

Paul Brook wrote:


as far as i remember it was used to address something with
cpu_physical_memory_rw() probably related to TARGET_PAGE_SIZE
or ~TARGET_PAGE_SIZE,

the fact is that i dont know if it ever fixed anything
  

It fixes TARGET_PAGE_MASK, defined one line downscreen.


That doesn't really answer the question. What was wrong with the original
definition?
  

There are many instances of ((physical address)  TARGET_PAGE_MASK)
scattered throughout the code.  With 64-bit physical addresses, this
causes truncation.



No it doesn't. TARGET_PAGE_MASK will be sign extended to the width of 
physical_address. This is why I asked for a concrete example of something 
that broke.
  


I understand now.  No, I don't recall a specific instance, and it may 
have been an unnecessary step along the way to get large memory support 
working.


--
error compiling committee.c: too many arguments to function





[Qemu-devel] [PATCH] Handle -localtime and -startdate in one place

2008-02-10 Thread andrzej zaborowski
Here's a patch to change RTC hardware to use a global
qemu_get_timedate function instead of handling rtc_utc and
rtc_start_date so that these don't have to be global anymore.  The
means also that files in hw/ don't have to use time.h functions
(unless they want to).

hw/m48t59.c:alarm_cb was initialising tm_now in a wrong place, this
should be fixed now. I will apply if there are no objections.

diff --git a/hw/m48t59.c b/hw/m48t59.c
index 45c05a0..b781f50 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -53,7 +53,7 @@ struct m48t59_t {
 time_t   time_offset;
 time_t   stop_time;
 /* Alarm  watchdog */
-time_t   alarm;
+struct tm alarm;
 struct QEMUTimer *alrm_timer;
 struct QEMUTimer *wd_timer;
 /* NVRAM storage */
@@ -74,35 +74,10 @@ static inline uint8_t fromBCD (uint8_t BCD)
 return ((BCD  4) * 10) + (BCD  0x0F);
 }

-/* RTC management helpers */
-static void get_time (m48t59_t *NVRAM, struct tm *tm)
-{
-time_t t;
-
-t = time(NULL) + NVRAM-time_offset;
-#ifdef _WIN32
-memcpy(tm,localtime(t),sizeof(*tm));
-#else
-if (rtc_utc)
-gmtime_r (t, tm);
-else
-localtime_r (t, tm) ;
-#endif
-}
-
-static void set_time (m48t59_t *NVRAM, struct tm *tm)
-{
-time_t now, new_time;
-
-new_time = mktime(tm);
-now = time(NULL);
-NVRAM-time_offset = new_time - now;
-}
-
 /* Alarm management */
 static void alarm_cb (void *opaque)
 {
-struct tm tm, tm_now;
+struct tm tm;
 uint64_t next_time;
 m48t59_t *NVRAM = opaque;

@@ -111,62 +86,62 @@ static void alarm_cb (void *opaque)
(NVRAM-buffer[0x1FF4]  0x80) == 0 
(NVRAM-buffer[0x1FF3]  0x80) == 0 
(NVRAM-buffer[0x1FF2]  0x80) == 0) {
-   /* Repeat once a month */
-   get_time(NVRAM, tm_now);
-   memcpy(tm, tm_now, sizeof(struct tm));
-   tm.tm_mon++;
-   if (tm.tm_mon == 13) {
-   tm.tm_mon = 1;
-   tm.tm_year++;
-   }
-   next_time = mktime(tm);
+/* Repeat once a month */
+qemu_get_timedate(tm, NVRAM-time_offset);
+tm.tm_mon++;
+if (tm.tm_mon == 13) {
+tm.tm_mon = 1;
+tm.tm_year++;
+}
+next_time = qemu_timedate_diff(tm) - NVRAM-time_offset;
 } else if ((NVRAM-buffer[0x1FF5]  0x80) != 0 
   (NVRAM-buffer[0x1FF4]  0x80) == 0 
   (NVRAM-buffer[0x1FF3]  0x80) == 0 
   (NVRAM-buffer[0x1FF2]  0x80) == 0) {
-   /* Repeat once a day */
-   next_time = 24 * 60 * 60 + mktime(tm_now);
+/* Repeat once a day */
+next_time = 24 * 60 * 60;
 } else if ((NVRAM-buffer[0x1FF5]  0x80) != 0 
   (NVRAM-buffer[0x1FF4]  0x80) != 0 
   (NVRAM-buffer[0x1FF3]  0x80) == 0 
   (NVRAM-buffer[0x1FF2]  0x80) == 0) {
-   /* Repeat once an hour */
-   next_time = 60 * 60 + mktime(tm_now);
+/* Repeat once an hour */
+next_time = 60 * 60;
 } else if ((NVRAM-buffer[0x1FF5]  0x80) != 0 
   (NVRAM-buffer[0x1FF4]  0x80) != 0 
   (NVRAM-buffer[0x1FF3]  0x80) != 0 
   (NVRAM-buffer[0x1FF2]  0x80) == 0) {
-   /* Repeat once a minute */
-   next_time = 60 + mktime(tm_now);
+/* Repeat once a minute */
+next_time = 60;
 } else {
-   /* Repeat once a second */
-   next_time = 1 + mktime(tm_now);
+/* Repeat once a second */
+next_time = 1;
 }
-qemu_mod_timer(NVRAM-alrm_timer, next_time * 1000);
+qemu_mod_timer(NVRAM-alrm_timer, qemu_get_clock(vm_clock) +
+next_time * 1000);
 qemu_set_irq(NVRAM-IRQ, 0);
 }

+static void set_alarm (m48t59_t *NVRAM)
+{
+int diff;
+if (NVRAM-alrm_timer != NULL) {
+qemu_del_timer(NVRAM-alrm_timer);
+diff = qemu_timedate_diff(NVRAM-alarm) - NVRAM-time_offset;
+if (diff  0)
+qemu_mod_timer(NVRAM-alrm_timer, diff * 1000);
+}
+}

-static void get_alarm (m48t59_t *NVRAM, struct tm *tm)
+/* RTC management helpers */
+static inline void get_time (m48t59_t *NVRAM, struct tm *tm)
 {
-#ifdef _WIN32
-memcpy(tm,localtime(NVRAM-alarm),sizeof(*tm));
-#else
-if (rtc_utc)
-gmtime_r (NVRAM-alarm, tm);
-else
-localtime_r (NVRAM-alarm, tm);
-#endif
+qemu_get_timedate(tm, NVRAM-time_offset);
 }

-static void set_alarm (m48t59_t *NVRAM, struct tm *tm)
+static void set_time (m48t59_t *NVRAM, struct tm *tm)
 {
-NVRAM-alarm = mktime(tm);
-if (NVRAM-alrm_timer != NULL) {
-qemu_del_timer(NVRAM-alrm_timer);
-if (NVRAM-alarm - time(NULL)  0)
-qemu_mod_timer(NVRAM-alrm_timer, NVRAM-alarm * 1000);
-}
+NVRAM-time_offset = qemu_timedate_diff(tm);
+set_alarm(NVRAM);
 }

 /* Watchdog management */
@@ -229,40 +204,36 @@ void m48t59_write (void *opaque, uint32_t addr,
uint32_t val)
 /* alarm seconds */
 tmp = fromBCD(val  0x7F);
 if (tmp = 0  tmp = 59) {
-get_alarm(NVRAM, tm);
-

[Qemu-devel] qemu Makefile Makefile.target configure console...

2008-02-10 Thread Andrzej Zaborowski
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Andrzej Zaborowski balrog 08/02/10 16:33:14

Modified files:
.  : Makefile Makefile.target configure console.c 
 console.h monitor.c vl.c vnc.c 
hw : cirrus_vga.c jazz_led.c omap_lcdc.c pl110.c 
 pxa2xx_lcd.c ssd0303.c ssd0323.c tcx.c vga.c 
 vga_int.h vmware_vga.c 
Added files:
.  : curses.c curses_keys.h 

Log message:
Add an ncurses UI.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile?cvsroot=qemur1=1.145r2=1.146
http://cvs.savannah.gnu.org/viewcvs/qemu/Makefile.target?cvsroot=qemur1=1.244r2=1.245
http://cvs.savannah.gnu.org/viewcvs/qemu/configure?cvsroot=qemur1=1.187r2=1.188
http://cvs.savannah.gnu.org/viewcvs/qemu/console.c?cvsroot=qemur1=1.18r2=1.19
http://cvs.savannah.gnu.org/viewcvs/qemu/console.h?cvsroot=qemur1=1.1r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemu/monitor.c?cvsroot=qemur1=1.93r2=1.94
http://cvs.savannah.gnu.org/viewcvs/qemu/vl.c?cvsroot=qemur1=1.404r2=1.405
http://cvs.savannah.gnu.org/viewcvs/qemu/vnc.c?cvsroot=qemur1=1.34r2=1.35
http://cvs.savannah.gnu.org/viewcvs/qemu/curses.c?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/curses_keys.h?cvsroot=qemurev=1.1
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/cirrus_vga.c?cvsroot=qemur1=1.30r2=1.31
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/jazz_led.c?cvsroot=qemur1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/omap_lcdc.c?cvsroot=qemur1=1.3r2=1.4
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/pl110.c?cvsroot=qemur1=1.15r2=1.16
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/pxa2xx_lcd.c?cvsroot=qemur1=1.10r2=1.11
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ssd0303.c?cvsroot=qemur1=1.2r2=1.3
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/ssd0323.c?cvsroot=qemur1=1.4r2=1.5
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/tcx.c?cvsroot=qemur1=1.26r2=1.27
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/vga.c?cvsroot=qemur1=1.59r2=1.60
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/vga_int.h?cvsroot=qemur1=1.15r2=1.16
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/vmware_vga.c?cvsroot=qemur1=1.6r2=1.7




[Qemu-devel] qemu/hw omap.h omap_i2c.c

2008-02-10 Thread Andrzej Zaborowski
CVSROOT:/sources/qemu
Module name:qemu
Changes by: Andrzej Zaborowski balrog 08/02/10 17:02:23

Modified files:
hw : omap.h omap_i2c.c 

Log message:
Make omap I2C controller work (previously untested).  Implement 
post-OMAP1 changes.  Introduce omap L4 abstraction.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/omap.h?cvsroot=qemur1=1.21r2=1.22
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/omap_i2c.c?cvsroot=qemur1=1.3r2=1.4




[Qemu-devel] [PATCH]version.rc patch

2008-02-10 Thread C.W. Betts
First of all, I'd like to thank Johannes Schindelin for all the help and 
patience when dealing with a newbie like me.


This is a patch that will add version information to the Windows executable.
Index: Makefile.target
===
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.245
diff -u -r1.245 Makefile.target
--- Makefile.target 10 Feb 2008 16:33:12 - 1.245
+++ Makefile.target 10 Feb 2008 18:08:44 -
@@ -638,6 +638,7 @@

ifdef CONFIG_WIN32
SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
+OBJS+=version.o
endif

# profiling code
@@ -654,6 +655,9 @@
%.o: %.c
 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $

+%.o: %.rc
+ windres -I. -DORIGINAL_FILENAME=\$(QEMU_PROG)\ -c -o $ $@
+
%.o: %.S
 $(CC) $(CPPFLAGS) -c -o $@ $

Index: configure
===
RCS file: /sources/qemu/qemu/configure,v
retrieving revision 1.188
diff -u -r1.188 configure
--- configure 10 Feb 2008 16:33:12 - 1.188
+++ configure 10 Feb 2008 18:08:45 -
@@ -1089,6 +1089,10 @@
echo # Automatically generated by configure - do not modify  $config_mak
echo /* Automatically generated by configure - do not modify */  
$config_h


+if test $mingw32 = yes ; then
+echo #define QEMU_FILEVERSION $(tr . ,  VERSION),0  $config_h
+echo #define QEMU_PRODUCTVERSION $(tr . ,  VERSION),0  $config_h
+fi

echo include ../config-host.mak  $config_mak
echo #include \../config-host.h\  $config_h
Index: version.rc
===
diff -u /dev/null version.rc
--- /dev/null Sun Feb 10 11:08:50 2008
+++ version.rc Fri Feb  8 15:41:46 2008
@@ -0,0 +1,22 @@
+#include config.h
+
+1 VERSIONINFO
+FILEVERSION QEMU_FILEVERSION
+PRODUCTVERSION QEMU_PRODUCTVERSION
+FILETYPE 0x1 //VFT_APP
+ {
+BLOCK StringFileInfo
+  {
+  BLOCK 040904E4
+  {
+   VALUE FileDescription, Qemu System emulator,  TARGET_ARCH  version
+   VALUE FileVersion, QEMU_VERSION
+   VALUE LegalCopyright, GNU General Public License
+   VALUE ProductName, Qemu
+  }
+ }
+BLOCK VarFileInfo
+ {
+  VALUE Translation, 0x0409, 1252
+ }
+} 


versionrc.diff
Description: Binary data


[Qemu-devel] Switch back from graphical mode to text mode

2008-02-10 Thread Samuel Thibault
Hello,

Thanks for merging the ncurses interface, that'll be very useful!

However there is a small bug when switching back from graphical mode to
text mode in vga.c: in graphical mode, the text screen is resized to
60x3 so as to display a message, but nothing is done to make sure that
it will be reset back to e.g.  80x25 when switching back to text mode.
The attached patch fixes that by recording when a message is displayed
(and thus fake resize performed), and when going back to text mode,
force the resize.

Samuel

Index: hw/vga.c
===
RCS file: /sources/qemu/qemu/hw/vga.c,v
retrieving revision 1.60
diff -u -p -r1.60 vga.c
--- hw/vga.c10 Feb 2008 16:33:14 -  1.60
+++ hw/vga.c10 Feb 2008 18:58:17 -
@@ -1152,7 +1152,7 @@ static void vga_draw_text(VGAState *s, i
 }
 
 if (width != s-last_width || height != s-last_height ||
-cw != s-last_cw || cheight != s-last_ch) {
+cw != s-last_cw || cheight != s-last_ch || s-message_screen) {
 s-last_scr_width = width * cw;
 s-last_scr_height = height * cheight;
 dpy_resize(s-ds, s-last_scr_width, s-last_scr_height);
@@ -1160,6 +1160,7 @@ static void vga_draw_text(VGAState *s, i
 s-last_height = height;
 s-last_ch = cheight;
 s-last_cw = cw;
+s-message_screen = 0;
 full_update = 1;
 }
 cursor_offset = ((s-cr[0x0e]  8) | s-cr[0x0f]) - s-start_addr;
@@ -1724,7 +1725,7 @@ static void vga_update_text(void *opaque
 }
 
 if (width != s-last_width || height != s-last_height ||
-cw != s-last_cw || cheight != s-last_ch) {
+cw != s-last_cw || cheight != s-last_ch || s-message_screen) {
 s-last_scr_width = width * cw;
 s-last_scr_height = height * cheight;
 dpy_resize(s-ds, width, height);
@@ -1732,6 +1733,7 @@ static void vga_update_text(void *opaque
 s-last_height = height;
 s-last_ch = cheight;
 s-last_cw = cw;
+s-message_screen = 0;
 full_update = 1;
 }
 
@@ -1806,6 +1808,7 @@ static void vga_update_text(void *opaque
 /* Display a message */
 dpy_cursor(s-ds, -1, -1);
 dpy_resize(s-ds, 60, 3);
+s-message_screen = 1;
 
 for (dst = chardata, i = 0; i  60 * 3; i ++)
 console_write_ch(dst ++, ' ');
Index: hw/vga_int.h
===
RCS file: /sources/qemu/qemu/hw/vga_int.h,v
retrieving revision 1.16
diff -u -p -r1.16 vga_int.h
--- hw/vga_int.h10 Feb 2008 16:33:14 -  1.16
+++ hw/vga_int.h10 Feb 2008 18:58:17 -
@@ -129,6 +129,7 @@
 uint32_t line_compare;  \
 uint32_t start_addr;\
 uint32_t plane_updated; \
+int message_screen; \
 uint8_t last_cw, last_ch;   \
 uint32_t last_width, last_height; /* in chars or pixels */  \
 uint32_t last_scr_width, last_scr_height; /* in pixels */   \




Re: [Qemu-devel] [PATCH] loadvm for read-only snapshot files

2008-02-10 Thread Eddie Kohler

andrzej zaborowski wrote:

On 03/02/2008, Eddie Kohler [EMAIL PROTECTED] wrote:

The following patch, against cvs, supports read-only snapshots on read-only
qcow2 image files.  Snapshots can be loaded, but not saved.  This is really
useful in my context, which is operating systems projects; a read-only memory
snapshot allows students to share a snapshot that skips the boot process,
allowing them to run their code right away.

Please let me know if anything needs changing.


Instead of including block_int.h in vl.c you should use the provided
functions from block.h (bs-drv can be checked with _is_inserted).


Thanks for the comment.  The attached patch introduces a new block.h function, 
bdev_is_snapshot_capable.  Better?


Eddie

Index: block-qcow2.c
===
RCS file: /sources/qemu/qemu/block-qcow2.c,v
retrieving revision 1.10
diff -u -u -r1.10 block-qcow2.c
--- block-qcow2.c	11 Nov 2007 02:51:16 -	1.10
+++ block-qcow2.c	10 Feb 2008 23:54:34 -
@@ -429,7 +429,6 @@
 BDRVQcowState *s = bs-opaque;
 int new_l1_size, new_l1_size2, ret, i;
 uint64_t *new_l1_table;
-uint64_t new_l1_table_offset;
 uint64_t data64;
 uint32_t data32;
 
@@ -450,28 +449,32 @@
 memcpy(new_l1_table, s-l1_table, s-l1_size * sizeof(uint64_t));
 
 /* write new table (align to cluster) */
-new_l1_table_offset = alloc_clusters(bs, new_l1_size2);
+if (!bs-read_only) {
+	uint64_t new_l1_table_offset = alloc_clusters(bs, new_l1_size2);
 
-for(i = 0; i  s-l1_size; i++)
-new_l1_table[i] = cpu_to_be64(new_l1_table[i]);
-ret = bdrv_pwrite(s-hd, new_l1_table_offset, new_l1_table, new_l1_size2);
-if (ret != new_l1_size2)
-goto fail;
-for(i = 0; i  s-l1_size; i++)
-new_l1_table[i] = be64_to_cpu(new_l1_table[i]);
-
-/* set new table */
-data64 = cpu_to_be64(new_l1_table_offset);
-if (bdrv_pwrite(s-hd, offsetof(QCowHeader, l1_table_offset),
-data64, sizeof(data64)) != sizeof(data64))
-goto fail;
-data32 = cpu_to_be32(new_l1_size);
-if (bdrv_pwrite(s-hd, offsetof(QCowHeader, l1_size),
-data32, sizeof(data32)) != sizeof(data32))
-goto fail;
+	for(i = 0; i  s-l1_size; i++)
+	new_l1_table[i] = cpu_to_be64(new_l1_table[i]);
+	ret = bdrv_pwrite(s-hd, new_l1_table_offset, new_l1_table, new_l1_size2);
+	if (ret != new_l1_size2)
+	goto fail;
+	for(i = 0; i  s-l1_size; i++)
+	new_l1_table[i] = be64_to_cpu(new_l1_table[i]);
+
+	/* set new table */
+	data64 = cpu_to_be64(new_l1_table_offset);
+	if (bdrv_pwrite(s-hd, offsetof(QCowHeader, l1_table_offset),
+			data64, sizeof(data64)) != sizeof(data64))
+	goto fail;
+	data32 = cpu_to_be32(new_l1_size);
+	if (bdrv_pwrite(s-hd, offsetof(QCowHeader, l1_size),
+			data32, sizeof(data32)) != sizeof(data32))
+	goto fail;
+	free_clusters(bs, s-l1_table_offset, s-l1_size * sizeof(uint64_t));
+	
+	s-l1_table_offset = new_l1_table_offset;
+}
+
 qemu_free(s-l1_table);
-free_clusters(bs, s-l1_table_offset, s-l1_size * sizeof(uint64_t));
-s-l1_table_offset = new_l1_table_offset;
 s-l1_table = new_l1_table;
 s-l1_size = new_l1_size;
 return 0;
@@ -521,7 +524,8 @@
 /* update the L1 entry */
 s-l1_table[l1_index] = l2_offset | QCOW_OFLAG_COPIED;
 tmp = cpu_to_be64(l2_offset | QCOW_OFLAG_COPIED);
-if (bdrv_pwrite(s-hd, s-l1_table_offset + l1_index * sizeof(tmp),
+if (!bs-read_only 
+	bdrv_pwrite(s-hd, s-l1_table_offset + l1_index * sizeof(tmp),
 tmp, sizeof(tmp)) != sizeof(tmp))
 return 0;
 min_index = l2_cache_new_entry(bs);
@@ -535,7 +539,8 @@
 s-l2_size * sizeof(uint64_t))
 return 0;
 }
-if (bdrv_pwrite(s-hd, l2_offset,
+if (!bs-read_only 
+	bdrv_pwrite(s-hd, l2_offset,
 l2_table, s-l2_size * sizeof(uint64_t)) !=
 s-l2_size * sizeof(uint64_t))
 return 0;
@@ -624,7 +629,8 @@
 }
 /* update L2 table */
 l2_table[l2_index] = tmp;
-if (bdrv_pwrite(s-hd,
+if (!bs-read_only 
+	bdrv_pwrite(s-hd,
 l2_offset + l2_index * sizeof(tmp), tmp, sizeof(tmp)) != sizeof(tmp))
 return 0;
 return cluster_offset;
@@ -1322,7 +1328,7 @@
 }
 }
 }
-if (l2_modified) {
+if (l2_modified  !bs-read_only) {
 if (bdrv_pwrite(s-hd,
 l2_offset, l2_table, l2_size) != l2_size)
 goto fail;
@@ -1342,7 +1348,7 @@
 }
 }
 }
-if (l1_modified) {
+if (l1_modified  !bs-read_only) {
 for(i = 0; i  l1_size; i++)
 cpu_to_be64s(l1_table[i]);
 if (bdrv_pwrite(s-hd, l1_table_offset, l1_table,
@@ -1553,6 +1559,9 @@
 int i, ret;
 uint64_t *l1_table = NULL;
 
+if 

[Qemu-devel] [PATCH] sparc32 mmu register fixes

2008-02-10 Thread Robert Reif
This patch gets openboot prom mmu register self tests passing for lx, 
ss4, ss5 and ss10 prom images.
Index: target-sparc/cpu.h
===
RCS file: /sources/qemu/qemu/target-sparc/cpu.h,v
retrieving revision 1.61
diff -p -u -r1.61 cpu.h
--- target-sparc/cpu.h  28 Nov 2007 20:54:33 -  1.61
+++ target-sparc/cpu.h  11 Feb 2008 00:07:10 -
@@ -198,6 +198,10 @@ typedef struct CPUSPARCState {
 int interrupt_request;
 int halted;
 uint32_t mmu_bm;
+uint32_t mmu_ctpr_mask;
+uint32_t mmu_cxr_mask;
+uint32_t mmu_sfsr_mask;
+uint32_t mmu_trcr_mask;
 /* NOTE: we allow 8 more registers to handle wrapping */
 target_ulong regbase[NWINDOWS * 16 + 8];
 
Index: target-sparc/helper.c
===
RCS file: /sources/qemu/qemu/target-sparc/helper.c,v
retrieving revision 1.33
diff -p -u -r1.33 helper.c
--- target-sparc/helper.c   25 Dec 2007 07:49:10 -  1.33
+++ target-sparc/helper.c   11 Feb 2008 00:07:11 -
@@ -129,7 +129,7 @@ int get_physical_address (CPUState *env,
 
 /* SPARC reference MMU table walk: Context table-L1-L2-PTE */
 /* Context base + context number */
-pde_ptr = ((env-mmuregs[1]  ~63) 4) + (env-mmuregs[2]  2);
+pde_ptr = (env-mmuregs[1]  4) + (env-mmuregs[2]  2);
 pde = ldl_phys(pde_ptr);
 
 /* Ctx pde */
Index: target-sparc/op_helper.c
===
RCS file: /sources/qemu/qemu/target-sparc/op_helper.c,v
retrieving revision 1.65
diff -p -u -r1.65 op_helper.c
--- target-sparc/op_helper.c1 Jan 2008 17:07:39 -   1.65
+++ target-sparc/op_helper.c11 Feb 2008 00:07:12 -
@@ -591,7 +591,7 @@ void helper_st_asi(int asi, int size)
 
 oldreg = env-mmuregs[reg];
 switch(reg) {
-case 0:
+case 0: // Control Register
 env-mmuregs[reg] = (env-mmuregs[reg]  0xff00) |
 (T1  0x00ff);
 // Mappings generated during no-fault mode or MMU
@@ -600,21 +600,27 @@ void helper_st_asi(int asi, int size)
 (env-mmuregs[reg]  (MMU_E | MMU_NF | env-mmu_bm)))
 tlb_flush(env, 1);
 break;
-case 2:
-env-mmuregs[reg] = T1;
+case 1: // Context Table Pointer Register
+env-mmuregs[reg] = T1  env-mmu_ctpr_mask;
+break;
+case 2: // Context Register
+env-mmuregs[reg] = T1  env-mmu_cxr_mask;
 if (oldreg != env-mmuregs[reg]) {
 /* we flush when the MMU context changes because
QEMU has no MMU context support */
 tlb_flush(env, 1);
 }
 break;
-case 3:
-case 4:
+case 3: // Synchronous Fault Status Register with Clear
+case 4: // Synchronous Fault Address Register
+break;
+case 0x10: // TLB Replacement Control Register
+env-mmuregs[reg] = T1  env-mmu_trcr_mask;
 break;
-case 0x13:
-env-mmuregs[3] = T1;
+case 0x13: // Synchronous Fault Status Register with Read and Clear
+env-mmuregs[3] = T1  env-mmu_sfsr_mask;
 break;
-case 0x14:
+case 0x14: // Synchronous Fault Address Register
 env-mmuregs[4] = T1;
 break;
 default:
Index: target-sparc/translate.c
===
RCS file: /sources/qemu/qemu/target-sparc/translate.c,v
retrieving revision 1.86
diff -p -u -r1.86 translate.c
--- target-sparc/translate.c1 Feb 2008 10:50:11 -   1.86
+++ target-sparc/translate.c11 Feb 2008 00:07:14 -
@@ -62,6 +62,10 @@ struct sparc_def_t {
 uint32_t fpu_version;
 uint32_t mmu_version;
 uint32_t mmu_bm;
+uint32_t mmu_ctpr_mask;
+uint32_t mmu_cxr_mask;
+uint32_t mmu_sfsr_mask;
+uint32_t mmu_trcr_mask;
 };
 
 static const sparc_def_t *cpu_sparc_find_by_name(const unsigned char *name);
@@ -3758,6 +3762,10 @@ CPUSPARCState *cpu_sparc_init(const char
 env-fsr = def-fpu_version;
 #if !defined(TARGET_SPARC64)
 env-mmu_bm = def-mmu_bm;
+env-mmu_ctpr_mask = def-mmu_ctpr_mask;
+env-mmu_cxr_mask = def-mmu_cxr_mask;
+env-mmu_sfsr_mask = def-mmu_sfsr_mask;
+env-mmu_trcr_mask = def-mmu_trcr_mask;
 env-mmuregs[0] |= def-mmu_version;
 cpu_sparc_set_id(env, 0);
 #endif
@@ -3887,6 +3895,10 @@ static const sparc_def_t sparc_defs[] = 
 .fpu_version = 4  17, /* FPU version 4 (Meiko) */
 .mmu_version = 0x00  24, /* Impl 0, ver 0 */
 .mmu_bm = 0x4000,
+.mmu_ctpr_mask = 0x0070,
+.mmu_cxr_mask = 0x003f,
+