• David Gibson's avatar
    target/ppc: Manage external HPT via virtual hypervisor · e57ca75c
    David Gibson authored
    The pseries machine type implements the behaviour of a PAPR compliant
    hypervisor, without actually executing such a hypervisor on the virtual
    CPU.  To do this we need some hooks in the CPU code to make hypervisor
    facilities get redirected to the machine instead of emulated internally.
    For hypercalls this is managed through the cpu->vhyp field, which points
    to a QOM interface with a method implementing the hypercall.
    For the hashed page table (HPT) - also a hypervisor resource - we use an
    older hack.  CPUPPCState has an 'external_htab' field which when non-NULL
    indicates that the HPT is stored in qemu memory, rather than within the
    guest's address space.
    For consistency - and to make some future extensions easier - this merges
    the external HPT mechanism into the vhyp mechanism.  Methods are added
    to vhyp for the basic operations the core hash MMU code needs: map_hptes()
    and unmap_hptes() for reading the HPT, store_hpte() for updating it and
    hpt_mask() to retrieve its size.
    To match this, the pseries machine now sets these vhyp fields in its
    existing vhyp class, rather than reaching into the cpu object to set the
    external_htab field.
    Signed-off-by: 's avatarDavid Gibson <david@gibson.dropbear.id.au>
    Reviewed-by: 's avatarSuraj Jitindar Singh <sjitindarsingh@gmail.com>
machine.c 17.7 KB