qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Izik Eidus <izike@qumranet.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: kvm-devel@lists.sourceforge.net,
	Paul Brook <paul@codesourcery.com>,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [kvm-devel] [PATCH 1/6] Use correct types to enable > 2G support
Date: Sun, 03 Feb 2008 10:58:11 +0200	[thread overview]
Message-ID: <1202029091.8452.3.camel@localhost.localdomain> (raw)
In-Reply-To: <1201818980-27534-2-git-send-email-aliguori@us.ibm.com>


On Thu, 2008-01-31 at 16:36 -0600, Anthony Liguori wrote:
> KVM supports more than 2GB of memory for x86_64 hosts.  The following patch
> fixes a number of type related issues where int's were being used when they
> shouldn't have been.  It also introduces CMOS support so the BIOS can build
> the appropriate e820 tables.
the CMOS addresses that we used to register the above 4 giga memory are
reserved and therefor the qemu bios does not know them
you have to patch the bios as well to make it work with above 4 giga

i once wrote this patch to qemu,

hope it still apply.

commit 21ea5f8286fd9cd7124dfa0865a213613b51add5
Author: Izik Eidus <izike@qumranet.com>
Date:   Mon Aug 20 17:46:04 2007 +0300

    kvm: bios: add support to memory above the pci hole
    
    the new memory region is mapped after address 0x100000000,
    the bios take the size of the memory after the 0x100000000 from
    three new cmos bytes.

diff --git a/bios/rombios.c b/bios/rombios.c
index 9ea2dbc..ac918ad 100644
--- a/bios/rombios.c
+++ b/bios/rombios.c
@@ -4078,22 +4078,25 @@ BX_DEBUG_INT15("case default:\n");
 #endif
 

-void set_e820_range(ES, DI, start, end, type)
+void set_e820_range(ES, DI, start, end, extra_start, extra_end, type)
      Bit16u ES;
      Bit16u DI;
      Bit32u start;
      Bit32u end;
+     Bit8u extra_start;
+     Bit8u extra_end;
      Bit16u type;
 {
     write_word(ES, DI, start);
     write_word(ES, DI+2, start >> 16);
-    write_word(ES, DI+4, 0x00);
+    write_word(ES, DI+4, extra_start);
     write_word(ES, DI+6, 0x00);
 
     end -= start;
+    extra_end -= extra_start;
     write_word(ES, DI+8, end);
     write_word(ES, DI+10, end >> 16);
-    write_word(ES, DI+12, 0x0000);
+    write_word(ES, DI+12, extra_end);
     write_word(ES, DI+14, 0x0000);
 
     write_word(ES, DI+16, type);
@@ -4106,7 +4109,9 @@ int15_function32(regs, ES, DS, FLAGS)
   Bit16u ES, DS, FLAGS;
 {
   Bit32u  extended_memory_size=0; // 64bits long
+  Bit32u  extra_lowbits_memory_size=0;
   Bit16u  CX,DX;
+  Bit8u   extra_highbits_memory_size=0;
 
 BX_DEBUG_INT15("int15 AX=%04x\n",regs.u.r16.ax);
 
@@ -4179,11 +4184,18 @@ ASM_END
                     extended_memory_size *= 1024;
                 }
 
+                extra_lowbits_memory_size = inb_cmos(0x5c);
+                extra_lowbits_memory_size <<= 8;
+                extra_lowbits_memory_size |= inb_cmos(0x5b);
+                extra_lowbits_memory_size *= 64;
+                extra_lowbits_memory_size *= 1024;
+                extra_highbits_memory_size = inb_cmos(0x5d);
+
                 switch(regs.u.r16.bx)
                 {
                     case 0:
                         set_e820_range(ES, regs.u.r16.di,
-                                       0x0000000L, 0x0009fc00L, 1);
+                                       0x0000000L, 0x0009fc00L, 0, 0, 1);
                         regs.u.r32.ebx = 1;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;
@@ -4192,7 +4204,7 @@ ASM_END
                         break;
                     case 1:
                         set_e820_range(ES, regs.u.r16.di,
-                                       0x0009fc00L, 0x000a0000L, 2);
+                                       0x0009fc00L, 0x000a0000L, 0, 0, 2);
                         regs.u.r32.ebx = 2;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;
@@ -4201,7 +4213,7 @@ ASM_END
                         break;
                     case 2:
                         set_e820_range(ES, regs.u.r16.di,
-                                       0x000e8000L, 0x00100000L, 2);
+                                       0x000e8000L, 0x00100000L, 0, 0, 2);
                         regs.u.r32.ebx = 3;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;
@@ -4211,7 +4223,7 @@ ASM_END
                     case 3:
                         set_e820_range(ES, regs.u.r16.di,
                                        0x00100000L,
-                                       extended_memory_size - ACPI_DATA_SIZE, 1);
+                                       extended_memory_size - ACPI_DATA_SIZE ,0, 0, 1);
                         regs.u.r32.ebx = 4;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;
@@ -4221,7 +4233,7 @@ ASM_END
                     case 4:
                         set_e820_range(ES, regs.u.r16.di,
                                        extended_memory_size - ACPI_DATA_SIZE,
-                                       extended_memory_size, 3); // ACPI RAM
+                                       extended_memory_size ,0, 0, 3); // ACPI RAM
                         regs.u.r32.ebx = 5;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;
@@ -4231,7 +4243,20 @@ ASM_END
                     case 5:
                         /* 256KB BIOS area at the end of 4 GB */
                         set_e820_range(ES, regs.u.r16.di,
-                                       0xfffc0000L, 0x00000000L, 2);
+                                       0xfffc0000L, 0x00000000L ,0, 0, 2);
+                        if (extra_highbits_memory_size || extra_lowbits_memory_size)
+                            regs.u.r32.ebx = 6;
+                        else
+                            regs.u.r32.ebx = 0;
+                        regs.u.r32.eax = 0x534D4150;
+                        regs.u.r32.ecx = 0x14;
+                        CLEAR_CF();
+                        return;
+                    case 6:
+                        /* Maping of memory above 4 GB */
+                        set_e820_range(ES, regs.u.r16.di, 0x00000000L,
+                        extra_lowbits_memory_size, 1, extra_highbits_memory_size
+                                       + 1, 1);
                         regs.u.r32.ebx = 0;
                         regs.u.r32.eax = 0x534D4150;
                         regs.u.r32.ecx = 0x14;

  parent reply	other threads:[~2008-02-03  8:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 22:36 [Qemu-devel] [PATCH 0/6] Support for the Kernel Virtual Machine interface Anthony Liguori
2008-01-31 22:36 ` [Qemu-devel] [PATCH 1/6] Use correct types to enable > 2G support Anthony Liguori
2008-01-31 23:54   ` [Qemu-devel] " Paul Brook
2008-02-01  0:25     ` Anthony Liguori
2008-02-01  0:37       ` Paul Brook
2008-02-01  0:40         ` Anthony Liguori
2008-02-01 10:26   ` Fabrice Bellard
2008-02-01 14:35     ` Anthony Liguori
2008-02-01 15:13       ` Avi Kivity
2008-02-01 11:56         ` Robert William Fuller
2008-02-01 16:09           ` M. Warner Losh
2008-02-01 16:47             ` Philip Boulain
2008-02-01 17:35           ` Jamie Lokier
2008-02-01 15:33         ` [Qemu-devel] Re: [kvm-devel] " Anthony Liguori
2008-02-01 15:40           ` Ian Jackson
2008-02-01 17:53             ` [kvm-devel] [Qemu-devel] " Anthony Liguori
2008-02-01 17:57               ` Daniel P. Berrange
2008-02-01 20:31                 ` Anthony Liguori
2008-02-01 21:33                   ` Paul Brook
2008-02-01 16:00       ` Paul Brook
2008-02-01 16:21         ` Fabrice Bellard
2008-02-05 11:34           ` Ian Jackson
2008-02-01 17:49         ` [Qemu-devel] Re: [kvm-devel] " Anthony Liguori
2008-02-03  8:58   ` Izik Eidus [this message]
2008-01-31 22:36 ` [Qemu-devel] [PATCH 2/6] SCI fixes Anthony Liguori
2008-01-31 22:36 ` [Qemu-devel] [PATCH 3/6] Fix daemonize options Anthony Liguori
2008-01-31 22:36 ` [Qemu-devel] [PATCH 4/6] Tell BIOS about the number of CPUs Anthony Liguori
2008-02-01  0:14   ` [Qemu-devel] " Paul Brook
2008-02-01  0:28     ` Anthony Liguori
2008-02-01  0:40       ` Paul Brook
2008-01-31 22:36 ` [Qemu-devel] [PATCH 5/6] Refactor option ROM loading Anthony Liguori
2008-01-31 22:36 ` [Qemu-devel] [PATCH 6/6] QEMU support for the Kernel Virtual Machine interface Anthony Liguori
2008-02-01  9:49   ` [Qemu-devel] " Fabrice Bellard
2008-02-01 14:18     ` Anthony Liguori
2008-01-31 22:53 ` [qemu-devel] [PATCH 0/6] Support " Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1202029091.8452.3.camel@localhost.localdomain \
    --to=izike@qumranet.com \
    --cc=aliguori@us.ibm.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).