mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-03 23:00:40 -07:00
Accesses to the hashed page table (HPT) are complicated by the fact that
the HPT could be in one of three places:
1) Within guest memory - when we're emulating a full guest CPU at the
hardware level (e.g. powernv, mac99, g3beige)
2) Within qemu, but outside guest memory - when we're emulating user and
supervisor instructions within TCG, but instead of emulating
the CPU's hypervisor mode, we just emulate a hypervisor's behaviour
(pseries in TCG or KVM-PR)
3) Within the host kernel - a pseries machine using KVM-HV
acceleration. Mostly accesses to the HPT are handled by KVM,
but there are a few cases where qemu needs to access it via a
special fd for the purpose.
In order to batch accesses to the fd in case (3), we use a somewhat awkward
ppc_hash64_start_access() / ppc_hash64_stop_access() pair, which for case
(3) reads / releases several HPTEs from the kernel as a batch (usually a
whole PTEG). For cases (1) & (2) it just returns an address value. The
actual HPTE load helpers then need to interpret the returned token
differently in the 3 cases.
This patch keeps the same basic structure, but simplfiies the details.
First start_access() / stop_access() are renamed to map_hptes() and
unmap_hptes() to make their operation more obvious. Second, map_hptes()
now always returns a qemu pointer, which can always be used in the same way
by the load_hpte() helpers. In case (1) it comes from address_space_map()
in case (2) directly from qemu's HPT buffer and in case (3) from a
temporary buffer read from the KVM fd.
While we're at it, make things a bit more consistent in terms of types and
variable names: avoid variables named 'index' (it shadows index(3) which
can lead to confusing results), use 'hwaddr ptex' for HPTE indices and
uint64_t for each of the HPTE words, use ptex throughout the call stack
instead of pte_offset in some places (we still need that at the bottom
layer, but nowhere else).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
||
|---|---|---|
| .. | ||
| e500-ccsr.h | ||
| e500.c | ||
| e500.h | ||
| e500plat.c | ||
| fdt.c | ||
| mac.h | ||
| mac_newworld.c | ||
| mac_oldworld.c | ||
| Makefile.objs | ||
| mpc8544_guts.c | ||
| mpc8544ds.c | ||
| pnv.c | ||
| pnv_core.c | ||
| pnv_lpc.c | ||
| pnv_xscom.c | ||
| ppc.c | ||
| ppc4xx_devs.c | ||
| ppc4xx_pci.c | ||
| ppc405.h | ||
| ppc405_boards.c | ||
| ppc405_uc.c | ||
| ppc440_bamboo.c | ||
| ppc_booke.c | ||
| ppce500_spin.c | ||
| prep.c | ||
| prep_systemio.c | ||
| rs6000_mc.c | ||
| spapr.c | ||
| spapr_cpu_core.c | ||
| spapr_drc.c | ||
| spapr_events.c | ||
| spapr_hcall.c | ||
| spapr_iommu.c | ||
| spapr_ovec.c | ||
| spapr_pci.c | ||
| spapr_pci_vfio.c | ||
| spapr_rng.c | ||
| spapr_rtas.c | ||
| spapr_rtas_ddw.c | ||
| spapr_rtc.c | ||
| spapr_vio.c | ||
| trace-events | ||
| virtex_ml507.c | ||