From: David Gibson <david@gibson.dropbear.id.au>
To: agraf@suse.de
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 02/15] target-ppc: Rework storage of VPA registration state
Date: Thu, 18 Oct 2012 16:50:24 +1100 [thread overview]
Message-ID: <1350539437-535-3-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1350539437-535-1-git-send-email-david@gibson.dropbear.id.au>
With PAPR guests, hypercalls allow registration of the Virtual Processor
Area (VPA), SLB shadow and dispatch trace log (DTL), each of which allow
for certain communication between the guest and hypervisor. Currently, we
store the addresses of the three areas and the size of the dtl in
CPUPPCState.
The SLB shadow and DTL are variable sized, with the size being retrieved
from within the registered memory area at the hypercall time. This size
can later be overwritten with other information, however, so we need to
save the size as of registration time. We already do this for the DTL,
but not for the SLB shadow, so this patch fixes that.
In addition, we change the storage of the VPA information to use fixed
size integer types which will make life easier for syncing this data with
KVM, which we will need in future.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/spapr_hcall.c | 26 ++++++++++++++------------
target-ppc/cpu.h | 7 +++----
target-ppc/translate_init.c | 7 ++++---
3 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/hw/spapr_hcall.c b/hw/spapr_hcall.c
index 762493a..621dabd 100644
--- a/hw/spapr_hcall.c
+++ b/hw/spapr_hcall.c
@@ -366,26 +366,26 @@ static target_ulong register_vpa(CPUPPCState *env, target_ulong vpa)
return H_PARAMETER;
}
- env->vpa = vpa;
+ env->vpa_addr = vpa;
- tmp = ldub_phys(env->vpa + VPA_SHARED_PROC_OFFSET);
+ tmp = ldub_phys(env->vpa_addr + VPA_SHARED_PROC_OFFSET);
tmp |= VPA_SHARED_PROC_VAL;
- stb_phys(env->vpa + VPA_SHARED_PROC_OFFSET, tmp);
+ stb_phys(env->vpa_addr + VPA_SHARED_PROC_OFFSET, tmp);
return H_SUCCESS;
}
static target_ulong deregister_vpa(CPUPPCState *env, target_ulong vpa)
{
- if (env->slb_shadow) {
+ if (env->slb_shadow_addr) {
return H_RESOURCE;
}
- if (env->dispatch_trace_log) {
+ if (env->dtl_addr) {
return H_RESOURCE;
}
- env->vpa = 0;
+ env->vpa_addr = 0;
return H_SUCCESS;
}
@@ -407,18 +407,20 @@ static target_ulong register_slb_shadow(CPUPPCState *env, target_ulong addr)
return H_PARAMETER;
}
- if (!env->vpa) {
+ if (!env->vpa_addr) {
return H_RESOURCE;
}
- env->slb_shadow = addr;
+ env->slb_shadow_addr = addr;
+ env->slb_shadow_size = size;
return H_SUCCESS;
}
static target_ulong deregister_slb_shadow(CPUPPCState *env, target_ulong addr)
{
- env->slb_shadow = 0;
+ env->slb_shadow_addr = 0;
+ env->slb_shadow_size = 0;
return H_SUCCESS;
}
@@ -437,11 +439,11 @@ static target_ulong register_dtl(CPUPPCState *env, target_ulong addr)
return H_PARAMETER;
}
- if (!env->vpa) {
+ if (!env->vpa_addr) {
return H_RESOURCE;
}
- env->dispatch_trace_log = addr;
+ env->dtl_addr = addr;
env->dtl_size = size;
return H_SUCCESS;
@@ -449,7 +451,7 @@ static target_ulong register_dtl(CPUPPCState *env, target_ulong addr)
static target_ulong deregister_dtl(CPUPPCState *env, target_ulong addr)
{
- env->dispatch_trace_log = 0;
+ env->dtl_addr = 0;
env->dtl_size = 0;
return H_SUCCESS;
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index faf4404..eb2f43d 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1045,10 +1045,9 @@ struct CPUPPCState {
#endif
#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
- target_phys_addr_t vpa;
- target_phys_addr_t slb_shadow;
- target_phys_addr_t dispatch_trace_log;
- uint32_t dtl_size;
+ uint64_t vpa_addr;
+ uint64_t slb_shadow_addr, slb_shadow_size;
+ uint64_t dtl_addr, dtl_size;
#endif /* TARGET_PPC64 */
int error_code;
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index a972287..831b169 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -10425,9 +10425,10 @@ static void ppc_cpu_reset(CPUState *s)
env->error_code = 0;
#if defined(TARGET_PPC64) && !defined(CONFIG_USER_ONLY)
- env->vpa = 0;
- env->slb_shadow = 0;
- env->dispatch_trace_log = 0;
+ env->vpa_addr = 0;
+ env->slb_shadow_addr = 0;
+ env->slb_shadow_size = 0;
+ env->dtl_addr = 0;
env->dtl_size = 0;
#endif /* TARGET_PPC64 */
--
1.7.10.4
next prev parent reply other threads:[~2012-10-18 5:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-18 5:50 [Qemu-devel] [0/15] pseries patch queue David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 01/15] pseries: Don't allow duplicate registration of hcalls or RTAS calls David Gibson
2012-10-18 5:50 ` David Gibson [this message]
2012-10-18 5:50 ` [Qemu-devel] [PATCH 03/15] pseries: Implement qemu initiated shutdowns using EPOW events David Gibson
2012-10-22 2:15 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 04/15] target-ppc: Extend FPU state for newer POWER CPUs David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 05/15] pseries: Clean up inconsistent variable name in xics.c David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 06/15] pseries: Use #define for XICS base irq number David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 07/15] pseries: Cleanup duplications of ics_valid_irq() code David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 08/15] pseries: Move XICS initialization before cpu initialization David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 09/15] pseries: Return the token when we register an RTAS call David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 10/15] pseries: Allow RTAS tokens without a qemu handler David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 11/15] pseries: Add tracepoints to the XICS interrupt controller David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 12/15] pseries: Split xics irq configuration from state information David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 13/15] target-pcc: Convert ppcemb_tlb_t to use fixed 64-bit RPN David Gibson
2012-10-18 6:37 ` Alexander Graf
2012-10-18 8:19 ` David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 14/15] pseries: Implement PAPR NVRAM David Gibson
2012-10-18 5:50 ` [Qemu-devel] [PATCH 15/15] pseries: Update SLOF for NVRAM support David Gibson
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=1350539437-535-3-git-send-email-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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).