Received: from eggs.gnu.org ([2001:4830:134:3::10]:42861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEbcR-0002oI-Ci for qemu-devel@nongnu.org; Sun, 19 Jun 2016 08:14:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEbcN-0006z2-5o for qemu-devel@nongnu.org; Sun, 19 Jun 2016 08:14:26 -0400 Date: Sun, 19 Jun 2016 14:14:12 +0200 (CEST) From: BALATON Zoltan In-Reply-To: <1466297653.24271.101.camel@kernel.crashing.org> Message-ID: References: <1466297653.24271.101.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] ppc: Improve emulation of THRM registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Benjamin Herrenschmidt Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au On Sun, 19 Jun 2016, Benjamin Herrenschmidt wrote: > The 75x and 74xx processors have some thermal monitoring SPRs that > some OSes such as MacOS do use. Our current "dumb" implementation > isn't good enough and will cause some versions of MacOS to hang during > boot. > > This lifts an improved emulation from MacOnLinux and adapts it to > qemu, thus fixing the problem. > > Signed-off-by: Benjamin Herrenschmidt > --- > target-ppc/helper.h | 1 + > target-ppc/misc_helper.c | 41 +++++++++++++++++++++++++++++++++++++++++ > target-ppc/translate_init.c | 13 ++++++++++--- > 3 files changed, 52 insertions(+), 3 deletions(-) > > diff --git a/target-ppc/helper.h b/target-ppc/helper.h > index f4410a8..18eb52f 100644 > --- a/target-ppc/helper.h > +++ b/target-ppc/helper.h > @@ -670,3 +670,4 @@ DEF_HELPER_4(dscli, void, env, fprp, fprp, i32) > DEF_HELPER_4(dscliq, void, env, fprp, fprp, i32) > > DEF_HELPER_1(tbegin, void, env) > +DEF_HELPER_1(fixup_thrm, void, env) > diff --git a/target-ppc/misc_helper.c b/target-ppc/misc_helper.c > index 7d41b01..4315778 100644 > --- a/target-ppc/misc_helper.c > +++ b/target-ppc/misc_helper.c > @@ -166,3 +166,44 @@ void ppc_store_msr(CPUPPCState *env, target_ulong value) > { > hreg_store_msr(env, value, 0); > } > + > +/* This code is lifted from MacOnLinux. It is called whenever > + * THRM1,2 or 3 is read an fixes up the values in such a way > + * that will mac MacOS not hang. These registers exist on some Typo: mac -> make?