libxc/migration: Rename TSC_INFO to X86_TSC_INFO
diff mbox series

Message ID 20191220173044.12714-1-andrew.cooper3@citrix.com
State New
Headers show
Series
  • libxc/migration: Rename TSC_INFO to X86_TSC_INFO
Related show

Commit Message

Andrew Cooper Dec. 20, 2019, 5:30 p.m. UTC
This record is specific to x86, and should have had a prefix to being with.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Wei Liu <wl@xen.org>
CC: Julien Grall <julien@xen.org>
CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 docs/specs/libxc-migration-stream.pandoc   | 10 +++++-----
 tools/libxc/xc_sr_common.c                 |  4 ++--
 tools/libxc/xc_sr_common_x86.c             | 12 ++++++------
 tools/libxc/xc_sr_common_x86.h             |  8 ++++----
 tools/libxc/xc_sr_restore_x86_hvm.c        |  4 ++--
 tools/libxc/xc_sr_restore_x86_pv.c         |  4 ++--
 tools/libxc/xc_sr_save_x86_hvm.c           |  2 +-
 tools/libxc/xc_sr_save_x86_pv.c            |  2 +-
 tools/libxc/xc_sr_stream_format.h          |  6 +++---
 tools/python/scripts/convert-legacy-stream |  4 ++--
 tools/python/xen/migration/libxc.py        | 10 +++++-----
 tools/python/xen/migration/tests.py        |  2 +-
 12 files changed, 34 insertions(+), 34 deletions(-)

Comments

Ian Jackson Dec. 20, 2019, 6:23 p.m. UTC | #1
Andrew Cooper writes ("[PATCH] libxc/migration: Rename TSC_INFO to X86_TSC_INFO"):
> This record is specific to x86, and should have had a prefix to being with.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Patch
diff mbox series

diff --git a/docs/specs/libxc-migration-stream.pandoc b/docs/specs/libxc-migration-stream.pandoc
index a365dba0c8..313be3e80d 100644
--- a/docs/specs/libxc-migration-stream.pandoc
+++ b/docs/specs/libxc-migration-stream.pandoc
@@ -215,7 +215,7 @@  type         0x00000000: END
 
              0x00000007: SHARED_INFO
 
-             0x00000008: TSC_INFO
+             0x00000008: X86_TSC_INFO
 
              0x00000009: HVM_CONTEXT
 
@@ -460,8 +460,8 @@  shared_info      Contents of the shared info page.  This record
 
 \clearpage
 
-TSC_INFO
---------
+X86_TSC_INFO
+------------
 
 Domain TSC information, as accessed by the
 XEN_DOMCTL_{get,set}tscinfo hypercall sub-ops.
@@ -646,7 +646,7 @@  A typical save record for an x86 PV guest image would look like:
 * X86_PV_INFO record
 * X86_PV_P2M_FRAMES record
 * Many PAGE_DATA records
-* TSC_INFO
+* X86_TSC_INFO
 * SHARED_INFO record
 * VCPU context records for each online VCPU
     * X86_PV_VCPU_BASIC record
@@ -672,7 +672,7 @@  A typical save record for an x86 HVM guest image would look like:
 * Image header
 * Domain header
 * Many PAGE_DATA records
-* TSC_INFO
+* X86_TSC_INFO
 * HVM_PARAMS
 * HVM_CONTEXT
 
diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xc_sr_common.c
index 6b887b3053..370d98d94a 100644
--- a/tools/libxc/xc_sr_common.c
+++ b/tools/libxc/xc_sr_common.c
@@ -30,7 +30,7 @@  static const char *mandatory_rec_types[] =
     [REC_TYPE_X86_PV_VCPU_EXTENDED]         = "x86 PV vcpu extended",
     [REC_TYPE_X86_PV_VCPU_XSAVE]            = "x86 PV vcpu xsave",
     [REC_TYPE_SHARED_INFO]                  = "Shared info",
-    [REC_TYPE_TSC_INFO]                     = "TSC info",
+    [REC_TYPE_X86_TSC_INFO]                 = "x86 TSC info",
     [REC_TYPE_HVM_CONTEXT]                  = "HVM context",
     [REC_TYPE_HVM_PARAMS]                   = "HVM params",
     [REC_TYPE_TOOLSTACK]                    = "Toolstack",
@@ -151,7 +151,7 @@  static void __attribute__((unused)) build_assertions(void)
     BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_info)       != 8);
     BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_p2m_frames) != 8);
     BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_vcpu_hdr)   != 8);
-    BUILD_BUG_ON(sizeof(struct xc_sr_rec_tsc_info)          != 24);
+    BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_tsc_info)      != 24);
     BUILD_BUG_ON(sizeof(struct xc_sr_rec_hvm_params_entry)  != 16);
     BUILD_BUG_ON(sizeof(struct xc_sr_rec_hvm_params)        != 8);
 }
diff --git a/tools/libxc/xc_sr_common_x86.c b/tools/libxc/xc_sr_common_x86.c
index 98f1cef30f..1dee840a03 100644
--- a/tools/libxc/xc_sr_common_x86.c
+++ b/tools/libxc/xc_sr_common_x86.c
@@ -1,12 +1,12 @@ 
 #include "xc_sr_common_x86.h"
 
-int write_tsc_info(struct xc_sr_context *ctx)
+int write_x86_tsc_info(struct xc_sr_context *ctx)
 {
     xc_interface *xch = ctx->xch;
-    struct xc_sr_rec_tsc_info tsc = { 0 };
+    struct xc_sr_rec_x86_tsc_info tsc = {};
     struct xc_sr_record rec =
     {
-        .type = REC_TYPE_TSC_INFO,
+        .type = REC_TYPE_X86_TSC_INFO,
         .length = sizeof(tsc),
         .data = &tsc
     };
@@ -21,14 +21,14 @@  int write_tsc_info(struct xc_sr_context *ctx)
     return write_record(ctx, &rec);
 }
 
-int handle_tsc_info(struct xc_sr_context *ctx, struct xc_sr_record *rec)
+int handle_x86_tsc_info(struct xc_sr_context *ctx, struct xc_sr_record *rec)
 {
     xc_interface *xch = ctx->xch;
-    struct xc_sr_rec_tsc_info *tsc = rec->data;
+    struct xc_sr_rec_x86_tsc_info *tsc = rec->data;
 
     if ( rec->length != sizeof(*tsc) )
     {
-        ERROR("TSC_INFO record wrong size: length %u, expected %zu",
+        ERROR("X86_TSC_INFO record wrong size: length %u, expected %zu",
               rec->length, sizeof(*tsc));
         return -1;
     }
diff --git a/tools/libxc/xc_sr_common_x86.h b/tools/libxc/xc_sr_common_x86.h
index 1d42da9af2..ebc4355bd1 100644
--- a/tools/libxc/xc_sr_common_x86.h
+++ b/tools/libxc/xc_sr_common_x86.h
@@ -4,15 +4,15 @@ 
 #include "xc_sr_common.h"
 
 /*
- * Obtains a domains TSC information from Xen and writes a TSC_INFO record
+ * Obtains a domains TSC information from Xen and writes a X86_TSC_INFO record
  * into the stream.
  */
-int write_tsc_info(struct xc_sr_context *ctx);
+int write_x86_tsc_info(struct xc_sr_context *ctx);
 
 /*
- * Parses a TSC_INFO record and applies the result to the domain.
+ * Parses a X86_TSC_INFO record and applies the result to the domain.
  */
-int handle_tsc_info(struct xc_sr_context *ctx, struct xc_sr_record *rec);
+int handle_x86_tsc_info(struct xc_sr_context *ctx, struct xc_sr_record *rec);
 
 #endif
 /*
diff --git a/tools/libxc/xc_sr_restore_x86_hvm.c b/tools/libxc/xc_sr_restore_x86_hvm.c
index 9763aaa8dc..4a24dc0137 100644
--- a/tools/libxc/xc_sr_restore_x86_hvm.c
+++ b/tools/libxc/xc_sr_restore_x86_hvm.c
@@ -171,8 +171,8 @@  static int x86_hvm_process_record(struct xc_sr_context *ctx,
 {
     switch ( rec->type )
     {
-    case REC_TYPE_TSC_INFO:
-        return handle_tsc_info(ctx, rec);
+    case REC_TYPE_X86_TSC_INFO:
+        return handle_x86_tsc_info(ctx, rec);
 
     case REC_TYPE_HVM_CONTEXT:
         return handle_hvm_context(ctx, rec);
diff --git a/tools/libxc/xc_sr_restore_x86_pv.c b/tools/libxc/xc_sr_restore_x86_pv.c
index 70b8d2ad95..b64f79d4d5 100644
--- a/tools/libxc/xc_sr_restore_x86_pv.c
+++ b/tools/libxc/xc_sr_restore_x86_pv.c
@@ -1098,8 +1098,8 @@  static int x86_pv_process_record(struct xc_sr_context *ctx,
     case REC_TYPE_SHARED_INFO:
         return handle_shared_info(ctx, rec);
 
-    case REC_TYPE_TSC_INFO:
-        return handle_tsc_info(ctx, rec);
+    case REC_TYPE_X86_TSC_INFO:
+        return handle_x86_tsc_info(ctx, rec);
 
     default:
         return RECORD_NOT_PROCESSED;
diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c
index 97a8c49807..90ff35a439 100644
--- a/tools/libxc/xc_sr_save_x86_hvm.c
+++ b/tools/libxc/xc_sr_save_x86_hvm.c
@@ -195,7 +195,7 @@  static int x86_hvm_end_of_checkpoint(struct xc_sr_context *ctx)
     int rc;
 
     /* Write the TSC record. */
-    rc = write_tsc_info(ctx);
+    rc = write_x86_tsc_info(ctx);
     if ( rc )
         return rc;
 
diff --git a/tools/libxc/xc_sr_save_x86_pv.c b/tools/libxc/xc_sr_save_x86_pv.c
index e4b099cfd0..09b6efeee3 100644
--- a/tools/libxc/xc_sr_save_x86_pv.c
+++ b/tools/libxc/xc_sr_save_x86_pv.c
@@ -1104,7 +1104,7 @@  static int x86_pv_end_of_checkpoint(struct xc_sr_context *ctx)
 {
     int rc;
 
-    rc = write_tsc_info(ctx);
+    rc = write_x86_tsc_info(ctx);
     if ( rc )
         return rc;
 
diff --git a/tools/libxc/xc_sr_stream_format.h b/tools/libxc/xc_sr_stream_format.h
index 15ff1c7efb..051afa7dcd 100644
--- a/tools/libxc/xc_sr_stream_format.h
+++ b/tools/libxc/xc_sr_stream_format.h
@@ -68,7 +68,7 @@  struct xc_sr_rhdr
 #define REC_TYPE_X86_PV_VCPU_EXTENDED       0x00000005U
 #define REC_TYPE_X86_PV_VCPU_XSAVE          0x00000006U
 #define REC_TYPE_SHARED_INFO                0x00000007U
-#define REC_TYPE_TSC_INFO                   0x00000008U
+#define REC_TYPE_X86_TSC_INFO               0x00000008U
 #define REC_TYPE_HVM_CONTEXT                0x00000009U
 #define REC_TYPE_HVM_PARAMS                 0x0000000aU
 #define REC_TYPE_TOOLSTACK                  0x0000000bU
@@ -114,8 +114,8 @@  struct xc_sr_rec_x86_pv_vcpu_hdr
     uint8_t context[0];
 };
 
-/* TSC_INFO */
-struct xc_sr_rec_tsc_info
+/* X86_TSC_INFO */
+struct xc_sr_rec_x86_tsc_info
 {
     uint32_t mode;
     uint32_t khz;
diff --git a/tools/python/scripts/convert-legacy-stream b/tools/python/scripts/convert-legacy-stream
index 6b68ef5923..a5da30b1ce 100755
--- a/tools/python/scripts/convert-legacy-stream
+++ b/tools/python/scripts/convert-legacy-stream
@@ -153,7 +153,7 @@  def write_page_data(pfns, pages):
 
 def write_libxc_tsc_info(mode, khz, nsec, incarn):
     write_record(libxc.REC_TYPE_tsc_info,
-                 pack(libxc.TSC_INFO_FORMAT,
+                 pack(libxc.X86_TSC_INFO_FORMAT,
                       mode, khz, nsec, incarn, 0))
 
 def write_libxc_hvm_params(params):
@@ -435,7 +435,7 @@  def read_chunks(vm):
 
         elif marker == legacy.CHUNK_tsc_info:
             mode, nsec, khz, incarn = unpack_exact("=IQII")
-            info("  TSC_INFO: mode %s, %d ns, %d khz, %d incarn"
+            info("  X86_TSC_INFO: mode %s, %d ns, %d khz, %d incarn"
                  % (mode, nsec, khz, incarn))
             write_libxc_tsc_info(mode, khz, nsec, incarn)
 
diff --git a/tools/python/xen/migration/libxc.py b/tools/python/xen/migration/libxc.py
index 0a329c2090..70bcb8d15b 100644
--- a/tools/python/xen/migration/libxc.py
+++ b/tools/python/xen/migration/libxc.py
@@ -109,8 +109,8 @@ 
 # x86_pv_vcpu_{basic,extended,xsave,msrs}
 X86_PV_VCPU_HDR_FORMAT    = "II"
 
-# tsc_info
-TSC_INFO_FORMAT           = "IIQII"
+# x86_tsc_info
+X86_TSC_INFO_FORMAT       = "IIQII"
 
 # hvm_params
 HVM_PARAMS_ENTRY_FORMAT   = "QQ"
@@ -354,15 +354,15 @@  def verify_record_shared_info(self, content):
     def verify_record_tsc_info(self, content):
         """ tsc info record """
 
-        sz = calcsize(TSC_INFO_FORMAT)
+        sz = calcsize(X86_TSC_INFO_FORMAT)
 
         if len(content) != sz:
             raise RecordError("Length should be %u bytes" % (sz, ))
 
-        mode, khz, nsec, incarn, res1 = unpack(TSC_INFO_FORMAT, content)
+        mode, khz, nsec, incarn, res1 = unpack(X86_TSC_INFO_FORMAT, content)
 
         if res1 != 0:
-            raise StreamError("Reserved bits set in TSC_INFO: 0x%08x"
+            raise StreamError("Reserved bits set in X86_TSC_INFO: 0x%08x"
                               % (res1, ))
 
         self.info("  Mode %u, %u kHz, %u ns, incarnation %d"
diff --git a/tools/python/xen/migration/tests.py b/tools/python/xen/migration/tests.py
index 026cf38012..ff2768946b 100644
--- a/tools/python/xen/migration/tests.py
+++ b/tools/python/xen/migration/tests.py
@@ -23,7 +23,7 @@  def test_format_sizes(self):
                          (libxc.X86_PV_INFO_FORMAT, 8),
                          (libxc.X86_PV_P2M_FRAMES_FORMAT, 8),
                          (libxc.X86_PV_VCPU_HDR_FORMAT, 8),
-                         (libxc.TSC_INFO_FORMAT, 24),
+                         (libxc.X86_TSC_INFO_FORMAT, 24),
                          (libxc.HVM_PARAMS_ENTRY_FORMAT, 16),
                          (libxc.HVM_PARAMS_FORMAT, 8),
                          ):