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