From: "Jan Beulich" <JBeulich@suse.com>
To: Paul Durrant <paul.durrant@citrix.com>
Cc: Keir Fraser <keir@xen.org>,
xen-devel@lists.xen.org, IanJackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 1/2] x86/viridian: Re-purpose the HVM parameter to be a feature mask
Date: Fri, 01 Aug 2014 16:41:01 +0100 [thread overview]
Message-ID: <53DBD12D02000078000288EC@mail.emea.novell.com> (raw)
In-Reply-To: <1406906491-38243-1-git-send-email-paul.durrant@citrix.com>
>>> On 01.08.14 at 17:21, <paul.durrant@citrix.com> wrote:
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -5533,8 +5533,20 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)
> rc = -EINVAL;
> break;
> case HVM_PARAM_VIRIDIAN:
> - if ( a.value > 1 )
> - rc = -EINVAL;
> + /* This should only ever be set once by the tools and read by the guest. */
> + rc = -EPERM;
> + if ( curr_d == d )
> + break;
> +
> + rc = -EPERM;
> + if ( d->arch.hvm_domain.params[a.index] )
> + break;
Wouldn't it make sense to not fail a (redundant) attempt to set the
value to what it already is?
> +
Line with only spaces.
> + rc = -EINVAL;
> + if ( a.value & ~HVMPV_feature_mask )
> + break;
Shouldn't you better also require any non-zero value having
HVMPV_base_freq set?
> --- a/xen/arch/x86/hvm/viridian.c
> +++ b/xen/arch/x86/hvm/viridian.c
> @@ -90,8 +90,9 @@ int cpuid_viridian_leaves(unsigned int leaf, unsigned int *eax,
> /* Which hypervisor MSRs are available to the guest */
> *eax = (CPUID3A_MSR_APIC_ACCESS |
> CPUID3A_MSR_HYPERCALL |
> - CPUID3A_MSR_VP_INDEX |
> - CPUID3A_MSR_FREQ);
> + CPUID3A_MSR_VP_INDEX);
> + if ( ~viridian_feature_mask(d) & HVMPV_no_freq )
Could I talk you into using the more conventional
if ( !(viridian_feature_mask(d) & HVMPV_no_freq) )
here?
> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -344,8 +344,11 @@ static inline unsigned long hvm_get_shadow_gs_base(struct vcpu *v)
> return hvm_funcs.get_shadow_gs_base(v);
> }
>
> -#define is_viridian_domain(_d) \
> - (is_hvm_domain(_d) && ((_d)->arch.hvm_domain.params[HVM_PARAM_VIRIDIAN]))
> +#define viridian_feature_mask(_d) \
> + ((_d)->arch.hvm_domain.params[HVM_PARAM_VIRIDIAN])
> +
> +#define is_viridian_domain(_d) \
> + (is_hvm_domain(_d) && (viridian_feature_mask(_d) & HVMPV_base_freq))
Since you're re-writing this anyway, can you please drop the bogus
leading underscores on both macros' parameter?
Jan
next prev parent reply other threads:[~2014-08-01 15:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 15:21 [PATCH 1/2] x86/viridian: Re-purpose the HVM parameter to be a feature mask Paul Durrant
2014-08-01 15:21 ` [PATCH 2/2] x86/viridian: Add partition time reference counter MSR support Paul Durrant
2014-08-01 15:51 ` Jan Beulich
2014-08-01 16:11 ` Paul Durrant
2014-08-01 15:41 ` Jan Beulich [this message]
2014-08-01 15:56 ` [PATCH 1/2] x86/viridian: Re-purpose the HVM parameter to be a feature mask 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=53DBD12D02000078000288EC@mail.emea.novell.com \
--to=jbeulich@suse.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=keir@xen.org \
--cc=paul.durrant@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.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).