[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 32/34] target/ppc: Use probe_access for LMW, STMW
From: |
David Gibson |
Subject: |
[PULL 32/34] target/ppc: Use probe_access for LMW, STMW |
Date: |
Fri, 31 Jan 2020 17:09:22 +1100 |
From: Richard Henderson <address@hidden>
Use a minimum number of mmu lookups for the contiguous bytes
that are accessed. If the lookup succeeds, we can finish the
operation with host addresses only.
Reported-by: Howard Spoelstra <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
Tested-by: Howard Spoelstra <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/mem_helper.c | 45 +++++++++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 13 deletions(-)
diff --git a/target/ppc/mem_helper.c b/target/ppc/mem_helper.c
index 508d472a2f..e7d3a79d96 100644
--- a/target/ppc/mem_helper.c
+++ b/target/ppc/mem_helper.c
@@ -84,26 +84,45 @@ static void *probe_contiguous(CPUPPCState *env,
target_ulong addr, uint32_t nb,
void helper_lmw(CPUPPCState *env, target_ulong addr, uint32_t reg)
{
- for (; reg < 32; reg++) {
- if (needs_byteswap(env)) {
- env->gpr[reg] = bswap32(cpu_ldl_data_ra(env, addr, GETPC()));
- } else {
- env->gpr[reg] = cpu_ldl_data_ra(env, addr, GETPC());
+ uintptr_t raddr = GETPC();
+ int mmu_idx = cpu_mmu_index(env, false);
+ void *host = probe_contiguous(env, addr, (32 - reg) * 4,
+ MMU_DATA_LOAD, mmu_idx, raddr);
+
+ if (likely(host)) {
+ /* Fast path -- the entire operation is in RAM at host. */
+ for (; reg < 32; reg++) {
+ env->gpr[reg] = (uint32_t)ldl_be_p(host);
+ host += 4;
+ }
+ } else {
+ /* Slow path -- at least some of the operation requires i/o. */
+ for (; reg < 32; reg++) {
+ env->gpr[reg] = cpu_ldl_mmuidx_ra(env, addr, mmu_idx, raddr);
+ addr = addr_add(env, addr, 4);
}
- addr = addr_add(env, addr, 4);
}
}
void helper_stmw(CPUPPCState *env, target_ulong addr, uint32_t reg)
{
- for (; reg < 32; reg++) {
- if (needs_byteswap(env)) {
- cpu_stl_data_ra(env, addr, bswap32((uint32_t)env->gpr[reg]),
- GETPC());
- } else {
- cpu_stl_data_ra(env, addr, (uint32_t)env->gpr[reg], GETPC());
+ uintptr_t raddr = GETPC();
+ int mmu_idx = cpu_mmu_index(env, false);
+ void *host = probe_contiguous(env, addr, (32 - reg) * 4,
+ MMU_DATA_STORE, mmu_idx, raddr);
+
+ if (likely(host)) {
+ /* Fast path -- the entire operation is in RAM at host. */
+ for (; reg < 32; reg++) {
+ stl_be_p(host, env->gpr[reg]);
+ host += 4;
+ }
+ } else {
+ /* Slow path -- at least some of the operation requires i/o. */
+ for (; reg < 32; reg++) {
+ cpu_stl_mmuidx_ra(env, addr, env->gpr[reg], mmu_idx, raddr);
+ addr = addr_add(env, addr, 4);
}
- addr = addr_add(env, addr, 4);
}
}
--
2.24.1
- [PULL 29/34] migration: Include migration support for machine check handling, (continued)
- [PULL 29/34] migration: Include migration support for machine check handling, David Gibson, 2020/01/31
- [PULL 23/34] target/ppc/cpu.h: Put macro parameter in parentheses, David Gibson, 2020/01/31
- [PULL 34/34] target/ppc: Use probe_write for DCBZ, David Gibson, 2020/01/31
- [PULL 31/34] target/ppc: Use probe_access for LSW, STSW, David Gibson, 2020/01/31
- [PULL 26/34] target/ppc: Handle NMI guest exit, David Gibson, 2020/01/31
- [PULL 28/34] ppc: spapr: Handle "ibm, nmi-register" and "ibm, nmi-interlock" RTAS calls, David Gibson, 2020/01/31
- [PULL 04/34] hw/ppc/prep: Remove the deprecated "prep" machine and the OpenHackware BIOS, David Gibson, 2020/01/31
- [PULL 18/34] docs/specs/tpm: reST-ify TPM documentation, David Gibson, 2020/01/31
- [PULL 33/34] target/ppc: Remove redundant mask in DCBZ, David Gibson, 2020/01/31
- [PULL 30/34] ppc: spapr: Activate the FWNMI functionality, David Gibson, 2020/01/31
- [PULL 32/34] target/ppc: Use probe_access for LMW, STMW,
David Gibson <=
- [PULL 20/34] ppc/pnv: Add models for POWER8 PHB3 PCIe Host bridge, David Gibson, 2020/01/31
- [PULL 19/34] ppc/pnv: Add models for POWER9 PHB4 PCIe Host bridge, David Gibson, 2020/01/31
- Re: [PULL 00/34] ppc-for-5.0 queue 20200131, Peter Maydell, 2020/01/31