lkml.org 
[lkml]   [2019]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 4/4] x86/xen: Add "nopv" support for HVM guest
From
Date

On 2019/7/5 21:06, Boris Ostrovsky wrote:
> On 7/2/19 9:19 PM, Zhenzhong Duan wrote:
>> PVH guest needs PV extentions to work, so "nopv" parameter should be
>> ignored for PVH but not for HVM guest.
>>
>> If PVH guest boots up via the Xen-PVH boot entry, xen_pvh is set early,
>> we know it's PVH guest and ignore "nopv" parameter directly.
>>
>> If PVH guest boots up via the normal boot entry same as HVM guest, it's
>> hard to distinguish PVH and HVM guest at that time.
>>
>> To handle that case, add a new function xen_hvm_nopv_guest_late_init()
>> to detect PVH at a late time and panic itself if nopv enabled for a
>> PVH guest.
>>
>> Signed-off-by: Zhenzhong Duan<zhenzhong.duan@oracle.com>
>> Cc: Boris Ostrovsky<boris.ostrovsky@oracle.com>
>> Cc: Juergen Gross<jgross@suse.com>
>> Cc: Stefano Stabellini<sstabellini@kernel.org>
>> Cc: Thomas Gleixner<tglx@linutronix.de>
>> Cc: Ingo Molnar<mingo@redhat.com>
>> Cc: Borislav Petkov<bp@alien8.de>
>> ---
>> arch/x86/xen/enlighten_hvm.c | 27 +++++++++++++++++++++++++++
>> 1 file changed, 27 insertions(+)
>>
>> diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
>> index 1756cf7..09a010a 100644
>> --- a/arch/x86/xen/enlighten_hvm.c
>> +++ b/arch/x86/xen/enlighten_hvm.c
>> @@ -231,11 +231,37 @@ bool __init xen_hvm_need_lapic(void)
>> return true;
>> }
>>
>> +static __init void xen_hvm_nopv_guest_late_init(void)
>> +{
>> +#ifdef CONFIG_XEN_PVH
>> + if (x86_platform.legacy.rtc || !x86_platform.legacy.no_vga)
>> + return;
>> +
>> + /* PVH detected. */
>> + xen_pvh = true;
>> +
>> + panic("\"nopv\" and \"xen_nopv\" parameters are unsupported in PVH guest.");
>> +#endif
>> +}
> Can't all of this be done in xen_hvm_guest_late_init()? It has the same
> tests already and it seems to me you should be able to panic from there.

Indeed, I didn't realize this, thanks for pointing, I'll fix it.

Zhenzhong

\
 
 \ /
  Last update: 2019-07-08 10:35    [W:0.040 / U:3.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site