* [PATCH] nestedhvm: handle l2 guest MMIO access
@ 2011-10-21 13:20 Christoph Egger
2011-10-24 10:31 ` Tim Deegan
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Egger @ 2011-10-21 13:20 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 560 bytes --]
Hyper-V starts a root domain which effectively an l2 guest.
Hyper-V passes its devices through to the root domain and
let it do the MMIO accesses. The emulation is done by
Xen (host) and Hyper-V forwards the interrupts to the l2 guest.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_nh_mmio.diff --]
[-- Type: text/plain, Size: 2723 bytes --]
diff -r 55b3a1acb259 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Fri Oct 21 11:15:06 2011 +0200
+++ b/xen/arch/x86/hvm/hvm.c Fri Oct 21 15:16:13 2011 +0200
@@ -1208,6 +1208,10 @@ int hvm_hap_nested_page_fault(unsigned l
return 0;
case NESTEDHVM_PAGEFAULT_INJECT:
return -1;
+ case NESTEDHVM_PAGEFAULT_MMIO:
+ if ( !handle_mmio() )
+ hvm_inject_exception(TRAP_gp_fault, 0, 0);
+ return 1;
}
}
diff -r 55b3a1acb259 xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c Fri Oct 21 11:15:06 2011 +0200
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c Fri Oct 21 15:16:13 2011 +0200
@@ -1165,6 +1165,15 @@ enum hvm_intblk nsvm_intr_blocked(struct
if ( svm->ns_hostflags.fields.vintrmask )
if ( !svm->ns_hostflags.fields.rflagsif )
return hvm_intblk_rflags_ie;
+
+ /* when l1 guest passes its devices through to the l2 guest
+ * and l2 guest does an MMIO access then we may want to
+ * inject an VMEXIT(#INTR) exitcode into the l1 guest.
+ * Delay the injection because this would result in delivering
+ * an interrupt *within* the execution of an instruction.
+ */
+ if ( v->arch.hvm_vcpu.io_state != HVMIO_none )
+ return hvm_intblk_shadow;
}
if ( nv->nv_vmexit_pending ) {
diff -r 55b3a1acb259 xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c Fri Oct 21 11:15:06 2011 +0200
+++ b/xen/arch/x86/mm/hap/nested_hap.c Fri Oct 21 15:16:13 2011 +0200
@@ -151,6 +151,9 @@ nestedhap_walk_L0_p2m(struct p2m_domain
mfn = gfn_to_mfn_type_p2m(p2m, L1_gpa >> PAGE_SHIFT, &p2mt, &p2ma,
p2m_query, page_order);
+ if ( p2m_is_mmio(p2mt) )
+ return NESTEDHVM_PAGEFAULT_MMIO;
+
if ( p2m_is_paging(p2mt) || p2m_is_shared(p2mt) || !p2m_is_ram(p2mt) )
return NESTEDHVM_PAGEFAULT_ERROR;
@@ -228,6 +231,8 @@ nestedhvm_hap_nested_page_fault(struct v
return rv;
case NESTEDHVM_PAGEFAULT_DONE:
break;
+ case NESTEDHVM_PAGEFAULT_MMIO:
+ return rv;
default:
BUG();
break;
diff -r 55b3a1acb259 xen/include/asm-x86/hvm/nestedhvm.h
--- a/xen/include/asm-x86/hvm/nestedhvm.h Fri Oct 21 11:15:06 2011 +0200
+++ b/xen/include/asm-x86/hvm/nestedhvm.h Fri Oct 21 15:16:13 2011 +0200
@@ -50,6 +50,7 @@ bool_t nestedhvm_vcpu_in_guestmode(struc
#define NESTEDHVM_PAGEFAULT_DONE 0
#define NESTEDHVM_PAGEFAULT_INJECT 1
#define NESTEDHVM_PAGEFAULT_ERROR 2
+#define NESTEDHVM_PAGEFAULT_MMIO 3
int nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t L2_gpa);
/* IO permission map */
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] nestedhvm: handle l2 guest MMIO access
2011-10-21 13:20 [PATCH] nestedhvm: handle l2 guest MMIO access Christoph Egger
@ 2011-10-24 10:31 ` Tim Deegan
0 siblings, 0 replies; 2+ messages in thread
From: Tim Deegan @ 2011-10-24 10:31 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel@lists.xensource.com
At 15:20 +0200 on 21 Oct (1319210419), Christoph Egger wrote:
> Hyper-V starts a root domain which effectively an l2 guest.
> Hyper-V passes its devices through to the root domain and
> let it do the MMIO accesses. The emulation is done by
> Xen (host) and Hyper-V forwards the interrupts to the l2 guest.
>
> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Applied, thanks.
Tim.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-24 10:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-21 13:20 [PATCH] nestedhvm: handle l2 guest MMIO access Christoph Egger
2011-10-24 10:31 ` Tim Deegan
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.