Skip to contentSkip to conversation

Help: mtrr.c

PVH Mukesh Rathor 1 participant 1 message Dec 8, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

I am getting closer to submitting RFC patch for PVH but have two more things that need sorting out beofre I can do that. First is mtrr.c, I'm attaching list of functions that are affected below. I am guessing it should be similar to HVM path, but I'd need to spend time understanding it. If anyone already knows, please let me know.

Thanks,
Mukesh

xen/arch/x86/hvm/mtrr.c +27 -0
diff -r ba5e9253d04d xen/arch/x86/hvm/mtrr.c
@@ -553,6 +553,10 @@ int32_t hvm_get_mem_pinned_cacheattr(
 
     *type = 0;
 
+    if ( is_pvh_domain(d) ) {
+        printk("PVH: fixme: hvm_get_mem_pinned_cacheattr(). \n");
+        return 0;
+    }
     if ( !is_hvm_domain(d) )
         return 0;
 
@@ -578,6 +582,11 @@ int32_t hvm_set_mem_pinned_cacheattr(
 {
     struct hvm_mem_pinned_cacheattr_range *range;
 
+    if ( is_pvh_domain(d) ) {
+        printk("PVH: fixme: hvm_set_mem_pinned_cacheattr()\n");
+        return 0;
+    }
+
     if ( !((type == PAT_TYPE_UNCACHABLE) ||
            (type == PAT_TYPE_WRCOMB) ||
            (type == PAT_TYPE_WRTHROUGH) ||
@@ -606,6 +615,12 @@ static int hvm_save_mtrr_msr(struct doma
     struct vcpu *v;
     struct hvm_hw_mtrr hw_mtrr;
     struct mtrr_state *mtrr_state;
+
+    if ( is_pvh_domain(d) ) {
+        printk("PVH: fixme: hvm_save_mtrr_msr()\n");
+        return 0;
+    }
+
     /* save mtrr&pat */
     for_each_vcpu(d, v)
     {
@@ -644,6 +659,10 @@ static int hvm_load_mtrr_msr(struct doma
     struct mtrr_state *mtrr_state;
     struct hvm_hw_mtrr hw_mtrr;
 
+    if ( is_pvh_domain(d) ) {
+        printk("PVH: fixme: hvm_load_mtrr_msr()\n");
+        return 0;
+    }
     vcpuid = hvm_load_instance(h);
     if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
     {
@@ -693,6 +712,14 @@ uint8_t epte_get_entry_emt(struct domain
          ((d->vcpu == NULL) || ((v = d->vcpu[0]) == NULL)) )
         return MTRR_TYPE_WRBACK;
 
+    /* PVH TBD: FIXME: this needs to be studied, figure what need to be done
+     * for PVH */
+    if ( is_pvh_domain(d) ) {
+        if (direct_mmio)
+            return MTRR_TYPE_UNCACHABLE;
+        return MTRR_TYPE_WRBACK;
+    }
+
     if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_IDENT_PT] )
         return MTRR_TYPE_WRBACK;