• P
    KVM: PPC: Book3S HV: Restructure HPT entry creation code · 7ed661bf
    Paul Mackerras 提交于
    This restructures the code that creates HPT (hashed page table)
    entries so that it can be called in situations where we don't have a
    struct vcpu pointer, only a struct kvm pointer.  It also fixes a bug
    where kvmppc_map_vrma() would corrupt the guest R4 value.
    
    Most of the work of kvmppc_virtmode_h_enter is now done by a new
    function, kvmppc_virtmode_do_h_enter, which itself calls another new
    function, kvmppc_do_h_enter, which contains most of the old
    kvmppc_h_enter.  The new kvmppc_do_h_enter takes explicit arguments
    for the place to return the HPTE index, the Linux page tables to use,
    and whether it is being called in real mode, thus removing the need
    for it to have the vcpu as an argument.
    
    Currently kvmppc_map_vrma creates the VRMA (virtual real mode area)
    HPTEs by calling kvmppc_virtmode_h_enter, which is designed primarily
    to handle H_ENTER hcalls from the guest that need to pin a page of
    memory.  Since H_ENTER returns the index of the created HPTE in R4,
    kvmppc_virtmode_h_enter updates the guest R4, corrupting the guest R4
    in the case when it gets called from kvmppc_map_vrma on the first
    VCPU_RUN ioctl.  With this, kvmppc_map_vrma instead calls
    kvmppc_virtmode_do_h_enter with the address of a dummy word as the
    place to store the HPTE index, thus avoiding corrupting the guest R4.
    Signed-off-by: NPaul Mackerras <paulus@samba.org>
    Signed-off-by: NAlexander Graf <agraf@suse.de>
    7ed661bf
book3s_hv_rm_mmu.c 22.4 KB