|
|
ae23c9 |
From e4af250e57428a1a29b8f18c4ceaeb6be3d1eff6 Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Suraj Jitindar Singh <sursingh@redhat.com>
|
|
|
ae23c9 |
Date: Thu, 21 Jun 2018 06:56:47 +0200
|
|
|
ae23c9 |
Subject: [PATCH 060/268] target/ppc: Factor out the parsing in
|
|
|
ae23c9 |
kvmppc_get_cpu_characteristics()
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Suraj Jitindar Singh <sursingh@redhat.com>
|
|
|
ae23c9 |
Message-id: <1529564209-30369-2-git-send-email-sursingh@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 80927
|
|
|
ae23c9 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 1/3] target/ppc: Factor out the parsing in kvmppc_get_cpu_characteristics()
|
|
|
ae23c9 |
Bugzilla: 1560847
|
|
|
ae23c9 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: David Gibson <dgibson@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
From: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Factor out the parsing of struct kvm_ppc_cpu_char in
|
|
|
ae23c9 |
kvmppc_get_cpu_characteristics() into a separate function for each cap
|
|
|
ae23c9 |
for simplicity.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
|
|
|
ae23c9 |
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
ae23c9 |
(cherry picked from commit 8fea70440eb0d095442de7e80d586a285cf96be5)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1560847
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Suraj Jitindar Singh <sursingh@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
target/ppc/kvm.c | 59 +++++++++++++++++++++++++++++++++++++-------------------
|
|
|
ae23c9 |
1 file changed, 39 insertions(+), 20 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
|
|
|
ae23c9 |
index 79a436a..d787032 100644
|
|
|
ae23c9 |
--- a/target/ppc/kvm.c
|
|
|
ae23c9 |
+++ b/target/ppc/kvm.c
|
|
|
ae23c9 |
@@ -2461,6 +2461,41 @@ bool kvmppc_has_cap_mmu_hash_v3(void)
|
|
|
ae23c9 |
return cap_mmu_hash_v3;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+static int parse_cap_ppc_safe_cache(struct kvm_ppc_cpu_char c)
|
|
|
ae23c9 |
+{
|
|
|
ae23c9 |
+ if (~c.behaviour & c.behaviour_mask & H_CPU_BEHAV_L1D_FLUSH_PR) {
|
|
|
ae23c9 |
+ return 2;
|
|
|
ae23c9 |
+ } else if ((c.character & c.character_mask & H_CPU_CHAR_L1D_THREAD_PRIV) &&
|
|
|
ae23c9 |
+ (c.character & c.character_mask
|
|
|
ae23c9 |
+ & (H_CPU_CHAR_L1D_FLUSH_ORI30 | H_CPU_CHAR_L1D_FLUSH_TRIG2))) {
|
|
|
ae23c9 |
+ return 1;
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ return 0;
|
|
|
ae23c9 |
+}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+static int parse_cap_ppc_safe_bounds_check(struct kvm_ppc_cpu_char c)
|
|
|
ae23c9 |
+{
|
|
|
ae23c9 |
+ if (~c.behaviour & c.behaviour_mask & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR) {
|
|
|
ae23c9 |
+ return 2;
|
|
|
ae23c9 |
+ } else if (c.character & c.character_mask & H_CPU_CHAR_SPEC_BAR_ORI31) {
|
|
|
ae23c9 |
+ return 1;
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ return 0;
|
|
|
ae23c9 |
+}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+static int parse_cap_ppc_safe_indirect_branch(struct kvm_ppc_cpu_char c)
|
|
|
ae23c9 |
+{
|
|
|
ae23c9 |
+ if (c.character & c.character_mask & H_CPU_CHAR_CACHE_COUNT_DIS) {
|
|
|
ae23c9 |
+ return SPAPR_CAP_FIXED_CCD;
|
|
|
ae23c9 |
+ } else if (c.character & c.character_mask & H_CPU_CHAR_BCCTRL_SERIALISED) {
|
|
|
ae23c9 |
+ return SPAPR_CAP_FIXED_IBS;
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ return 0;
|
|
|
ae23c9 |
+}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
static void kvmppc_get_cpu_characteristics(KVMState *s)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
struct kvm_ppc_cpu_char c;
|
|
|
ae23c9 |
@@ -2479,26 +2514,10 @@ static void kvmppc_get_cpu_characteristics(KVMState *s)
|
|
|
ae23c9 |
if (ret < 0) {
|
|
|
ae23c9 |
return;
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
- /* Parse and set cap_ppc_safe_cache */
|
|
|
ae23c9 |
- if (~c.behaviour & c.behaviour_mask & H_CPU_BEHAV_L1D_FLUSH_PR) {
|
|
|
ae23c9 |
- cap_ppc_safe_cache = 2;
|
|
|
ae23c9 |
- } else if ((c.character & c.character_mask & H_CPU_CHAR_L1D_THREAD_PRIV) &&
|
|
|
ae23c9 |
- (c.character & c.character_mask
|
|
|
ae23c9 |
- & (H_CPU_CHAR_L1D_FLUSH_ORI30 | H_CPU_CHAR_L1D_FLUSH_TRIG2))) {
|
|
|
ae23c9 |
- cap_ppc_safe_cache = 1;
|
|
|
ae23c9 |
- }
|
|
|
ae23c9 |
- /* Parse and set cap_ppc_safe_bounds_check */
|
|
|
ae23c9 |
- if (~c.behaviour & c.behaviour_mask & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR) {
|
|
|
ae23c9 |
- cap_ppc_safe_bounds_check = 2;
|
|
|
ae23c9 |
- } else if (c.character & c.character_mask & H_CPU_CHAR_SPEC_BAR_ORI31) {
|
|
|
ae23c9 |
- cap_ppc_safe_bounds_check = 1;
|
|
|
ae23c9 |
- }
|
|
|
ae23c9 |
- /* Parse and set cap_ppc_safe_indirect_branch */
|
|
|
ae23c9 |
- if (c.character & c.character_mask & H_CPU_CHAR_CACHE_COUNT_DIS) {
|
|
|
ae23c9 |
- cap_ppc_safe_indirect_branch = SPAPR_CAP_FIXED_CCD;
|
|
|
ae23c9 |
- } else if (c.character & c.character_mask & H_CPU_CHAR_BCCTRL_SERIALISED) {
|
|
|
ae23c9 |
- cap_ppc_safe_indirect_branch = SPAPR_CAP_FIXED_IBS;
|
|
|
ae23c9 |
- }
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ cap_ppc_safe_cache = parse_cap_ppc_safe_cache(c);
|
|
|
ae23c9 |
+ cap_ppc_safe_bounds_check = parse_cap_ppc_safe_bounds_check(c);
|
|
|
ae23c9 |
+ cap_ppc_safe_indirect_branch = parse_cap_ppc_safe_indirect_branch(c);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
int kvmppc_get_cap_safe_cache(void)
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|