|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] fixed location of share info page in HVM guests
On Tue, Aug 28, Keir Fraser wrote:
> On 28/08/2012 09:23, "Olaf Hering" <olaf@xxxxxxxxx> 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;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |