From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdPxv-0001Ve-7N for qemu-devel@nongnu.org; Mon, 13 Feb 2017 18:23:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdPxu-0001hG-4J for qemu-devel@nongnu.org; Mon, 13 Feb 2017 18:23:27 -0500 Message-ID: <1487028190.2288.7.camel@gmail.com> From: Suraj Jitindar Singh Date: Tue, 14 Feb 2017 10:23:10 +1100 In-Reply-To: <20170213041042.GS25381@umbus> References: <1486956627-11123-1-git-send-email-sjitindarsingh@gmail.com> <20170213041042.GS25381@umbus> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH] target/ppc: Stop parsing pvr list in H_CAS when exact match found List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de On Mon, 2017-02-13 at 15:10 +1100, David Gibson wrote: > On Mon, Feb 13, 2017 at 02:30:27PM +1100, Suraj Jitindar Singh wrote: > > > > The pvr-list passed in H_Client_Architecture_Support is used to > > communicate the supported pvrs of the client program. When an > > exact match is found you are allowed to stop parsing the list and > > continue > > the boot process. > > > > Currently while explicit_match is set when we find an exact match, > > we still > > set a compat mode based on best_compat irrespective of whether an > > exact > > match was found or not. This is wrong since it means we can only > > ever run > > in an architected state, not a raw state since we always set a > > compat mode. > > We are basically ignoring the case were we find an exact match. > > > > Fix the code to stop parsing the pvr list when an exact match is > > found. > > This means that best_compat will always be zero in the case of an > > exact > > match which means we will not set a compat mode an thus run in raw > > mode, > > which is the desired functionality when we have an exact match. > > > > Fixes: 152ef803ceb1 ("pseries: Rewrite CAS PVR compatibility > > logic") > > > > Signed-off-by: Suraj Jitindar Singh > Nack.  That change was deliberately intended to prefer compatibility > modes, only ever using a "raw" mode if there's no matching > compatibility mode. > > Using compatibility modes as often as possible makes migration across > different host types substantially easier to handle and more likely > to > succeed. Ok cool, didn't realise that was an intended effect. Guess I'll just add power9 to the compat table. > > > > > > > --- > >  hw/ppc/spapr_hcall.c | 1 + > >  1 file changed, 1 insertion(+) > > > > diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c > > index 590105a..215c385 100644 > > --- a/hw/ppc/spapr_hcall.c > > +++ b/hw/ppc/spapr_hcall.c > > @@ -1028,6 +1028,7 @@ static target_ulong > > h_client_architecture_support(PowerPCCPU *cpu, > >   > >          if ((cpu->env.spr[SPR_PVR] & pvr_mask) == (pvr & > > pvr_mask)) { > >              explicit_match = true; > > +            break; > >          } else { > >              if (ppc_check_compat(cpu, pvr, best_compat, > > max_compat)) { > >                  best_compat = pvr;