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

[Xen-changelog] [xen-unstable] [IA64] vti save-restore: save/restore opt_feature status



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1195575687 25200
# Node ID e6acebec04a2be339254bb44979fcc4b07c487a8
# Parent  6fc79cb7934d9ad98ae163108e10f3fe6080dd9c
[IA64] vti save-restore: save/restore opt_feature status

Make hvm domain save/restore support opt_feature.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 xen/arch/ia64/vmx/mmio.c                |   72 ++++++++++++++++++++++++++++++++
 xen/include/public/arch-ia64/hvm/save.h |   40 +++++++++++------
 2 files changed, 97 insertions(+), 15 deletions(-)

diff -r 6fc79cb7934d -r e6acebec04a2 xen/arch/ia64/vmx/mmio.c
--- a/xen/arch/ia64/vmx/mmio.c  Tue Nov 20 09:14:43 2007 -0700
+++ b/xen/arch/ia64/vmx/mmio.c  Tue Nov 20 09:21:27 2007 -0700
@@ -37,6 +37,8 @@
 #include <asm/viosapic.h>
 #include <asm/vlsapic.h>
 #include <asm/hvm/vacpi.h>
+#include <asm/hvm/support.h>
+#include <public/hvm/save.h>
 
 #define HVM_BUFFERED_IO_RANGE_NR 1
 
@@ -261,6 +263,76 @@ static inline void set_os_type(VCPU *v, 
     }
 }
 
+static void __vmx_identity_mapping_save(int on,
+        const struct identity_mapping* im,
+        struct hvm_hw_ia64_identity_mapping *im_save)
+{
+    im_save->on = !!on;
+    if (!on) {
+        im_save->pgprot = 0;
+        im_save->key    = 0;
+    } else {
+        im_save->pgprot = im->pgprot;
+        im_save->key    = im->key;
+    }
+}
+
+static int vmx_identity_mappings_save(struct domain *d,
+                                      hvm_domain_context_t *h)
+{
+    const struct opt_feature *optf = &d->arch.opt_feature;
+    struct hvm_hw_ia64_identity_mappings im_save;
+
+    __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG4,
+                                &optf->im_reg4, &im_save.im_reg4);
+    __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG5,
+                                &optf->im_reg5, &im_save.im_reg5);
+    __vmx_identity_mapping_save(optf->mask & XEN_IA64_OPTF_IDENT_MAP_REG7,
+                                &optf->im_reg7, &im_save.im_reg7);
+
+    return hvm_save_entry(OPT_FEATURE_IDENTITY_MAPPINGS, 0, h, &im_save);
+}
+
+static int __vmx_identity_mapping_load(struct domain *d, unsigned long cmd,
+        const struct hvm_hw_ia64_identity_mapping *im_load)
+{
+    struct xen_ia64_opt_feature optf;
+
+    optf.cmd    = cmd;
+    optf.on     = im_load->on;
+    optf.pgprot = im_load->pgprot;
+    optf.key    = im_load->key;
+
+    return domain_opt_feature(d, &optf);
+}
+
+static int vmx_identity_mappings_load(struct domain *d,
+                                      hvm_domain_context_t *h)
+{
+    struct hvm_hw_ia64_identity_mappings im_load;
+    int rc;
+
+    if (hvm_load_entry(OPT_FEATURE_IDENTITY_MAPPINGS, h, &im_load))
+        return -EINVAL;
+
+    rc = __vmx_identity_mapping_load(d, XEN_IA64_OPTF_IDENT_MAP_REG4,
+                                     &im_load.im_reg4);
+    if (rc)
+        return rc;
+    rc = __vmx_identity_mapping_load(d, XEN_IA64_OPTF_IDENT_MAP_REG5,
+                                     &im_load.im_reg5);
+    if (rc)
+        return rc;
+    rc = __vmx_identity_mapping_load(d, XEN_IA64_OPTF_IDENT_MAP_REG7,
+                                     &im_load.im_reg7);
+
+    return rc;
+}
+
+HVM_REGISTER_SAVE_RESTORE(OPT_FEATURE_IDENTITY_MAPPINGS, 
+                          vmx_identity_mappings_save,
+                          vmx_identity_mappings_load,
+                          1, HVMSR_PER_DOM);
 
 static void legacy_io_access(VCPU *vcpu, u64 pa, u64 *val, size_t s, int dir)
 {
diff -r 6fc79cb7934d -r e6acebec04a2 xen/include/public/arch-ia64/hvm/save.h
--- a/xen/include/public/arch-ia64/hvm/save.h   Tue Nov 20 09:14:43 2007 -0700
+++ b/xen/include/public/arch-ia64/hvm/save.h   Tue Nov 20 09:21:27 2007 -0700
@@ -162,25 +162,35 @@ struct hvm_hw_ia64_vacpi {
 };
 DECLARE_HVM_SAVE_TYPE(VACPI, 7, struct hvm_hw_ia64_vacpi);
 // update last_gtime and setup timer of struct vacpi
-#endif
-
-#if 0
-/*
- * guest os type
- * XXX Xen guest os specific optimization
- *     This isn't hvm specific so this should be addressed genericly
- *     including paravirtualized domain.
- */
-struct hvm_hw_ia64_gos {
-    uint64_t   gos_type;
-};
-DECLARE_HVM_SAVE_TYPE(GOS_TYPE, 8, struct hvm_hw_ia64_gos);
-#endif
+
+/*
+ * opt_feature: identity mapping of region 4, 5 and 7.
+ * With the c/s 16396:d2935f9c217f of xen-ia64-devel.hg,
+ * opt_feature hypercall supports only region 4,5,7 identity mappings.
+ * structure hvm_hw_ia64_identity_mappings only supports them.
+ * The new structure, struct hvm_hw_ia64_identity_mappings, is created to
+ * avoid to keep up with change of the xen/ia64 internal structure, struct
+ * opt_feature.
+ *
+ * If it is enhanced in the future, new structure will be created.
+ */
+struct hvm_hw_ia64_identity_mapping {
+    uint64_t on;        /* on/off */
+    uint64_t pgprot;    /* The page protection bit mask of the pte. */
+    uint64_t key;       /* A protection key. */
+};
+
+struct hvm_hw_ia64_identity_mappings {
+    struct hvm_hw_ia64_identity_mapping im_reg4;/* Region 4 identity mapping */
+    struct hvm_hw_ia64_identity_mapping im_reg5;/* Region 5 identity mapping */
+    struct hvm_hw_ia64_identity_mapping im_reg7;/* Region 7 identity mapping */
+};
+DECLARE_HVM_SAVE_TYPE(OPT_FEATURE_IDENTITY_MAPPINGS, 8, struct 
hvm_hw_ia64_identity_mappings);
 
 /* 
  * Largest type-code in use
  */
-#define HVM_SAVE_CODE_MAX       7
+#define HVM_SAVE_CODE_MAX       8
 
 #endif /* __XEN_PUBLIC_HVM_SAVE_IA64_H__ */
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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