From: Mukesh Rathor Subject: [PATCH] pvh bug fixes Date: Fri, 21 Feb 2014 18:23:23 -0800 Message-ID: <1393035803-9483-2-git-send-email-mukesh.rathor@oracle.com> References: <1393035803-9483-1-git-send-email-mukesh.rathor@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WH2Fl-000646-D4 for xen-devel@lists.xenproject.org; Sat, 22 Feb 2014 02:23:45 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s1M2Nfgh006023 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 22 Feb 2014 02:23:41 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s1M2NewS019616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 22 Feb 2014 02:23:41 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s1M2NeMN011275 for ; Sat, 22 Feb 2014 02:23:40 GMT In-Reply-To: <1393035803-9483-1-git-send-email-mukesh.rathor@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Nested hvm is presently not supported for pvh. Calling hvm_hap_nested_page_fault in certain paths will crash. The rearrange in linux code causes it to go thru paths that will corrupt hvm_domain structs and xen to panic for dom0 pvh. Signed-off-by: Mukesh Rathor --- xen/arch/x86/hvm/hvm.c | 3 +++ xen/arch/x86/irq.c | 4 ++-- xen/arch/x86/physdev.c | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 69f7e74..a4a3dcf 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1416,6 +1416,9 @@ int hvm_hap_nested_page_fault(paddr_t gpa, int sharing_enomem = 0; mem_event_request_t *req_ptr = NULL; + if ( is_pvh_vcpu(v) ) + return 0; + /* On Nested Virtualization, walk the guest page table. * If this succeeds, all is fine. * If this fails, inject a nested page fault into the guest. diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index db70077..88444be 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1068,13 +1068,13 @@ bool_t cpu_has_pending_apic_eoi(void) static inline void set_pirq_eoi(struct domain *d, unsigned int irq) { - if ( !is_hvm_domain(d) && d->arch.pv_domain.pirq_eoi_map ) + if ( is_pv_domain(d) && d->arch.pv_domain.pirq_eoi_map ) set_bit(irq, d->arch.pv_domain.pirq_eoi_map); } static inline void clear_pirq_eoi(struct domain *d, unsigned int irq) { - if ( !is_hvm_domain(d) && d->arch.pv_domain.pirq_eoi_map ) + if ( is_pv_domain(d) && d->arch.pv_domain.pirq_eoi_map ) clear_bit(irq, d->arch.pv_domain.pirq_eoi_map); } diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c index bc0634c..9f85857 100644 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -339,6 +339,10 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) unsigned long mfn; struct page_info *page; + ret = -ENOSYS; + if ( is_pvh_vcpu(current) ) + break; + ret = -EFAULT; if ( copy_from_guest(&info, arg, 1) != 0 ) break; -- 1.8.3.1