xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>
Subject: [RFC PATCH 11/16]: PVH xen: some misc changes like mtrr, intr, msi.
Date: Fri, 11 Jan 2013 18:03:56 -0800	[thread overview]
Message-ID: <20130111180356.2eedfb82@mantra.us.oracle.com> (raw)

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

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

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;

             reply	other threads:[~2013-01-12  2:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-12  2:03 Mukesh Rathor [this message]
2013-01-14 12:07 ` [RFC PATCH 11/16]: PVH xen: some misc changes like mtrr, intr, msi Jan Beulich
2013-01-16  1:02   ` Mukesh Rathor
2013-01-16 10:00     ` Jan Beulich
2013-02-06  0:31       ` Mukesh Rathor
2013-01-24 16:44 ` Tim Deegan
2013-02-01  0:05   ` Mukesh Rathor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130111180356.2eedfb82@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=Xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).