[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/2] x86/Intel: use CPUID bit to determine PPIN availability
- To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Wed, 26 Jan 2022 23:30:48 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=b7qGjUtkWUNkEPjMZRwwEk327kJmGLqbfISdAUSYC3c=; b=jJt7Z2rxba4/h24OzLUCFmmFuzORMvZJNCreLKhcRfHn3E8ZST0YxX090r61vPfMNbQZ47yDqYP1ZiBcikwWKrCnKbcsIK6AAUx9mQbQTfeprboh9hszvG+WBtiDu3kgabfNQ4rg1sf8bZYsYE6fOPt6i/tsNig/veyXAUeCrR3KtxPX47uuGAYZhXhsvqVU0qEYUOk+rYX0GwXQd7YUNdsLYvChJ6oF6cMGqPAybaY2yVBIne2z3vQg7NcgutALaHGp4+3IaKjWzJWCmX9okYVaaDgrIvWT3jvL31yGkyPV/1ryhxVaU1BAeTiXqnrBwRhSkptGqQjvdLb8VcFLZA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jlLNwJoqXld7SUZrmt5buCsxnPAICB1YwHPX9k17HfFEAZNvCOQ2e+O/scMfxZvPF6B9UgQC0v8n+g+0SgK9DNj5rjtyES78gDe33XGFmmhMyaPqwBGFej/Ofut9+0UlAXgd5V3csiXoyZWoQ2lQvXziwCmqcJzh27WjUcWQ3vRlV4PFWv5nezk+FZ2UBVw6x9gqjPlqSxFyI/7qcwJprYAURJAj8krzbFNpMz2yI2gH/srChxjCwMubnhs5t2JTMz4DgMBfco6o9NNwj1iCXQ24PeNjdTBPbBWI7SnhiwN6LtJgZzPHpQaeXnUm9LiCNyAhrzTACdKuBbN517oDXw==
- Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>
- Delivery-date: Wed, 26 Jan 2022 23:31:07 +0000
- Ironport-data: A9a23:MBDSRa+FzeC7dFqBKe/TDrUDbXmTJUtcMsCJ2f8bNWPcYEJGY0x3n WNNWGzSPPeKMGKjLdpyOduz9kIO75eHzNA3GgJkqC08E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si9AttENlFEkvU2ybuOU5NXsZ2YhFWeIdA970Ug5w7dj3NYz6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPhSj /9M7oKBbT4FGf3Fp+s9cj1/EwphaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguwKKsXxMZxZkXZn1TzDVt4tQIzZQrWM7thdtNs1rp4UQqiDP JZIAdZpRC2cWT8UAX5GMZgzoeKHr2vuchpD9V3A8MLb5ECMlVcsgdABKuH9ZdiiVchT2EGCq Qru72n/Rx0XKtGb4T6E6W63wP/CmzvhX4AfH6H+8eRl6HWRzGEODBwdVXOgvOK0zEW5Xrpix 1c8o3R06/JorQryE4e7D0bQTGO4UgA0eJ16ErYk2SW05o2E6jmWJkkgaT5qd4lz3CMpfgAC2 liMltLvIDVgtryJVH6QnoupQSOO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uRYjzrSHGeLzM2YabRYa DsgPav0ADQHkj/AP7LZEUtbqzmnZnmhZjmaRkJC1oM8w+Vlw6l77b8Dlyxwgoeeykn+8ZgzU H11yjCoomzufCyzRHRk0XJ6Y5NpdfnwtxfQOSRl8kuLCn2gArAXvUiZ1TChkFxnAic0idsrD D+mWZnAy210QKJQoiBm2qo5+An6kd315at8y7CvZKpm72HeNtzMbs+uWseSGqF16NohqAN7E oAtVjpxqZ/HFfOmj/w6MPPUAwvnk2ooWA6mepWlHBHV5ACAYUh57D30XklWKvoJhiKo7zP0d MeeP309bJTaxeXfnrZtm5gzJilWWkyBA6PRgwHttaO2zZbkXhlxw9ArfZv0kso5dY4Ud1J9u 7EOqNnmPVHSdIXd7t0AKMETdGsAmLATBrQOCaZIEjhFqsAJ3XRwqSHrYkd9aWvYtgF3ZEykJ POXBdRsnMzYVvnDYmU0JhC4nn2MSyAtPTWu7djDrRCy8/BrYvQQFq+oQoV4ridSt0kc7jmZ8 o=
- Ironport-sdr: o4DOjTXEmOkR5cbhZ+DxJ8Snv/9Hfh4LdC2jYFdwqP/CFetW4Pvl57D/rk2Y+BwliWlAKDbCJb cwc5lSbqlhRjmSpAYZENDPmY17amUXsQX7946lXzgPja2zfWgZVpIRyP4WnBL7qS5Ly7aM2UG0 B6VGfTYgN0QlZAumQCTguRaOxsrRLIO9M9HfQacxxadq7aOK9Lz1w1zOpcKL7FDxAXgLnu/mKa UdVyRBWB0Stbq/IqEZW2hovnCga1uY6wjmKvJYyBXAFg0cXvtsA5ezmf7ChRZU2LmYcrMcQPWa EVTk0MRR4oslraQZPT/RqL86
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYDgiCEwv0NK4Rvkyq5oesJ8VOH6x1/WyA
- Thread-topic: [PATCH v2 2/2] x86/Intel: use CPUID bit to determine PPIN availability
On 20/01/2022 14:17, Jan Beulich wrote:
> --- a/tools/misc/xen-cpuid.c
> +++ b/tools/misc/xen-cpuid.c
> @@ -195,6 +195,11 @@ static const char *const str_e21a[32] =
> [ 6] = "nscb",
> };
>
> +static const char *const str_7b1[32] =
> +{
> + [ 0] = "ppin",
> +};
I hadn't realised what a mess we had with the prefixes.
We have AMD_PPIN rendered as simply "ppin", while we also have
AMD_{STIBP,SSBD} which are rendered with an amd- prefix. This patch is
the first introduction of an INTEL_ prefixed feature.
We should figure out a consistency rule and fix the logic, before adding
more confusion.
Given the AMD MSR_SPEC_CTRL series just posted, use of CPUID bits will
often be symmetrical and it's awkward to have one or with a prefix and
the other without.
> --- a/xen/include/public/arch-x86/cpufeatureset.h
> +++ b/xen/include/public/arch-x86/cpufeatureset.h
> @@ -299,6 +299,9 @@ XEN_CPUFEATURE(FSRCS, 10*32+12) /
> XEN_CPUFEATURE(LFENCE_DISPATCH, 11*32+ 2) /*A LFENCE always serializing
> */
> XEN_CPUFEATURE(NSCB, 11*32+ 6) /*A Null Selector Clears Base
> (and limit too) */
>
> +/* Intel-defined CPU features, CPUID level 0x00000007:1.ebx, word 12 */
> +XEN_CPUFEATURE(INTEL_PPIN, 12*32+ 0) /* Protected Processor
> Inventory Number */
> +
> #endif /* XEN_CPUFEATURE */
>
> /* Clean up from a default include. Close the enum (for C). */
> --- a/xen/include/xen/lib/x86/cpuid.h
> +++ b/xen/include/xen/lib/x86/cpuid.h
> @@ -16,6 +16,7 @@
> #define FEATURESET_7d0 9 /* 0x00000007:0.edx */
> #define FEATURESET_7a1 10 /* 0x00000007:1.eax */
> #define FEATURESET_e21a 11 /* 0x80000021.eax */
> +#define FEATURESET_7b1 12 /* 0x00000007:1.ebx */
>
> struct cpuid_leaf
> {
> @@ -188,6 +189,10 @@ struct cpuid_policy
> uint32_t _7a1;
> struct { DECL_BITFIELD(7a1); };
> };
> + union {
> + uint32_t _7b1;
> + struct { DECL_BITFIELD(7b1); };
> + };
> };
> } feat;
>
>
Looking at a related patch I've got, at a minimum, you also need:
* collect the leaf in generic_identify()
* extend cpuid_policy_to_featureset() and cpuid_featureset_to_policy()
However I've got an idea to help us split "add new leaf" from "first bit
in new leaf" which I'd like to experiment with first. It is rather
awkward having the two mostly-unrelated changes forced together in a
single patch.
~Andrew
|