Re: [Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons

2019-05-27 Thread Bernhard M. Wiedemann
On 23/05/2019 23.27, Eduardo Habkost wrote:
> On Thu, May 23, 2019 at 07:57:38PM +0100, Dr. David Alan Gilbert wrote:
>> * Bernhard M. Wiedemann (bwiedem...@suse.de) wrote:
>>> Without this patch, a VM on a Opteron G3 host will have the svm flag, but
>>> the kvm-amd module fails to load in there, complaining that it needs
>>> cpuid 0x800a
>>>
>>> I have successfully built and tested this for 3+ years in production
>>> on Opteron G3 servers.
> 
> Have you reproduced the bug on QEMU 2.8 or newer?  The problem
> you describe should be fixed by the following commit (from ~2.5
> years ago).
> 
> commit 0c3d7c0051576d220e6da0a8ac08f2d8482e2f0b
> target-i386: Enable CPUID[0x800A] if SVM is enabled

I was still on qemu-2.6.2 so it is good to know that this might work out
of the box with 2.8+

Thanks for the pointer.



[Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons

2019-05-16 Thread Bernhard M. Wiedemann
Without this patch, a VM on a Opteron G3 host will have the svm flag, but
the kvm-amd module fails to load in there, complaining that it needs
cpuid 0x800a

I have successfully built and tested this for 3+ years in production
on Opteron G3 servers.

Signed-off-by: Bernhard M. Wiedemann 
---
 target/i386/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 722c5514d4..df1d81ded8 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2723,7 +2723,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
 CPUID_EXT_SSE3,
 .features[FEAT_8000_0001_EDX] =
 CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
-.xlevel = 0x8008,
+.xlevel = 0x800A,
 .model_id = "AMD Opteron 240 (Gen 1 Class Opteron)",
 },
 {
@@ -2745,7 +2745,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
 CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
 .features[FEAT_8000_0001_ECX] =
 CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
-.xlevel = 0x8008,
+.xlevel = 0x800A,
 .model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)",
 },
 {
@@ -2770,7 +2770,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
 .features[FEAT_8000_0001_ECX] =
 CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A |
 CPUID_EXT3_ABM | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
-.xlevel = 0x8008,
+.xlevel = 0x800A,
 .model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)",
 },
 {
-- 
2.16.4




[Qemu-devel] [PATCH] i386: Fix nested SVM on older Opterons

2019-05-16 Thread Bernhard M. Wiedemann
Without this patch, a VM on a Opteron G3 host will have the svm flag, but
the kvm-amd module fails to load in there, complaining that it needs
cpuid 0x800a

I have successfully built and tested this for 3+ years in production
on Opteron G3 servers.

Signed-off-by: Bernhard M. Wiedemann 
---
 target/i386/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 722c5514d4..df1d81ded8 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2723,7 +2723,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
 CPUID_EXT_SSE3,
 .features[FEAT_8000_0001_EDX] =
 CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
-.xlevel = 0x8008,
+.xlevel = 0x800A,
 .model_id = "AMD Opteron 240 (Gen 1 Class Opteron)",
 },
 {
@@ -2745,7 +2745,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
 CPUID_EXT2_LM | CPUID_EXT2_NX | CPUID_EXT2_SYSCALL,
 .features[FEAT_8000_0001_ECX] =
 CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
-.xlevel = 0x8008,
+.xlevel = 0x800A,
 .model_id = "AMD Opteron 22xx (Gen 2 Class Opteron)",
 },
 {
@@ -2770,7 +2770,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
 .features[FEAT_8000_0001_ECX] =
 CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A |
 CPUID_EXT3_ABM | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM,
-.xlevel = 0x8008,
+.xlevel = 0x800A,
 .model_id = "AMD Opteron 23xx (Gen 3 Class Opteron)",
 },
 {
-- 
2.16.4




[Qemu-devel] [Bug 691424] Re: qemu/kvm SDL over ssh -X broken

2016-12-16 Thread Bernhard M. Wiedemann
It seems to be working now with current versions, so has probably been
fixed somewhere.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/691424

Title:
  qemu/kvm SDL over ssh -X broken

Status in QEMU:
  Incomplete

Bug description:
  qemu/kvm by default uses SDL to render the output of its emulated VGA 
graphics.
  This is broken over ssh -X since quite a while.
  The only workaround I know, is to use qemu -vnc :0
  and connect using vncviewer

  
  How To Reproduce:
  1. zypper in qemu
  2. ssh -X localhost qemu -cdrom ANYISOFILE

  Actual Results:
  qemu hangs in an endless loop on the BIOS display screen

  Expected Results:
  should boot up the iso as 0.10 versions did

  Reproducible: Always

  
  this is what broke it:
  $ git bisect bad
  c18a2c360e3100bbd71162cf922dcd8c429a8b71 is first bad commit
  commit c18a2c360e3100bbd71162cf922dcd8c429a8b71
  Author: Stefano Stabellini 
  Date:   Wed Jun 24 11:58:25 2009 +0100

  sdl zooming

  Hi all,
  this patch implements zooming capabilities for the sdl interface.
  A new sdl_zoom_blit function is added that is able to scale and blit a
  portion of a surface into another.
  This way we can enable SDL_RESIZABLE and have a real_screen surface with
  a different size than the guest surface and let sdl_zoom_blit take care
  of the problem.

  Signed-off-by: Stefano Stabellini 
  Signed-off-by: Anthony Liguori 

  :100644 100644 a06c9bfc22cc6de1c6e5e9068d6bf59d89613767 
f8dc5065dd27010bfdbb6bcfb0c6e3af25024cdb M  Makefile
  :100644 100644 417217582363a87ee67e746ba798e285a64b6cdc 
35183399f65de6f50f3baa4767ab7d4d11d45bca M  console.h
  :100644 100644 178b5532b8d9dd2194a8662fbfdcd49b4bc04222 
d81399e51276e1c97fa1f7272ef16ea4c312b51b M  sdl.c
  :00 100644  
56d3604fc3d79e4cc4622be8437c78bf70075da3 A  sdl_zoom.c
  :00 100644  
33dc63408b43a37fd6b1acde3fa62b1a51315e75 A  sdl_zoom.h
  :00 100644  
64bbca849bd3af678c2259b4d8cc0e48c6a6b43c A  sdl_zoom_template.h

  
  This problem occurs on both Debian and openSUSE.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/691424/+subscriptions



[Qemu-devel] [Bug 601946] Re: [Feature request] qemu-img multi-threaded compressed image conversion

2015-01-28 Thread Bernhard M. Wiedemann
qcow2_write_compressed in block/qcow2.c would need to be changed. 
Currently it seems to need bigger changes as it always does compress+write for 
one block.
Not sure, how well it would handle multiple writes in parallel, so the safest 
would be to avoid that and just wait for the previous writer to finish before 
starting to write.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/601946

Title:
  [Feature request] qemu-img multi-threaded compressed image conversion

Status in QEMU:
  New

Bug description:
  Feature request:
  qemu-img multi-threaded compressed image conversion

  Suppose I want to convert raw image to compressed qcow2. Multi-
  threaded conversion will be much faster, because bottleneck is
  compressing data.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/601946/+subscriptions



[Qemu-devel] ARM brk bug

2012-02-27 Thread Bernhard M. Wiedemann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I found that running a debian arm5 bash with qemu runs into varying
problems with -R but works without. Also works fine on both armv5 and
armv7hf hardware.


This happened with both master and 1.0 builds:

curl www.zq1.de/~bernhard/temp/debian-bash-bug-nss-minimal.tar.gz |\
  tar xz
cd debian-bash-bug-nss-minimal
path/to/qemu/arm-linux-user/qemu-arm -R 500M -L . bin/bash
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault


with chroot and our openSUSE qemu-arm-binfmt (which only does some
argv[0] magic) I saw it working after rm lib/libnss*

but otherwise it failed with messages like
bash: xmalloc: ../bash/variables.c:1971: cannot allocate 2 bytes (8192
bytes allocated)


Ciao
Bernhard M.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9LnmsACgkQSTYLOx37oWT6FgCdEgIriKRVmwkaMQU6jBGN/ABP
s/EAn1cZj4KytK9iC3i6EqqfIXFyEUVX
=DCV8
-END PGP SIGNATURE-



Re: [Qemu-devel] ARM brk bug

2012-02-27 Thread Bernhard M. Wiedemann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 02/27/2012 04:32 PM, Peter Maydell wrote:
 On 27 February 2012 15:16, Bernhard M. Wiedemann
 bwiedem...@suse.de wrote:
 I found that running a debian arm5 bash with qemu runs into
 varying problems with -R but works without. Also works fine on
 both armv5 and armv7hf hardware.
 
 
 This happened with both master and 1.0 builds:
 
 curl www.zq1.de/~bernhard/temp/debian-bash-bug-nss-minimal.tar.gz
 |\ tar xz cd debian-bash-bug-nss-minimal 
 path/to/qemu/arm-linux-user/qemu-arm -R 500M -L . bin/bash qemu:
 uncaught target signal 11 (Segmentation fault) - core dumped 
 Segmentation fault
 
 but otherwise it failed with messages like bash: xmalloc:
 ../bash/variables.c:1971: cannot allocate 2 bytes (8192 bytes
 allocated)
 
 So, er, don't do that then? This looks suspiciously like we're 
 failing an mmap() (because of the limited guest address space
 you've asked for with -R) and then bash is either failing to handle
 it and crashing or printing a message about the allocation
 failure.
 
 -- PMM

apparently, we patched qemu for openSUSE to always use -R because
otherwise java did not work (with the binfmt chroot magic).

even when I used the highest possible value for -R it did not work:

qemu-arm -R 4026M -L . bin/bash
bash: xmalloc: ../bash/variables.c:1971: cannot allocate 2 bytes (8192
bytes allocated)

even though it worked with any other arm binary I tried (including
openSUSE's bash, Debians dash etc).


Ciao
Bernhard M.
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9Lt14ACgkQSTYLOx37oWTt4ACghJYkfju/iG/jDS/51RasTwzn
HUMAoNyKiuJ3ApeLpWM4EIPAaMHVsGaT
=QN4N
-END PGP SIGNATURE-



[Qemu-devel] [Bug 691424] Re: qemu/kvm SDL over ssh -X broken

2011-04-12 Thread Bernhard M. Wiedemann
I now found that it depends on my client side. The bug happens when I ssh -XC 
from my netbook with 1024x600(intel)  to a server, but when I ssh -XC to the 
same server from my laptop with 1024x768(fbdev), then it works.
So might be that the scaling code that made the difference in my bisecting, is 
only used for small screens.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/691424

Title:
  qemu/kvm SDL over ssh -X broken

Status in QEMU:
  New

Bug description:
  qemu/kvm by default uses SDL to render the output of its emulated VGA 
graphics.
  This is broken over ssh -X since quite a while.
  The only workaround I know, is to use qemu -vnc :0
  and connect using vncviewer

  
  How To Reproduce:
  1. zypper in qemu
  2. ssh -X localhost qemu -cdrom ANYISOFILE

  Actual Results:
  qemu hangs in an endless loop on the BIOS display screen

  Expected Results:
  should boot up the iso as 0.10 versions did

  Reproducible: Always

  
  this is what broke it:
  $ git bisect bad
  c18a2c360e3100bbd71162cf922dcd8c429a8b71 is first bad commit
  commit c18a2c360e3100bbd71162cf922dcd8c429a8b71
  Author: Stefano Stabellini stefano.stabell...@eu.citrix.com
  Date:   Wed Jun 24 11:58:25 2009 +0100

  sdl zooming

  Hi all,
  this patch implements zooming capabilities for the sdl interface.
  A new sdl_zoom_blit function is added that is able to scale and blit a
  portion of a surface into another.
  This way we can enable SDL_RESIZABLE and have a real_screen surface with
  a different size than the guest surface and let sdl_zoom_blit take care
  of the problem.

  Signed-off-by: Stefano Stabellini stefano.stabell...@eu.citrix.com
  Signed-off-by: Anthony Liguori aligu...@us.ibm.com

  :100644 100644 a06c9bfc22cc6de1c6e5e9068d6bf59d89613767 
f8dc5065dd27010bfdbb6bcfb0c6e3af25024cdb M  Makefile
  :100644 100644 417217582363a87ee67e746ba798e285a64b6cdc 
35183399f65de6f50f3baa4767ab7d4d11d45bca M  console.h
  :100644 100644 178b5532b8d9dd2194a8662fbfdcd49b4bc04222 
d81399e51276e1c97fa1f7272ef16ea4c312b51b M  sdl.c
  :00 100644  
56d3604fc3d79e4cc4622be8437c78bf70075da3 A  sdl_zoom.c
  :00 100644  
33dc63408b43a37fd6b1acde3fa62b1a51315e75 A  sdl_zoom.h
  :00 100644  
64bbca849bd3af678c2259b4d8cc0e48c6a6b43c A  sdl_zoom_template.h

  
  This problem occurs on both Debian and openSUSE.



[Qemu-devel] [Bug 752476] Re: monitor command mouse_button 1 moves mouse

2011-04-08 Thread Bernhard M. Wiedemann
Hi.

I build a kvm-0.14 with this patch on top and it finally allowed me to issue a 
click using mouse_button via monitor.
Great! Thanks!


For my automated tests I use kvm like this:
/usr/bin/qemu-kvm -m 1024 -net user -monitor tcp:127.0.0.1:15222,server,nowait 
-net nic,model=virtio,macaddr=52:54:00:12:34:56 -serial file:serial0 -drive 
file=raid/l1,if=virtio,boot=on -boot dc -cdrom 
/opensuse/factory/iso/openSUSE-NET-i586-Build0046-Media.iso -vnc :99 -k de -cpu 
qemu32 -usb -usbdevice tablet

VNC is only there for manual interaction with automated testruns. All 
automation goes over the monitor interface.
Moving+Clicking over VNC/SDL of course always worked.

However, I found that even without -usbdevice tablet it will use
absolute mouse with openSUSE. It mentions VMMOUSE in /var/log/Xorg.0.log

I also noticed that when using VNC to move the mouse, the next
mouse_button command will move to the last position set with mouse_move
- not a problem for my needs, though.

SDL on a headless server is not possible because of Bug #691424

Btw: test results can be seen on http://openqa.opensuse.org/results/

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/752476

Title:
  monitor command mouse_button 1 moves mouse

Status in QEMU:
  New

Bug description:
  via the qemu -monitor interface, it is possible to move and click the mouse 
using
  mouse_move 2 1
  mouse_button 1
  but the mouse_button command always moves the mouse to (0,0) making it rather 
unusable to (auto-)trigger any widgets in the VM from the outside.

  Would be nice to have this available for my qemu/kvm based os-autoinst
  testing framework.



[Qemu-devel] [Bug 752476] [NEW] monitor command mouse_button 1 moves mouse

2011-04-06 Thread Bernhard M. Wiedemann
Public bug reported:

via the qemu -monitor interface, it is possible to move and click the mouse 
using
mouse_move 2 1
mouse_button 1
but the mouse_button command always moves the mouse to (0,0) making it rather 
unusable to (auto-)trigger any widgets in the VM from the outside.

Would be nice to have this available for my qemu/kvm based os-autoinst
testing framework.

** Affects: qemu
 Importance: Undecided
 Status: New


** Tags: click monitor mouse

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/752476

Title:
  monitor command mouse_button 1 moves mouse

Status in QEMU:
  New

Bug description:
  via the qemu -monitor interface, it is possible to move and click the mouse 
using
  mouse_move 2 1
  mouse_button 1
  but the mouse_button command always moves the mouse to (0,0) making it rather 
unusable to (auto-)trigger any widgets in the VM from the outside.

  Would be nice to have this available for my qemu/kvm based os-autoinst
  testing framework.



[Qemu-devel] [Bug 691424] Re: qemu/kvm SDL over ssh -X broken

2010-12-17 Thread Bernhard M. Wiedemann
One possible way to get X11-forwarding back on qemu master is to disable
zoom by this patch.

But I do not know why the do_sdl_resize function should be problematic.
There is probably a better solution.

** Patch added: disable zoom
   
https://bugs.launchpad.net/qemu/+bug/691424/+attachment/1769014/+files/sdl-x11-fix1.diff

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/691424

Title:
  qemu/kvm SDL over ssh -X broken

Status in QEMU:
  New

Bug description:
  qemu/kvm by default uses SDL to render the output of its emulated VGA 
graphics.
This is broken over ssh -X since quite a while.
The only workaround I know, is to use qemu -vnc :0
and connect using vncviewer


How To Reproduce:
1. zypper in qemu
2. ssh -X localhost qemu -cdrom ANYISOFILE

Actual Results:
qemu hangs in an endless loop on the BIOS display screen

Expected Results:
should boot up the iso as 0.10 versions did

Reproducible: Always


this is what broke it:
$ git bisect bad
c18a2c360e3100bbd71162cf922dcd8c429a8b71 is first bad commit
commit c18a2c360e3100bbd71162cf922dcd8c429a8b71
Author: Stefano Stabellini stefano.stabell...@eu.citrix.com
Date:   Wed Jun 24 11:58:25 2009 +0100

sdl zooming

Hi all,
this patch implements zooming capabilities for the sdl interface.
A new sdl_zoom_blit function is added that is able to scale and blit a
portion of a surface into another.
This way we can enable SDL_RESIZABLE and have a real_screen surface with
a different size than the guest surface and let sdl_zoom_blit take care
of the problem.

Signed-off-by: Stefano Stabellini stefano.stabell...@eu.citrix.com
Signed-off-by: Anthony Liguori aligu...@us.ibm.com

:100644 100644 a06c9bfc22cc6de1c6e5e9068d6bf59d89613767 
f8dc5065dd27010bfdbb6bcfb0c6e3af25024cdb M  Makefile
:100644 100644 417217582363a87ee67e746ba798e285a64b6cdc 
35183399f65de6f50f3baa4767ab7d4d11d45bca M  console.h
:100644 100644 178b5532b8d9dd2194a8662fbfdcd49b4bc04222 
d81399e51276e1c97fa1f7272ef16ea4c312b51b M  sdl.c
:00 100644  
56d3604fc3d79e4cc4622be8437c78bf70075da3 A  sdl_zoom.c
:00 100644  
33dc63408b43a37fd6b1acde3fa62b1a51315e75 A  sdl_zoom.h
:00 100644  
64bbca849bd3af678c2259b4d8cc0e48c6a6b43c A  sdl_zoom_template.h


This problem occurs on both Debian and openSUSE.





[Qemu-devel] [PATCH] Extra scan codes for missing keys

2010-06-01 Thread Bernhard M. Wiedemann
The code comes from
http://lists.gnu.org/archive/html/qemu-devel/2010-05/msg02788.html

Without this patch it is not possible to send at least 10 special
characters (\|'`~:;[]{}) via the monitor sendkey command.

Signed-off-by: Bernhard M. Wiedemann qemudev...@lsmod.de
---
 monitor.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/monitor.c b/monitor.c
index 15b53b9..09ff8cf 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1563,6 +1563,8 @@ static const KeyDef key_defs[] = {
 { 0x17, i },
 { 0x18, o },
 { 0x19, p },
+{ 0x1a, sqr_brack_l },
+{ 0x1b, sqr_brack_r },
 
 { 0x1c, ret },
 
@@ -1575,7 +1577,11 @@ static const KeyDef key_defs[] = {
 { 0x24, j },
 { 0x25, k },
 { 0x26, l },
+{ 0x27, semicolon },
+{ 0x28, apostrophe },
+{ 0x29, grave_accent },
 
+{ 0x2b, backslash },
 { 0x2c, z },
 { 0x2d, x },
 { 0x2e, c },
-- 
1.5.6.5



[Qemu-devel] [PATCH] Extra scan codes for missing keys

2010-06-01 Thread Bernhard M. Wiedemann
The code comes from
http://lists.gnu.org/archive/html/qemu-devel/2010-05/msg02788.html

Without this patch it is not possible to send at least 10 special
characters (\|'`~:;[]{}) via the monitor sendkey command.

Signed-off-by: Bernhard M. Wiedemann qemudev...@lsmod.de
---
 monitor.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/monitor.c b/monitor.c
index 15b53b9..1635040 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1563,7 +1563,8 @@ static const KeyDef key_defs[] = {
 { 0x17, i },
 { 0x18, o },
 { 0x19, p },
-
+{ 0x1a, bracket_left },
+{ 0x1b, bracket_right },
 { 0x1c, ret },
 
 { 0x1e, a },
@@ -1575,7 +1576,11 @@ static const KeyDef key_defs[] = {
 { 0x24, j },
 { 0x25, k },
 { 0x26, l },
+{ 0x27, semicolon },
+{ 0x28, apostrophe },
+{ 0x29, grave_accent },
 
+{ 0x2b, backslash },
 { 0x2c, z },
 { 0x2d, x },
 { 0x2e, c },
-- 
1.5.6.5



[Qemu-devel] [PATCH] hw: better i440 emulation

2010-04-20 Thread Bernhard M. Wiedemann
updated version of an old patch
http://xenon.stanford.edu/~eswierk/misc/qemu-linuxbios/qemu-piix-ram-size.patch
that together with
http://www.mail-archive.com/linuxb...@linuxbios.org/msg02390.html
(which is already in coreboot trunk) allows coreboot to autodetect the amount 
of RAM within qemu/kvm from a register in i440 northbridge.

The message on the old patch states:
Unfortunately the current version of qemu does not set these
registers, but I have patched qemu so that it emulates the i440 more
faithfully in this regard.

Signed-off-by: Bernhard M. Wiedemann qemudev...@lsmod.de
---
 hw/pc.c   |2 +-
 hw/pc.h   |2 +-
 hw/piix_pci.c |7 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index b797f21..eec0864 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -926,7 +926,7 @@ static void pc_init1(ram_addr_t ram_size,
 isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
 
 if (pci_enabled) {
-pci_bus = i440fx_init(i440fx_state, piix3_devfn, isa_irq);
+pci_bus = i440fx_init(i440fx_state, piix3_devfn, isa_irq, ram_size);
 } else {
 pci_bus = NULL;
 isa_bus_new(NULL);
diff --git a/hw/pc.h b/hw/pc.h
index 5f86b37..d11a576 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -107,7 +107,7 @@ int pcspk_audio_init(qemu_irq *pic);
 struct PCII440FXState;
 typedef struct PCII440FXState PCII440FXState;
 
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq 
*pic);
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq 
*pic, int ram_size);
 void i440fx_set_smm(PCII440FXState *d, int val);
 void i440fx_init_memory_mappings(PCII440FXState *d);
 
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index cd12212..97519db 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -213,7 +213,7 @@ static int i440fx_initfn(PCIDevice *dev)
 return 0;
 }
 
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq 
*pic)
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq 
*pic, int ram_size)
 {
 DeviceState *dev;
 PCIBus *b;
@@ -238,6 +238,11 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int 
*piix3_devfn, qemu_irq *
 
 *piix3_devfn = piix3-dev.devfn;
 
+ram_size = ram_size / 8 / 1024 / 1024;
+if (ram_size  255)
+ram_size = 255;
+(*pi440fx_state)-dev.config[0x57]=ram_size;
+
 return b;
 }
 
-- 
1.5.6.5




[Qemu-devel] [PATCH 1/1] hw: better i440 emulation

2010-04-19 Thread Bernhard M. Wiedemann
attached is a tested 0.12.3-version of an old patch
http://xenon.stanford.edu/~eswierk/misc/qemu-linuxbios/qemu-piix-ram-size.patch
that together with
http://www.mail-archive.com/linuxb...@linuxbios.org/msg02390.html
(which is already in coreboot trunk) allows coreboot BIOS to autodetect the 
amount of RAM within qemu/kvm from a register in i440 northbridge.

The message on the old patch states:
Unfortunately the current version of qemu does not set these
registers, but I have patched qemu so that it emulates the i440 more
faithfully in this regard.



new patch is also available at
http://www.zq1.de/~bernhard/linux/qemu-0.12.3-piix-ram-size.patch

Please discuss or apply this patch.

regards
Bernhard M. Wiedemann
--
software engineer
diff -ru ./hw/pc.c ../qpatch/hw/pc.c
--- ./hw/pc.c	2010-02-26 03:34:00.0 +0100
+++ ../qpatch/hw/pc.c	2010-04-19 17:18:12.0 +0200
@@ -1130,7 +1130,7 @@
 }
 
 if (pci_enabled) {
-pci_bus = i440fx_init(i440fx_state, piix3_devfn, isa_irq);
+pci_bus = i440fx_init(i440fx_state, piix3_devfn, isa_irq, ram_size);
 } else {
 pci_bus = NULL;
 isa_bus_new(NULL);
diff -ru ./hw/pc.h ../qpatch/hw/pc.h
--- ./hw/pc.h	2010-02-26 03:34:00.0 +0100
+++ ../qpatch/hw/pc.h	2010-04-19 17:10:50.0 +0200
@@ -129,7 +129,7 @@
 struct PCII440FXState;
 typedef struct PCII440FXState PCII440FXState;
 
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic);
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic, int ram_size);
 void i440fx_set_smm(PCII440FXState *d, int val);
 void i440fx_init_memory_mappings(PCII440FXState *d);
 
diff -ru ./hw/piix_pci.c ../qpatch/hw/piix_pci.c
--- ./hw/piix_pci.c	2010-02-26 03:34:00.0 +0100
+++ ../qpatch/hw/piix_pci.c	2010-04-19 17:27:59.0 +0200
@@ -209,7 +209,7 @@
 
 static PIIX3State *piix3_dev;
 
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic)
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic, int ram_size)
 {
 DeviceState *dev;
 PCIBus *b;
@@ -236,6 +236,11 @@
 
 piix3_dev = piix3;
 
+ram_size = ram_size / 8 / 1024 / 1024;
+if (ram_size  255)
+ram_size = 255;
+(*pi440fx_state)-dev.config[0x57]=ram_size;
+
 return b;
 }