OSDN Git Service

spapr: Correctly set LPCR[GTSE] in H_REGISTER_PROCESS_TABLE
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 13 Mar 2019 03:17:27 +0000 (14:17 +1100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 19 Mar 2019 04:20:14 +0000 (15:20 +1100)
commit49e9fdd741301a891493caf0d3936249504e7fdc
treedc82c8bd3b5c04de2a77a554a5a18da61fdf3146
parent082c0543baa6f237704c83a51658bd7f6ae316d5
spapr: Correctly set LPCR[GTSE] in H_REGISTER_PROCESS_TABLE

176dccee "target/ppc/spapr: Clear partition table entry when allocating
hash table" reworked the H_REGISTER_PROCESS_TABLE hypercall, but
unfortunately due to a small error no longer correctly sets the LPCR[GTSE]
bit which allows the guest to directly execute (some types of) tlbie (TLB
flush) instructions without involving the hypervisor.

We got away with this, initially, because POWER9 did not have hypervisor
mode enabled in its msr_mask, which meant we didn't actually run hypervisor
privilege checks in TCG at all.  However, da874d90 "target/ppc: add HV
support for POWER9" turned on HV support on POWER9 for the benefit of the
powernv machine type.

This exposed the earlier bug in H_REGISTER_PROCESS_TABLE, and causes guests
which rely on LPCR[GTSE] (i.e. basically all of them) to crash during early
boot when their first tlbie instruction causes an unexpected trap.

Fixes: 176dccee target/ppc/spapr: Clear partition table entry when allocating hash table
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Cleber Rosa <crosa@redhat.com>
hw/ppc/spapr_hcall.c