From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au,
sam.bobroff@au1.ibm.com, rnsastry@linux.vnet.ibm.com,
Bharata B Rao <bharata@linux.vnet.ibm.com>
Subject: [Qemu-devel] [RFC PATCH 1/2] spapr: Make h_register_process_table hcall flags global
Date: Mon, 8 May 2017 14:36:16 +0530 [thread overview]
Message-ID: <1494234377-1773-2-git-send-email-bharata@linux.vnet.ibm.com> (raw)
In-Reply-To: <1494234377-1773-1-git-send-email-bharata@linux.vnet.ibm.com>
The flags used in h_register_process_table hcall are needed in spapr.c
and hence move them to a header file. While doing so, give them
slightly specific names.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
hw/ppc/spapr_hcall.c | 31 ++++++++++++++-----------------
include/hw/ppc/spapr.h | 10 ++++++++++
2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 0d608d6..3600b0e 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -924,13 +924,6 @@ static void spapr_check_setup_free_hpt(sPAPRMachineState *spapr,
return;
}
-#define FLAGS_MASK 0x01FULL
-#define FLAG_MODIFY 0x10
-#define FLAG_REGISTER 0x08
-#define FLAG_RADIX 0x04
-#define FLAG_HASH_PROC_TBL 0x02
-#define FLAG_GTSE 0x01
-
static target_ulong h_register_process_table(PowerPCCPU *cpu,
sPAPRMachineState *spapr,
target_ulong opcode,
@@ -943,12 +936,13 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu,
target_ulong table_size = args[3];
uint64_t cproc;
- if (flags & ~FLAGS_MASK) { /* Check no reserved bits are set */
+ if (flags & ~SPAPR_PROC_TABLE_MASK) { /* Check no reserved bits are set */
return H_PARAMETER;
}
- if (flags & FLAG_MODIFY) {
- if (flags & FLAG_REGISTER) {
- if (flags & FLAG_RADIX) { /* Register new RADIX process table */
+ if (flags & SPAPR_PROC_TABLE_MODIFY) {
+ if (flags & SPAPR_PROC_TABLE_REGISTER) {
+ if (flags & SPAPR_PROC_TABLE_RADIX) {
+ /* Register new RADIX process table */
if (proc_tbl & 0xfff || proc_tbl >> 60) {
return H_P2;
} else if (page_size) {
@@ -958,7 +952,8 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu,
}
cproc = PATBE1_GR | proc_tbl | table_size;
} else { /* Register new HPT process table */
- if (flags & FLAG_HASH_PROC_TBL) { /* Hash with Segment Tables */
+ if (flags & SPAPR_PROC_TABLE_HPT_PT) {
+ /* Hash with Segment Tables */
/* TODO - Not Supported */
/* Technically caused by flag bits => H_PARAMETER */
return H_PARAMETER;
@@ -981,7 +976,8 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu,
cproc = spapr->patb_entry & PATBE1_GR;
}
} else { /* Maintain current registration */
- if (!(flags & FLAG_RADIX) != !(spapr->patb_entry & PATBE1_GR)) {
+ if (!(flags & SPAPR_PROC_TABLE_RADIX) !=
+ !(spapr->patb_entry & PATBE1_GR)) {
/* Technically caused by flag bits => H_PARAMETER */
return H_PARAMETER; /* Existing Process Table Mismatch */
}
@@ -996,13 +992,14 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu,
/* Update the UPRT and GTSE bits in the LPCR for all cpus */
CPU_FOREACH(cs) {
set_spr(cs, SPR_LPCR, LPCR_UPRT | LPCR_GTSE,
- ((flags & (FLAG_RADIX | FLAG_HASH_PROC_TBL)) ? LPCR_UPRT : 0) |
- ((flags & FLAG_GTSE) ? LPCR_GTSE : 0));
+ ((flags & (SPAPR_PROC_TABLE_RADIX | SPAPR_PROC_TABLE_HPT_PT)) ?
+ LPCR_UPRT : 0) | ((flags & SPAPR_PROC_TABLE_GTSE) ?
+ SPAPR_PROC_TABLE_GTSE : 0));
}
if (kvm_enabled()) {
- return kvmppc_configure_v3_mmu(cpu, flags & FLAG_RADIX,
- flags & FLAG_GTSE, cproc);
+ return kvmppc_configure_v3_mmu(cpu, flags & SPAPR_PROC_TABLE_RADIX,
+ flags & SPAPR_PROC_TABLE_GTSE, cproc);
}
return H_SUCCESS;
}
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 5802f88..a692e63 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -681,4 +681,14 @@ int spapr_rng_populate_dt(void *fdt);
void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg);
+/*
+ * Defines for flag value used in H_REGISTER_PROC_TBL hcall.
+ */
+#define SPAPR_PROC_TABLE_MASK 0x01FULL
+#define SPAPR_PROC_TABLE_MODIFY 0x10
+#define SPAPR_PROC_TABLE_REGISTER 0x08
+#define SPAPR_PROC_TABLE_RADIX 0x04
+#define SPAPR_PROC_TABLE_HPT_PT 0x02
+#define SPAPR_PROC_TABLE_GTSE 0x01
+
#endif /* HW_SPAPR_H */
--
2.7.4
next prev parent reply other threads:[~2017-05-08 9:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-08 9:06 [Qemu-devel] [RFC PATCH 0/2] ppc/spapr: Fix migration of radix guests Bharata B Rao
2017-05-08 9:06 ` Bharata B Rao [this message]
2017-05-11 0:14 ` [Qemu-devel] [RFC PATCH 1/2] spapr: Make h_register_process_table hcall flags global David Gibson
2017-05-08 9:06 ` [Qemu-devel] [RFC PATCH 2/2] spapr: Fix migration of Radix guests Bharata B Rao
2017-05-11 1:02 ` David Gibson
2017-05-17 3:42 ` Bharata B Rao
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=1494234377-1773-2-git-send-email-bharata@linux.vnet.ibm.com \
--to=bharata@linux.vnet.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rnsastry@linux.vnet.ibm.com \
--cc=sam.bobroff@au1.ibm.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).