From patchwork Mon Jun 5 00:49:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 771057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wgx7g0yGrz9s0g for ; Mon, 5 Jun 2017 10:50:39 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Zbe0PL9M"; dkim-atps=neutral Received: from localhost ([::1]:59137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHgE8-0002zo-US for incoming@patchwork.ozlabs.org; Sun, 04 Jun 2017 20:50:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHgDj-0002xm-SF for qemu-devel@nongnu.org; Sun, 04 Jun 2017 20:50:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHgDi-0000nw-VQ for qemu-devel@nongnu.org; Sun, 04 Jun 2017 20:50:11 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:35269) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHgDc-0000f4-Q9; Sun, 04 Jun 2017 20:50:04 -0400 Received: by mail-pf0-x243.google.com with SMTP id u26so18756996pfd.2; Sun, 04 Jun 2017 17:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Qul5DcJ4T7Tdd6Tbo22y9eDj5svoH5Df3uVRL3awuCQ=; b=Zbe0PL9MALyWgxI5cxpX5ysHZv4kSjbY/xBQYo8yQ6sSM/i9Uv24tXIBS/3QMhUD9V JwTarPgGME4aH5J4cLNG+vvJkoxJg4yY/3Abr4EVuZYB+siL3hHD8VnCg1Ea9nKkUM6u zEvDVuD+D/K+KzdfTgT7l6h692r+YHZKjVzPgaAbdJfLHke6yIs2jL/OadXropMtnIX0 02+BhfTfRgODwvZ7Kbj4ym8+iSH+Yq2InvTuBhfAgemYxSXEbVUo22i/KGyJR4+7i5Wu 6cD5MD86dchTXZ4vvGSx+QpO4nNMSdwkEULVJjrvibzT34poeV5yQcWODkZmaiJA3Ztz KQDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Qul5DcJ4T7Tdd6Tbo22y9eDj5svoH5Df3uVRL3awuCQ=; b=phDT6+SE6TsxuP1siqYg4pBRPiO2MFtCKtssiuMUQyHA4H4O50rXMdpsgPCV2Oiui/ bxW5PaedDguUp3fv3poactvH9r0UtdRgTXkhEEMGh7y3tQ1AzJEvN7eCjT7B/zRR+YNl I0TboW7kdRkJL3G6Jw++WASZDQrI4iAzwx38mgqwwIZj4tQaH1axL5QI2dCAvzBPkem8 vyrLmYvfzGhniBnKAIPzvO1MexyKnfU4aSNEdFFQ02zvX8ew8zBaO+S+Ib2SCn9nJrVq CmmdmYIY2cMqxelTn9js0rr4fiR9L4uvXTy2TTVZ6PH6nhN9vGLewd4KLBf4fQhqNpuM dPpw== X-Gm-Message-State: AODbwcC2PiRb6KCT+uVKAVOTlmclFOT73/PQnqJxZSrpqOk6lLeOfVxC 5Pv2RCFfGXpMNoB7 X-Received: by 10.98.89.5 with SMTP id n5mr17612684pfb.2.1496623803625; Sun, 04 Jun 2017 17:50:03 -0700 (PDT) Received: from surajjs1.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id r29sm24440952pfg.95.2017.06.04.17.50.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Jun 2017 17:50:02 -0700 (PDT) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Mon, 5 Jun 2017 10:49:51 +1000 Message-Id: <20170605004951.1009-1-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.9.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH] target/ppc: Fixup set_spr error in h_register_process_table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: agraf@suse.de, qemu-devel@nongnu.org, Suraj Jitindar Singh , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" set_spr is used in the function h_register_process_table() to update the LPCR_GTSE and LPCR_UPRT values based on the flags passed by the guest. The set_spr function takes the last two arguments mask and value used to mask and set the value of the spr respectively. The current call site passes these arguments in the wrong order and thus bot GTSE and UPRT will be set irrespective, which is obviously incorrect. Rearrange the function call so that these arguments are passed in the correct order and the correct behaviour is exhibited. It is worth noting that this wasn't detected earlier since these were always both set in all cases where this H_CALL was made. Fixes: 6de833070ca2 ("target/ppc: Set UPRT and GTSE on all cpus in H_REGISTER_PROCESS_TABLE") Signed-off-by: Suraj Jitindar Singh --- hw/ppc/spapr_hcall.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index aae5a62..aa1ffea 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -992,9 +992,10 @@ static target_ulong h_register_process_table(PowerPCCPU *cpu, /* Update the UPRT and GTSE bits in the LPCR for all cpus */ CPU_FOREACH(cs) { - set_spr(cs, SPR_LPCR, LPCR_UPRT | LPCR_GTSE, + set_spr(cs, SPR_LPCR, ((flags & (FLAG_RADIX | FLAG_HASH_PROC_TBL)) ? LPCR_UPRT : 0) | - ((flags & FLAG_GTSE) ? LPCR_GTSE : 0)); + ((flags & FLAG_GTSE) ? LPCR_GTSE : 0), + LPCR_UPRT | LPCR_GTSE); } if (kvm_enabled()) {