From: Paul Durrant <paul.durrant@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Paul Durrant <paul.durrant@citrix.com>,
Wei Liu <wei.liu2@citrix.com>, Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v2 3/9] viridian: remove comments referencing section number in the spec.
Date: Wed, 31 Oct 2018 12:43:29 +0000 [thread overview]
Message-ID: <20181031124335.23867-4-paul.durrant@citrix.com> (raw)
In-Reply-To: <20181031124335.23867-1-paul.durrant@citrix.com>
Microsoft has a habit of re-numbering sections in the spec. so avoid
referring to section numbers in comments. Also remove the URL for the
spec. from the boilerplate... Again, Microsoft has a habit of changing
these too.
This patch also cleans up some > 80 character lines.
Purely cosmetic. No functional change.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed--by: Roger Pau Monne <roger.pau@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
v2:
- Fix comment style
---
xen/arch/x86/hvm/viridian/viridian.c | 84 ++++++++++++++++--------------------
xen/include/asm-x86/hvm/viridian.h | 4 --
2 files changed, 36 insertions(+), 52 deletions(-)
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index c5722d6992..f5f5fbcdfe 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -1,12 +1,8 @@
-/******************************************************************************
+/**************************************************************************
* viridian.c
*
* An implementation of some Viridian enlightenments. See Microsoft's
- * Hypervisor Top Level Functional Specification (v5.0a) at:
- *
- * https://github.com/Microsoft/Virtualization-Documentation/raw/master/tlfs/Hypervisor%20Top%20Level%20Functional%20Specification%20v5.0.pdf
- *
- * for more information.
+ * Hypervisor Top Level Functional Specification for more information.
*/
#include <xen/sched.h>
@@ -102,12 +98,7 @@
/* Viridian Hypercall Flags. */
#define HV_FLUSH_ALL_PROCESSORS 1
-/*
- * Viridian Partition Privilege Flags.
- *
- * This is taken from section 4.2.2 of the specification, and fixed for
- * style and correctness.
- */
+/* Viridian Partition Privilege Flags */
typedef struct {
/* Access to virtual MSRs */
uint64_t AccessVpRunTimeReg:1;
@@ -168,7 +159,7 @@ typedef union _HV_CRASH_CTL_REG_CONTENTS
#define CPUID4A_MSR_BASED_APIC (1 << 3)
#define CPUID4A_RELAX_TIMER_INT (1 << 5)
-/* Viridian CPUID leaf 6: Implementation HW features detected and in use. */
+/* Viridian CPUID leaf 6: Implementation HW features detected and in use */
#define CPUID6A_APIC_OVERLAY (1 << 0)
#define CPUID6A_MSR_BITMAPS (1 << 1)
#define CPUID6A_NESTED_PAGING (1 << 3)
@@ -204,7 +195,6 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
switch ( leaf )
{
case 0:
- /* See section 2.4.1 of the specification */
res->a = 0x40000006; /* Maximum leaf */
memcpy(&res->b, "Micr", 4);
memcpy(&res->c, "osof", 4);
@@ -212,13 +202,14 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
break;
case 1:
- /* See section 2.4.2 of the specification */
memcpy(&res->a, "Hv#1", 4);
break;
case 2:
- /* Hypervisor information, but only if the guest has set its
- own version number. */
+ /*
+ * Hypervisor information, but only if the guest has set its
+ * own version number.
+ */
if ( d->arch.hvm.viridian.guest_os_id.raw == 0 )
break;
res->a = viridian_build;
@@ -230,9 +221,9 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
case 3:
{
/*
- * Section 2.4.4 details this leaf and states that EAX and EBX
- * are defined to be the low and high parts of the partition
- * privilege mask respectively.
+ * The specification states that EAX and EBX are defined to be
+ * the low and high parts of the partition privilege mask
+ * respectively.
*/
HV_PARTITION_PRIVILEGE_MASK mask = {
.AccessIntrCtrlRegs = 1,
@@ -382,11 +373,6 @@ static void initialize_vp_assist(struct vcpu *v)
ASSERT(!v->arch.hvm.viridian.vp_assist.va);
- /*
- * See section 7.8.7 of the specification for details of this
- * enlightenment.
- */
-
if ( !page )
goto fail;
@@ -409,8 +395,8 @@ static void initialize_vp_assist(struct vcpu *v)
return;
fail:
- gdprintk(XENLOG_WARNING, "Bad GMFN %#"PRI_gfn" (MFN %#"PRI_mfn")\n", gmfn,
- mfn_x(page ? page_to_mfn(page) : INVALID_MFN));
+ gdprintk(XENLOG_WARNING, "Bad GMFN %#"PRI_gfn" (MFN %#"PRI_mfn")\n",
+ gmfn, mfn_x(page ? page_to_mfn(page) : INVALID_MFN));
}
static void teardown_vp_assist(struct vcpu *v)
@@ -498,14 +484,15 @@ static void update_reference_tsc(struct domain *d, bool_t initialize)
clear_page(p);
/*
- * This enlightenment must be disabled is the host TSC is not invariant.
- * However it is also disabled if vtsc is true (which means rdtsc is being
- * emulated). This generally happens when guest TSC freq and host TSC freq
- * don't match. The TscScale value could be adjusted to cope with this,
- * allowing vtsc to be turned off, but support for this is not yet present
- * in the hypervisor. Thus is it is possible that migrating a Windows VM
- * between hosts of differing TSC frequencies may result in large
- * differences in guest performance.
+ * This enlightenment must be disabled is the host TSC is not
+ * invariant. However it is also disabled if vtsc is true (which
+ * means rdtsc is being emulated). This generally happens when guest
+ * TSC freq and host TSC freq don't match. The TscScale value could be
+ * adjusted to cope with this, allowing vtsc to be turned off, but
+ * support for this is not yet present in the hypervisor. Thus is it
+ * is possible that migrating a Windows VM between hosts of differing
+ * TSC frequencies may result in large differences in guest
+ * performance.
*/
if ( !host_tsc_is_safe() || d->arch.vtsc )
{
@@ -515,10 +502,10 @@ static void update_reference_tsc(struct domain *d, bool_t initialize)
* this mechanism is no longer a reliable source of time and that
* the VM should fall back to a different source.
*
- * Server 2012 (6.2 kernel) and 2012 R2 (6.3 kernel) actually violate
- * the spec. and rely on a value of 0 to indicate that this
- * enlightenment should no longer be used. These two kernel
- * versions are currently the only ones to make use of this
+ * Server 2012 (6.2 kernel) and 2012 R2 (6.3 kernel) actually
+ * violate the specification and rely on a value of 0 to indicate
+ * that this enlightenment should no longer be used. These two
+ * kernel versions are currently the only ones to make use of this
* enlightenment, so just use 0 here.
*/
p->TscSequence = 0;
@@ -646,7 +633,8 @@ int guest_wrmsr_viridian(struct vcpu *v, uint32_t idx, uint64_t val)
default:
gdprintk(XENLOG_INFO,
- "Write %016"PRIx64" to unimplemented MSR %#x\n", val, idx);
+ "Write %016"PRIx64" to unimplemented MSR %#x\n", val,
+ idx);
return X86EMUL_EXCEPTION;
}
@@ -872,10 +860,6 @@ int viridian_hypercall(struct cpu_user_regs *regs)
uint64_t vcpu_mask;
} input_params;
- /*
- * See sections 9.4.2 and 9.4.4 of the specification.
- */
-
/* These hypercalls should never use the fast-call convention. */
status = HV_STATUS_INVALID_PARAMETER;
if ( input.fast )
@@ -883,7 +867,8 @@ int viridian_hypercall(struct cpu_user_regs *regs)
/* Get input parameters. */
if ( hvm_copy_from_guest_phys(&input_params, input_params_gpa,
- sizeof(input_params)) != HVMTRANS_okay )
+ sizeof(input_params)) !=
+ HVMTRANS_okay )
break;
/*
@@ -961,7 +946,8 @@ out:
return HVM_HCALL_completed;
}
-static int viridian_save_domain_ctxt(struct vcpu *v, hvm_domain_context_t *h)
+static int viridian_save_domain_ctxt(struct vcpu *v,
+ hvm_domain_context_t *h)
{
const struct domain *d = v->domain;
struct hvm_viridian_domain_context ctxt = {
@@ -977,7 +963,8 @@ static int viridian_save_domain_ctxt(struct vcpu *v, hvm_domain_context_t *h)
return (hvm_save_entry(VIRIDIAN_DOMAIN, 0, h, &ctxt) != 0);
}
-static int viridian_load_domain_ctxt(struct domain *d, hvm_domain_context_t *h)
+static int viridian_load_domain_ctxt(struct domain *d,
+ hvm_domain_context_t *h)
{
struct hvm_viridian_domain_context ctxt;
@@ -1011,7 +998,8 @@ static int viridian_save_vcpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
return hvm_save_entry(VIRIDIAN_VCPU, v->vcpu_id, h, &ctxt);
}
-static int viridian_load_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h)
+static int viridian_load_vcpu_ctxt(struct domain *d,
+ hvm_domain_context_t *h)
{
unsigned int vcpuid = hvm_load_instance(h);
struct vcpu *v;
diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/viridian.h
index 071fb445bb..f6008f9bdb 100644
--- a/xen/include/asm-x86/hvm/viridian.h
+++ b/xen/include/asm-x86/hvm/viridian.h
@@ -77,10 +77,6 @@ union viridian_reference_tsc
} fields;
};
-/*
- * Type defintion as in Microsoft Hypervisor Top-Level Functional
- * Specification v4.0a, section 15.4.2.
- */
typedef struct _HV_REFERENCE_TSC_PAGE
{
uint32_t TscSequence;
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-10-31 12:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-31 12:43 [PATCH v2 0/9] viridian cleanup Paul Durrant
2018-10-31 12:43 ` [PATCH v2 1/9] viridian: move the code into its own sub-directory Paul Durrant
2018-10-31 12:43 ` [PATCH v2 2/9] viridian: remove MSR perf counters Paul Durrant
2018-10-31 12:43 ` Paul Durrant [this message]
2018-10-31 12:43 ` [PATCH v2 4/9] viridian: remove duplicate union types Paul Durrant
2018-10-31 12:43 ` [PATCH v2 5/9] viridian: separate interrupt related enlightenment implementations Paul Durrant
2018-10-31 15:40 ` Wei Liu
2018-11-05 12:51 ` Jan Beulich
2018-11-05 13:22 ` Paul Durrant
2018-10-31 12:43 ` [PATCH v2 6/9] viridian: separate time " Paul Durrant
2018-10-31 15:43 ` Wei Liu
2018-11-05 12:56 ` Jan Beulich
2018-11-05 13:26 ` Paul Durrant
2018-11-05 13:36 ` Jan Beulich
2018-11-05 13:54 ` Paul Durrant
2018-11-05 14:56 ` Jan Beulich
2018-10-31 12:43 ` [PATCH v2 7/9] viridian: define type for the 'virtual VP assist page' Paul Durrant
2018-10-31 15:45 ` Wei Liu
2018-11-05 12:59 ` Jan Beulich
2018-11-05 13:19 ` Paul Durrant
2018-10-31 12:43 ` [PATCH v2 8/9] tools/misc: fix hard tabs in xen-hvmctx.c Paul Durrant
2018-10-31 14:00 ` Wei Liu
2018-10-31 12:43 ` [PATCH v2 9/9] viridian: introduce struct viridian_page Paul Durrant
2018-10-31 15:50 ` Wei Liu
2018-11-05 13:05 ` Jan Beulich
2018-11-05 13:18 ` Paul Durrant
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=20181031124335.23867-4-paul.durrant@citrix.com \
--to=paul.durrant@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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).