From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 09/10] x86/cpuid: Drop legacy CPUID infrastructure
Date: Mon, 20 Feb 2017 11:00:33 +0000 [thread overview]
Message-ID: <1487588434-4359-10-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1487588434-4359-1-git-send-email-andrew.cooper3@citrix.com>
Now that all leaves have been altered to use the guest_cpuid() path, remove
all the remaining legacy infrastructure.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
xen/arch/x86/cpuid.c | 76 ---------------------------------------------
xen/arch/x86/domctl.c | 45 +--------------------------
xen/include/asm-x86/cpuid.h | 27 ----------------
3 files changed, 1 insertion(+), 147 deletions(-)
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index f1bcd7d..eaeec97 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -582,8 +582,6 @@ void recalculate_cpuid_policy(struct domain *d)
int init_domain_cpuid_policy(struct domain *d)
{
- unsigned int i;
-
d->arch.cpuid = xmalloc(struct cpuid_policy);
if ( !d->arch.cpuid )
@@ -596,70 +594,9 @@ int init_domain_cpuid_policy(struct domain *d)
recalculate_cpuid_policy(d);
- for ( i = 0; i < MAX_CPUID_INPUT; i++ )
- {
- d->arch.cpuid->legacy[i].input[0] = XEN_CPUID_INPUT_UNUSED;
- d->arch.cpuid->legacy[i].input[1] = XEN_CPUID_INPUT_UNUSED;
- }
-
return 0;
}
-static void domain_cpuid(const struct domain *d, uint32_t leaf,
- uint32_t subleaf, struct cpuid_leaf *res)
-{
- unsigned int i;
-
- for ( i = 0; i < MAX_CPUID_INPUT; i++ )
- {
- xen_domctl_cpuid_t *cpuid = &d->arch.cpuid->legacy[i];
-
- if ( (cpuid->input[0] == leaf) &&
- ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) ||
- (cpuid->input[1] == subleaf)) )
- {
- *res = (struct cpuid_leaf){ cpuid->eax, cpuid->ebx,
- cpuid->ecx, cpuid->edx };
- return;
- }
- }
-}
-
-static void pv_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res)
-{
- struct vcpu *curr = current;
- struct domain *currd = curr->domain;
-
- if ( !is_control_domain(currd) && !is_hardware_domain(currd) )
- domain_cpuid(currd, leaf, subleaf, res);
- else
- cpuid_count_leaf(leaf, subleaf, res);
-
- switch ( leaf )
- {
- case 0x0 ... XSTATE_CPUID:
- case 0x80000000 ... 0xffffffff:
- ASSERT_UNREACHABLE();
- /* Now handled in guest_cpuid(). */
- }
-}
-
-static void hvm_cpuid(uint32_t leaf, uint32_t subleaf, struct cpuid_leaf *res)
-{
- struct vcpu *v = current;
- struct domain *d = v->domain;
-
- domain_cpuid(d, leaf, subleaf, res);
-
- switch ( leaf )
- {
- case 0x0 ... XSTATE_CPUID:
- case 0x80000000 ... 0xffffffff:
- ASSERT_UNREACHABLE();
- /* Now handled in guest_cpuid(). */
- }
-}
-
void guest_cpuid(const struct vcpu *v, uint32_t leaf,
uint32_t subleaf, struct cpuid_leaf *res)
{
@@ -709,11 +646,6 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
break;
default:
- goto legacy;
-
- case 0x0 ... 0x3:
- case 0x5 ... 0x6:
- case 0x8 ... 0xc:
*res = p->basic.raw[leaf];
break;
}
@@ -1037,14 +969,6 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
res->a = (res->d & v->arch.hvm_svm.guest_lwp_cfg) | 1;
break;
}
-
- /* Done. */
- return;
-
- legacy:
- /* {hvm,pv}_cpuid() have this expectation. */
- ASSERT(v == current);
- (is_hvm_domain(d) ? hvm_cpuid : pv_cpuid)(leaf, subleaf, res);
}
static void __init __maybe_unused build_assertions(void)
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index aa0d914..e345767 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -47,51 +47,12 @@ static int gdbsx_guest_mem_io(domid_t domid, struct xen_domctl_gdbsx_memio *iop)
return iop->remain ? -EFAULT : 0;
}
-static int update_legacy_cpuid_array(struct domain *d,
- const xen_domctl_cpuid_t *ctl)
-{
- xen_domctl_cpuid_t *cpuid, *unused = NULL;
- unsigned int i;
-
- /* Try to insert ctl into d->arch.cpuids[] */
- for ( i = 0; i < MAX_CPUID_INPUT; i++ )
- {
- cpuid = &d->arch.cpuid->legacy[i];
-
- if ( cpuid->input[0] == XEN_CPUID_INPUT_UNUSED )
- {
- if ( !unused )
- unused = cpuid;
- continue;
- }
-
- if ( (cpuid->input[0] == ctl->input[0]) &&
- ((cpuid->input[1] == XEN_CPUID_INPUT_UNUSED) ||
- (cpuid->input[1] == ctl->input[1])) )
- break;
- }
-
- if ( !(ctl->eax | ctl->ebx | ctl->ecx | ctl->edx) )
- {
- if ( i < MAX_CPUID_INPUT )
- cpuid->input[0] = XEN_CPUID_INPUT_UNUSED;
- }
- else if ( i < MAX_CPUID_INPUT )
- *cpuid = *ctl;
- else if ( unused )
- *unused = *ctl;
- else
- return -ENOENT;
-
- return 0;
-}
-
static int update_domain_cpuid_info(struct domain *d,
const xen_domctl_cpuid_t *ctl)
{
struct cpuid_policy *p = d->arch.cpuid;
const struct cpuid_leaf leaf = { ctl->eax, ctl->ebx, ctl->ecx, ctl->edx };
- int rc, old_vendor = p->x86_vendor;
+ int old_vendor = p->x86_vendor;
/*
* Skip update for leaves we don't care about. This avoids the overhead
@@ -125,10 +86,6 @@ static int update_domain_cpuid_info(struct domain *d,
return 0;
}
- rc = update_legacy_cpuid_array(d, ctl);
- if ( rc )
- return rc;
-
/* Insert ctl data into cpuid_policy. */
switch ( ctl->input[0] )
{
diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/asm-x86/cpuid.h
index 14fc95c..8d6a653 100644
--- a/xen/include/asm-x86/cpuid.h
+++ b/xen/include/asm-x86/cpuid.h
@@ -72,29 +72,6 @@ DECLARE_PER_CPU(bool, cpuid_faulting_enabled);
struct cpuid_policy
{
- /*
- * WARNING: During the CPUID transition period, not all information here
- * is accurate. The following items are accurate, and can be relied upon.
- *
- * Global *_policy objects:
- *
- * - Guest accurate:
- * - All of the feat, xstate and extd unions
- * - max_{,sub}leaf
- * - All FEATURESET_* words
- * - Short vendor infomation
- *
- * Per-domain objects:
- *
- * - Guest accurate:
- * - All of the feat, xstate and extd unions
- * - max_{,sub}leaf
- * - All FEATURESET_* words
- * - Short vendor infomation
- *
- * Everything else should be considered inaccurate, and not necesserily 0.
- */
-
#define DECL_BITFIELD(word) _DECL_BITFIELD(FEATURESET_ ## word)
#define _DECL_BITFIELD(x) __DECL_BITFIELD(x)
#define __DECL_BITFIELD(x) CPUID_BITFIELD_ ## x
@@ -230,10 +207,6 @@ struct cpuid_policy
/* Value calculated from raw data above. */
uint8_t x86_vendor;
-
- /* Temporary: Legacy data array. */
-#define MAX_CPUID_INPUT 40
- xen_domctl_cpuid_t legacy[MAX_CPUID_INPUT];
};
/* Fill in a featureset bitmap from a CPUID policy. */
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-02-20 11:00 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 11:00 [PATCH 00/10] x86/cpuid: Remove the legacy infrastructure Andrew Cooper
2017-02-20 11:00 ` [PATCH 01/10] x86/cpuid: Disallow policy updates once the domain is running Andrew Cooper
2017-02-21 16:37 ` Jan Beulich
2017-02-20 11:00 ` [PATCH 02/10] x86/gen-cpuid: Clarify the intended meaning of AVX wrt feature dependencies Andrew Cooper
2017-02-21 16:40 ` Jan Beulich
2017-02-21 16:41 ` Andrew Cooper
2017-02-21 16:47 ` Jan Beulich
2017-02-21 16:53 ` Andrew Cooper
2017-02-21 17:07 ` Jan Beulich
2017-02-21 17:12 ` Andrew Cooper
2017-02-21 17:17 ` Jan Beulich
2017-02-21 17:42 ` Andrew Cooper
2017-02-22 7:13 ` Jan Beulich
2017-02-20 11:00 ` [PATCH 03/10] x86/cpuid: Handle leaf 0x1 in guest_cpuid() Andrew Cooper
2017-02-21 16:59 ` Jan Beulich
2017-02-21 17:13 ` Andrew Cooper
2017-02-21 17:20 ` Jan Beulich
2017-02-21 17:29 ` Andrew Cooper
2017-02-22 7:16 ` Jan Beulich
2017-02-20 11:00 ` [PATCH 04/10] x86/cpuid: Handle leaf 0x4 " Andrew Cooper
2017-02-21 17:16 ` Jan Beulich
2017-02-21 17:35 ` Andrew Cooper
2017-02-22 7:23 ` Jan Beulich
2017-02-22 7:55 ` Andrew Cooper
2017-03-10 16:27 ` [PATCH v2 " Andrew Cooper
2017-03-13 12:03 ` Jan Beulich
2017-03-13 12:51 ` Andrew Cooper
2017-03-13 13:05 ` Jan Beulich
2017-03-13 13:24 ` Andrew Cooper
2017-03-13 13:36 ` Jan Beulich
2017-02-20 11:00 ` [PATCH 05/10] x86/cpuid: Handle leaf 0x5 " Andrew Cooper
2017-02-21 17:22 ` Jan Beulich
2017-02-20 11:00 ` [PATCH 06/10] x86/cpuid: Handle leaf 0x6 " Andrew Cooper
2017-02-21 17:25 ` Jan Beulich
2017-02-21 17:40 ` Andrew Cooper
2017-02-21 17:44 ` Andrew Cooper
2017-02-22 7:31 ` Jan Beulich
2017-02-22 8:23 ` Andrew Cooper
2017-02-22 9:12 ` Andrew Cooper
2017-02-22 9:26 ` Jan Beulich
2017-02-27 14:30 ` Andrew Cooper
2017-03-10 16:32 ` [PATCH v2 " Andrew Cooper
2017-03-13 12:04 ` Jan Beulich
2017-02-20 11:00 ` [PATCH 07/10] x86/cpuid: Handle leaf 0xa " Andrew Cooper
2017-02-22 9:11 ` Jan Beulich
2017-02-20 11:00 ` [PATCH 08/10] x86/cpuid: Handle leaf 0xb " Andrew Cooper
2017-02-22 9:16 ` Jan Beulich
2017-02-22 10:22 ` Andrew Cooper
2017-02-22 10:37 ` Jan Beulich
2017-02-27 15:05 ` Andrew Cooper
2017-03-10 16:44 ` [PATCH v2 " Andrew Cooper
2017-03-13 12:13 ` Jan Beulich
2017-02-20 11:00 ` Andrew Cooper [this message]
2017-02-22 9:19 ` [PATCH 09/10] x86/cpuid: Drop legacy CPUID infrastructure Jan Beulich
2017-02-20 11:00 ` [PATCH 10/10] x86/cpuid: Always enable faulting for the control domain Andrew Cooper
2017-02-22 9:23 ` Jan Beulich
2017-02-22 10:00 ` Andrew Cooper
2017-02-22 10:10 ` Jan Beulich
2017-02-27 15:10 ` Andrew Cooper
2017-02-28 9:31 ` Jan Beulich
2017-03-10 17:10 ` Andrew Cooper
2017-03-13 11:48 ` Jan Beulich
2017-03-14 15:06 ` Wei Liu
2017-03-14 15:13 ` Jan Beulich
2017-03-14 16:05 ` Wei Liu
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=1487588434-4359-10-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.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).