ppc/kvm: generalize the use of kvmppc_get_htab_fd()
commit14b0d748877d79d61017e7e38b1ae98c3fd339bc
authorGreg Kurz <groug@kaod.org>
Fri, 15 Sep 2017 13:16:20 +0000 (15 15:16 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 27 Sep 2017 03:05:41 +0000 (27 13:05 +1000)
tree3d775d1dcc7d7174fb9a8d7f89ecff0c2bd7045e
parent82be8e7394b31fd2d740651365b8ebdd0c847529
ppc/kvm: generalize the use of kvmppc_get_htab_fd()

The use of KVM_PPC_GET_HTAB_FD is open-coded in kvmppc_read_hptes()
and kvmppc_write_hpte().

This patch modifies kvmppc_get_htab_fd() so that it can be used
everywhere we need to access the in-kernel htab:
- add an index argument
  => only kvmppc_read_hptes() passes an actual index, all other users
     pass 0
- add an errp argument to propagate error messages to the caller.
  => spapr migration code prints the error
  => hpte helpers pass &error_abort to keep the current behavior
     of hw_error()

While here, this also fixes a bug in kvmppc_write_hpte() so that it
opens the htab fd for writing instead of reading as it currently does.
This never broke anything because we currently never call this code,
as explained in the changelog of commit c1385933804bb:

"This support updating htab managed by the hypervisor. Currently
 we don't have any user for this feature. This actually bring the
 store_hpte interface in-line with the load_hpte one. We may want
 to use this when we want to emulate henter hcall in qemu for HV
 kvm."

The above is still true today.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr.c
target/ppc/kvm.c
target/ppc/kvm_ppc.h