xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Keir Fraser <keir@xen.org>
To: Kevin O'Connor <kevin@koconnor.net>,
	Julian Pidancet <julian.pidancet@gmail.com>
Cc: xen-devel@lists.xensource.com, seabios@seabios.org,
	ian.campbell@citrix.com
Subject: Re: Re: [PATCH] SeaBIOS/Xen: Compute the low RAM memory size in the BDA according to the e820
Date: Mon, 14 Nov 2011 13:23:41 +0000	[thread overview]
Message-ID: <CAE6C6DF.34049%keir@xen.org> (raw)
In-Reply-To: <CAE687A1.24CDF%keir.xen@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]

On 14/11/2011 08:53, "Keir Fraser" <keir.xen@gmail.com> wrote:

> On 14/11/2011 03:36, "Kevin O'Connor" <kevin@koconnor.net> wrote:
> 
>> On Xen, the PCI init code isn't used, so assuming this struct doesn't
>> need to live in real "ram", I think it could live just about anywhere
>> past the end of ram.  Even with pciinit.c, addresses over 0xfc00000
>> (with the exception of a few bytes for hpet, apic, ioapic, and bios
>> image) could be used.
> 
> I suggest we stick it at FC000000, and shift hvmloader's mem_alloc()
> starting address up by one page to FC001000. The acpi build code will have
> to manually mem_hole_populate_ram() that one page before writing to it. This
> can then be documented in hvmloader/config.h which contains a description
> of, and defines for, the system memory map. This is by far the easiest
> solution to this problem; manually crafting an SSDT is a right pain in the
> arse, whereas this is maybe a 5-line patch.

Like the attached patch (untested), which is a bit larger than anticipated,
but actually allows code to be net deleted. :-)

 -- Keir

>  -- Keir
> 
>> -Kevin
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
> 
> 


[-- Attachment #2: 00-relocate-acpi-info --]
[-- Type: application/octet-stream, Size: 6105 bytes --]

diff -r 0844b17df7a9 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c	Fri Nov 11 18:14:35 2011 +0000
+++ b/tools/firmware/hvmloader/acpi/build.c	Mon Nov 14 13:20:26 2011 +0000
@@ -276,7 +276,7 @@ static int construct_secondary_tables(un
 
 void acpi_build_tables(struct acpi_config *config, unsigned int physical)
 {
-    struct acpi_info *acpi_info = (struct acpi_info *)ACPI_INFO_PHYSICAL_ADDRESS;
+    struct acpi_info *acpi_info;
     struct acpi_20_rsdp *rsdp;
     struct acpi_20_rsdt *rsdt;
     struct acpi_20_xsdt *xsdt;
@@ -287,6 +287,9 @@ void acpi_build_tables(struct acpi_confi
     unsigned long        secondary_tables[16];
     int                  nr_secondaries, i;
 
+    /* Allocate and initialise the acpi info area. */
+    mem_hole_populate_ram(ACPI_INFO_PHYSICAL_ADDRESS >> PAGE_SHIFT, 1);
+    acpi_info = (struct acpi_info *)ACPI_INFO_PHYSICAL_ADDRESS;
     memset(acpi_info, 0, sizeof(*acpi_info));
 
     /*
diff -r 0844b17df7a9 tools/firmware/hvmloader/acpi/dsdt.asl
--- a/tools/firmware/hvmloader/acpi/dsdt.asl	Fri Nov 11 18:14:35 2011 +0000
+++ b/tools/firmware/hvmloader/acpi/dsdt.asl	Mon Nov 14 13:20:26 2011 +0000
@@ -61,8 +61,8 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, 
 
     Scope (\_SB)
     {
-       /* ACPI_INFO_PHYSICAL_ADDRESS == 0x9F000 */
-       OperationRegion(BIOS, SystemMemory, 0x9F000, 24)
+       /* ACPI_INFO_PHYSICAL_ADDRESS == 0xFC000000 */
+       OperationRegion(BIOS, SystemMemory, 0xFC000000, 24)
        Field(BIOS, ByteAcc, NoLock, Preserve) {
            UAR1, 1,
            UAR2, 1,
diff -r 0844b17df7a9 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h	Fri Nov 11 18:14:35 2011 +0000
+++ b/tools/firmware/hvmloader/config.h	Mon Nov 14 13:20:26 2011 +0000
@@ -54,18 +54,17 @@ extern struct bios_config seabios_config
 #define PCI_MEM_END         0xfc000000
 extern unsigned long pci_mem_start, pci_mem_end;
 
-/* Reserved for special BIOS mappings, etc. */
-#define RESERVED_MEMBASE    0xfc000000
 
 /* Memory map. */
 #define SCRATCH_PHYSICAL_ADDRESS      0x00010000
 #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
-#define ACPI_INFO_PHYSICAL_ADDRESS    0x0009F000
 #define VGABIOS_PHYSICAL_ADDRESS      0x000C0000
 #define HVMLOADER_PHYSICAL_ADDRESS    0x00100000
-
-#define ACPI_INFO_SIZE                     0xC00
-#define ACPI_INFO_PHYSICAL_END (ACPI_INFO_PHYSICAL_ADDRESS + ACPI_INFO_SIZE)
+/* Special BIOS mappings, etc. are allocated from here upwards... */
+#define RESERVED_MEMBASE              0xFC000000
+/* NB. ACPI_INFO_PHYSICAL_ADDRESS *MUST* match definition in acpi/dsdt.asl! */
+#define ACPI_INFO_PHYSICAL_ADDRESS    0xFC000000
+#define RESERVED_MEMORY_DYNAMIC       0xFC001000
 
 extern unsigned long scratch_start;
 
diff -r 0844b17df7a9 tools/firmware/hvmloader/e820.c
--- a/tools/firmware/hvmloader/e820.c	Fri Nov 11 18:14:35 2011 +0000
+++ b/tools/firmware/hvmloader/e820.c	Mon Nov 14 13:20:26 2011 +0000
@@ -81,55 +81,24 @@ int build_e820_table(struct e820entry *e
     /* Lowmem must be at least 512K to keep Windows happy) */
     ASSERT ( lowmem_reserved_base > 512<<10 );
 
-    /*
-     * Lowmem reservation must either cover the ACPI info region
-     * entirely or not at all. Sitting half way through suggests
-     * something funny is going on.
-     */
-    ASSERT ( lowmem_reserved_base < ACPI_INFO_PHYSICAL_ADDRESS ||
-             lowmem_reserved_base > ACPI_INFO_PHYSICAL_END );
-
     ASSERT ( bios_image_base < 0x100000 );
 
-    if ( lowmem_reserved_base < ACPI_INFO_PHYSICAL_ADDRESS )
+    /*
+     * 0x0-lowmem_reserved_base: Ordinary RAM.
+     */
+    e820[nr].addr = 0x00000;
+    e820[nr].size = lowmem_reserved_base;
+    e820[nr].type = E820_RAM;
+    nr++;
+
+    /* lowmem_reserved_base-0xA0000: reserved by BIOS implementation. */
+    if ( lowmem_reserved_base < 0xA0000 )
     {
-        /*
-         * 0x0-lowmem_reserved_base: Ordinary RAM.
-         */
-        e820[nr].addr = 0x00000;
-        e820[nr].size = lowmem_reserved_base;
-        e820[nr].type = E820_RAM;
-        nr++;
-    }
-    else
-    {
-        /* 0x0-ACPI_INFO: Ordinary RAM. */
-        e820[nr].addr = 0x00000;
-        e820[nr].size = ACPI_INFO_PHYSICAL_ADDRESS;
-        e820[nr].type = E820_RAM;
-        nr++;
-
-        /* ACPI INFO: Reserved. */
-        e820[nr].addr = ACPI_INFO_PHYSICAL_ADDRESS;
-        e820[nr].size = ACPI_INFO_SIZE;
+        /* Reserved for internal use. */
+        e820[nr].addr = lowmem_reserved_base;
+        e820[nr].size = 0xA0000-lowmem_reserved_base;
         e820[nr].type = E820_RESERVED;
         nr++;
-
-        /* ACPI_INFO-lowmem_reserved_base: Ordinary RAM. */
-        e820[nr].addr = ACPI_INFO_PHYSICAL_END;
-        e820[nr].size = lowmem_reserved_base - ACPI_INFO_PHYSICAL_END;
-        e820[nr].type = E820_RAM;
-        nr++;
-    }
-
-    /* lowmem_reserved_base-0xa00000: reserved by BIOS implementation. */
-    if ( lowmem_reserved_base < 0xA0000 )
-    {
-            /* Reserved for internal use. */
-            e820[nr].addr = lowmem_reserved_base;
-            e820[nr].size = 0xA0000-lowmem_reserved_base;
-            e820[nr].type = E820_RESERVED;
-            nr++;
     }
 
     /*
diff -r 0844b17df7a9 tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c	Fri Nov 11 18:14:35 2011 +0000
+++ b/tools/firmware/hvmloader/rombios.c	Mon Nov 14 13:20:26 2011 +0000
@@ -47,7 +47,6 @@ static void rombios_setup_e820(void)
 {
     /*
      * 0x9E000-0x09F000: Stack.
-     * 0x9F000-0x09C000: ACPI info.
      * 0x9FC00-0x0A0000: Extended BIOS Data Area (EBDA).
      * ...
      * 0xE0000-0x0F0000: PC-specific area. We place various tables here.
diff -r 0844b17df7a9 tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c	Fri Nov 11 18:14:35 2011 +0000
+++ b/tools/firmware/hvmloader/util.c	Mon Nov 14 13:20:26 2011 +0000
@@ -343,7 +343,7 @@ void mem_hole_populate_ram(xen_pfn_t mfn
     }
 }
 
-static uint32_t reserve = RESERVED_MEMBASE - 1;
+static uint32_t reserve = RESERVED_MEMORY_DYNAMIC - 1;
 
 xen_pfn_t mem_hole_alloc(uint32_t nr_mfns)
 {

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2011-11-14 13:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14  1:50 [PATCH] SeaBIOS/Xen: Compute the low RAM memory size in the BDA according to the e820 Julian Pidancet
2011-11-14  1:11 ` Kevin O'Connor
2011-11-14  2:03   ` Julian Pidancet
2011-11-14  2:09     ` Kevin O'Connor
2011-11-14  2:48       ` Julian Pidancet
2011-11-14  3:36         ` Kevin O'Connor
2011-11-14  7:37           ` Rudolf Marek
2011-11-14  8:53           ` Keir Fraser
2011-11-14 13:23             ` Keir Fraser [this message]
2011-11-14 13:27               ` Julian Pidancet
2011-11-14 13:43               ` Kevin O'Connor
2011-11-14 19:25               ` [Xen-devel] " Julian Pidancet
2011-11-14 20:16                 ` Keir Fraser

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=CAE6C6DF.34049%keir@xen.org \
    --to=keir@xen.org \
    --cc=ian.campbell@citrix.com \
    --cc=julian.pidancet@gmail.com \
    --cc=kevin@koconnor.net \
    --cc=seabios@seabios.org \
    --cc=xen-devel@lists.xensource.com \
    /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).