From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756556AbcJNThB (ORCPT ); Fri, 14 Oct 2016 15:37:01 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:17800 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756179AbcJNThA (ORCPT ); Fri, 14 Oct 2016 15:37:00 -0400 Subject: Re: [Xen-devel] [PATCH 5/8] xen/pvh: Prevent PVH guests from using PIC, RTC and IOAPIC To: Konrad Rzeszutek Wilk References: <1476468318-24422-1-git-send-email-boris.ostrovsky@oracle.com> <1476468318-24422-6-git-send-email-boris.ostrovsky@oracle.com> <20161014191613.GB16777@localhost.localdomain> Cc: david.vrabel@citrix.com, JGross@suse.com, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, roger.pau@citrix.com From: Boris Ostrovsky Message-ID: <4006b86b-a259-1519-d9b2-6d59e04cad23@oracle.com> Date: Fri, 14 Oct 2016 15:37:40 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161014191613.GB16777@localhost.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/14/2016 03:16 PM, Konrad Rzeszutek Wilk wrote: > On Fri, Oct 14, 2016 at 02:05:15PM -0400, Boris Ostrovsky wrote: >> Make sure they don't use these devices since they are not emulated >> for unprivileged PVH guest. > Which means they would just return 0 ? Or would it get worst since > the in/out would go to the hypervisor which would kill the guest? For PIC and IOAPIC (and I think RTC too) we will get a warning (with a splat) that SCI cannot be initialized. But the guest will continue running without problems. -boris >> Also don't initialize hypercall page for them in init_hvm_pv_info() >> since this has already been done. >> >> Signed-off-by: Boris Ostrovsky >> --- >> arch/x86/xen/enlighten.c | 24 +++++++++++++++++------- >> 1 file changed, 17 insertions(+), 7 deletions(-) >> >> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c >> index d38d568..6c1a330 100644 >> --- a/arch/x86/xen/enlighten.c >> +++ b/arch/x86/xen/enlighten.c >> @@ -1803,10 +1803,21 @@ static void __init init_hvm_pv_info(void) >> minor = eax & 0xffff; >> printk(KERN_INFO "Xen version %d.%d.\n", major, minor); >> >> - cpuid(base + 2, &pages, &msr, &ecx, &edx); >> + xen_domain_type = XEN_HVM_DOMAIN; >> >> - pfn = __pa(hypercall_page); >> - wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); >> + /* PVH set up hypercall page earlier in xen_prepare_pvh() */ > A period at the end? >> + if (xen_pvh_domain()) { >> + pv_info.name = "Xen PVH"; >> +#ifdef CONFIG_ACPI >> + /* No PIC or IOAPIC */ > Here? >> + acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; >> +#endif >> + } else { >> + pv_info.name = "Xen HVM"; >> + cpuid(base + 2, &pages, &msr, &ecx, &edx); > Could you use cpuid_ebx ? >> + pfn = __pa(hypercall_page); >> + wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32)); >> + } >> >> xen_setup_features(); >> >> @@ -1815,10 +1826,6 @@ static void __init init_hvm_pv_info(void) >> this_cpu_write(xen_vcpu_id, ebx); >> else >> this_cpu_write(xen_vcpu_id, smp_processor_id()); >> - >> - pv_info.name = "Xen HVM"; >> - >> - xen_domain_type = XEN_HVM_DOMAIN; >> } >> >> static int xen_cpu_up_prepare(unsigned int cpu) >> @@ -1892,6 +1899,9 @@ static void __init xen_hvm_guest_init(void) >> >> init_hvm_pv_info(); >> >> + if (xen_pvh_domain()) >> + x86_platform.legacy.rtc = 0; >> + >> xen_hvm_init_shared_info(); >> >> xen_panic_handler_init(); >> -- >> 1.8.3.1 >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xen.org >> https://lists.xen.org/xen-devel