[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH 11/16]: PVH xen: some misc changes like mtrr, intr, msi.



I could use some feedback here, not sure if I covered everything here. 

Signed-off-by: Mukesh Rathor <mukesh.rathor@xxxxxxxxxx>

diff -r 0a38c610f26b -r 33fc5356ad7c xen/arch/x86/hvm/irq.c
--- a/xen/arch/x86/hvm/irq.c    Fri Jan 11 16:34:17 2013 -0800
+++ b/xen/arch/x86/hvm/irq.c    Fri Jan 11 16:35:48 2013 -0800
@@ -405,6 +405,9 @@ struct hvm_intack hvm_vcpu_has_pending_i
          && vcpu_info(v, evtchn_upcall_pending) )
         return hvm_intack_vector(plat->irq.callback_via.vector);
 
+    if ( is_pvh_vcpu(v) )
+        return hvm_intack_none;
+
     if ( vlapic_accept_pic_intr(v) && plat->vpic[0].int_output )
         return hvm_intack_pic(0);
 
diff -r 0a38c610f26b -r 33fc5356ad7c xen/arch/x86/hvm/mtrr.c
--- a/xen/arch/x86/hvm/mtrr.c   Fri Jan 11 16:34:17 2013 -0800
+++ b/xen/arch/x86/hvm/mtrr.c   Fri Jan 11 16:35:48 2013 -0800
@@ -553,6 +553,9 @@ int32_t hvm_get_mem_pinned_cacheattr(
 
     *type = 0;
 
+    if ( is_pvh_domain(d) )
+        return 0;
+
     if ( !is_hvm_domain(d) )
         return 0;
 
@@ -578,6 +581,9 @@ int32_t hvm_set_mem_pinned_cacheattr(
 {
     struct hvm_mem_pinned_cacheattr_range *range;
 
+    /* PVH note: The guest writes to MSR_IA32_CR_PAT natively */
+    NO_PVH_ASSERT_DOMAIN(d);
+
     if ( !((type == PAT_TYPE_UNCACHABLE) ||
            (type == PAT_TYPE_WRCOMB) ||
            (type == PAT_TYPE_WRTHROUGH) ||
@@ -606,6 +612,7 @@ static int hvm_save_mtrr_msr(struct doma
     struct vcpu *v;
     struct hvm_hw_mtrr hw_mtrr;
     struct mtrr_state *mtrr_state;
+
     /* save mtrr&pat */
     for_each_vcpu(d, v)
     {
@@ -693,7 +700,15 @@ uint8_t epte_get_entry_emt(struct domain
          ((d->vcpu == NULL) || ((v = d->vcpu[0]) == NULL)) )
         return MTRR_TYPE_WRBACK;
 
-    if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
+    /* PVH:fixme: this needs to be studied more */
+    if ( is_pvh_domain(d) ) {
+        if (direct_mmio)
+            return MTRR_TYPE_UNCACHABLE;
+        return MTRR_TYPE_WRBACK;
+    }
+
+    if ( !is_pvh_domain(d) &&
+         !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
         return MTRR_TYPE_WRBACK;
 
     if ( (v == current) && v->domain->arch.hvm_domain.is_in_uc_mode )
diff -r 0a38c610f26b -r 33fc5356ad7c xen/arch/x86/hvm/vmx/intr.c
--- a/xen/arch/x86/hvm/vmx/intr.c       Fri Jan 11 16:34:17 2013 -0800
+++ b/xen/arch/x86/hvm/vmx/intr.c       Fri Jan 11 16:35:48 2013 -0800
@@ -216,15 +216,16 @@ void vmx_intr_assist(void)
         return;
     }
 
-    /* Crank the handle on interrupt state. */
-    pt_vector = pt_update_irq(v);
+    if ( !is_pvh_vcpu(v) )
+        /* Crank the handle on interrupt state. */
+        pt_vector = pt_update_irq(v);
 
     do {
         intack = hvm_vcpu_has_pending_irq(v);
         if ( likely(intack.source == hvm_intsrc_none) )
             goto out;
 
-        if ( unlikely(nvmx_intr_intercept(v, intack)) )
+        if ( !is_pvh_vcpu(v) && unlikely(nvmx_intr_intercept(v, intack)) )
             goto out;
 
         intblk = hvm_interrupt_blocked(v, intack);
diff -r 0a38c610f26b -r 33fc5356ad7c xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c        Fri Jan 11 16:34:17 2013 -0800
+++ b/xen/arch/x86/msi.c        Fri Jan 11 16:35:48 2013 -0800
@@ -766,10 +766,12 @@ static int msix_capability_init(struct p
         WARN_ON(rangeset_overlaps_range(mmio_ro_ranges, dev->msix_pba.first,
                                         dev->msix_pba.last));
 
-        if ( rangeset_add_range(mmio_ro_ranges, dev->msix_table.first,
+/* PVH: for now we don't make the mmio range readonly. See xen-devel for 
thread:
+ * "[PVH]: Help: msi.c". When linux msi.c is fixed, pvh check can be removed */
+        if ( !is_pvh_domain(dev->domain) && rangeset_add_range(mmio_ro_ranges, 
dev->msix_table.first,
                                 dev->msix_table.last) )
             WARN();
-        if ( rangeset_add_range(mmio_ro_ranges, dev->msix_pba.first,
+        if ( !is_pvh_domain(dev->domain) && rangeset_add_range(mmio_ro_ranges, 
dev->msix_pba.first,
                                 dev->msix_pba.last) )
             WARN();
 
diff -r 0a38c610f26b -r 33fc5356ad7c xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Fri Jan 11 16:34:17 2013 -0800
+++ b/xen/arch/x86/time.c       Fri Jan 11 16:35:48 2013 -0800
@@ -1923,7 +1923,7 @@ void tsc_set_info(struct domain *d,
         break;
     }
     d->arch.incarnation = incarnation + 1;
-    if ( is_hvm_domain(d) )
+    if ( is_hvm_or_pvh_domain(d) )
         hvm_set_rdtsc_exiting(d, d->arch.vtsc);
 }
 
diff -r 0a38c610f26b -r 33fc5356ad7c xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c    Fri Jan 11 16:34:17 2013 -0800
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c    Fri Jan 11 16:35:48 2013 -0800
@@ -968,6 +968,10 @@ static int ioport_access_check(
     struct segment_register tr;
     int rc = X86EMUL_OKAY;
 
+    /* PVH should not really get here */
+    /* fixme: need bunch of headers for this assert. check why no headers. */
+    /* NO_PVH_ASSERT_VCPU(current); */
+
     if ( !(ctxt->regs->eflags & EFLG_VM) && mode_iopl() )
         return X86EMUL_OKAY;
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.