* [PATCH v2 0/2] Minor improvement to early boot code
@ 2018-09-28 17:06 Wei Liu
2018-09-28 17:06 ` [PATCH v2 1/2] x86: make sure module array is large enough in pvh-boot.c Wei Liu
2018-09-28 17:06 ` [PATCH v2 2/2] xen: initialise opt_xen_console early in PVH boot path Wei Liu
0 siblings, 2 replies; 5+ messages in thread
From: Wei Liu @ 2018-09-28 17:06 UTC (permalink / raw)
To: xen-devel; +Cc: Wei Liu
Wei Liu (2):
x86: make sure module array is large enough in pvh-boot.c
xen: initialise opt_xen_console early in PVH boot path
xen/arch/x86/guest/pvh-boot.c | 12 +++++++++++-
xen/arch/x86/setup.c | 5 +++++
xen/drivers/char/console.c | 10 ++++++++--
xen/include/xen/console.h | 2 ++
4 files changed, 26 insertions(+), 3 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] 5+ messages in thread
* [PATCH v2 1/2] x86: make sure module array is large enough in pvh-boot.c
2018-09-28 17:06 [PATCH v2 0/2] Minor improvement to early boot code Wei Liu
@ 2018-09-28 17:06 ` Wei Liu
2018-09-28 17:12 ` Andrew Cooper
2018-09-28 17:06 ` [PATCH v2 2/2] xen: initialise opt_xen_console early in PVH boot path Wei Liu
1 sibling, 1 reply; 5+ messages in thread
From: Wei Liu @ 2018-09-28 17:06 UTC (permalink / raw)
To: xen-devel; +Cc: Andrew Cooper, Wei Liu, Jan Beulich
The relocation code in __start_xen requires one extra element in the
module array. By the looks of it the temporary array is already large
enough. Panic if that's not the case.
While at it, turn an ASSERT to panic() as well.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
xen/arch/x86/guest/pvh-boot.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/guest/pvh-boot.c b/xen/arch/x86/guest/pvh-boot.c
index 0e9e5bfdf6..3b44aee90a 100644
--- a/xen/arch/x86/guest/pvh-boot.c
+++ b/xen/arch/x86/guest/pvh-boot.c
@@ -42,7 +42,17 @@ static void __init convert_pvh_info(void)
module_t *mod;
unsigned int i;
- ASSERT(pvh_info->magic == XEN_HVM_START_MAGIC_VALUE);
+ if ( pvh_info->magic != XEN_HVM_START_MAGIC_VALUE )
+ panic("Magic value is wrong: %X\n", pvh_info->magic);
+
+ /*
+ * Temporary module array needs to be at least one element bigger than
+ * required. The extra element is used to aid relocation. See
+ * arch/x86/setup.c:__start_xen().
+ */
+ if ( ARRAY_SIZE(pvh_mbi_mods) <= pvh_info->nr_modules )
+ panic("The module array is too small, size %lu, requested %u.\n",
+ ARRAY_SIZE(pvh_mbi_mods), pvh_info->nr_modules);
/*
* Turn hvm_start_info into mbi. Luckily all modules are placed under 4GB
--
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] 5+ messages in thread
* [PATCH v2 2/2] xen: initialise opt_xen_console early in PVH boot path
2018-09-28 17:06 [PATCH v2 0/2] Minor improvement to early boot code Wei Liu
2018-09-28 17:06 ` [PATCH v2 1/2] x86: make sure module array is large enough in pvh-boot.c Wei Liu
@ 2018-09-28 17:06 ` Wei Liu
2018-09-28 17:14 ` Andrew Cooper
1 sibling, 1 reply; 5+ messages in thread
From: Wei Liu @ 2018-09-28 17:06 UTC (permalink / raw)
To: xen-devel
Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk, George Dunlap,
Andrew Cooper, Ian Jackson, Tim Deegan, Julien Grall, Jan Beulich
This helps capture issues before console is initialised.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
xen/arch/x86/setup.c | 5 +++++
xen/drivers/char/console.c | 10 ++++++++--
xen/include/xen/console.h | 2 ++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2fbf7d574c..20cb0acc3f 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -708,6 +708,11 @@ void __init noreturn __start_xen(unsigned long mbi_p)
if ( pvh_boot )
{
+ /*
+ * Force xen console to be enabled. We will reset it later in console
+ * initialisation code.
+ */
+ opt_console_xen = -1;
ASSERT(mbi_p == 0);
mbi = pvh_init();
}
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index e48039dd82..3b75f7a472 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -91,7 +91,8 @@ static uint32_t conringc, conringp;
static int __read_mostly sercon_handle = -1;
#ifdef CONFIG_X86
-static bool __read_mostly opt_console_xen; /* console=xen */
+/* Tristate: 0 disabled, 1 user enabled, -1 default enabled */
+int8_t __read_mostly opt_console_xen; /* console=xen */
#endif
static DEFINE_SPINLOCK(console_lock);
@@ -832,7 +833,7 @@ void __init console_init_preirq(void)
pv_console_init();
#ifdef CONFIG_X86
else if ( !strncmp(p, "xen", 3) )
- opt_console_xen = true;
+ opt_console_xen = 1;
#endif
else if ( !strncmp(p, "none", 4) )
continue;
@@ -852,6 +853,11 @@ void __init console_init_preirq(void)
}
}
+#ifdef CONFIG_X86
+ if ( opt_console_xen == -1 )
+ opt_console_xen = 0;
+#endif
+
serial_set_rx_handler(sercon_handle, serial_rx);
pv_console_set_rx_handler(serial_rx);
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index ea06fd8078..70c9911a49 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -43,4 +43,6 @@ void console_giveback(int id);
int console_suspend(void);
int console_resume(void);
+extern int8_t opt_console_xen;
+
#endif /* __CONSOLE_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] 5+ messages in thread
* Re: [PATCH v2 1/2] x86: make sure module array is large enough in pvh-boot.c
2018-09-28 17:06 ` [PATCH v2 1/2] x86: make sure module array is large enough in pvh-boot.c Wei Liu
@ 2018-09-28 17:12 ` Andrew Cooper
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-09-28 17:12 UTC (permalink / raw)
To: Wei Liu, xen-devel; +Cc: Jan Beulich
On 28/09/18 18:06, Wei Liu wrote:
> diff --git a/xen/arch/x86/guest/pvh-boot.c b/xen/arch/x86/guest/pvh-boot.c
> index 0e9e5bfdf6..3b44aee90a 100644
> --- a/xen/arch/x86/guest/pvh-boot.c
> +++ b/xen/arch/x86/guest/pvh-boot.c
> @@ -42,7 +42,17 @@ static void __init convert_pvh_info(void)
> module_t *mod;
> unsigned int i;
>
> - ASSERT(pvh_info->magic == XEN_HVM_START_MAGIC_VALUE);
> + if ( pvh_info->magic != XEN_HVM_START_MAGIC_VALUE )
> + panic("Magic value is wrong: %X\n", pvh_info->magic);
%x ?
> +
> + /*
> + * Temporary module array needs to be at least one element bigger than
> + * required. The extra element is used to aid relocation. See
> + * arch/x86/setup.c:__start_xen().
> + */
> + if ( ARRAY_SIZE(pvh_mbi_mods) <= pvh_info->nr_modules )
> + panic("The module array is too small, size %lu, requested %u.\n",
%zu for size_t, and please drop the unnecessary trailing .
Otherwise, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> + ARRAY_SIZE(pvh_mbi_mods), pvh_info->nr_modules);
>
> /*
> * Turn hvm_start_info into mbi. Luckily all modules are placed under 4GB
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] xen: initialise opt_xen_console early in PVH boot path
2018-09-28 17:06 ` [PATCH v2 2/2] xen: initialise opt_xen_console early in PVH boot path Wei Liu
@ 2018-09-28 17:14 ` Andrew Cooper
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-09-28 17:14 UTC (permalink / raw)
To: Wei Liu, xen-devel
Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, George Dunlap,
Tim Deegan, Ian Jackson, Julien Grall, Jan Beulich
On 28/09/18 18:06, Wei Liu wrote:
> This helps capture issues before console is initialised.
>
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Much nicer behaviour.
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-09-28 17:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28 17:06 [PATCH v2 0/2] Minor improvement to early boot code Wei Liu
2018-09-28 17:06 ` [PATCH v2 1/2] x86: make sure module array is large enough in pvh-boot.c Wei Liu
2018-09-28 17:12 ` Andrew Cooper
2018-09-28 17:06 ` [PATCH v2 2/2] xen: initialise opt_xen_console early in PVH boot path Wei Liu
2018-09-28 17:14 ` Andrew Cooper
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.