]> git.proxmox.com Git - mirror_qemu.git/commit - target/ppc/machine.c
target-ppc: Rework SLB page size lookup
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 27 Jan 2016 00:52:57 +0000 (11:52 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Sat, 30 Jan 2016 12:37:38 +0000 (23:37 +1100)
commitcd6a9bb6e977864b1b7ec21b983fa0678b4b82e9
tree8e6fa95eca81306ed54c14cad662670598b7c78e
parentbcd81230037f60a2fc9c2e903f8f07db68f86ce8
target-ppc: Rework SLB page size lookup

Currently, the ppc_hash64_page_shift() function looks up a page size based
on information in an SLB entry.  It open codes the bit translation for
existing CPUs, however different CPU models can have different SLB
encodings.  We already store those in the 'sps' table in CPUPPCState, but
we don't currently enforce that that actually matches the logic in
ppc_hash64_page_shift.

This patch reworks lookup of page size from SLB in several ways:
  * ppc_store_slb() will now fail (triggering an illegal instruction
    exception) if given a bad SLB page size encoding
  * On success ppc_store_slb() stores a pointer to the relevant entry in
    the page size table in the SLB entry.  This is looked up directly from
    the published table of page size encodings, so can't get out ot sync.
  * ppc_hash64_htab_lookup() and others now use this precached page size
    information rather than decoding the SLB values
  * Now that callers have easy access to the page_shift,
    ppc_hash64_pte_raddr() amounts to just a deposit64(), so remove it and
    have the callers use deposit64() directly.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Alexander Graf <agraf@suse.de>
target-ppc/cpu.h
target-ppc/machine.c
target-ppc/mmu-hash64.c