All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tian, Kevin" <kevin.tian@intel.com>
To: Juergen Gross <jgross@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Jan Beulich" <jbeulich@suse.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: RE: [PATCH v10 01/12] xen/vmx: let opt_ept_ad always reflect the current setting
Date: Mon, 25 May 2020 02:23:26 +0000	[thread overview]
Message-ID: <MWHPR11MB1645A00E365615DD577663E98CB30@MWHPR11MB1645.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20200519072106.26894-2-jgross@suse.com>

> From: Juergen Gross <jgross@suse.com>
> Sent: Tuesday, May 19, 2020 3:21 PM
> 
> In case opt_ept_ad has not been set explicitly by the user via command
> line or runtime parameter, it is treated as "no" on Avoton cpus.
> 
> Change that handling by setting opt_ept_ad to 0 for this cpu type
> explicitly if no user value has been set.
> 
> By putting this into the (renamed) boot time initialization of vmcs.c
> _vmx_cpu_up() can be made static.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> ---
>  xen/arch/x86/hvm/vmx/vmcs.c        | 22 +++++++++++++++-------
>  xen/arch/x86/hvm/vmx/vmx.c         |  4 +---
>  xen/include/asm-x86/hvm/vmx/vmcs.h |  3 +--
>  3 files changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
> index 4c23645454..221af9737a 100644
> --- a/xen/arch/x86/hvm/vmx/vmcs.c
> +++ b/xen/arch/x86/hvm/vmx/vmcs.c
> @@ -315,10 +315,6 @@ static int vmx_init_vmcs_config(void)
> 
>          if ( !opt_ept_ad )
>              _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT;
> -        else if ( /* Work around Erratum AVR41 on Avoton processors. */
> -                  boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x4d
> &&
> -                  opt_ept_ad < 0 )
> -            _vmx_ept_vpid_cap &= ~VMX_EPT_AD_BIT;
> 
>          /*
>           * Additional sanity checking before using EPT:
> @@ -652,7 +648,7 @@ void vmx_cpu_dead(unsigned int cpu)
>      vmx_pi_desc_fixup(cpu);
>  }
> 
> -int _vmx_cpu_up(bool bsp)
> +static int _vmx_cpu_up(bool bsp)
>  {
>      u32 eax, edx;
>      int rc, bios_locked, cpu = smp_processor_id();
> @@ -2108,9 +2104,21 @@ static void vmcs_dump(unsigned char ch)
>      printk("**************************************\n");
>  }
> 
> -void __init setup_vmcs_dump(void)
> +int __init vmx_vmcs_init(void)
>  {
> -    register_keyhandler('v', vmcs_dump, "dump VT-x VMCSs", 1);
> +    int ret;
> +
> +    if ( opt_ept_ad < 0 )
> +        /* Work around Erratum AVR41 on Avoton processors. */
> +        opt_ept_ad = !(boot_cpu_data.x86 == 6 &&
> +                       boot_cpu_data.x86_model == 0x4d);
> +
> +    ret = _vmx_cpu_up(true);
> +
> +    if ( !ret )
> +        register_keyhandler('v', vmcs_dump, "dump VT-x VMCSs", 1);
> +
> +    return ret;
>  }
> 
>  static void __init __maybe_unused build_assertions(void)
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 6efa80e422..11a4dd94cf 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -2482,7 +2482,7 @@ const struct hvm_function_table * __init
> start_vmx(void)
>  {
>      set_in_cr4(X86_CR4_VMXE);
> 
> -    if ( _vmx_cpu_up(true) )
> +    if ( vmx_vmcs_init() )
>      {
>          printk("VMX: failed to initialise.\n");
>          return NULL;
> @@ -2553,8 +2553,6 @@ const struct hvm_function_table * __init
> start_vmx(void)
>          vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs;
>      }
> 
> -    setup_vmcs_dump();
> -
>      lbr_tsx_fixup_check();
>      bdf93_fixup_check();
> 
> diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-
> x86/hvm/vmx/vmcs.h
> index 95c1dea7b8..906810592f 100644
> --- a/xen/include/asm-x86/hvm/vmx/vmcs.h
> +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
> @@ -21,11 +21,10 @@
>  #include <xen/mm.h>
> 
>  extern void vmcs_dump_vcpu(struct vcpu *v);
> -extern void setup_vmcs_dump(void);
> +extern int vmx_vmcs_init(void);
>  extern int  vmx_cpu_up_prepare(unsigned int cpu);
>  extern void vmx_cpu_dead(unsigned int cpu);
>  extern int  vmx_cpu_up(void);
> -extern int  _vmx_cpu_up(bool bsp);
>  extern void vmx_cpu_down(void);
> 
>  struct vmcs_struct {
> --
> 2.26.1



  reply	other threads:[~2020-05-25  2:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  7:20 [PATCH v10 00/12] Add hypervisor sysfs-like support Juergen Gross
2020-05-19  7:20 ` [PATCH v10 01/12] xen/vmx: let opt_ept_ad always reflect the current setting Juergen Gross
2020-05-25  2:23   ` Tian, Kevin [this message]
2020-05-19  7:20 ` [PATCH v10 02/12] xen: add a generic way to include binary files as variables Juergen Gross
2020-05-19  7:47   ` Jan Beulich
2020-05-19  7:52     ` Jürgen Groß
2020-05-19  7:58       ` Jan Beulich
2020-05-19  8:14         ` Jürgen Groß
2020-05-19  7:20 ` [PATCH v10 03/12] docs: add feature document for Xen hypervisor sysfs-like support Juergen Gross
2020-05-19  7:20 ` [PATCH v10 04/12] xen: add basic hypervisor filesystem support Juergen Gross
2020-05-21 12:51   ` Julien Grall
2020-05-19  7:20 ` [PATCH v10 05/12] libs: add libxenhypfs Juergen Gross
2020-05-30 15:54   ` Andrew Cooper
2020-06-01  5:27     ` Jürgen Groß
2020-05-19  7:21 ` [PATCH v10 06/12] tools: add xenfs tool Juergen Gross
2020-05-19  7:21 ` [PATCH v10 07/12] xen: provide version information in hypfs Juergen Gross
2020-05-29  8:34   ` Jan Beulich
2020-05-29  9:19     ` Jürgen Groß
2020-05-29  9:53       ` Jan Beulich
2020-05-29  9:56         ` Jürgen Groß
2020-05-19  7:21 ` [PATCH v10 08/12] xen: add /buildinfo/config entry to hypervisor filesystem Juergen Gross
2020-06-02  9:03   ` Andrew Cooper
2020-06-02 10:43     ` Jürgen Groß
2020-05-19  7:21 ` [PATCH v10 09/12] xen: add runtime parameter access support to hypfs Juergen Gross
2020-05-21 12:52   ` Julien Grall
2020-05-19  7:21 ` [PATCH v10 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters Juergen Gross
2020-05-19  8:17   ` Wei Liu
2020-09-10 20:09   ` Regression: " Andrew Cooper
2020-09-11  5:40     ` Jürgen Groß
2020-05-19  7:21 ` [PATCH v10 11/12] tools/libxc: remove xc_set_parameters() Juergen Gross
2020-05-19  8:09   ` Wei Liu
2020-05-19  7:21 ` [PATCH v10 12/12] xen: remove XEN_SYSCTL_set_parameter support Juergen Gross
2020-05-19  7:30 ` [PATCH v10 00/12] Add hypervisor sysfs-like support Jürgen Groß
2020-05-19  7:45   ` Jan Beulich
2020-05-19  8:06     ` Paul Durrant
2020-05-25  7:02       ` Jürgen Groß
2020-05-26  8:00         ` Paul Durrant
2020-05-26  8:08           ` Jan Beulich
2020-05-26  8:18           ` Jürgen Groß

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=MWHPR11MB1645A00E365615DD577663E98CB30@MWHPR11MB1645.namprd11.prod.outlook.com \
    --to=kevin.tian@intel.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --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.