xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, Jan Beulich <jbeulich@suse.com>
Subject: Re: [PATCH v2 13/23] x86: provide stubs, declarations and macros in hvm.h
Date: Mon, 3 Sep 2018 09:45:01 +0000	[thread overview]
Message-ID: <1e7b9dd730604269b339f51959ff0c0c@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <d068682a0e82659a9f324c4b329de6a1a212b517.1535285866.git-series.wei.liu2@citrix.com>

> -----Original Message-----
> From: Xen-devel [mailto:xen-devel-bounces@lists.xenproject.org] On Behalf
> Of Wei Liu
> Sent: 26 August 2018 13:20
> 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: [Xen-devel] [PATCH v2 13/23] x86: provide stubs, declarations and
> macros in hvm.h
> 
> Make sure hvm_enabled evaluate to false then provide necessary stubs,
> declarations and macros to make Xen build.
> 
> The is_viridian_domain macro can't be turned into an inline function
> easily,

Why? It's just an is_hvm_domain() and a feature check.

> so instead its caller is modified to avoid unused variable
> warning.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
>  xen/arch/x86/traps.c          |   4 +-
>  xen/include/asm-x86/hvm/hvm.h | 149
> ++++++++++++++++++++++++++++++++++-
>  2 files changed, 148 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
> index ddff346..27b9651 100644
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -771,9 +771,9 @@ static void do_trap(struct cpu_user_regs *regs)
>  /* Returns 0 if not handled, and non-0 for success. */
>  int rdmsr_hypervisor_regs(uint32_t idx, uint64_t *val)
>  {
> -    struct domain *d = current->domain;
>      /* Optionally shift out of the way of Viridian architectural MSRs. */
> -    uint32_t base = is_viridian_domain(d) ? 0x40000200 : 0x40000000;
> +    uint32_t base = is_viridian_domain(current->domain)
> +        ? 0x40000200 : 0x40000000;
> 

This is a bit ugly so it would be nice to keep it on a single line.

  Paul

>      switch ( idx - base )
>      {
> diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-
> x86/hvm/hvm.h
> index 9c73cbf..7820586 100644
> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -235,7 +235,10 @@ struct hvm_function_table {
>  };
> 
>  extern struct hvm_function_table hvm_funcs;
> -extern bool_t hvm_enabled;
> +
> +#ifdef CONFIG_HVM
> +extern bool hvm_enabled;
> +
>  extern s8 hvm_port80_allowed;
> 
>  extern const struct hvm_function_table *start_svm(void);
> @@ -268,8 +271,8 @@ u64 hvm_get_guest_tsc_fixed(struct vcpu *v, u64
> at_tsc);
>  #define hvm_tsc_scaling_ratio(d) \
>      ((d)->arch.hvm_domain.tsc_scaling_ratio)
> 
> -u64 hvm_scale_tsc(const struct domain *d, u64 tsc);
> -u64 hvm_get_tsc_scaling_ratio(u32 gtsc_khz);
> +uint64_t hvm_scale_tsc(const struct domain *d, uint64_t tsc);
> +uint64_t hvm_get_tsc_scaling_ratio(uint32_t gtsc_khz);
> 
>  void hvm_init_guest_time(struct domain *d);
>  void hvm_set_guest_time(struct vcpu *v, u64 guest_time);
> @@ -675,6 +678,146 @@ unsigned long hvm_cr4_guest_valid_bits(const
> struct domain *d, bool restore);
>          d_->arch.hvm_domain.pi_ops.vcpu_block(v_);          \
>  })
> 
> +#else /* CONFIG_HVM */
> +
> +#define hvm_enabled false
> +
> +static inline int hvm_guest_x86_mode(struct vcpu *v)
> +{
> +    ASSERT_UNREACHABLE();
> +    return -1;
> +}
> +
> +static inline bool hvm_is_singlestep_supported(void)
> +{
> +    ASSERT_UNREACHABLE();
> +    return false;
> +}
> +
> +static inline int vmsi_deliver(
> +    struct domain *d, int vector,
> +    uint8_t dest, uint8_t dest_mode,
> +    uint8_t delivery_mode, uint8_t trig_mode)
> +{
> +    ASSERT_UNREACHABLE();
> +    return -EINVAL;
> +}
> +
> +static inline bool nhvm_vmcx_hap_enabled(struct vcpu *v)
> +{
> +    return false;
> +}
> +
> +static inline bool hvm_hap_supported(void)
> +{
> +    return false;
> +}
> +
> +static inline void hvm_set_info_guest(struct vcpu *v)
> +{
> +    ASSERT_UNREACHABLE();
> +}
> +
> +static inline void hvm_cpuid_policy_changed(struct vcpu *v)
> +{
> +    ASSERT_UNREACHABLE();
> +}
> +
> +static inline void hvm_flush_guest_tlbs(void)
> +{
> +    ASSERT_UNREACHABLE();
> +}
> +
> +static inline void hvm_invlpg(struct vcpu *v, unsigned long linear)
> +{
> +    ASSERT_UNREACHABLE();
> +}
> +
> +static inline int hvm_cpu_up(void)
> +{
> +    return 0;
> +}
> +
> +static inline void hvm_cpu_down(void)
> +{
> +}
> +
> +static inline unsigned long hvm_get_shadow_gs_base(struct vcpu *v)
> +{
> +    ASSERT_UNREACHABLE();
> +    return 0;
> +}
> +
> +static inline void hvm_set_tsc_offset(struct vcpu *v, uint64_t offset,
> +                                      uint64_t at_tsc)
> +{
> +    ASSERT_UNREACHABLE();
> +}
> +
> +static inline void hvm_update_host_cr3(struct vcpu *v)
> +{
> +    ASSERT_UNREACHABLE();
> +}
> +
> +static inline unsigned int hvm_get_cpl(struct vcpu *v)
> +{
> +    ASSERT_UNREACHABLE();
> +    return -1;
> +}
> +
> +static inline int hvm_event_pending(struct vcpu *v)
> +{
> +    return 0;
> +}
> +
> +static inline void hvm_inject_hw_exception(unsigned int vector, int
> errcode)
> +{
> +    ASSERT_UNREACHABLE();
> +}
> +
> +static inline void hvm_update_guest_cr3(struct vcpu *v, bool noflush)
> +{
> +    ASSERT_UNREACHABLE();
> +}
> +
> +#define hvm_long_mode_active(v) (false)
> +#define hvm_pae_enabled(v) (false)
> +#define hvm_get_guest_time(v) (0)
> +#define is_viridian_domain(d) (false)
> +#define has_viridian_time_ref_count(d) (false)
> +#define hvm_tsc_scaling_supported (false)
> +#define hap_has_1gb (false)
> +#define hap_has_2mb (false)
> +
> +#define hvm_paging_enabled(v) (false)
> +#define hvm_nx_enabled(v) (false)
> +#define hvm_wp_enabled(v) (false)
> +#define hvm_smap_enabled(v) (false)
> +#define hvm_smep_enabled(v) (false)
> +#define hvm_pku_enabled(v) (false)
> +
> +#define arch_vcpu_block(v) ((void)v)
> +
> +int hvm_vcpu_initialise(struct vcpu *v);
> +void hvm_vcpu_destroy(struct vcpu *v);
> +int hvm_domain_initialise(struct domain *d);
> +void hvm_domain_destroy(struct domain *d);
> +void hvm_domain_soft_reset(struct domain *d);
> +void hvm_domain_relinquish_resources(struct domain *d);
> +uint64_t hvm_scale_tsc(const struct domain *d, uint64_t tsc);
> +uint64_t hvm_get_tsc_scaling_ratio(uint32_t gtsc_khz);
> +
> +void hvm_get_segment_register(struct vcpu *v, enum x86_segment seg,
> +                              struct segment_register *reg);
> +
> +void hvm_set_rdtsc_exiting(struct domain *d, bool_t enable);
> +void hvm_toggle_singlestep(struct vcpu *v);
> +void hvm_mapped_guest_frames_mark_dirty(struct domain *);
> +void hvm_hypercall_page_initialise(struct domain *d,
> +                                   void *hypercall_page);
> +
> +#endif /* CONFIG_HVM */
> +
>  #endif /* __ASM_X86_HVM_HVM_H__ */
> 
>  /*
> --
> git-series 0.9.1
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-09-03  9:45 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-26 12:19 [PATCH v2 00/23] Make CONFIG_HVM work Wei Liu
2018-08-26 12:19 ` [PATCH v2 01/23] x86: change name of parameter for various invlpg functions Wei Liu
2018-08-27 13:49   ` Boris Ostrovsky
2018-08-27 13:54     ` Jan Beulich
2018-08-27 14:20   ` Jan Beulich
2018-08-30  1:26   ` Tian, Kevin
2018-09-03 13:46   ` Wei Liu
2018-09-04 13:42     ` Boris Ostrovsky
2018-08-26 12:19 ` [PATCH v2 02/23] xen: is_hvm_{domain, vcpu} should evaluate to false when !CONFIG_HVM Wei Liu
2018-08-27 14:24   ` Jan Beulich
2018-08-28  8:41     ` Wei Liu
2018-08-28 11:09       ` Julien Grall
2018-08-26 12:19 ` [PATCH v2 03/23] x86: enclose hvm_op and dm_op in CONFIG_HVM in relevant tables Wei Liu
2018-08-27 14:24   ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 04/23] x86/hvm: provide hvm_hap_supported Wei Liu
2018-08-27 14:25   ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 05/23] x86: provide stub for memory_type_changed Wei Liu
2018-08-27 14:28   ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 06/23] x86: don't call vpci function in physdev_op when !CONFIG_HAS_VPCI Wei Liu
2018-08-27 14:29   ` Jan Beulich
2018-08-28  8:45     ` Wei Liu
2018-08-28  9:08       ` Jan Beulich
2018-08-29 16:23         ` Wei Liu
2018-08-26 12:19 ` [PATCH v2 07/23] x86/vpmu: put HVM only code under CONFIG_HVM Wei Liu
2018-08-27 15:03   ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 08/23] xen/pt: io.c contains HVM only code Wei Liu
2018-08-27 15:04   ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 09/23] x86/pt: make it build with !CONFIG_HVM Wei Liu
2018-08-27 15:07   ` Jan Beulich
2018-08-30  1:29   ` Tian, Kevin
2018-08-26 12:19 ` [PATCH v2 10/23] x86/pt: split out HVM functions from vtd.c Wei Liu
2018-08-30  1:29   ` Tian, Kevin
2018-08-26 12:19 ` [PATCH v2 11/23] x86: XENMEM_resource_ioreq_server is HVM only Wei Liu
2018-08-27 15:13   ` Jan Beulich
2018-08-29 16:28     ` Wei Liu
2018-08-26 12:19 ` [PATCH v2 12/23] x86: monitor.o is currently " Wei Liu
2018-08-26 16:33   ` Razvan Cojocaru
2018-08-27 15:18   ` Jan Beulich
2018-08-27 15:23     ` Razvan Cojocaru
2018-08-29 16:42     ` Wei Liu
2018-08-29 17:43       ` Tamas K Lengyel
2018-08-29 18:09         ` Razvan Cojocaru
2018-08-30  7:14           ` Wei Liu
2018-08-26 12:19 ` [PATCH v2 13/23] x86: provide stubs, declarations and macros in hvm.h Wei Liu
2018-08-27 15:43   ` Jan Beulich
2018-09-03  9:45   ` Paul Durrant [this message]
2018-09-03  9:50     ` Wei Liu
2018-08-26 12:19 ` [PATCH v2 14/23] x86/mm: put nested p2m code under CONFIG_HVM Wei Liu
2018-08-27 15:56   ` Jan Beulich
2018-08-28  8:40     ` Wei Liu
2018-08-28  9:10       ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 15/23] x86/mm: put HVM only " Wei Liu
2018-08-26 16:39   ` Razvan Cojocaru
2018-08-27  9:03   ` Wei Liu
2018-08-28 10:41     ` Wei Liu
2018-08-28 10:53       ` Jan Beulich
2018-08-27 16:01   ` Jan Beulich
2018-08-28 10:41     ` Wei Liu
2018-08-26 12:19 ` [PATCH v2 16/23] x86/p2m/pod: make it build with !CONFIG_HVM Wei Liu
2018-08-28 10:47   ` Jan Beulich
2018-08-28 10:54     ` Wei Liu
2018-08-28 11:32       ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 17/23] x86/mm: put paging_update_nestedmode under CONFIG_HVM Wei Liu
2018-08-28 10:50   ` Jan Beulich
2018-08-30  7:42     ` Wei Liu
2018-08-30  8:35       ` Jan Beulich
2018-09-03 14:27         ` Wei Liu
2018-09-03 14:48           ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 18/23] x86/domctl: XEN_DOMCTL_debug_op is HVM only Wei Liu
2018-08-28 10:50   ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 19/23] x86: PIT emulation is common to both PV and HVM Wei Liu
2018-08-28 11:44   ` Jan Beulich
2018-08-28 13:19     ` Wei Liu
2018-08-28 14:36       ` Jan Beulich
2018-08-28 14:48         ` Wei Liu
2018-08-28 14:51           ` Andrew Cooper
2018-08-28 14:58             ` Wei Liu
2018-08-28 15:04               ` Jan Beulich
2018-08-28 15:17                 ` Wei Liu
2018-08-28 14:56           ` Wei Liu
2018-08-26 12:19 ` [PATCH v2 20/23] xen: connect guest creation with CONFIG_{HVM, PV} Wei Liu
2018-08-28 11:07   ` Julien Grall
2018-08-28 13:13     ` Wei Liu
2018-08-28 11:47   ` Jan Beulich
2018-08-28 13:15     ` Wei Liu
2018-08-26 12:19 ` [PATCH v2 21/23] x86: expose CONFIG_HVM Wei Liu
2018-08-28 11:50   ` Jan Beulich
2018-08-28 12:14     ` Andrew Cooper
2018-08-28 13:33       ` Jan Beulich
2018-08-29 16:56         ` Andrew Cooper
2018-08-30  6:21           ` Jan Beulich
2018-08-30  6:57             ` Juergen Gross
2018-08-31 20:09             ` Andrew Cooper
2018-09-03 11:35               ` Jan Beulich
2018-08-26 12:19 ` [PATCH v2 22/23] x86/pvshim: disable HVM for PV shim Wei Liu
2018-08-26 12:19 ` [PATCH v2 23/23] xen: decouple HVM and IOMMU capabilities Wei Liu
2018-08-28 11:56   ` Jan Beulich

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=1e7b9dd730604269b339f51959ff0c0c@AMSPEX02CL03.citrite.net \
    --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).