Statistics
| Branch: | Revision:

root / target-ppc @ f53ec699

# Date Author Comment
986a2998 07/27/2013 01:04 am Andreas Färber

gdbstub: Replace GET_REG*() macros with gdb_get_reg*() functions

This avoids polluting the global namespace with a non-prefixed macro and
makes it obvious in the call sites that we return.

Semi-automatic conversion using, e.g.,
sed i 's/GET_REGL(/return gdb_get_regl(mem_buf, /g' target*/gdbstub.c...

5b50e790 07/27/2013 01:04 am Andreas Färber

cpu: Introduce CPUClass::gdb_{read,write}_register()

Completes migration of target-specific code to new target-*/gdbstub.c.

Acked-by: Michael Walle <> (for lm32)
Acked-by: Max Filippov <> (for xtensa)
Signed-off-by: Andreas Färber <>

5b24c641 07/27/2013 01:04 am Andreas Färber

cpu: Introduce CPUClass::gdb_core_xml_file for GDB_CORE_XML

Replace the GDB_CORE_XML define in gdbstub.c with a CPUClass field.
Use first_cpu for qSupported and qXfer:features:read: for now.
Add a stub for xml_builtin.

Signed-off-by: Andreas Färber <>

0980bfab 07/27/2013 12:24 am Andreas Färber

target-ppc: Move cpu_gdb_{read,write}_register()

Signed-off-by: Andreas Färber <>

a0e372f0 07/27/2013 12:23 am Andreas Färber

cpu: Introduce CPUState::gdb_num_regs and CPUClass::gdb_num_core_regs

CPUState::gdb_num_regs replaces num_g_regs.
CPUClass::gdb_num_core_regs replaces NUM_CORE_REGS.

Allows building gdb_register_coprocessor() for xtensa, too.

As a side effect this should fix coprocessor register numbering for SMP....

00b941e5 07/23/2013 03:41 am Andreas Färber

cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook

Change breakpoint_invalidate() argument to CPUState alongside.

Since all targets now assign a softmmu-only field, we can drop helpers
cpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd()....

22169d41 07/23/2013 03:41 am Andreas Färber

gdbstub: Change gdb_register_coprocessor() argument to CPUState

Signed-off-by: Andreas Färber <>

bdf7ae5b 07/23/2013 03:41 am Andreas Färber

cpu: Introduce CPUClass::synchronize_from_tb() for cpu_pc_from_tb()

Where no extra implementation is needed, fall back to CPUClass::set_pc().

Acked-by: Michael Walle <> (for lm32)
Signed-off-by: Andreas Färber <>

ed2803da 07/23/2013 03:41 am Andreas Färber

cpu: Move singlestep_enabled field from CPU_COMMON to CPUState

Prepares for changing cpu_single_step() argument to CPUState.

Acked-by: Michael Walle <> (for lm32)
Signed-off-by: Andreas Färber <>

f45748f1 07/23/2013 03:41 am Andreas Färber

cpu: Introduce CPUClass::set_pc() for gdb_set_cpu_pc()

This moves setting the Program Counter from gdbstub into target code.
Use vaddr type as upper-bound replacement for target_ulong.

Signed-off-by: Andreas Färber <>

7162bdea 07/11/2013 07:51 pm Julio Guerra

e600 core for MPC86xx processors

MPC86xx processors are based on the e600 core, which is not the case
in qemu where it is based on the 7400 processor.

This patch creates the e600 core and instantiates the MPC86xx
processors based on it. Therefore, adding the high BATs, the SPRG...

8d43ea1c 07/11/2013 07:51 pm Prerna Saxena

target-ppc: Add POWER8 v1.0 CPU model

This patch adds CPU PVR definition for POWER8,
and enables QEMU to launch guests on POWER8 hardware.

Signed-off-by: Prerna Saxena

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paul Mackerras <paulus@samba.org>...

a0762859 07/09/2013 10:33 pm Andreas Färber

log: Change log_cpu_state[_mask]() argument to CPUState

Since commit 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (cpu: Turn
cpu_dump_{state,statistics}() into CPUState hooks) CPUArchState is no
longer needed.

Add documentation and make the functions available through qemu/log.h...

77710e7a 07/09/2013 10:33 pm Andreas Färber

target-ppc: Change LOG_MMU_STATE() argument to CPUState

Choose CPUState rather than PowerPCCPU since doing a CPU cast on the
macro argument would hide type mismatches.

Signed-off-by: Andreas Färber <>

91b1df8c 07/09/2013 10:33 pm Andreas Färber

cpu: Move reset logging to CPUState

x86 was using additional CPU_DUMP_* flags, so make that configurable in
CPUClass::reset_dump_flags.

This adds reset logging for alpha, unicore32 and xtensa.

Acked-by: Michael Walle <> (for lm32)
Reviewed-by: Richard Henderson <>...

213fe1f5 07/09/2013 10:33 pm Andreas Färber

target-ppc: Change gen_intermediate_code_internal() argument to PowerPCCPU

Also use bool type while at it.

Prepares for moving singlestep_enabled field to CPUState.

Reviewed-by: Richard Henderson <>
Signed-off-by: Andreas Färber <>

09c6a63a 07/09/2013 10:33 pm Andreas Färber

target-ppc: Don't overuse ENV_GET_CPU()

Commit b632a148b677b773ff155f9de840b37a653567b9 (target-ppc: QOM method
dispatch for MMU fault handling) introduced a use of ENV_GET_CPU()
inside target-ppc/ code. Use ppc_env_get_cpu() instead.

Purely cosmetic, non-functional change to aid in locating and removing...

182735ef 07/09/2013 10:32 pm Andreas Färber

cpu: Make first_cpu and next_cpu CPUState

Move next_cpu from CPU_COMMON to CPUState.
Move first_cpu variable to qom/cpu.h.

gdbstub needs to use CPUState::env_ptr for now.
cpu_copy() no longer needs to save and restore cpu_next.

Acked-by: Paolo Bonzini <>...

6291ad77 07/09/2013 10:20 pm Peter Maydell

linux-user: Move cpu_clone_regs() and cpu_set_tls() into linux-user

The functions cpu_clone_regs() and cpu_set_tls() are not purely CPU
related -- they are specific to the TLS ABI for a a particular OS.
Move them into the linux-user/ tree where they belong....

6e42be7c 07/09/2013 10:20 pm Andreas Färber

cpu: Drop unnecessary dynamic casts in *_env_get_cpu()

A transition from CPUFooState to FooCPU can be considered safe,
just like FooCPU::env access in the opposite direction.
The only benefit of the FOO_CPU() casts would be protection against
bogus CPUFooState pointers, but then surrounding code would likely...

2c9b15ca 07/04/2013 06:42 pm Paolo Bonzini

memory: add owner argument to initialization functions

Signed-off-by: Paolo Bonzini <>

886b7577 07/01/2013 02:11 am Fabien Chouteau

PPC: Add dump_mmu() for 6xx

"(qemu) info tlb" is a very useful tool for debugging, so I implemented
the missing 6xx version.

Signed-off-by: Fabien Chouteau <>
[agraf: fix printfs on hwaddr to PRI]
Signed-off-by: Alexander Graf <>

b177d8b7 07/01/2013 02:11 am Fabien Chouteau

PPC: Fix GDB read on code area for PPC6xx

On PPC 6xx, data and code have separated TLBs. Until now QEMU was only
looking at data TLBs, which is not good when GDB wants to read code.

This patch adds a second call to get_physical_address() with an
ACCESS_CODE type of access when the first call with ACCESS_INT fails....

9761ad75 07/01/2013 02:11 am Alexander Graf

PPC: Introduce an alias cache for faster lookups

When running QEMU with "-cpu ?" we walk through every alias for every
target CPU we know about. This takes several seconds on my very fast
host system.

Let's introduce a class object cache in the alias table. Using that we...

2345f1c0 07/01/2013 02:11 am Alexander Graf

PPC: Ignore writes to L2CR

The L2CR register contains a number of bits that either impose configuration
which we can't deal with or mean "something is in progress until the bit is
0 again".

Since we don't model the former and we do want to accomodate guests using the...

4bddaf55 07/01/2013 02:11 am Alexey Kardashevskiy

target-ppc kvm: save cr register

This adds a missing code to save CR (condition register) via
kvm_arch_put_registers(). kvm_arch_get_registers() already has it.

Signed-off-by: Alexey Kardashevskiy <>
Signed-off-by: David Gibson <>...

b048960f 07/01/2013 02:11 am Andreas Färber

target-ppc: Introduce unrealizefn for PowerPCCPU

Use it to clean up the opcode table, resolving a former TODO from Jocelyn.
Also switch from malloc() to g_malloc().

Signed-off-by: Andreas Färber <>
Signed-off-by: Alexander Graf <>

1e3438df 07/01/2013 02:11 am Andreas Färber

target-ppc: Drop redundant flags assignments from CPU families

Previous code has #define POWERPC_INSNS2_<family> PPC_NONE in some
places for macrofied assignment to insns_flags2 field.

PPC_NONE is defined as zero though and QOM classes are zero-initialized,...

9fea2ae2 07/01/2013 02:11 am Hervé Poussineau

ppc: do not register IABR SPR twice for 603e

IABR SPR is already registered in gen_spr_603(), called from init_proc_603E().

Signed-off-by: Hervé Poussineau <>
Reviewed-by: Andreas Färber <>
Signed-off-by: Alexander Graf <>

4be1db86 07/01/2013 02:11 am Alexander Graf

PPC: Add non-kvm stub file

There are cases where a kvm provided function is called from generic
hw code that doesn't know whether kvm is available or not. Provide
a stub file which can provide simple replacement functions for those
cases.

Signed-off-by: Alexander Graf <>...

d85937e6 07/01/2013 02:11 am Scott Wood

kvm/openpic: in-kernel mpic support

Enables support for the in-kernel MPIC that thas been merged into the
KVM next branch. This includes irqfd/KVM_IRQ_LINE support from Alex
Graf (along with some other improvements).

Note from Alex regarding kvm_irqchip_create():...

c643bed9 06/28/2013 02:25 pm Andreas Färber

cpu: Change qemu_init_vcpu() argument to CPUState

This allows to move the call into CPUState's realizefn.
Therefore move the stub into libqemustub.a.

Reviewed-by: Richard Henderson <>
Signed-off-by: Andreas Färber <>

cb446eca 06/28/2013 02:25 pm Andreas Färber

kvm: Change cpu_synchronize_state() argument to CPUState

Change Monitor::mon_cpu to CPUState as well.

Reviewed-by: liguang <>
Acked-by: Paolo Bonzini <>
Signed-off-by: Andreas Färber <>

878096ee 06/28/2013 02:25 pm Andreas Färber

cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks

Make cpustats monitor command available unconditionally.

Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()
arguments to CPUState.

Signed-off-by: Andreas Färber <>

82169660 06/12/2013 12:19 pm Scott Wood

KVM: PPC: Add dummy kvm_arch_init_irq_routing()

The common KVM code insists on calling kvm_arch_init_irq_routing()
as soon as it sees kernel header support for it (regardless of whether
QEMU supports it). Provide a dummy function to satisfy this.

Unlike x86, PPC does not have one default irqchip, so there's no common...

997aba8e 05/18/2013 03:35 pm Michael Tokarev

remove some double-includes

Some source files #include the same header more than
once for no good reason. Remove second #includes in
such cases.

Signed-off-by: Michael Tokarev <>

36f48d9c 05/08/2013 09:23 pm Alexander Graf

PPC: Depend behavior of cmp instructions only on instruction encoding

When running an L=1 cmp instruction on a 64bit PPC CPU with SF off, it
still behaves identical to what it does when SF is on. Remove the implicit
difference in the code.

Also, on most 32bit CPUs we should always treat the compare as 32bit...

554ecc57 05/08/2013 09:23 pm Alexander Graf

PPC: Fix rldcl

The implementation for rldcl tried to always fetch its
parameters from the opcode, even though the opcode was
already passed in in decoded and different forms.

Use the parameters instead, fixing rldcl.

Reported-by: Torbjorn Granlund <>...

126a7930 05/06/2013 06:22 pm Alexander Graf

PPC: Add MMU type for 2.06 with AMR but no TB pages

When running -cpu on a POWER7 system with PR KVM, we mask out the 1TB
MMU capability from the MMU type mask, but not the AMR bit.

This leads to us having a new MMU type that we don't check for in our
MMU management functions....

c05541ee 05/06/2013 06:22 pm Anton Blanchard

target-ppc: Fix invalid SPR read/write warnings

Invalid and privileged SPR warnings currently print the wrong
address. While fixing that, also make it clear that we are
printing both the decimal and hexadecimal SPR number.

Before:

Trying to read invalid spr 896 380 at 0000000000000714...
04559d52 05/06/2013 06:22 pm Anton Blanchard

target-ppc: Add read and write of PPR SPR

Recent Linux kernels save and restore the PPR across exceptions
so we need to handle it.

Signed-off-by: Anton Blanchard <>
Signed-off-by: Alexander Graf <>

909eedb7 04/27/2013 01:37 am Aurelien Jarno

target-ppc: slightly optimize lfiwax

Signed-off-by: Aurelien Jarno <>

199f830d 04/27/2013 12:02 am Aurelien Jarno

target-ppc: emulate lfiwax instruction

Needed for Power ISA version 2.05 compliance.

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>
[agraf: fix tcg debug error]
Signed-off-by: Alexander Graf <>

05050ee8 04/27/2013 12:02 am Aurelien Jarno

target-ppc: emulate load doubleword pair instructions

Needed for Power ISA version 2.05 compliance. The check for odd register
pairs is done using the invalid bits.

Signed-off-by: Aurelien Jarno <>
Signed-off-by: Alexander Graf <>

44bc0c4d 04/27/2013 12:02 am Aurelien Jarno

target-ppc: emulate store doubleword pair instructions

Needed for Power ISA version 2.05 compliance. The check for odd register
pairs is done using the invalid bits.

Signed-off-by: Aurelien Jarno <>
Signed-off-by: Alexander Graf <>

7d08d856 04/27/2013 12:02 am Aurelien Jarno

target-ppc: add support for extended mtfsf/mtfsfi forms

Power ISA 2.05 adds support for extended mtfsf/mtfsfi form, with a new
W field to select the upper part of the FPCSR register.

For that the helper is changed to handle 64-bit input values and mask with...

db72c9f2 04/27/2013 12:02 am Tristan Gingold

powerpc: correctly handle fpu exceptions.

Raise the exception on the first occurence, do not wait for the next
floating point operation.

Signed-off-by: Fabien Chouteau <>
Signed-off-by: Alexander Graf <>

414f5d14 04/27/2013 12:02 am Alexander Graf

PPC: Fix dcbz for linux-user on 970

The default with linux-user for dcbz on 970 is to emulate 32 byte clears.
However, redoing the dcbzl support we added a check to not honor the bit
in HID5 that sets this.

Remove the #ifdef check on linux user, so that we get 32 byte clears again....

bf45a2e6 04/27/2013 12:02 am Aurelien Jarno

target-ppc: optimize fabs, fnabs, fneg

fabs, fnabs and fneg are just flipping the bit sign of an FP register,
this can be implemented in TCG instead of using softfloat.

Signed-off-by: Aurelien Jarno <>
Signed-off-by: Alexander Graf <>

9c2627b0 04/27/2013 12:02 am Aurelien Jarno

target-ppc: add instruction flags for Book I 2.05

.. and enable it on POWER7 CPU.

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>
Signed-off-by: Alexander Graf <>

fcfda20f 04/27/2013 12:02 am Aurelien Jarno

target-ppc: emulate cmpb instruction

Needed for Power ISA version 2.05 compliance.

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>
Signed-off-by: Alexander Graf <>

725bcec2 04/27/2013 12:02 am Aurelien Jarno

target-ppc: emulate prtyw and prtyd instructions

Needed for Power ISA version 2.05 compliance.

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>
[agraf: fix 32-bit host compile, simplify code]
Signed-off-by: Alexander Graf <>

f0332888 04/27/2013 12:02 am Aurelien Jarno

target-ppc: emulate fcpsgn instruction

Needed for Power ISA version 2.05 compliance.

Reviewed-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>
Signed-off-by: Alexander Graf <>

f36951c1 04/27/2013 12:02 am David Gibson

pseries: Fix incorrect calculation of RMA size in certain configurations

For the pseries machine, we need to advertise to the guest the size of its
RMA - that is the amount of memory it can access with the MMU off. For HV
KVM, this is constrained by the hardware limitations on the virtual RMA of...

0cbad81f 04/27/2013 12:02 am David Gibson

pseries: Fixes and enhancements to L1 cache properties

PAPR requires that the device tree's CPU nodes have several properties
with information about the L1 cache. We already create two of these
properties, but with incorrect names - "[id]cache-block-size" instead...

702763fa 04/27/2013 12:02 am David Gibson

target-ppc: Add more stubs for POWER7 PMU registers

In addition to the performance monitor registers found on nearly all
6xx chips, the POWER7 has two additional counters (PMC5 & PMC6) and an
extra control register (MMCRA). This patch adds stub support for them to...

9b00ea49 04/27/2013 12:02 am David Gibson

target-ppc: Synchronize VPA state with KVM

For PAPR guests, KVM tracks the various areas registered with the
H_REGISTER_VPA hypercall. For full emulation, of course, these are tracked
within qemu. At present these values are not synchronized. This is a...

3b961124 04/27/2013 12:02 am Stuart Yoder

PPC: e500: advertise 4.2 MPIC only if KVM supports EPR

Older KVM versions don't support EPR which breaks guests when we announce
MPIC variants that support EPR.

Catch that case and expose only MPIC version 2.0 which tells the guest that
we don't support the EPR capability yet....

2cf3eb6d 04/27/2013 12:02 am Fabien Chouteau

PPC: Remove env->hreset_excp_prefix

This value is not needed if we use correctly the MSR[IP] bit.

excp_prefix is always 0x00000000, except when the MSR[IP] bit is
implemented and set to 1, in that case excp_prefix is 0xfff00000.

The handling of MSR[IP] was already implemented but not used at reset...

8e7a6db9 04/27/2013 12:02 am Aurelien Jarno

target-ppc: fix nego and subf*o instructions

The overflow computation of nego and subf*o instructions has been broken
in commit ffe30937. Contrary to other targets, the instruction is subtract
from an not subtract on PowerPC.

This patch fixes the issue by using the correct argument in the xor...

09d9828a 04/27/2013 12:02 am Fabien Chouteau

PPC: fix hreset_vector for 60x, 7x0, 7x5, G2, MPC8xx, MPC5xx, 7400 and 7450

According to the different user's manuals, the vector offset for system
reset (both /HRESET and /SRESET) is 0x00100.

This patch may break support of some executables, as the power-on start...

2bc17322 04/27/2013 12:02 am Fabien Chouteau

PPC: Add breakpoint registers for 603 and e300

Signed-off-by: Fabien Chouteau <>
Signed-off-by: Alexander Graf <>

752d634e 04/27/2013 12:02 am Richard Henderson

target-ppc: Fix narrow-mode add/sub carry output

Broken in b5a73f8d8a57e940f9bbeb399a9e47897522ee9a, the carry itself was
fixed in 79482e5ab38a05ca8869040b0d8b8f451f16ff62. But we still need to
produce the full 64-bit addition.

Simplify the conditions at the top of the functions for when we need a...

31f2cb8f 04/27/2013 12:02 am Bharat Bhushan

Enable kvm emulated watchdog

Enable the KVM emulated watchdog if KVM supports (use the
capability enablement in watchdog handler). Also watchdog exit
(KVM_EXIT_WATCHDOG) handling is added.
Watchdog state machine is cleared whenever VM state changes to running....

e71ec2e9 04/27/2013 12:02 am Aurelien Jarno

target-ppc: Enable ISEL on POWER7

ISEL is a Power ISA 2.06 instruction and thus is available on POWER7.
Given this is trapped and emulated by the Linux kernel, I guess it went
unnoticed.

Signed-off-by: Aurelien Jarno <>
Signed-off-by: Alexander Graf <>

b421d9c6 04/15/2013 07:19 pm Paolo Bonzini

memory: move core typedefs to qemu/typedefs.h

Signed-off-by: Paolo Bonzini <>

0d09e41a 04/08/2013 07:13 pm Paolo Bonzini

hw: move headers to include/

Many of these should be cleaned up with proper qdev-/QOM-ification.
Right now there are many catch-all headers in include/hw/ARCH depending
on cpu.h, and this makes it necessary to compile these files per-target.
However, fixing this does not belong in these patches....

79482e5a 03/22/2013 04:28 pm Richard Henderson

target-ppc: Fix add and subf carry generation in narrow mode

The set of computations used in b5a73f8d8a57e940f9bbeb399a9e47897522ee9a
are only valid if the current word size == target_long size. This failed
to take ppc64 in 32-bit (narrow) mode into account....

e0c8f9ce 03/22/2013 04:28 pm Richard Henderson

target-ppc: Use NARROW_MODE macro for branches

Removing conditional compilation in the process.

Signed-off-by: Richard Henderson <>
Signed-off-by: Alexander Graf <>

02765534 03/22/2013 04:28 pm Richard Henderson

target-ppc: Use NARROW_MODE macro for comparisons

Removing conditional compilation in the process.

Signed-off-by: Richard Henderson <>
Signed-off-by: Alexander Graf <>

c791fe84 03/22/2013 04:28 pm Richard Henderson

target-ppc: Use NARROW_MODE macro for addresses

Removing conditional compilation in the process.

Signed-off-by: Richard Henderson <>
Signed-off-by: Alexander Graf <>

9ca3f7f3 03/22/2013 04:28 pm Richard Henderson

target-ppc: Use NARROW_MODE macro for tlbie

Removing conditional compilation in the process.

Signed-off-by: Richard Henderson <>
Signed-off-by: Alexander Graf <>

75d5ec89 03/22/2013 04:28 pm David Gibson

mmu-hash*: Correctly mask RPN from hash PTE

BEHAVIOUR CHANGE

At present we take the whole of word 1 of the hash PTE as the real page
number used to calculate the translated address. This is incorrect,
because it leaves the flags from the low bits of PTE word 1 in place in the...

5883d8b2 03/22/2013 04:28 pm David Gibson

mmu-hash*: Don't use full ppc_hash{32, 64}_translate() path for get_phys_page_debug()

Currently the hash mmu versionsof get_phys_page_debug() use the same
ppc64_hash64_translate() function to do the translation logic as the normal
mm fault handler code.
...

caa597bd 03/22/2013 04:28 pm David Gibson

mmu-hash*: Merge translate and fault handling functions

ppc_hash{32,64}_handle_mmu_fault() is now the only caller of
ppc_hash{32,64{_translate(), so this patch combines them together. This
means that instead of one returning a variety of non-obvious error codes...

f80872e2 03/22/2013 04:28 pm David Gibson

mmu-hash64: Implement Virtual Page Class Key Protection

Version 2.06 of the Power architecture describes an additional page
protection mechanism. Each virtual page has a "class" (0-31) recorded in
the PTE. The AMR register contains bits which can prohibit reads and/or...

cc8eae8a 03/22/2013 04:28 pm David Gibson

target-ppc: Split user only code out of mmu_helper.c

mmu_helper.c is, for obvious reasons, almost entirely concerned with
softmmu builds of qemu. However, it does contain one stub function which
is used when CONFIG_USER_ONLY=y - the user only versoin of...

eb20c1c6 03/22/2013 04:28 pm David Gibson

target-ppc: Move ppc tlb_fill implementation into mmu_helper.c

For softmmu builds the interface from the generic code to the target
specific MMU implementation is through the tlb_fill() function. For ppc
this is currently in mem_helper.c, whereas it would make more sense in...

b632a148 03/22/2013 04:28 pm David Gibson

target-ppc: Use QOM method dispatch for MMU fault handling

After previous cleanups, the many scattered checks of env->mmu_model in
the ppc MMU implementation have, at least for "classic" hash MMUs been
reduced (almost) to a single switch at the top of
cpu_ppc_handle_mmu_fault()....

87dc3fd1 03/22/2013 04:28 pm David Gibson

mmu-hash*: Don't update PTE flags when permission is denied

BEHAVIOUR CHANGE

Currently if ppc_hash{32,64}_translate() finds a PTE matching the given
virtual address, it will always update the PTE's R & C (Referenced and
Changed) bits. This happens even if the PTE's permissions mean we are...

e1a53ba2 03/22/2013 04:28 pm David Gibson

mmu-hash32: Remove nx from context structure

Previous cleanups have meant the nx field of the mmu_ctx_hash32 structure
is now only used within ppc_hash32_translate(), and so it can be replaced
by a local variable.

Signed-off-by: David Gibson <>...

e01b4445 03/22/2013 04:28 pm David Gibson

mmu-hash*: Clean up permission checking

Currently checking of PTE permission bits is split messily amongst
ppc_hash{32,64}_pp_check(), ppc_hash{32,64}_check_prot() and their callers.
This patch cleans this up to have the new function
ppc_hash{32,64}_pte_prot() compute the page permissions from the SLBE (for...

57d0a39d 03/22/2013 04:28 pm David Gibson

mmu-hash64: Factor SLB N bit into permissions bits

BEHAVIOUR CHANGE

Currently, for 64-bit hash mmu, the execute protection bit placed into the
qemu tlb is based only on the N (No execute) bit from the PTE. However,
No Execute can also be set at the segment level. We do check this on...

b3440746 03/22/2013 04:28 pm David Gibson

mmu-hash*: Clean up PTE flags update

Currently the ppc_hash{32,64}_pte_update_flags() helper functions update a
PTE's referenced and changed bits as necessary to reflect the access. It
is somewhat long winded, though. This patch open codes them in their...

6d11d998 03/22/2013 04:28 pm David Gibson

mmu-hash*: Clean up real address calculation

More recent 64-bit hash MMUs support multiple page sizes, and PTEs for
large pages only include the offset of the whole large page. But the qemu
tlb only handles pages of the base size (4k) so we need to break up the...

6a980110 03/22/2013 04:28 pm David Gibson

mmu-hash*: Fold pte_check*() logic into caller

With previous cleanups made, the 32-bit and 64-bit pte_check*() functions
are pretty trivial and only have one call site. This patch therefore
clarifies the overall code flow by folding those functions into their...

9986ed1e 03/22/2013 04:28 pm David Gibson

mmu-hash32: Remove odd pointer usage from BAT code

In the code for handling BATs, the hash32_bat_size_prot() and
hash32_bat_601_size_prot() functions are passed the BAT contents by
reference (pointer) for no clear reason, since they only need the values
within....

e1d49515 03/22/2013 04:28 pm David Gibson

mmu-hash32: Split BAT size logic from permissions logic

hash32_bat_size_prot() and its 601 variant, as the name suggests, returns
both a BAT's size - needed to search for a matching BAT - and its
permissions, only relevant once a matching BAT has been located....

6fc76aa9 03/22/2013 04:28 pm David Gibson

mmu-hash32: Clean up BAT matching logic

The code to search for a matching BAT for a virtual address is somewhat
longwinded and awkward. In particular, it relies on seperate size and
validity information being returned from the hash32_bat_size() function...

145e52f3 03/22/2013 04:28 pm David Gibson

mmu-hash32: Cleanup BAT lookup

This patch makes a general cleanup of the ppc_hash32_get_bat() function,
renaming it to ppc_hash32_bat_lookup(). In particular, the new function
only looks for a matching BAT, with the permissions check from the old
function moved to the caller....

59acbe28 03/22/2013 04:28 pm David Gibson

mmu-hash32: Don't look up page tables on BAT permission error

BEHAVIOUR CHANGE

Currently, on any failure translating an address with BATs, we proceed to
normal segment and page table translation. That's incorrect if the
BAT error was due to permissions, rather than not finding a matching BAT....

f95d7cc7 03/22/2013 04:28 pm David Gibson

mmu-hash*: Don't keep looking for PTEs after we find a match

BEHAVIOUR CHANGE

The ppc hash mmu hashes each virtual address to a primary and secondary
possible hash bucket (aka PTE group or PTEG) each with 8 PTEs. Then we
need a linear search through the PTEs to find the correct one for the...

aea390e4 03/22/2013 04:28 pm David Gibson

mmu-hash*: Separate PTEG searching from permissions checking

find_pte{32,64{() do several things. First they search through a PTEG
ooking for a PTE matching our virtual address. Then they do permissions
checking and other processing on that PTE.

This patch separates the search by VA out from the rest. The search is...

a1ff751a 03/22/2013 04:28 pm David Gibson

mmu-hash*: Make find_pte{32, 64} do more of the job of finding ptes

find_pte{32,64}() are not particularly well named. They only "find" a PTE
within a given PTE group, and they also do permissions checking and other
things.

This patch makes it somewhat close to matching the name, by folding the...

7f3bdc2d 03/22/2013 04:28 pm David Gibson

mmu-hash*: Remove permission checking from find_pte{32, 64}()

find_pte{32,64}() are poorly named, since they both find a PTE and do
permissions checking of it. This patch makes them only locate a matching
PTE, moving the permission checking and other logic to the caller. We...

18148898 03/22/2013 04:28 pm David Gibson

mmu-hash64: Clean up ppc_hash64_htab_lookup()

This patch makes a general cleanup of the address mangling logic in
ppc_hash64_htab_lookup(). In particular it now avoids repeatedly switching
on the segment size. The lack of SLB and multiple segment sizes on 32-bit...

65d61643 03/22/2013 04:28 pm David Gibson

mmu-hash*: Combine ppc_hash{32, 64}_get_physical_address and get_segment{32, 64}()

After previous work, ppc_hash{32,64}_get_physical_address() are almost
trivial wrappers around get_segment{32,64}() which does nearly all the work of
translating an address according to the hash mmu model. Therefore combine the...

4b9605a5 03/22/2013 04:28 pm David Gibson

mmu-hash32: Split out handling of direct store segments

At present a large chunk of ppc_hash32_translate() is taken up with an
ugly if selecting between direct store segments (hardly ever used) and
normal paged segments. This patch clarifies the flow of code by...

723ed73a 03/22/2013 04:28 pm David Gibson

mmu-hash32: Split direct store segment handling into a helper

This further separates the unusual case handling of direct store segments
from the main translation path by moving its logic into a helper function,
with some tiny cleanups along the way.

Signed-off-by: David Gibson <>...

bb218042 03/22/2013 04:28 pm David Gibson

mmu-hash*: Cleanup segment-level NX check

On the ppc hash mmus, no-execute can be set at the segment level (on more
recent 64-bit hash mmus it can also be set at the page level). This patch
separates out this check to make it clearer what is going on, and avoiding...