Skip to contentSkip to conversation

Fixes and improvements to pvshim

PATCH In review Wei Liu 4 participants 20 messages Jan 19, 2018 – Jan 22, 2018

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover Fixes and improvements to pvshim

Wei Liu (7):
Update shim.config
libxl: remove whitespaces introduced in 62982da926 x86/guest: clean up guest/xen.h
x86/shim: use credit scheduler
x86: relocate pvh_info
Revert "x86/boot: Map more than the first 16MB"
libxl: lower shim related message to level DEBUG

 docs/man/xl.cfg.pod.5.in           |  2 +-
 tools/firmware/xen-dir/shim.config |  8 ++----
 tools/libxl/libxl_dom.c            |  8 +++---
 tools/libxl/libxl_internal.h       |  2 +-
 xen/arch/x86/boot/Makefile         |  7 ++++-
 xen/arch/x86/boot/build32.mk       |  3 ++
 xen/arch/x86/boot/defs.h           |  3 ++
 xen/arch/x86/boot/head.S           | 25 +++++++++-------
 xen/arch/x86/boot/reloc.c          | 59 +++++++++++++++++++++++++++++++++-----
 xen/arch/x86/boot/x86_64.S         |  3 +-
 xen/include/asm-x86/guest/xen.h    | 15 +++-------
 11 files changed, 93 insertions(+), 42 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#1 lore raw

PATCH v2 1/7 Update shim.config

Kconfig has

bool "VGA support" if !PV_SHIM_EXCLUSIVE

so for the shim build VGA option doesn't exist.

This avoids having shim.config changed every time the shim is built.

---
 tools/firmware/xen-dir/shim.config | 1 -
 1 file changed, 1 deletion(-)
tools/firmware/xen-dir/shim.config +0 -1
index 78b965f4c7..d5bd516632 100644
@@ -68,7 +68,6 @@ CONFIG_HAS_EHCI=y
 CONFIG_HAS_CPUFREQ=y
 CONFIG_HAS_PASSTHROUGH=y
 CONFIG_HAS_PCI=y
-# CONFIG_VGA is not set
 CONFIG_DEFCONFIG_LIST="$ARCH_DEFCONFIG"
 CONFIG_ARCH_SUPPORTS_INT128=y
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#2 lore raw

PATCH v2 2/7 libxl: remove whitespaces introduced in 62982da926

In reply to Wei Liu

No functional change.

---
 tools/libxl/libxl_dom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/libxl/libxl_dom.c +2 -2
index b03386409f..e1a3e747fc 100644
@@ -1069,7 +1069,7 @@ static int libxl__domain_firmware(libxl__gc *gc,
                 }
             }
         }
-        
+
         if (state->pv_ramdisk.path && strlen(state->pv_ramdisk.path)) {
             if (state->pv_ramdisk.mapped) {
                 rc = xc_dom_module_mem(dom, state->pv_ramdisk.data,
@@ -1183,7 +1183,7 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
 
     xc_dom_loginit(ctx->xch);
 
-    /* 
+    /*
      * If PVH and we have a shim override, use the shim cmdline.
      * If PVH and no shim override, use the pv cmdline.
      * If not PVH, use info->cmdline.
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#3 lore raw

PATCH v2 3/7 x86/guest: clean up guest/xen.h

In reply to Wei Liu

Remove extraneous semicolon. Add blank lines. Remove unused static inline functions.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>

---
 xen/include/asm-x86/guest/xen.h | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
xen/include/asm-x86/guest/xen.h +4 -11
index 11243fe60d..c0acf4c36e 100644
@@ -49,7 +49,8 @@ DECLARE_PER_CPU(struct vcpu_info *, vcpu_info);
 #define xen_guest 0
 #define pv_console 0
 
-static inline void probe_hypervisor(void) {};
+static inline void probe_hypervisor(void) {}
+
 static inline void hypervisor_setup(void)
 {
     ASSERT_UNREACHABLE();
@@ -63,20 +64,12 @@ static inline void hypervisor_fixup_e820(struct e820map *e820)
 {
     ASSERT_UNREACHABLE();
 }
+
 static inline const unsigned long *hypervisor_reserved_pages(unsigned int *size)
 {
     ASSERT_UNREACHABLE();
     return NULL;
-};
-static inline uint32_t hypervisor_cpuid_base(void)
-{
-    ASSERT_UNREACHABLE();
-    return 0;
-};
-static inline void hypervisor_resume(void)
-{
-    ASSERT_UNREACHABLE();
-};
+}
 
 #endif /* CONFIG_XEN_GUEST */
 #endif /* __X86_GUEST_XEN_H__ */
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v2 3/7
#5 lore raw

Re: [PATCH v2 3/7] x86/guest: clean up guest/xen.h

In reply to Wei Liu
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 19.01.18 at 16:34, <[email protected]> wrote:

Remove extraneous semicolon. Add blank lines. Remove unused static inline functions.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#6 lore raw

PATCH v2 4/7 x86/shim: use credit scheduler

In reply to Wei Liu

Remove sched=null from shim cmdline and doc

We use the default scheduler (credit1 as of writing). The NULL scheduler still has bugs to fix.

Update shim.config.

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 docs/man/xl.cfg.pod.5.in           | 2 +-
 tools/firmware/xen-dir/shim.config | 7 +++----
 tools/libxl/libxl_internal.h       | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
docs/man/xl.cfg.pod.5.in +1 -1
index 30fe4b8531..a699367779 100644
@@ -531,7 +531,7 @@ Ignored if pvhsim is false.
 =item B<pvshim_cmdline="STRING">
 
 Command line for the shim.
-Default is "pv-shim console=xen,pv sched=null".
+Default is "pv-shim console=xen,pv".
 Ignored if pvhsim is false.
 
 =item B<pvshim_extra="STRING">
tools/firmware/xen-dir/shim.config +3 -4
index d5bd516632..effbbd90c9 100644
@@ -49,10 +49,9 @@ CONFIG_SCHED_CREDIT=y
 # CONFIG_SCHED_CREDIT2 is not set
 # CONFIG_SCHED_RTDS is not set
 # CONFIG_SCHED_ARINC653 is not set
-CONFIG_SCHED_NULL=y
-# CONFIG_SCHED_CREDIT_DEFAULT is not set
-CONFIG_SCHED_NULL_DEFAULT=y
-CONFIG_SCHED_DEFAULT="null"
+# CONFIG_SCHED_NULL is not set
+CONFIG_SCHED_CREDIT_DEFAULT=y
+CONFIG_SCHED_DEFAULT="credit"
 # CONFIG_LIVEPATCH is not set
 # CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS is not set
 CONFIG_CMDLINE=""
tools/libxl/libxl_internal.h +1 -1
index 0f89364466..7ff9a67e50 100644
@@ -119,7 +119,7 @@
 #define DOMID_XS_PATH "domid"
 #define INVALID_DOMID ~0
 #define PVSHIM_BASENAME "xen-shim"
-#define PVSHIM_CMDLINE "pv-shim console=xen,pv sched=null"
+#define PVSHIM_CMDLINE "pv-shim console=xen,pv"
 
 /* Size macros. */
 #define __AC(X,Y)   (X##Y)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v2 4/7
#7 lore raw

Re: [PATCH v2 4/7] x86/shim: use credit scheduler

Quoted 8 lines · Wei Liu

Remove sched=null from shim cmdline and doc

We use the default scheduler (credit1 as of writing). The NULL scheduler still has bugs to fix.

Update shim.config.

Quoted 15 lines

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

---
 docs/man/xl.cfg.pod.5.in           | 2 +-
 tools/firmware/xen-dir/shim.config | 7 +++----
 tools/libxl/libxl_internal.h       | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
docs/man/xl.cfg.pod.5.in +0 -0
index 30fe4b8531..a699367779 100644

docs/man/xl.cfg.pod.5.in Ignored if pvhsim is false. · line 535

Quoted 6 lines
docs/man/xl.cfg.pod.5.in +1 -1
@@ -531,7 +531,7 @@ Ignored if pvhsim is false.
 =item B<pvshim_cmdline="STRING">
 
 Command line for the shim.
-Default is "pv-shim console=xen,pv sched=null".
+Default is "pv-shim console=xen,pv".
 Ignored if pvhsim is false.

The above chunk would be nice to backport to the 4.10 branch for correctness.

tools/libxl/libxl_internal.h line 122

Quoted 10 lines
tools/libxl/libxl_internal.h +1 -1
index 0f89364466..7ff9a67e50 100644
@@ -119,7 +119,7 @@
 #define DOMID_XS_PATH "domid"
 #define INVALID_DOMID ~0
 #define PVSHIM_BASENAME "xen-shim"
-#define PVSHIM_CMDLINE "pv-shim console=xen,pv sched=null"
+#define PVSHIM_CMDLINE "pv-shim console=xen,pv"

Together with this one. sched=null has no effect on the 4.10 branch because the shim by default is compiled without null scheduler support.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by
#8 lore raw

Re: [PATCH v2 4/7] x86/shim: use credit scheduler

Roger Pau Monné writes ("Re: [Xen-devel] [PATCH v2 4/7] x86/shim: use credit scheduler"):

Quoted 11 lines · Wei Liu
Quoted 8 lines

Remove sched=null from shim cmdline and doc

We use the default scheduler (credit1 as of writing). The NULL scheduler still has bugs to fix.

Update shim.config.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#9 lore raw

PATCH v2 5/7 x86: relocate pvh_info

In reply to Wei Liu

Modify early boot code to relocate pvh info as well, so that we can be sure __va in __start_xen works.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>

v2: use XEN_HVM_START_MAGIC_VALUE and switch statement in reloc. Move header inclusion.

---
 xen/arch/x86/boot/Makefile   |  7 +++++-
 xen/arch/x86/boot/build32.mk |  3 +++
 xen/arch/x86/boot/defs.h     |  3 +++
 xen/arch/x86/boot/head.S     | 25 ++++++++++---------
 xen/arch/x86/boot/reloc.c    | 59 ++++++++++++++++++++++++++++++++++++++------
 5 files changed, 78 insertions(+), 19 deletions(-)
xen/arch/x86/boot/Makefile +6 -1
index c6246c85d2..9fe5b309c5 100644
@@ -7,10 +7,15 @@ CMDLINE_DEPS = $(DEFS_H_DEPS) video.h
 RELOC_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/include/xen/multiboot.h \
 	     $(BASEDIR)/include/xen/multiboot2.h
 
+ifeq ($(CONFIG_PVH_GUEST),y)
+RELOC_DEPS += $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
+RELOC_EXTRA = CONFIG_PVH_GUEST=y
+endif
+
 head.o: cmdline.S reloc.S
 
 cmdline.S: cmdline.c $(CMDLINE_DEPS)
 	$(MAKE) -f build32.mk $@ CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
 reloc.S: reloc.c $(RELOC_DEPS)
-	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)"
+	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)" $(RELOC_EXTRA)
xen/arch/x86/boot/build32.mk +3 -0
index 48c7407c00..028ac19b96 100644
@@ -36,5 +36,8 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 cmdline.o: cmdline.c $(CMDLINE_DEPS)
 
 reloc.o: reloc.c $(RELOC_DEPS)
+ifeq ($(CONFIG_PVH_GUEST),y)
+reloc.o: CFLAGS += -DCONFIG_PVH_GUEST
+endif
 
 .PRECIOUS: %.bin %.lnk
xen/arch/x86/boot/defs.h +3 -0
index 6abdc15446..05921a64a3 100644
@@ -51,6 +51,9 @@ typedef unsigned short u16;
 typedef unsigned int u32;
 typedef unsigned long long u64;
 typedef unsigned int size_t;
+typedef u8 uint8_t;
+typedef u32 uint32_t;
+typedef u64 uint64_t;
 
 #define U16_MAX		((u16)(~0U))
 #define UINT_MAX	(~0U)
xen/arch/x86/boot/head.S +14 -11
index 0f652cea11..614e53081e 100644
@@ -414,6 +414,7 @@ __pvh_start:
 
         /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
         movw    $0x1000, sym_esi(trampoline_phys)
+        movl    $0x336ec578, %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */
         jmp     trampoline_setup
 
 #endif /* CONFIG_PVH_GUEST */
@@ -578,18 +579,20 @@ trampoline_setup:
         /* Get bottom-most low-memory stack address. */
         add     $TRAMPOLINE_SPACE,%ecx
 
-#ifdef CONFIG_PVH_GUEST
-        cmpb    $0, sym_fs(pvh_boot)
-        jne     1f
-#endif
-
-        /* Save the Multiboot info struct (after relocation) for later use. */
+        /* Save Multiboot / PVH info struct (after relocation) for later use. */
         push    %ecx                /* Bottom-most low-memory stack address. */
-        push    %ebx                /* Multiboot information address. */
-        push    %eax                /* Multiboot magic. */
+        push    %ebx                /* Multiboot / PVH information address. */
+        push    %eax                /* Magic number. */
         call    reloc
-        mov     %eax,sym_fs(multiboot_ptr)
+#ifdef CONFIG_PVH_GUEST
+        cmp     $0,sym_fs(pvh_boot)
+        je      1f
+        mov     %eax,sym_fs(pvh_start_info_pa)
+        jmp     2f
+#endif
 1:
+        mov     %eax,sym_fs(multiboot_ptr)
+2:
 
         /*
          * Now trampoline_phys points to the following structure (lowest address
@@ -598,12 +601,12 @@ trampoline_setup:
          * +------------------------+
          * | TRAMPOLINE_STACK_SPACE |
          * +------------------------+
-         * |        mbi data        |
+         * |     Data (MBI / PVH)   |
          * +- - - - - - - - - - - - +
          * |    TRAMPOLINE_SPACE    |
          * +------------------------+
          *
-         * mbi data grows downwards from the highest address of TRAMPOLINE_SPACE
+         * Data grows downwards from the highest address of TRAMPOLINE_SPACE
          * region to the end of the trampoline. The rest of TRAMPOLINE_SPACE is
          * reserved for trampoline code and data.
          */
xen/arch/x86/boot/reloc.c +52 -7

80 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#10 lore raw

Re: [PATCH v2 5/7] x86: relocate pvh_info

xen/arch/x86/boot/build32.mk CFLAGS := $(filter-out -flto,$(CFLAGS)) · line 41

Quoted 11 lines · Wei Liu
xen/arch/x86/boot/build32.mk +3 -0
index 48c7407c00..028ac19b96 100644
@@ -36,5 +36,8 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 cmdline.o: cmdline.c $(CMDLINE_DEPS)
 
 reloc.o: reloc.c $(RELOC_DEPS)
+ifeq ($(CONFIG_PVH_GUEST),y)
+reloc.o: CFLAGS += -DCONFIG_PVH_GUEST
+endif

I would maybe do this above, where the rest of the CFLAGS are set. Certainly setting -DCONFIG_PVH_GUEST shouldn't cause issues elsewhere.

CFLAGS-$(CONFIG_PVH_GUEST) += -DCONFIG_PVH_GUEST
CFLAGS += $(CFLAGS-y)

xen/arch/x86/boot/defs.h typedef unsigned short u16; · line 56

Quoted 12 lines
xen/arch/x86/boot/build32.mk +0 -0
 .PRECIOUS: %.bin %.lnk
xen/arch/x86/boot/defs.h +3 -0
index 6abdc15446..05921a64a3 100644
@@ -51,6 +51,9 @@ typedef unsigned short u16;
 typedef unsigned int u32;
 typedef unsigned long long u64;
 typedef unsigned int size_t;
+typedef u8 uint8_t;
+typedef u32 uint32_t;
+typedef u64 uint64_t;

This this seems to be always expanding, maybe better to simply replace the stdbool.h include above with types.h?

xen/arch/x86/boot/head.S __pvh_start: · line 417

Quoted 11 lines
xen/arch/x86/boot/defs.h +0 -0
 #define U16_MAX		((u16)(~0U))
 #define UINT_MAX	(~0U)
xen/arch/x86/boot/head.S +1 -0
index 0f652cea11..614e53081e 100644
@@ -414,6 +414,7 @@ __pvh_start:
 
         /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
         movw    $0x1000, sym_esi(trampoline_phys)
+        movl    $0x336ec578, %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */

Hm, if XEN_HVM_START_MAGIC_VALUE cannot be used I would rather prefer to use (%ebx).

Quoted 5 lines
xen/arch/x86/boot/head.S +1 -1
-multiboot_info_t __stdcall *reloc(u32 mb_magic, u32 mbi_in, u32 trampoline)
+void __stdcall *reloc(u32 magic, u32 in, u32 trampoline)
 {
     alloc = trampoline;
 

xen/arch/x86/boot/head.S __pvh_start:

Quoted 10 lines
xen/arch/x86/boot/head.S +6 -4
-    if ( mb_magic == MULTIBOOT2_BOOTLOADER_MAGIC )
-        return mbi2_reloc(mbi_in);
-    else
-        return mbi_reloc(mbi_in);
+    switch ( magic )
+    {
+    case MULTIBOOT_BOOTLOADER_MAGIC:
+        return mbi_reloc(in);
+    case MULTIBOOT2_BOOTLOADER_MAGIC:
+        return mbi2_reloc(in);

Newline between non-fallthrough cases.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#11 lore raw

Re: [PATCH v2 5/7] x86: relocate pvh_info

Quoted 19 lines · Roger Pau Monné

xen/arch/x86/boot/build32.mk CFLAGS := $(filter-out -flto,$(CFLAGS)) · line 41

Quoted 11 lines · Wei Liu
xen/arch/x86/boot/build32.mk +3 -0
index 48c7407c00..028ac19b96 100644
@@ -36,5 +36,8 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 cmdline.o: cmdline.c $(CMDLINE_DEPS)
 
 reloc.o: reloc.c $(RELOC_DEPS)
+ifeq ($(CONFIG_PVH_GUEST),y)
+reloc.o: CFLAGS += -DCONFIG_PVH_GUEST
+endif

I would maybe do this above, where the rest of the CFLAGS are set. Certainly setting -DCONFIG_PVH_GUEST shouldn't cause issues elsewhere.

CFLAGS-$(CONFIG_PVH_GUEST) += -DCONFIG_PVH_GUEST
CFLAGS += $(CFLAGS-y)

Quoted 16 lines

xen/arch/x86/boot/defs.h typedef unsigned short u16; · line 56

Quoted 12 lines
xen/arch/x86/boot/build32.mk +0 -0
 .PRECIOUS: %.bin %.lnk
xen/arch/x86/boot/defs.h +3 -0
index 6abdc15446..05921a64a3 100644
@@ -51,6 +51,9 @@ typedef unsigned short u16;
 typedef unsigned int u32;
 typedef unsigned long long u64;
 typedef unsigned int size_t;
+typedef u8 uint8_t;
+typedef u32 uint32_t;
+typedef u64 uint64_t;

This this seems to be always expanding, maybe better to simply replace the stdbool.h include above with types.h?

I'm two minded here. My impression is that this wants to be minimal and standalone. The content in types.h is a lot more than we need here.

I will let Jan and Andrew decide.

Quoted 8 lines
Quoted 8 lines
xen/arch/x86/boot/defs.h +0 -0
 #define U16_MAX		((u16)(~0U))
 #define UINT_MAX	(~0U)
xen/arch/x86/boot/head.S +0 -0
index 0f652cea11..614e53081e 100644
@@ -414,6 +414,7 @@ __pvh_start:
 
Quoted 6 lines

xen/arch/x86/boot/head.S __pvh_start: · line 417

Quoted 3 lines
xen/arch/x86/boot/head.S +1 -0
         /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
         movw    $0x1000, sym_esi(trampoline_phys)
+        movl    $0x336ec578, %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */

Hm, if XEN_HVM_START_MAGIC_VALUE cannot be used I would rather prefer to use (%ebx).

The same reason I didn't include types.h + hvm_start_info.h here.

We can include both to make $XEN_HVM_START_MAGIC_VALUE work. But I think using (%ebx) is better in here.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#12 lore raw

Re: [PATCH v2 5/7] x86: relocate pvh_info

Quoted 38 lines
Quoted 1 line
Quoted 1 line · On 19.01.18 at 17:39, <[email protected]> wrote:
Quoted 19 lines · Roger Pau Monné

xen/arch/x86/boot/build32.mk CFLAGS := $(filter-out -flto,$(CFLAGS)) · line 41

Quoted 11 lines · Wei Liu
xen/arch/x86/boot/build32.mk +3 -0
index 48c7407c00..028ac19b96 100644
@@ -36,5 +36,8 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 cmdline.o: cmdline.c $(CMDLINE_DEPS)
 
 reloc.o: reloc.c $(RELOC_DEPS)
+ifeq ($(CONFIG_PVH_GUEST),y)
+reloc.o: CFLAGS += -DCONFIG_PVH_GUEST
+endif

I would maybe do this above, where the rest of the CFLAGS are set. Certainly setting -DCONFIG_PVH_GUEST shouldn't cause issues elsewhere.

CFLAGS-$(CONFIG_PVH_GUEST) += -DCONFIG_PVH_GUEST
CFLAGS += $(CFLAGS-y)

Quoted 16 lines

xen/arch/x86/boot/defs.h typedef unsigned short u16; · line 56

Quoted 12 lines
xen/arch/x86/boot/build32.mk +0 -0
 .PRECIOUS: %.bin %.lnk
xen/arch/x86/boot/defs.h +3 -0
index 6abdc15446..05921a64a3 100644
@@ -51,6 +51,9 @@ typedef unsigned short u16;
 typedef unsigned int u32;
 typedef unsigned long long u64;
 typedef unsigned int size_t;
+typedef u8 uint8_t;
+typedef u32 uint32_t;
+typedef u64 uint64_t;

This this seems to be always expanding, maybe better to simply replace the stdbool.h include above with types.h?

Quoted 2 lines

I'm two minded here. My impression is that this wants to be minimal and standalone. The content in types.h is a lot more than we need here.

Please keep it the (minimal) way you have it.

Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
xen/arch/x86/boot/defs.h +0 -0
 #define U16_MAX		((u16)(~0U))
 #define UINT_MAX	(~0U)
xen/arch/x86/boot/head.S +0 -0
index 0f652cea11..614e53081e 100644
@@ -414,6 +414,7 @@ __pvh_start:
 
Quoted 6 lines

xen/arch/x86/boot/head.S __pvh_start: · line 417

Quoted 3 lines
xen/arch/x86/boot/head.S +1 -0
         /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
         movw    $0x1000, sym_esi(trampoline_phys)
+        movl    $0x336ec578, %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */

Hm, if XEN_HVM_START_MAGIC_VALUE cannot be used I would rather prefer to use (%ebx).

Quoted 4 lines

The same reason I didn't include types.h + hvm_start_info.h here.

We can include both to make $XEN_HVM_START_MAGIC_VALUE work. But I think using (%ebx) is better in here.

I agree (%ebx) is preferable.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#13 lore raw

Re: [PATCH v2 5/7] x86: relocate pvh_info

Quoted 58 lines · Jan Beulich
Quoted 38 lines
Quoted 1 line
Quoted 1 line · On 19.01.18 at 17:39, <[email protected]> wrote:
Quoted 19 lines · Roger Pau Monné

xen/arch/x86/boot/build32.mk CFLAGS := $(filter-out -flto,$(CFLAGS)) · line 41

Quoted 11 lines · Wei Liu
xen/arch/x86/boot/build32.mk +3 -0
index 48c7407c00..028ac19b96 100644
@@ -36,5 +36,8 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 cmdline.o: cmdline.c $(CMDLINE_DEPS)
 
 reloc.o: reloc.c $(RELOC_DEPS)
+ifeq ($(CONFIG_PVH_GUEST),y)
+reloc.o: CFLAGS += -DCONFIG_PVH_GUEST
+endif

I would maybe do this above, where the rest of the CFLAGS are set. Certainly setting -DCONFIG_PVH_GUEST shouldn't cause issues elsewhere.

CFLAGS-$(CONFIG_PVH_GUEST) += -DCONFIG_PVH_GUEST
CFLAGS += $(CFLAGS-y)

Quoted 16 lines

xen/arch/x86/boot/defs.h typedef unsigned short u16; · line 56

Quoted 12 lines
xen/arch/x86/boot/build32.mk +0 -0
 .PRECIOUS: %.bin %.lnk
xen/arch/x86/boot/defs.h +3 -0
index 6abdc15446..05921a64a3 100644
@@ -51,6 +51,9 @@ typedef unsigned short u16;
 typedef unsigned int u32;
 typedef unsigned long long u64;
 typedef unsigned int size_t;
+typedef u8 uint8_t;
+typedef u32 uint32_t;
+typedef u64 uint64_t;

This this seems to be always expanding, maybe better to simply replace the stdbool.h include above with types.h?

Quoted 2 lines

I'm two minded here. My impression is that this wants to be minimal and standalone. The content in types.h is a lot more than we need here.

Please keep it the (minimal) way you have it.

Quoted 15 lines
Quoted 14 lines

xen/arch/x86/boot/head.S __pvh_start: · line 417

Quoted 11 lines
xen/arch/x86/boot/defs.h +0 -0
 #define U16_MAX		((u16)(~0U))
 #define UINT_MAX	(~0U)
xen/arch/x86/boot/head.S +1 -0
index 0f652cea11..614e53081e 100644
@@ -414,6 +414,7 @@ __pvh_start:
 
         /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
         movw    $0x1000, sym_esi(trampoline_phys)
+        movl    $0x336ec578, %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */

Hm, if XEN_HVM_START_MAGIC_VALUE cannot be used I would rather prefer to use (%ebx).

Quoted 7 lines
Quoted 4 lines

The same reason I didn't include types.h + hvm_start_info.h here.

We can include both to make $XEN_HVM_START_MAGIC_VALUE work. But I think using (%ebx) is better in here.

I agree (%ebx) is preferable.

To avoid spamming the list with all the other acked patches, here is the updated patch.

---8<---
From 1ac0afbbc0ecd620c5fba3a03bb084bc4dafc78e Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Wed, 17 Jan 2018 18:38:02 +0000
Subject: [PATCH] x86: relocate pvh_info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Modify early boot code to relocate pvh info as well, so that we can be sure __va in __start_xen works.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Roger Pau Monné <[email protected]>

v2: use XEN_HVM_START_MAGIC_VALUE and switch statement in reloc. Move header inclusion.

v3: Use (%ebx). Add blank lines.

---
 xen/arch/x86/boot/Makefile   |  7 ++++-
 xen/arch/x86/boot/build32.mk |  3 +++
 xen/arch/x86/boot/defs.h     |  3 +++
 xen/arch/x86/boot/head.S     | 25 ++++++++++--------
 xen/arch/x86/boot/reloc.c    | 62 +++++++++++++++++++++++++++++++++++++++-----
 5 files changed, 81 insertions(+), 19 deletions(-)
xen/arch/x86/boot/Makefile +6 -1
index c6246c85d2..9fe5b309c5 100644
@@ -7,10 +7,15 @@ CMDLINE_DEPS = $(DEFS_H_DEPS) video.h
 RELOC_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/include/xen/multiboot.h \
 	     $(BASEDIR)/include/xen/multiboot2.h
 
+ifeq ($(CONFIG_PVH_GUEST),y)
+RELOC_DEPS += $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
+RELOC_EXTRA = CONFIG_PVH_GUEST=y
+endif
+
 head.o: cmdline.S reloc.S
 
 cmdline.S: cmdline.c $(CMDLINE_DEPS)
 	$(MAKE) -f build32.mk $@ CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
 reloc.S: reloc.c $(RELOC_DEPS)
-	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)"
+	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)" $(RELOC_EXTRA)
xen/arch/x86/boot/build32.mk +3 -0
index 48c7407c00..028ac19b96 100644
@@ -36,5 +36,8 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 cmdline.o: cmdline.c $(CMDLINE_DEPS)
 
 reloc.o: reloc.c $(RELOC_DEPS)
+ifeq ($(CONFIG_PVH_GUEST),y)
+reloc.o: CFLAGS += -DCONFIG_PVH_GUEST
+endif
 
 .PRECIOUS: %.bin %.lnk
xen/arch/x86/boot/defs.h +3 -0
index 6abdc15446..05921a64a3 100644
@@ -51,6 +51,9 @@ typedef unsigned short u16;
 typedef unsigned int u32;
 typedef unsigned long long u64;
 typedef unsigned int size_t;
+typedef u8 uint8_t;
+typedef u32 uint32_t;
+typedef u64 uint64_t;
 
 #define U16_MAX		((u16)(~0U))
 #define UINT_MAX	(~0U)
xen/arch/x86/boot/head.S +14 -11
index 0f652cea11..aa2e2a93c8 100644
@@ -414,6 +414,7 @@ __pvh_start:
 
         /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
         movw    $0x1000, sym_esi(trampoline_phys)
+        movl    (%ebx), %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */
         jmp     trampoline_setup
 
 #endif /* CONFIG_PVH_GUEST */
@@ -578,18 +579,20 @@ trampoline_setup:
         /* Get bottom-most low-memory stack address. */
         add     $TRAMPOLINE_SPACE,%ecx
 
-#ifdef CONFIG_PVH_GUEST
-        cmpb    $0, sym_fs(pvh_boot)
-        jne     1f
-#endif
-
-        /* Save the Multiboot info struct (after relocation) for later use. */
+        /* Save Multiboot / PVH info struct (after relocation) for later use. */
         push    %ecx                /* Bottom-most low-memory stack address. */
-        push    %ebx                /* Multiboot information address. */
-        push    %eax                /* Multiboot magic. */
+        push    %ebx                /* Multiboot / PVH information address. */
+        push    %eax                /* Magic number. */
         call    reloc
-        mov     %eax,sym_fs(multiboot_ptr)
+#ifdef CONFIG_PVH_GUEST
+        cmp     $0,sym_fs(pvh_boot)
+        je      1f
+        mov     %eax,sym_fs(pvh_start_info_pa)
+        jmp     2f
+#endif
 1:
+        mov     %eax,sym_fs(multiboot_ptr)
+2:
 
         /*
          * Now trampoline_phys points to the following structure (lowest address
@@ -598,12 +601,12 @@ trampoline_setup:
          * +------------------------+
          * | TRAMPOLINE_STACK_SPACE |
          * +------------------------+
-         * |        mbi data        |
+         * |     Data (MBI / PVH)   |
          * +- - - - - - - - - - - - +
          * |    TRAMPOLINE_SPACE    |
          * +------------------------+
          *
-         * mbi data grows downwards from the highest address of TRAMPOLINE_SPACE
+         * Data grows downwards from the highest address of TRAMPOLINE_SPACE
          * region to the end of the trampoline. The rest of TRAMPOLINE_SPACE is
          * reserved for trampoline code and data.
          */
xen/arch/x86/boot/reloc.c +55 -7

83 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by
#14 lore raw

Re: [PATCH v2 5/7] x86: relocate pvh_info

Quoted 12 lines · Wei Liu

To avoid spamming the list with all the other acked patches, here is the updated patch.

---8<---
From 1ac0afbbc0ecd620c5fba3a03bb084bc4dafc78e Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Wed, 17 Jan 2018 18:38:02 +0000
Subject: [PATCH] x86: relocate pvh_info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Quoted 4 lines

Modify early boot code to relocate pvh info as well, so that we can be sure __va in __start_xen works.

With one question below.

xen/arch/x86/boot/head.S __pvh_start: · line 417

Quoted 9 lines
xen/arch/x86/boot/head.S +1 -0
index 0f652cea11..aa2e2a93c8 100644
@@ -414,6 +414,7 @@ __pvh_start:
 
         /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
         movw    $0x1000, sym_esi(trampoline_phys)
+        movl    (%ebx), %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */

Do you really need the l suffix here?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#15 lore raw

Re: [PATCH v2 5/7] x86: relocate pvh_info

Quoted 28 lines · Roger Pau Monné
Quoted 12 lines · Wei Liu

To avoid spamming the list with all the other acked patches, here is the updated patch.

---8<---
From 1ac0afbbc0ecd620c5fba3a03bb084bc4dafc78e Mon Sep 17 00:00:00 2001
From: Wei Liu <[email protected]>
Date: Wed, 17 Jan 2018 18:38:02 +0000
Subject: [PATCH] x86: relocate pvh_info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Quoted 4 lines

Modify early boot code to relocate pvh info as well, so that we can be sure __va in __start_xen works.

With one question below.

Quoted 6 lines
xen/arch/x86/boot/head.S +0 -0
index 0f652cea11..aa2e2a93c8 100644
@@ -414,6 +414,7 @@ __pvh_start:
 
Quoted 5 lines

xen/arch/x86/boot/head.S __pvh_start: · line 417

Quoted 3 lines
xen/arch/x86/boot/head.S +1 -0
         /* Set trampoline_phys to use mfn 1 to avoid having a mapping at VA 0 */
         movw    $0x1000, sym_esi(trampoline_phys)
+        movl    (%ebx), %eax /* mov $XEN_HVM_START_MAGIC_VALUE, %eax */

Do you really need the l suffix here?

I guess no. I copied it from your previous reply. ;-)

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw

Re: [PATCH v2 5/7] x86: relocate pvh_info

In reply to Wei Liu
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 22.01.18 at 13:35, <[email protected]> wrote:

To avoid spamming the list with all the other acked patches, here is the updated patch.

Feel free to re-instate my R-b, but please commit only if Andrew withdraws his earlier voiced more general objection.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#17 lore raw

Re: [PATCH v2 5/7] x86: relocate pvh_info

In reply to Roger Pau Monné
Quoted 16 lines · Roger Pau Monné

xen/arch/x86/boot/build32.mk CFLAGS := $(filter-out -flto,$(CFLAGS)) · line 41

Quoted 11 lines · Wei Liu
xen/arch/x86/boot/build32.mk +3 -0
index 48c7407c00..028ac19b96 100644
@@ -36,5 +36,8 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 cmdline.o: cmdline.c $(CMDLINE_DEPS)
 
 reloc.o: reloc.c $(RELOC_DEPS)
+ifeq ($(CONFIG_PVH_GUEST),y)
+reloc.o: CFLAGS += -DCONFIG_PVH_GUEST
+endif

I would maybe do this above, where the rest of the CFLAGS are set. Certainly setting -DCONFIG_PVH_GUEST shouldn't cause issues elsewhere.

Quoted 3 lines

CFLAGS-$(CONFIG_PVH_GUEST) += -DCONFIG_PVH_GUEST
CFLAGS += $(CFLAGS-y)

Missed this one.

I would rather only have -DCONFIG_PVH_GUEST for the file that needs it. Let me know if you feel strongly about this.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#18 lore raw

PATCH v2 6/7 Revert "x86/boot: Map more than the first 16MB"

In reply to Wei Liu

This reverts commit 7d6f958d9d18c54017f5ef6e299a08037f035747.

Now we have PVH info relocation support, this change is no longer needed.

---
 xen/arch/x86/boot/x86_64.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/boot/x86_64.S +2 -1
index 42636cf334..cf47e019f5 100644
@@ -114,10 +114,11 @@ GLOBAL(__page_tables_start)
 GLOBAL(l2_identmap)
         .quad sym_offs(l1_identmap) + __PAGE_HYPERVISOR
         idx = 1
-        .rept 4 * L2_PAGETABLE_ENTRIES - 1
+        .rept 7
         .quad (idx << L2_PAGETABLE_SHIFT) | PAGE_HYPERVISOR | _PAGE_PSE
         idx = idx + 1
         .endr
+        .fill 4 * L2_PAGETABLE_ENTRIES - 8, 8, 0
         .size l2_identmap, . - l2_identmap
 
 /*
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#19 lore raw

PATCH v2 7/7 libxl: lower shim related message to level DEBUG

In reply to Wei Liu
---
 tools/libxl/libxl_dom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/libxl/libxl_dom.c +2 -2
index e1a3e747fc..29fd2f5d6a 100644
@@ -1035,7 +1035,7 @@ static int libxl__domain_firmware(libxl__gc *gc,
 
             /* We've loaded the shim, so load the kernel as a secondary module */
             if (state->pv_kernel.mapped) {
-                LOG(WARN, "xc_dom_module_mem, cmdline %s",
+                LOG(DEBUG, "xc_dom_module_mem, cmdline %s",
                     state->pv_cmdline);
                 rc = xc_dom_module_mem(dom, state->pv_kernel.data,
                                        state->pv_kernel.size, state->pv_cmdline);
@@ -1044,7 +1044,7 @@ static int libxl__domain_firmware(libxl__gc *gc,
                     goto out;
                 }
             } else {
-                LOG(WARN, "xc_dom_module_file, path %s cmdline %s",
+                LOG(DEBUG, "xc_dom_module_file, path %s cmdline %s",
                     state->pv_kernel.path, state->pv_cmdline);
                 rc = xc_dom_module_file(dom, state->pv_kernel.path, state->pv_cmdline);
                 if (rc) {
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel