All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Fixes and improvements to pvshim
@ 2018-01-19 15:34 Wei Liu
  2018-01-19 15:34 ` [PATCH v2 1/7] Update shim.config Wei Liu
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-19 15:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

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(-)

-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 1/7] Update shim.config
  2018-01-19 15:34 [PATCH v2 0/7] Fixes and improvements to pvshim Wei Liu
@ 2018-01-19 15:34 ` Wei Liu
  2018-01-19 15:34 ` [PATCH v2 2/7] libxl: remove whitespaces introduced in 62982da926 Wei Liu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-19 15:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

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.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/firmware/xen-dir/shim.config | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/firmware/xen-dir/shim.config b/tools/firmware/xen-dir/shim.config
index 78b965f4c7..d5bd516632 100644
--- a/tools/firmware/xen-dir/shim.config
+++ b/tools/firmware/xen-dir/shim.config
@@ -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
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 2/7] libxl: remove whitespaces introduced in 62982da926
  2018-01-19 15:34 [PATCH v2 0/7] Fixes and improvements to pvshim Wei Liu
  2018-01-19 15:34 ` [PATCH v2 1/7] Update shim.config Wei Liu
@ 2018-01-19 15:34 ` Wei Liu
  2018-01-19 15:34 ` [PATCH v2 3/7] x86/guest: clean up guest/xen.h Wei Liu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-19 15:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/libxl/libxl_dom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index b03386409f..e1a3e747fc 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -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.
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 3/7] x86/guest: clean up guest/xen.h
  2018-01-19 15:34 [PATCH v2 0/7] Fixes and improvements to pvshim Wei Liu
  2018-01-19 15:34 ` [PATCH v2 1/7] Update shim.config Wei Liu
  2018-01-19 15:34 ` [PATCH v2 2/7] libxl: remove whitespaces introduced in 62982da926 Wei Liu
@ 2018-01-19 15:34 ` Wei Liu
  2018-01-19 15:55   ` Roger Pau Monné
  2018-01-19 16:01   ` Jan Beulich
  2018-01-19 15:34 ` [PATCH v2 4/7] x86/shim: use credit scheduler Wei Liu
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-19 15:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich, Roger Pau Monné

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

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/include/asm-x86/guest/xen.h | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xen.h
index 11243fe60d..c0acf4c36e 100644
--- a/xen/include/asm-x86/guest/xen.h
+++ b/xen/include/asm-x86/guest/xen.h
@@ -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__ */
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 4/7] x86/shim: use credit scheduler
  2018-01-19 15:34 [PATCH v2 0/7] Fixes and improvements to pvshim Wei Liu
                   ` (2 preceding siblings ...)
  2018-01-19 15:34 ` [PATCH v2 3/7] x86/guest: clean up guest/xen.h Wei Liu
@ 2018-01-19 15:34 ` Wei Liu
  2018-01-19 16:00   ` Roger Pau Monné
  2018-01-19 15:34 ` [PATCH v2 5/7] x86: relocate pvh_info Wei Liu
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Wei Liu @ 2018-01-19 15:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Ian Jackson, Wei Liu, Jan Beulich, Andrew Cooper

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.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 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(-)

diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in
index 30fe4b8531..a699367779 100644
--- a/docs/man/xl.cfg.pod.5.in
+++ b/docs/man/xl.cfg.pod.5.in
@@ -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">
diff --git a/tools/firmware/xen-dir/shim.config b/tools/firmware/xen-dir/shim.config
index d5bd516632..effbbd90c9 100644
--- a/tools/firmware/xen-dir/shim.config
+++ b/tools/firmware/xen-dir/shim.config
@@ -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=""
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 0f89364466..7ff9a67e50 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -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)
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-19 15:34 [PATCH v2 0/7] Fixes and improvements to pvshim Wei Liu
                   ` (3 preceding siblings ...)
  2018-01-19 15:34 ` [PATCH v2 4/7] x86/shim: use credit scheduler Wei Liu
@ 2018-01-19 15:34 ` Wei Liu
  2018-01-19 16:29   ` Roger Pau Monné
  2018-01-19 15:34 ` [PATCH v2 6/7] Revert "x86/boot: Map more than the first 16MB" Wei Liu
  2018-01-19 15:34 ` [PATCH v2 7/7] libxl: lower shim related message to level DEBUG Wei Liu
  6 siblings, 1 reply; 20+ messages in thread
From: Wei Liu @ 2018-01-19 15:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich, Roger Pau Monné

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

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Roger Pau Monné <roger.pau@citrix.com>

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(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index c6246c85d2..9fe5b309c5 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -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)
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 48c7407c00..028ac19b96 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -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
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index 6abdc15446..05921a64a3 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -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)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 0f652cea11..614e53081e 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -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.
          */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index b992678b5e..69c9bc9911 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -14,8 +14,8 @@
 
 /*
  * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - 0x4(%esp) = MULTIBOOT_MAGIC,
- *   - 0x8(%esp) = MULTIBOOT_INFORMATION_ADDRESS,
+ *   - 0x4(%esp) = MAGIC,
+ *   - 0x8(%esp) = INFORMATION_ADDRESS,
  *   - 0xc(%esp) = TOPMOST_LOW_MEMORY_STACK_ADDRESS.
  */
 asm (
@@ -71,6 +71,41 @@ static u32 copy_string(u32 src)
     return copy_mem(src, p - src + 1);
 }
 
+#ifdef CONFIG_PVH_GUEST
+
+#include <public/arch-x86/hvm/start_info.h>
+
+static struct hvm_start_info *pvh_info_reloc(u32 in)
+{
+    struct hvm_start_info *out;
+
+    out = _p(copy_mem(in, sizeof(*out)));
+
+    if ( out->cmdline_paddr )
+        out->cmdline_paddr = copy_string(out->cmdline_paddr);
+
+    if ( out->nr_modules )
+    {
+        unsigned int i;
+        struct hvm_modlist_entry *mods;
+
+        out->modlist_paddr =
+            copy_mem(out->modlist_paddr,
+                     out->nr_modules * sizeof(struct hvm_modlist_entry));
+
+        mods = _p(out->modlist_paddr);
+
+        for ( i = 0; i < out->nr_modules; i++ )
+        {
+            if ( mods[i].cmdline_paddr )
+                mods[i].cmdline_paddr = copy_string(mods[i].cmdline_paddr);
+        }
+    }
+
+    return out;
+}
+#endif
+
 static multiboot_info_t *mbi_reloc(u32 mbi_in)
 {
     int i;
@@ -226,14 +261,24 @@ static multiboot_info_t *mbi2_reloc(u32 mbi_in)
     return mbi_out;
 }
 
-multiboot_info_t __stdcall *reloc(u32 mb_magic, u32 mbi_in, u32 trampoline)
+void __stdcall *reloc(u32 magic, u32 in, u32 trampoline)
 {
     alloc = trampoline;
 
-    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);
+#ifdef CONFIG_PVH_GUEST
+    case XEN_HVM_START_MAGIC_VALUE:
+        return pvh_info_reloc(in);
+#endif
+    default:
+        /* Nothing we can do */
+        return NULL;
+    }
 }
 
 /*
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 6/7] Revert "x86/boot: Map more than the first 16MB"
  2018-01-19 15:34 [PATCH v2 0/7] Fixes and improvements to pvshim Wei Liu
                   ` (4 preceding siblings ...)
  2018-01-19 15:34 ` [PATCH v2 5/7] x86: relocate pvh_info Wei Liu
@ 2018-01-19 15:34 ` Wei Liu
  2018-01-19 15:34 ` [PATCH v2 7/7] libxl: lower shim related message to level DEBUG Wei Liu
  6 siblings, 0 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-19 15:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

This reverts commit 7d6f958d9d18c54017f5ef6e299a08037f035747.

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

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/x86_64.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 42636cf334..cf47e019f5 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -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
 
 /*
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 7/7] libxl: lower shim related message to level DEBUG
  2018-01-19 15:34 [PATCH v2 0/7] Fixes and improvements to pvshim Wei Liu
                   ` (5 preceding siblings ...)
  2018-01-19 15:34 ` [PATCH v2 6/7] Revert "x86/boot: Map more than the first 16MB" Wei Liu
@ 2018-01-19 15:34 ` Wei Liu
  6 siblings, 0 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-19 15:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/libxl/libxl_dom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index e1a3e747fc..29fd2f5d6a 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -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) {
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 3/7] x86/guest: clean up guest/xen.h
  2018-01-19 15:34 ` [PATCH v2 3/7] x86/guest: clean up guest/xen.h Wei Liu
@ 2018-01-19 15:55   ` Roger Pau Monné
  2018-01-19 16:01   ` Jan Beulich
  1 sibling, 0 replies; 20+ messages in thread
From: Roger Pau Monné @ 2018-01-19 15:55 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Jan Beulich, Andrew Cooper

On Fri, Jan 19, 2018 at 03:34:54PM +0000, Wei Liu wrote:
> Remove extraneous semicolon. Add blank lines. Remove unused static
> inline functions.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 4/7] x86/shim: use credit scheduler
  2018-01-19 15:34 ` [PATCH v2 4/7] x86/shim: use credit scheduler Wei Liu
@ 2018-01-19 16:00   ` Roger Pau Monné
  2018-01-22 15:30     ` Ian Jackson
  0 siblings, 1 reply; 20+ messages in thread
From: Roger Pau Monné @ 2018-01-19 16:00 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Ian Jackson, Jan Beulich, Andrew Cooper

On Fri, Jan 19, 2018 at 03:34:55PM +0000, Wei Liu wrote:
> 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.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  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(-)
> 
> diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in
> index 30fe4b8531..a699367779 100644
> --- a/docs/man/xl.cfg.pod.5.in
> +++ b/docs/man/xl.cfg.pod.5.in
> @@ -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.

> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 0f89364466..7ff9a67e50 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 3/7] x86/guest: clean up guest/xen.h
  2018-01-19 15:34 ` [PATCH v2 3/7] x86/guest: clean up guest/xen.h Wei Liu
  2018-01-19 15:55   ` Roger Pau Monné
@ 2018-01-19 16:01   ` Jan Beulich
  1 sibling, 0 replies; 20+ messages in thread
From: Jan Beulich @ 2018-01-19 16:01 UTC (permalink / raw)
  To: Wei Liu; +Cc: AndrewCooper, Xen-devel, Roger Pau Monné

>>> On 19.01.18 at 16:34, <wei.liu2@citrix.com> wrote:
> Remove extraneous semicolon. Add blank lines. Remove unused static
> inline functions.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-19 15:34 ` [PATCH v2 5/7] x86: relocate pvh_info Wei Liu
@ 2018-01-19 16:29   ` Roger Pau Monné
  2018-01-19 16:39     ` Wei Liu
  2018-01-22 12:10     ` Wei Liu
  0 siblings, 2 replies; 20+ messages in thread
From: Roger Pau Monné @ 2018-01-19 16:29 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, Jan Beulich, Andrew Cooper

On Fri, Jan 19, 2018 at 03:34:56PM +0000, Wei Liu wrote:
> diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
> index 48c7407c00..028ac19b96 100644
> --- a/xen/arch/x86/boot/build32.mk
> +++ b/xen/arch/x86/boot/build32.mk
> @@ -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)

>  .PRECIOUS: %.bin %.lnk
> diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
> index 6abdc15446..05921a64a3 100644
> --- a/xen/arch/x86/boot/defs.h
> +++ b/xen/arch/x86/boot/defs.h
> @@ -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?

>  #define U16_MAX		((u16)(~0U))
>  #define UINT_MAX	(~0U)
> diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> index 0f652cea11..614e53081e 100644
> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -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).

> -multiboot_info_t __stdcall *reloc(u32 mb_magic, u32 mbi_in, u32 trampoline)
> +void __stdcall *reloc(u32 magic, u32 in, u32 trampoline)
>  {
>      alloc = trampoline;
>  
> -    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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-19 16:29   ` Roger Pau Monné
@ 2018-01-19 16:39     ` Wei Liu
  2018-01-22 10:31       ` Jan Beulich
  2018-01-22 12:10     ` Wei Liu
  1 sibling, 1 reply; 20+ messages in thread
From: Wei Liu @ 2018-01-19 16:39 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: Xen-devel, Wei Liu, Jan Beulich, Andrew Cooper

On Fri, Jan 19, 2018 at 04:29:31PM +0000, Roger Pau Monné wrote:
> On Fri, Jan 19, 2018 at 03:34:56PM +0000, Wei Liu wrote:
> > diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
> > index 48c7407c00..028ac19b96 100644
> > --- a/xen/arch/x86/boot/build32.mk
> > +++ b/xen/arch/x86/boot/build32.mk
> > @@ -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)
> 
> >  .PRECIOUS: %.bin %.lnk
> > diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
> > index 6abdc15446..05921a64a3 100644
> > --- a/xen/arch/x86/boot/defs.h
> > +++ b/xen/arch/x86/boot/defs.h
> > @@ -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.

> >  #define U16_MAX		((u16)(~0U))
> >  #define UINT_MAX	(~0U)
> > diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> > index 0f652cea11..614e53081e 100644
> > --- a/xen/arch/x86/boot/head.S
> > +++ b/xen/arch/x86/boot/head.S
> > @@ -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).

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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-19 16:39     ` Wei Liu
@ 2018-01-22 10:31       ` Jan Beulich
  2018-01-22 12:35         ` Wei Liu
  0 siblings, 1 reply; 20+ messages in thread
From: Jan Beulich @ 2018-01-22 10:31 UTC (permalink / raw)
  To: Wei Liu; +Cc: Andrew Cooper, Xen-devel, Roger Pau Monné

>>> On 19.01.18 at 17:39, <wei.liu2@citrix.com> wrote:
> On Fri, Jan 19, 2018 at 04:29:31PM +0000, Roger Pau Monné wrote:
>> On Fri, Jan 19, 2018 at 03:34:56PM +0000, Wei Liu wrote:
>> > diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
>> > index 48c7407c00..028ac19b96 100644
>> > --- a/xen/arch/x86/boot/build32.mk
>> > +++ b/xen/arch/x86/boot/build32.mk
>> > @@ -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)
>> 
>> >  .PRECIOUS: %.bin %.lnk
>> > diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
>> > index 6abdc15446..05921a64a3 100644
>> > --- a/xen/arch/x86/boot/defs.h
>> > +++ b/xen/arch/x86/boot/defs.h
>> > @@ -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.

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

>> >  #define U16_MAX		((u16)(~0U))
>> >  #define UINT_MAX	(~0U)
>> > diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
>> > index 0f652cea11..614e53081e 100644
>> > --- a/xen/arch/x86/boot/head.S
>> > +++ b/xen/arch/x86/boot/head.S
>> > @@ -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).
> 
> 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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-19 16:29   ` Roger Pau Monné
  2018-01-19 16:39     ` Wei Liu
@ 2018-01-22 12:10     ` Wei Liu
  1 sibling, 0 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-22 12:10 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: Xen-devel, Wei Liu, Jan Beulich, Andrew Cooper

On Fri, Jan 19, 2018 at 04:29:31PM +0000, Roger Pau Monné wrote:
> On Fri, Jan 19, 2018 at 03:34:56PM +0000, Wei Liu wrote:
> > diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
> > index 48c7407c00..028ac19b96 100644
> > --- a/xen/arch/x86/boot/build32.mk
> > +++ b/xen/arch/x86/boot/build32.mk
> > @@ -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)
> 

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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-22 10:31       ` Jan Beulich
@ 2018-01-22 12:35         ` Wei Liu
  2018-01-22 12:44           ` Roger Pau Monné
  2018-01-22 12:54           ` Jan Beulich
  0 siblings, 2 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-22 12:35 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, Wei Liu, Xen-devel, Roger Pau Monné

On Mon, Jan 22, 2018 at 03:31:22AM -0700, Jan Beulich wrote:
> >>> On 19.01.18 at 17:39, <wei.liu2@citrix.com> wrote:
> > On Fri, Jan 19, 2018 at 04:29:31PM +0000, Roger Pau Monné wrote:
> >> On Fri, Jan 19, 2018 at 03:34:56PM +0000, Wei Liu wrote:
> >> > diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
> >> > index 48c7407c00..028ac19b96 100644
> >> > --- a/xen/arch/x86/boot/build32.mk
> >> > +++ b/xen/arch/x86/boot/build32.mk
> >> > @@ -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)
> >> 
> >> >  .PRECIOUS: %.bin %.lnk
> >> > diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
> >> > index 6abdc15446..05921a64a3 100644
> >> > --- a/xen/arch/x86/boot/defs.h
> >> > +++ b/xen/arch/x86/boot/defs.h
> >> > @@ -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.
> 
> Please keep it the (minimal) way you have it.
> 
> >> >  #define U16_MAX		((u16)(~0U))
> >> >  #define UINT_MAX	(~0U)
> >> > diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> >> > index 0f652cea11..614e53081e 100644
> >> > --- a/xen/arch/x86/boot/head.S
> >> > +++ b/xen/arch/x86/boot/head.S
> >> > @@ -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).
> > 
> > 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 <wei.liu2@citrix.com>
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.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Roger Pau Monné <roger.pau@citrix.com>

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(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index c6246c85d2..9fe5b309c5 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -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)
diff --git a/xen/arch/x86/boot/build32.mk b/xen/arch/x86/boot/build32.mk
index 48c7407c00..028ac19b96 100644
--- a/xen/arch/x86/boot/build32.mk
+++ b/xen/arch/x86/boot/build32.mk
@@ -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
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
index 6abdc15446..05921a64a3 100644
--- a/xen/arch/x86/boot/defs.h
+++ b/xen/arch/x86/boot/defs.h
@@ -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)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 0f652cea11..aa2e2a93c8 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -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.
          */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index b992678b5e..216edb83a6 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -14,8 +14,8 @@
 
 /*
  * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - 0x4(%esp) = MULTIBOOT_MAGIC,
- *   - 0x8(%esp) = MULTIBOOT_INFORMATION_ADDRESS,
+ *   - 0x4(%esp) = MAGIC,
+ *   - 0x8(%esp) = INFORMATION_ADDRESS,
  *   - 0xc(%esp) = TOPMOST_LOW_MEMORY_STACK_ADDRESS.
  */
 asm (
@@ -71,6 +71,41 @@ static u32 copy_string(u32 src)
     return copy_mem(src, p - src + 1);
 }
 
+#ifdef CONFIG_PVH_GUEST
+
+#include <public/arch-x86/hvm/start_info.h>
+
+static struct hvm_start_info *pvh_info_reloc(u32 in)
+{
+    struct hvm_start_info *out;
+
+    out = _p(copy_mem(in, sizeof(*out)));
+
+    if ( out->cmdline_paddr )
+        out->cmdline_paddr = copy_string(out->cmdline_paddr);
+
+    if ( out->nr_modules )
+    {
+        unsigned int i;
+        struct hvm_modlist_entry *mods;
+
+        out->modlist_paddr =
+            copy_mem(out->modlist_paddr,
+                     out->nr_modules * sizeof(struct hvm_modlist_entry));
+
+        mods = _p(out->modlist_paddr);
+
+        for ( i = 0; i < out->nr_modules; i++ )
+        {
+            if ( mods[i].cmdline_paddr )
+                mods[i].cmdline_paddr = copy_string(mods[i].cmdline_paddr);
+        }
+    }
+
+    return out;
+}
+#endif
+
 static multiboot_info_t *mbi_reloc(u32 mbi_in)
 {
     int i;
@@ -226,14 +261,27 @@ static multiboot_info_t *mbi2_reloc(u32 mbi_in)
     return mbi_out;
 }
 
-multiboot_info_t __stdcall *reloc(u32 mb_magic, u32 mbi_in, u32 trampoline)
+void __stdcall *reloc(u32 magic, u32 in, u32 trampoline)
 {
     alloc = trampoline;
 
-    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);
+
+#ifdef CONFIG_PVH_GUEST
+    case XEN_HVM_START_MAGIC_VALUE:
+        return pvh_info_reloc(in);
+#endif
+
+    default:
+        /* Nothing we can do */
+        return NULL;
+    }
 }
 
 /*
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-22 12:35         ` Wei Liu
@ 2018-01-22 12:44           ` Roger Pau Monné
  2018-01-22 12:46             ` Wei Liu
  2018-01-22 12:54           ` Jan Beulich
  1 sibling, 1 reply; 20+ messages in thread
From: Roger Pau Monné @ 2018-01-22 12:44 UTC (permalink / raw)
  To: Wei Liu; +Cc: Andrew Cooper, Jan Beulich, Xen-devel

On Mon, Jan 22, 2018 at 12:35:21PM +0000, Wei Liu wrote:
> 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 <wei.liu2@citrix.com>
> 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.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

With one question below.

> diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> index 0f652cea11..aa2e2a93c8 100644
> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-22 12:44           ` Roger Pau Monné
@ 2018-01-22 12:46             ` Wei Liu
  0 siblings, 0 replies; 20+ messages in thread
From: Wei Liu @ 2018-01-22 12:46 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: Andrew Cooper, Wei Liu, Jan Beulich, Xen-devel

On Mon, Jan 22, 2018 at 12:44:41PM +0000, Roger Pau Monné wrote:
> On Mon, Jan 22, 2018 at 12:35:21PM +0000, Wei Liu wrote:
> > 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 <wei.liu2@citrix.com>
> > 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.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> With one question below.
> 
> > diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> > index 0f652cea11..aa2e2a93c8 100644
> > --- a/xen/arch/x86/boot/head.S
> > +++ b/xen/arch/x86/boot/head.S
> > @@ -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?

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

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 5/7] x86: relocate pvh_info
  2018-01-22 12:35         ` Wei Liu
  2018-01-22 12:44           ` Roger Pau Monné
@ 2018-01-22 12:54           ` Jan Beulich
  1 sibling, 0 replies; 20+ messages in thread
From: Jan Beulich @ 2018-01-22 12:54 UTC (permalink / raw)
  To: Wei Liu; +Cc: Andrew Cooper, Xen-devel, Roger Pau Monné

>>> On 22.01.18 at 13:35, <wei.liu2@citrix.com> 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
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2 4/7] x86/shim: use credit scheduler
  2018-01-19 16:00   ` Roger Pau Monné
@ 2018-01-22 15:30     ` Ian Jackson
  0 siblings, 0 replies; 20+ messages in thread
From: Ian Jackson @ 2018-01-22 15:30 UTC (permalink / raw)
  To: Roger Pau Monné; +Cc: Xen-devel, Wei Liu, Jan Beulich, Andrew Cooper

Roger Pau Monné writes ("Re: [Xen-devel] [PATCH v2 4/7] x86/shim: use credit scheduler"):
> On Fri, Jan 19, 2018 at 03:34:55PM +0000, Wei Liu wrote:
> > 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.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-01-22 15:30 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-19 15:34 [PATCH v2 0/7] Fixes and improvements to pvshim Wei Liu
2018-01-19 15:34 ` [PATCH v2 1/7] Update shim.config Wei Liu
2018-01-19 15:34 ` [PATCH v2 2/7] libxl: remove whitespaces introduced in 62982da926 Wei Liu
2018-01-19 15:34 ` [PATCH v2 3/7] x86/guest: clean up guest/xen.h Wei Liu
2018-01-19 15:55   ` Roger Pau Monné
2018-01-19 16:01   ` Jan Beulich
2018-01-19 15:34 ` [PATCH v2 4/7] x86/shim: use credit scheduler Wei Liu
2018-01-19 16:00   ` Roger Pau Monné
2018-01-22 15:30     ` Ian Jackson
2018-01-19 15:34 ` [PATCH v2 5/7] x86: relocate pvh_info Wei Liu
2018-01-19 16:29   ` Roger Pau Monné
2018-01-19 16:39     ` Wei Liu
2018-01-22 10:31       ` Jan Beulich
2018-01-22 12:35         ` Wei Liu
2018-01-22 12:44           ` Roger Pau Monné
2018-01-22 12:46             ` Wei Liu
2018-01-22 12:54           ` Jan Beulich
2018-01-22 12:10     ` Wei Liu
2018-01-19 15:34 ` [PATCH v2 6/7] Revert "x86/boot: Map more than the first 16MB" Wei Liu
2018-01-19 15:34 ` [PATCH v2 7/7] libxl: lower shim related message to level DEBUG Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.