xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: Keir Fraser <keir.xen@gmail.com>
Cc: xen-devel@lists.xen.org
Subject: Re: fixed location of share info page in HVM guests
Date: Mon, 22 Oct 2012 20:50:36 +0200	[thread overview]
Message-ID: <20121022185036.GA15348@aepfle.de> (raw)
In-Reply-To: <CC626CC9.3CFA1%keir.xen@gmail.com>

On Tue, Aug 28, Keir Fraser wrote:

> On 28/08/2012 09:23, "Olaf Hering" <olaf@aepfle.de> wrote:
> 
> > On Tue, Aug 28, Keir Fraser wrote:
> > 
> >> How about we guarantee that guests can use the 1MB in address range
> >> 0xFED00000-0xFEDFFFFF for whatever mappings they like, guaranteed unused (or
> >> at least, mapped with nothing useful) when guest kernel starts?
> >> 
> >> This is already, and has always been, the case. But we can etch it in stone
> >> quite easily. :)
> > 
> > 0xFED00000UL is appearently the hpet base adress. But if there is room
> > after that, then lets use that. However, I'm not familiar with these
> > things. Should the area appear in the E820 map as reserverd? If so,
> > where is the code which configures the guests E820 map?
> 
> Okay, that was a bit too clever, trying to hide between IOAPIC and LAPIC
> pages. How about a bit lower in memory -- FE700000-FE7FFFFF?
> 
> Everything in range FC000000-FFFFFFFF should already be marked
> E820_RESERVED. You can test that, and also see
> tools/firmware/hvmloader/e820.c:build_e820_table() (and note that
> RESERVED_MEMBASE == FC000000).
> 
> Can document in hvmloader/config.h and have mem_alloc() test against it
> rather than hvm_info->reserved_mem_pgstart.

I came up with this (perhaps whitespace damaged) change, the guest still boots ok.
The asl part is just copy&paste from the HPET part.

Olaf

---
 tools/firmware/hvmloader/acpi/dsdt.asl |   23 +++++++++++++++++++++++
 tools/firmware/hvmloader/config.h      |    2 ++
 tools/firmware/hvmloader/util.c        |    8 ++++++++
 xen/arch/x86/hvm/hvm.c                 |    4 ++++
 4 files changed, 37 insertions(+)

Index: xen-4.2.0-testing/tools/firmware/hvmloader/acpi/dsdt.asl
===================================================================
--- xen-4.2.0-testing.orig/tools/firmware/hvmloader/acpi/dsdt.asl
+++ xen-4.2.0-testing/tools/firmware/hvmloader/acpi/dsdt.asl
@@ -50,6 +50,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2,
            UAR1, 1,
            UAR2, 1,
            LTP1, 1,
+           XENR, 1,
            HPET, 1,
            Offset(4),
            PMIN, 32,
@@ -166,6 +167,28 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2,
                 Return (PRT0)
             }

+            Device(XENR) {
+                Name(_UID, 0)
+                Method (_STA, 0, NotSerialized) {
+                    If(LEqual(\_SB.XENR, 0)) {
+                        Return(0x00)
+                    } Else {
+                        Return(0x0F)
+                    }
+                }
+                Name(_CRS, ResourceTemplate() {
+                    DWordMemory(
+                        ResourceConsumer, PosDecode, MinFixed, MaxFixed,
+                        NonCacheable, ReadWrite,
+                        0x00000000,
+                        0xFE700000,
+                        0xFE7FFFFF,
+                        0x00000000,
+                        0x00100000 /* 1M memory: FE700000 - FE7FFFFF */
+                    )
+                })
+            }
+
             Device(HPET) {
                 Name(_HID,  EISAID("PNP0103"))
                 Name(_UID, 0)
Index: xen-4.2.0-testing/tools/firmware/hvmloader/config.h
===================================================================
--- xen-4.2.0-testing.orig/tools/firmware/hvmloader/config.h
+++ xen-4.2.0-testing/tools/firmware/hvmloader/config.h
@@ -66,6 +66,8 @@ extern unsigned long pci_mem_start, pci_
 /* NB. ACPI_INFO_PHYSICAL_ADDRESS *MUST* match definition in acpi/dsdt.asl! */
 #define ACPI_INFO_PHYSICAL_ADDRESS    0xFC000000
 #define RESERVED_MEMORY_DYNAMIC       0xFC001000
+#define HVM_SHARED_INFO_AREA          0xFE700000
+#define HVM_SHARED_INFO_SIZE          0x00100000

 extern unsigned long scratch_start;

Index: xen-4.2.0-testing/tools/firmware/hvmloader/util.c
===================================================================
--- xen-4.2.0-testing.orig/tools/firmware/hvmloader/util.c
+++ xen-4.2.0-testing/tools/firmware/hvmloader/util.c
@@ -433,11 +433,19 @@ void *mem_alloc(uint32_t size, uint32_t
     if ( align < 16 )
         align = 16;

+retry:
     s = (reserve + align) & ~(align - 1);
     e = s + size - 1;

     BUG_ON((e < s) || (e >> PAGE_SHIFT) >= hvm_info->reserved_mem_pgstart);

+    /* Skip the shared info region */
+    if (s <= HVM_SHARED_INFO_AREA && e >= HVM_SHARED_INFO_AREA) {
+           printf("%s: skipping HVM_SHARED_INFO_AREA: s %08x e %08x r %08x", __func__, s, e, reserve);
+           reserve = HVM_SHARED_INFO_AREA + HVM_SHARED_INFO_SIZE - 1;
+           goto retry;
+    }
+
     while ( (reserve >> PAGE_SHIFT) != (e >> PAGE_SHIFT) )
     {
         reserve += PAGE_SIZE;

  parent reply	other threads:[~2012-10-22 18:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-27 17:55 fixed location of share info page in HVM guests Olaf Hering
2012-08-27 18:10 ` Keir Fraser
2012-08-27 21:32   ` Olaf Hering
2012-08-27 21:51     ` Keir Fraser
2012-08-27 21:56       ` Olaf Hering
2012-08-28  0:13         ` Keir Fraser
2012-08-28  8:23           ` Olaf Hering
2012-08-28 11:40             ` Keir Fraser
2012-08-28 12:42               ` Olaf Hering
2012-08-28 13:35                 ` Keir Fraser
2012-08-31 23:43                   ` Konrad Rzeszutek Wilk
2012-10-23 19:49                     ` Olaf Hering
2012-10-24  7:31                       ` Jan Beulich
2012-10-24 14:54                         ` Olaf Hering
2012-10-22 18:50               ` Olaf Hering [this message]
2012-10-22 12:15                 ` Keir Fraser
2012-10-23  7:34                 ` Jan Beulich
2012-10-23 20:27                   ` Olaf Hering

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=20121022185036.GA15348@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=keir.xen@gmail.com \
    --cc=xen-devel@lists.xen.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).