All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v3 08/16] x86/hvm: rearrange content of hvm.h
Date: Tue, 4 Sep 2018 17:15:25 +0100	[thread overview]
Message-ID: <20180904161533.11575-9-wei.liu2@citrix.com> (raw)
In-Reply-To: <20180904161533.11575-1-wei.liu2@citrix.com>

Move enum and function declarations to first half of the file.

Static inline functions and macros, which reference HVM specific
fields directly are grouped together in second half of the file.

The movement is needed because in a later patch the second half is
going to be enclosed in CONFIG_HVM.

Pure code movement. No functional change.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/include/asm-x86/hvm/hvm.h | 159 +++++++++++++++++++++---------------------
 1 file changed, 80 insertions(+), 79 deletions(-)

diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 6b0e088750..0c321409ee 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -257,16 +257,6 @@ void hvm_get_guest_pat(struct vcpu *v, u64 *guest_pat);
 int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat);
 
 u64 hvm_get_guest_tsc_fixed(struct vcpu *v, u64 at_tsc);
-#define hvm_get_guest_tsc(v) hvm_get_guest_tsc_fixed(v, 0)
-
-#define hvm_tsc_scaling_supported \
-    (!!hvm_funcs.tsc_scaling.ratio_frac_bits)
-
-#define hvm_default_tsc_scaling_ratio \
-    (1ULL << hvm_funcs.tsc_scaling.ratio_frac_bits)
-
-#define hvm_tsc_scaling_ratio(d) \
-    ((d)->arch.hvm.tsc_scaling_ratio)
 
 u64 hvm_scale_tsc(const struct domain *d, u64 tsc);
 u64 hvm_get_tsc_scaling_ratio(u32 gtsc_khz);
@@ -274,7 +264,6 @@ u64 hvm_get_tsc_scaling_ratio(u32 gtsc_khz);
 void hvm_init_guest_time(struct domain *d);
 void hvm_set_guest_time(struct vcpu *v, u64 guest_time);
 uint64_t hvm_get_guest_time_fixed(const struct vcpu *v, uint64_t at_tsc);
-#define hvm_get_guest_time(v) hvm_get_guest_time_fixed(v, 0)
 
 int vmsi_deliver(
     struct domain *d, int vector,
@@ -284,6 +273,86 @@ struct hvm_pirq_dpci;
 void vmsi_deliver_pirq(struct domain *d, const struct hvm_pirq_dpci *);
 int hvm_girq_dest_2_vcpu_id(struct domain *d, uint8_t dest, uint8_t dest_mode);
 
+enum hvm_intblk
+hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack);
+
+void hvm_hypercall_page_initialise(struct domain *d, void *hypercall_page);
+
+void hvm_get_segment_register(struct vcpu *v, enum x86_segment seg,
+                              struct segment_register *reg);
+void hvm_set_segment_register(struct vcpu *v, enum x86_segment seg,
+                              struct segment_register *reg);
+
+bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val);
+
+bool hvm_check_cpuid_faulting(struct vcpu *v);
+void hvm_migrate_timers(struct vcpu *v);
+void hvm_do_resume(struct vcpu *v);
+void hvm_migrate_pirqs(struct vcpu *v);
+
+void hvm_inject_event(const struct x86_event *event);
+
+int hvm_event_needs_reinjection(uint8_t type, uint8_t vector);
+
+uint8_t hvm_combine_hw_exceptions(uint8_t vec1, uint8_t vec2);
+
+void hvm_set_rdtsc_exiting(struct domain *d, bool_t enable);
+
+enum hvm_task_switch_reason { TSW_jmp, TSW_iret, TSW_call_or_int };
+void hvm_task_switch(
+    uint16_t tss_sel, enum hvm_task_switch_reason taskswitch_reason,
+    int32_t errcode);
+
+enum hvm_access_type {
+    hvm_access_insn_fetch,
+    hvm_access_none,
+    hvm_access_read,
+    hvm_access_write
+};
+bool_t hvm_virtual_to_linear_addr(
+    enum x86_segment seg,
+    const struct segment_register *reg,
+    unsigned long offset,
+    unsigned int bytes,
+    enum hvm_access_type access_type,
+    const struct segment_register *active_cs,
+    unsigned long *linear_addr);
+
+void *hvm_map_guest_frame_rw(unsigned long gfn, bool_t permanent,
+                             bool_t *writable);
+void *hvm_map_guest_frame_ro(unsigned long gfn, bool_t permanent);
+void hvm_unmap_guest_frame(void *p, bool_t permanent);
+void hvm_mapped_guest_frames_mark_dirty(struct domain *);
+
+int hvm_debug_op(struct vcpu *v, int32_t op);
+
+/* Caller should pause vcpu before calling this function */
+void hvm_toggle_singlestep(struct vcpu *v);
+
+int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
+                              struct npfec npfec);
+
+int hvm_x2apic_msr_read(struct vcpu *v, unsigned int msr, uint64_t *msr_content);
+int hvm_x2apic_msr_write(struct vcpu *v, unsigned int msr, uint64_t msr_content);
+
+/* Check CR4/EFER values */
+const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
+                           signed int cr0_pg);
+unsigned long hvm_cr4_guest_valid_bits(const struct domain *d, bool restore);
+
+#define hvm_get_guest_tsc(v) hvm_get_guest_tsc_fixed(v, 0)
+
+#define hvm_tsc_scaling_supported \
+    (!!hvm_funcs.tsc_scaling.ratio_frac_bits)
+
+#define hvm_default_tsc_scaling_ratio \
+    (1ULL << hvm_funcs.tsc_scaling.ratio_frac_bits)
+
+#define hvm_tsc_scaling_ratio(d) \
+    ((d)->arch.hvm.tsc_scaling_ratio)
+
+#define hvm_get_guest_time(v) hvm_get_guest_time_fixed(v, 0)
+
 #define hvm_paging_enabled(v) \
     (!!((v)->arch.hvm.guest_cr[0] & X86_CR0_PG))
 #define hvm_wp_enabled(v) \
@@ -307,9 +376,6 @@ int hvm_girq_dest_2_vcpu_id(struct domain *d, uint8_t dest, uint8_t dest_mode);
 
 #define hvm_long_mode_active(v) (!!((v)->arch.hvm.guest_efer & EFER_LMA))
 
-enum hvm_intblk
-hvm_interrupt_blocked(struct vcpu *v, struct hvm_intack intack);
-
 static inline int
 hvm_guest_x86_mode(struct vcpu *v)
 {
@@ -363,20 +429,12 @@ static inline void hvm_flush_guest_tlbs(void)
         hvm_asid_flush_core();
 }
 
-void hvm_hypercall_page_initialise(struct domain *d,
-                                   void *hypercall_page);
-
 static inline unsigned int
 hvm_get_cpl(struct vcpu *v)
 {
     return hvm_funcs.get_cpl(v);
 }
 
-void hvm_get_segment_register(struct vcpu *v, enum x86_segment seg,
-                              struct segment_register *reg);
-void hvm_set_segment_register(struct vcpu *v, enum x86_segment seg,
-                              struct segment_register *reg);
-
 static inline unsigned long hvm_get_shadow_gs_base(struct vcpu *v)
 {
     return hvm_funcs.get_shadow_gs_base(v);
@@ -388,8 +446,6 @@ static inline bool hvm_get_guest_bndcfgs(struct vcpu *v, u64 *val)
            hvm_funcs.get_guest_bndcfgs(v, val);
 }
 
-bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val);
-
 #define has_hvm_params(d) \
     ((d)->arch.hvm.params != NULL)
 
@@ -405,13 +461,6 @@ bool hvm_set_guest_bndcfgs(struct vcpu *v, u64 val);
 #define has_viridian_apic_assist(d) \
     (is_viridian_domain(d) && (viridian_feature_mask(d) & HVMPV_apic_assist))
 
-bool hvm_check_cpuid_faulting(struct vcpu *v);
-void hvm_migrate_timers(struct vcpu *v);
-void hvm_do_resume(struct vcpu *v);
-void hvm_migrate_pirqs(struct vcpu *v);
-
-void hvm_inject_event(const struct x86_event *event);
-
 static inline void hvm_inject_exception(
     unsigned int vector, unsigned int type,
     unsigned int insn_len, int error_code)
@@ -468,12 +517,6 @@ static inline void hvm_invlpg(struct vcpu *v, unsigned long linear)
                        (1U << TRAP_alignment_check) | \
                        (1U << TRAP_machine_check))
 
-int hvm_event_needs_reinjection(uint8_t type, uint8_t vector);
-
-uint8_t hvm_combine_hw_exceptions(uint8_t vec1, uint8_t vec2);
-
-void hvm_set_rdtsc_exiting(struct domain *d, bool_t enable);
-
 static inline int hvm_cpu_up(void)
 {
     return (hvm_funcs.cpu_up ? hvm_funcs.cpu_up() : 0);
@@ -490,43 +533,12 @@ static inline unsigned int hvm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
     return (hvm_funcs.get_insn_bytes ? hvm_funcs.get_insn_bytes(v, buf) : 0);
 }
 
-enum hvm_task_switch_reason { TSW_jmp, TSW_iret, TSW_call_or_int };
-void hvm_task_switch(
-    uint16_t tss_sel, enum hvm_task_switch_reason taskswitch_reason,
-    int32_t errcode);
-
-enum hvm_access_type {
-    hvm_access_insn_fetch,
-    hvm_access_none,
-    hvm_access_read,
-    hvm_access_write
-};
-bool_t hvm_virtual_to_linear_addr(
-    enum x86_segment seg,
-    const struct segment_register *reg,
-    unsigned long offset,
-    unsigned int bytes,
-    enum hvm_access_type access_type,
-    const struct segment_register *active_cs,
-    unsigned long *linear_addr);
-
-void *hvm_map_guest_frame_rw(unsigned long gfn, bool_t permanent,
-                             bool_t *writable);
-void *hvm_map_guest_frame_ro(unsigned long gfn, bool_t permanent);
-void hvm_unmap_guest_frame(void *p, bool_t permanent);
-void hvm_mapped_guest_frames_mark_dirty(struct domain *);
-
 static inline void hvm_set_info_guest(struct vcpu *v)
 {
     if ( hvm_funcs.set_info_guest )
         return hvm_funcs.set_info_guest(v);
 }
 
-int hvm_debug_op(struct vcpu *v, int32_t op);
-
-/* Caller should pause vcpu before calling this function */
-void hvm_toggle_singlestep(struct vcpu *v);
-
 static inline void hvm_invalidate_regs_fields(struct cpu_user_regs *regs)
 {
 #ifndef NDEBUG
@@ -542,18 +554,12 @@ static inline void hvm_invalidate_regs_fields(struct cpu_user_regs *regs)
 #endif
 }
 
-int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
-                              struct npfec npfec);
-
 #define hvm_msr_tsc_aux(v) ({                                               \
     struct domain *__d = (v)->domain;                                       \
     (__d->arch.tsc_mode == TSC_MODE_PVRDTSCP)                               \
         ? (u32)__d->arch.incarnation : (u32)(v)->arch.hvm.msr_tsc_aux;      \
 })
 
-int hvm_x2apic_msr_read(struct vcpu *v, unsigned int msr, uint64_t *msr_content);
-int hvm_x2apic_msr_write(struct vcpu *v, unsigned int msr, uint64_t msr_content);
-
 /*
  * Nested HVM
  */
@@ -657,11 +663,6 @@ static inline bool altp2m_vcpu_emulate_ve(struct vcpu *v)
     return false;
 }
 
-/* Check CR4/EFER values */
-const char *hvm_efer_valid(const struct vcpu *v, uint64_t value,
-                           signed int cr0_pg);
-unsigned long hvm_cr4_guest_valid_bits(const struct domain *d, bool restore);
-
 /*
  * This must be defined as a macro instead of an inline function,
  * because it uses 'struct vcpu' and 'struct domain' which have
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-09-04 16:15 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-04 16:15 [PATCH v3 00/16] Make CONFIG_HVM work Wei Liu
2018-09-04 16:15 ` [PATCH v3 01/16] x86: change name of parameter for various invlpg functions Wei Liu
2018-09-06 11:12   ` George Dunlap
2018-09-13 16:11   ` George Dunlap
2018-09-04 16:15 ` [PATCH v3 02/16] x86: introduce and use a set of internal emulation flags Wei Liu
2018-09-06 13:27   ` Jan Beulich
2018-09-06 13:47     ` Wei Liu
2018-09-04 16:15 ` [PATCH v3 03/16] x86: XENMEM_resource_ioreq_server is HVM only Wei Liu
2018-09-04 16:24   ` Paul Durrant
2018-09-04 16:42   ` Wei Liu
2018-09-06 13:29     ` Jan Beulich
2018-09-04 16:15 ` [PATCH v3 04/16] x86: monitor.o is currently " Wei Liu
2018-09-04 16:35   ` Razvan Cojocaru
2018-09-04 16:15 ` [PATCH v3 05/16] x86: PIT emulation is common to both PV and HVM Wei Liu
2018-09-06 14:26   ` Jan Beulich
2018-09-04 16:15 ` [PATCH v3 06/16] libxl: don't set PoD target for PV guests Wei Liu
2018-09-07 13:44   ` Ian Jackson
2018-09-04 16:15 ` [PATCH v3 07/16] x86/p2m/pod: make it build with !CONFIG_HVM Wei Liu
2018-09-04 17:08   ` Razvan Cojocaru
2018-09-04 17:10     ` Razvan Cojocaru
2018-09-04 17:24   ` Julien Grall
2018-09-06 10:57     ` Wei Liu
2018-09-06 15:30       ` George Dunlap
2018-09-06 15:05   ` Jan Beulich
2018-09-06 16:06     ` George Dunlap
2018-09-04 16:15 ` Wei Liu [this message]
2018-09-07  6:52   ` [PATCH v3 08/16] x86/hvm: rearrange content of hvm.h Jan Beulich
2018-09-04 16:15 ` [PATCH v3 09/16] x86: provide stubs, declarations and macros in hvm.h Wei Liu
2018-09-07  7:02   ` Jan Beulich
2018-09-13 15:31     ` Wei Liu
2018-09-04 16:15 ` [PATCH v3 10/16] x86/mm: put nested p2m code under CONFIG_HVM Wei Liu
2018-09-06 16:20   ` George Dunlap
2018-09-13 15:46     ` Wei Liu
2018-09-13 16:01       ` George Dunlap
2018-09-07  7:06   ` Jan Beulich
2018-09-13 15:07     ` Wei Liu
2018-09-14  8:01       ` Jan Beulich
2018-09-04 16:15 ` [PATCH v3 11/16] x86/mm: put HVM only " Wei Liu
2018-09-04 17:10   ` Razvan Cojocaru
2018-09-07  7:12   ` Jan Beulich
2018-09-07 21:27   ` Tamas K Lengyel
2018-09-13 15:43     ` Wei Liu
2018-09-13 16:31       ` Tamas K Lengyel
2018-09-04 16:15 ` [PATCH v3 12/16] x86/mm: put paging_update_nestedmode " Wei Liu
2018-09-13 16:39   ` George Dunlap
2018-09-04 16:15 ` [PATCH v3 13/16] xen: connect guest creation with CONFIG_{HVM, PV} Wei Liu
2018-09-04 16:15 ` [PATCH v3 14/16] x86: expose CONFIG_HVM Wei Liu
2018-09-07  7:15   ` Jan Beulich
2018-09-13 16:01     ` Wei Liu
2018-09-14  8:07       ` Jan Beulich
2018-09-14 10:36         ` Wei Liu
2018-09-04 16:15 ` [PATCH v3 15/16] x86/pvshim: disable HVM for PV shim Wei Liu
2018-09-07  7:18   ` Jan Beulich
2018-09-07  7:46     ` Wei Liu
2018-09-07  7:48       ` Wei Liu
2018-09-04 16:15 ` [PATCH v3 16/16] xen: decouple HVM and IOMMU capabilities Wei Liu
2018-09-13 15:52   ` Ian Jackson

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=20180904161533.11575-9-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.