From: Gautam Menghani <gautam@linux.ibm.com>
To: npiggin@gmail.com, harshpb@linux.ibm.com, rathc@linux.ibm.com,
pbonzini@redhat.com, sjitindarsingh@gmail.com
Cc: Gautam Menghani <gautam@linux.ibm.com>,
qemu-ppc@nongnu.org, kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: [PATCH] target/ppc/kvm : Use macro names instead of hardcoded constants as return values
Date: Tue, 2 Dec 2025 18:16:52 +0530 [thread overview]
Message-ID: <20251202124654.11481-1-gautam@linux.ibm.com> (raw)
In the parse_* functions used to parse the return values of
KVM_PPC_GET_CPU_CHAR ioctl, the return values are hardcoded as numbers.
Use the macro names for better readability. No functional change
intended.
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
---
target/ppc/kvm.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 43124bf1c7..464240d911 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -2450,26 +2450,26 @@ static int parse_cap_ppc_safe_cache(struct kvm_ppc_cpu_char c)
bool l1d_thread_priv_req = !kvmppc_power8_host();
if (~c.behaviour & c.behaviour_mask & H_CPU_BEHAV_L1D_FLUSH_PR) {
- return 2;
+ return SPAPR_CAP_FIXED;
} else if ((!l1d_thread_priv_req ||
c.character & c.character_mask & H_CPU_CHAR_L1D_THREAD_PRIV) &&
(c.character & c.character_mask
& (H_CPU_CHAR_L1D_FLUSH_ORI30 | H_CPU_CHAR_L1D_FLUSH_TRIG2))) {
- return 1;
+ return SPAPR_CAP_WORKAROUND;
}
- return 0;
+ return SPAPR_CAP_BROKEN;
}
static int parse_cap_ppc_safe_bounds_check(struct kvm_ppc_cpu_char c)
{
if (~c.behaviour & c.behaviour_mask & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR) {
- return 2;
+ return SPAPR_CAP_FIXED;
} else if (c.character & c.character_mask & H_CPU_CHAR_SPEC_BAR_ORI31) {
- return 1;
+ return SPAPR_CAP_WORKAROUND;
}
- return 0;
+ return SPAPR_CAP_BROKEN;
}
static int parse_cap_ppc_safe_indirect_branch(struct kvm_ppc_cpu_char c)
@@ -2486,15 +2486,15 @@ static int parse_cap_ppc_safe_indirect_branch(struct kvm_ppc_cpu_char c)
return SPAPR_CAP_FIXED_IBS;
}
- return 0;
+ return SPAPR_CAP_BROKEN;
}
static int parse_cap_ppc_count_cache_flush_assist(struct kvm_ppc_cpu_char c)
{
if (c.character & c.character_mask & H_CPU_CHAR_BCCTR_FLUSH_ASSIST) {
- return 1;
+ return SPAPR_CAP_WORKAROUND;
}
- return 0;
+ return SPAPR_CAP_BROKEN;
}
bool kvmppc_has_cap_xive(void)
--
2.51.1
next reply other threads:[~2025-12-02 12:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 12:46 Gautam Menghani [this message]
2025-12-04 9:52 ` [PATCH] target/ppc/kvm : Use macro names instead of hardcoded constants as return values Chinmay Rath
2025-12-04 17:10 ` Philippe Mathieu-Daudé
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=20251202124654.11481-1-gautam@linux.ibm.com \
--to=gautam@linux.ibm.com \
--cc=harshpb@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rathc@linux.ibm.com \
--cc=sjitindarsingh@gmail.com \
/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).