[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 07/22] target-ppc: Rework storage of VPA registration
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 07/22] target-ppc: Rework storage of VPA registration state |
Date: |
Mon, 29 Oct 2012 11:25:56 +0100 |
From: David Gibson <address@hidden>
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 <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
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 3f114c9..286f42a 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)
- hwaddr vpa;
- hwaddr slb_shadow;
- hwaddr dispatch_trace_log;
- uint32_t dtl_size;
+ hwaddr vpa_addr;
+ hwaddr slb_shadow_addr, slb_shadow_size;
+ hwaddr 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 ad54985..e63627c 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.6.0.2
- [Qemu-ppc] [PULL 00/22] ppc patch queue 2012-10-29, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 01/22] Remove TARGET_PHYS_ADDR_BITS define completely, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 05/22] Add USB option in machine options, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 03/22] PPC: 440: Emulate DCBR0, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 02/22] PPC: Bamboo: Fix memory size DT property, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 06/22] pseries: Don't allow duplicate registration of hcalls or RTAS calls, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 07/22] target-ppc: Rework storage of VPA registration state,
Alexander Graf <=
- [Qemu-ppc] [PATCH 09/22] ac97: convert PIO to new memory api read/write, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 10/22] virtio-pci: convert PIO to new memory api read/write, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 14/22] mc146818rtc: convert PIO to new memory api read/write, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 13/22] m48t59: convert PIO to new memory api read/write, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 17/22] rtl8139: convert PIO to new memory api read/write, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 11/22] es1370: convert PIO to new memory api read/write, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 04/22] e500: Fix serial initialization, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 21/22] PPC: e500: Map PIO space into core memory region, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 15/22] pc port92: convert PIO to new memory api read/write, Alexander Graf, 2012/10/29
- [Qemu-ppc] [PATCH 08/22] pseries: Implement qemu initiated shutdowns using EPOW events, Alexander Graf, 2012/10/29