Skip to contentSkip to conversation

Moving the e820 table creation into hvmloader

RFC PATCH In review Stefan Berger 2 participants 3 messages Nov 7, 2006 – Nov 8, 2006

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Moving the e820 table creation into hvmloader

Missing patch included this time.

This patch moves the creation of the e820 tables from libxc into the hvmloader. I have implemented some functions around the e820 tables for adding and reserving memory areas. I am using these to build the tables and reserve memory for BIOS and ACPI data. ACPI memory area is only reserved if ACPI is enabled for the domain.

xen-unstable.hg/tools/firmware/hvmloader/Makefile +1 -1
Index: root/xen-unstable.hg/tools/firmware/hvmloader/Makefile
===================================================================
@@ -40,7 +40,7 @@ OBJCOPY  = objcopy
 CFLAGS  += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
 LDFLAGS  = -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
 
-SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c smbios.c acpi_utils.c
+SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c smbios.c acpi_utils.c e820.c
 OBJS = $(patsubst %.c,%.o,$(SRCS))
 
 .PHONY: all
xen-unstable.hg/tools/firmware/hvmloader/e820.c new file +189 -0

189 lines not on this page · raw message

xen-unstable.hg/tools/firmware/hvmloader/util.h +3 -0
Index: root/xen-unstable.hg/tools/firmware/hvmloader/util.h
===================================================================
@@ -22,6 +22,7 @@ char *strncpy(char *dest, const char *sr
 unsigned strlen(const char *s);
 int memcmp(const void *s1, const void *s2, unsigned n);
 void *memcpy(void *dest, const void *src, unsigned n);
+void *memmove(void *dest, const void *src, unsigned n);
 void *memset(void *s, int c, unsigned n);
 char *itoa(char *a, unsigned int i);
 
@@ -37,5 +38,7 @@ void uuid_to_string(char *dest, uint8_t 
 
 /* Debug output */
 void puts(const char *s);
+int printf(const char *fmt, ...);
+
 
 #endif /* __HVMLOADER_UTIL_H__ */
xen-unstable.hg/tools/firmware/hvmloader/e820.h new file +15 -0
Index: root/xen-unstable.hg/tools/firmware/hvmloader/e820.h
===================================================================
@@ -0,0 +1,15 @@
+#ifndef E820_H
+#define E820_H
+
+#define E820_MAP_NR ((unsigned char *)E820_MAP_PAGE + E820_MAP_NR_OFFSET)
+#define E820_MAP    ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
+
+void print_e820_map(struct e820entry *map, int entries);
+int build_e820_map(unsigned char *start);
+
+uint64_t e820_reserve_range(unsigned char *e820,
+                            uint64_t start,
+                            uint64_t size,
+                            uint32_t type);
+
+#endif
xen-unstable.hg/tools/firmware/hvmloader/util.c +129 -0

144 lines not on this page · raw message

xen-unstable.hg/tools/firmware/hvmloader/hvmloader.c +49 -18

91 lines not on this page · raw message

xen-unstable.hg/tools/libxc/xc_hvm_build.c +0 -63

81 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 5 lines · Stefan Berger

This patch moves the creation of the e820 tables from libxc into the hvmloader. I have implemented some functions around the e820 tables for adding and reserving memory areas. I am using these to build the tables and reserve memory for BIOS and ACPI data. ACPI memory area is only reserved if ACPI is enabled for the domain.

We can just make the ACPI range statically a page bigger. It's no big loss (consider that we squander >100kB of memory between 0xC0000 and 0xF0000 right now), and at some point in the near future we'll get rid of the acpi option and always produce ACPI tables. There are just a few interrupt issues to sort out first.

The printk patch could be useful, however, since hvmloader is going to get more complicated in other ways and we'll want to get tracing out of it.

-- Keir

#2 lore raw

Keir Fraser <[email protected]> wrote on 11/07/2006 01:51:50 PM:

Quoted 4 lines · Stefan Berger
Quoted 3 lines

This patch moves the creation of the e820 tables from libxc into the hvmloader. I have implemented some functions around the e820 tables

for

Quoted 1 line
Quoted 1 line

adding and reserving memory areas. I am using these to build the

tables

Quoted 4 lines
Quoted 2 lines

and reserve memory for BIOS and ACPI data. ACPI memory area is only reserved if ACPI is enabled for the domain.

We can just make the ACPI range statically a page bigger. It's no big

loss

Quoted 2 lines

(consider that we squander >100kB of memory between 0xC0000 and 0xF0000 right now), and at some point in the near future we'll get rid of the

acpi

Quoted 1 line

option and always produce ACPI tables. There are just a few interrupt

issues

Quoted 1 line

to sort out first.

So I suppose you are not going to take the patch.

Quoted 2 lines

The printk patch could be useful, however, since hvmloader is going to

get

Quoted 1 line

more complicated in other ways and we'll want to get tracing out of it.

Which printk patch? Are you going to disable debugging there altogther?

Stefan

Quoted 4 lines

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel