From nobody Sun Apr 28 00:54:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502262498020804.7125340521369; Wed, 9 Aug 2017 00:08:18 -0700 (PDT) Received: from localhost ([::1]:46012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL6G-00014d-Jw for importer@patchew.org; Wed, 09 Aug 2017 03:08:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL2V-0006Dg-Gr for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfL2S-0003zO-EJ for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:23 -0400 Received: from ozlabs.org ([103.22.144.67]:37551) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfL2S-0003xM-28; Wed, 09 Aug 2017 03:04:20 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xS2Lg6Qnhz9sR9; Wed, 9 Aug 2017 17:04:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1502262251; bh=iVFgQTOdn5qHrF64buHw4ztIDU3AL17a+/NyHUVwEMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aynGKfN4e5cPPPuOHmIUMDra84+r0JFtQap5xp6pb+KyMPl/JoD7dZJliWZTjakJo 5TxiBajmdoJ4qIpImCXl9tGwhKJVYLj69XcyfDRFaF7WewvxPeZtmfM+QJPlnnzhhi 4WgvJnTGvRb8/qffCL0O9XoEjINrSpZ3AGP7amGw= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 9 Aug 2017 17:03:52 +1000 Message-Id: <20170809070357.28723-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170809070357.28723-1-david@gibson.dropbear.id.au> References: <20170809070357.28723-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 1/6] booke206: fix MAS update on tlb miss 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: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, KONRAD Frederic , qemu-ppc@nongnu.org, David Gibson , groug@kaod.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: KONRAD Frederic When a tlb instruction miss happen, rw is set to 0 at the bottom of cpu_ppc_handle_mmu_fault which cause the MAS update function to miss the SAS and TS bit in MAS6, MAS1 in booke206_update_mas_tlb_miss. Just calling booke206_update_mas_tlb_miss with rw =3D 2 solve the issue. Signed-off-by: KONRAD Frederic Signed-off-by: David Gibson --- target/ppc/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c index b7b9088842..f06b9382b4 100644 --- a/target/ppc/mmu_helper.c +++ b/target/ppc/mmu_helper.c @@ -1551,7 +1551,7 @@ static int cpu_ppc_handle_mmu_fault(CPUPPCState *env,= target_ulong address, env->spr[SPR_40x_ESR] =3D 0x00000000; break; case POWERPC_MMU_BOOKE206: - booke206_update_mas_tlb_miss(env, address, rw); + booke206_update_mas_tlb_miss(env, address, 2); /* fall through */ case POWERPC_MMU_BOOKE: cs->exception_index =3D POWERPC_EXCP_ITLB; --=20 2.13.4 From nobody Sun Apr 28 00:54:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502262373152459.42742129533724; Wed, 9 Aug 2017 00:06:13 -0700 (PDT) Received: from localhost ([::1]:46005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL4F-0007wx-MY for importer@patchew.org; Wed, 09 Aug 2017 03:06:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL2T-0006DV-Go for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfL2S-0003z2-D6 for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:21 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:41839) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfL2S-0003xQ-25; Wed, 09 Aug 2017 03:04:20 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xS2Lg5DBSz9sN5; Wed, 9 Aug 2017 17:04:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1502262251; bh=P9fKYFqRynYyIvUDPDoc6lqc+mITs9MwWkrjCe1AN1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnL2Ytp498sgcR+eYkeZDPLk8a4pH0eJcP5eJtwxLyS+YGo5E9beEFf+Ol6yEqSTg 2pPnhyBJvGy8ZLUSIfxDKdhATOPrb0qyiwi3sO42gM1evrBjK/Xse9v0Ssq/lCu5ui 6YHmv5szl0pN9k2moCBIW3E9ZiPdBKk11n8kugHs= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 9 Aug 2017 17:03:53 +1000 Message-Id: <20170809070357.28723-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170809070357.28723-1-david@gibson.dropbear.id.au> References: <20170809070357.28723-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 2/6] ppc: fix double-free in cpu_post_load() 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: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz When running nested with KVM PR, ppc_set_compat() fails and QEMU crashes because of "double free or corruption (!prev)". The crash happens because error_report_err() has already called error_free(). Signed-off-by: Greg Kurz Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- target/ppc/machine.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index f578156dd4..abe0a1cdf0 100644 --- a/target/ppc/machine.c +++ b/target/ppc/machine.c @@ -239,7 +239,6 @@ static int cpu_post_load(void *opaque, int version_id) ppc_set_compat(cpu, cpu->compat_pvr, &local_err); if (local_err) { error_report_err(local_err); - error_free(local_err); return -1; } } else --=20 2.13.4 From nobody Sun Apr 28 00:54:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502262372204714.2010509849634; Wed, 9 Aug 2017 00:06:12 -0700 (PDT) Received: from localhost ([::1]:46004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL4E-0007v4-3G for importer@patchew.org; Wed, 09 Aug 2017 03:06:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL2T-0006DU-Gm for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfL2S-0003zJ-E1 for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:21 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:58089) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfL2S-0003xP-2E; Wed, 09 Aug 2017 03:04:20 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xS2Lh0pXXz9sPt; Wed, 9 Aug 2017 17:04:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1502262252; bh=TdMTPDJMNu/rHjWgVZf5dsMwkQbq9gLqYz9K93HnYPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FmokRGbe7eyxuUtaFVGMQGeySj61Nrcp1n1FqUtx93Pw+/Nm4CoxwPHVlWtvkbHcb Krq5sNdvRsbYways+U75aIW/qRHz5iCdfe289uv73UK8nwNQh4p+mU98B48gbZJh5i a+BoSlXasvfgAyAbajrXhzPCk26mXOx1Kx9SSGFI= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 9 Aug 2017 17:03:54 +1000 Message-Id: <20170809070357.28723-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170809070357.28723-1-david@gibson.dropbear.id.au> References: <20170809070357.28723-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 3/6] target/ppc: Implement TIDR 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: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This adds a trivial implementation of the TIDR register added in POWER9. This isn't particularly important to qemu directly - it's used by accelerator modules that we don't emulate. However, since qemu isn't aware of it, its state is not synchronized with KVM and therefore not migrated, which can be a problem. Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Reviewed-by: Thomas Huth --- target/ppc/cpu.h | 1 + target/ppc/translate_init.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 6ee2a26a96..f6e5413fad 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1451,6 +1451,7 @@ void ppc_compat_add_property(Object *obj, const char = *name, #define SPR_TEXASR (0x082) #define SPR_TEXASRU (0x083) #define SPR_UCTRL (0x088) +#define SPR_TIDR (0x090) #define SPR_MPC_CMPA (0x090) #define SPR_MPC_CMPB (0x091) #define SPR_MPC_CMPC (0x092) diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 01723bdfec..94800cd29d 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8841,6 +8841,11 @@ static void init_proc_POWER9(CPUPPCState *env) gen_spr_power8_book4(env); gen_spr_power8_rpr(env); =20 + /* POWER9 Specific registers */ + spr_register_kvm(env, SPR_TIDR, "TIDR", NULL, NULL, + spr_read_generic, spr_write_generic, + KVM_REG_PPC_TIDR, 0); + /* env variables */ #if !defined(CONFIG_USER_ONLY) env->slb_nr =3D 32; --=20 2.13.4 From nobody Sun Apr 28 00:54:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502262373274270.76691120684984; Wed, 9 Aug 2017 00:06:13 -0700 (PDT) Received: from localhost ([::1]:46006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL4G-0007x9-21 for importer@patchew.org; Wed, 09 Aug 2017 03:06:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL2V-0006Di-HJ for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfL2S-0003zE-Dw for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:23 -0400 Received: from ozlabs.org ([103.22.144.67]:34419) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfL2S-0003xN-29; Wed, 09 Aug 2017 03:04:20 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xS2Lh1pZ3z9sRg; Wed, 9 Aug 2017 17:04:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1502262252; bh=fvGg4oyjgnavIU6mcEW9SNZZJpm+7MwZ4O8Xw2AZovw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H5kAacQ8+TtN4UbC3PX+qjWMCsrR8pJkjdQ7yNE+UE01+/YW3kN600irVuOoIN/DS EPjMkY/U8mv2vNuRmqTVSMFPxyqJycOaaH5fy1P0G8s/rgYM1izVd4pwnMwBPiX4CQ YFrCQWxoQgWhlZzNIyj89E8RxZx+JXEGnEjaFtDg= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 9 Aug 2017 17:03:55 +1000 Message-Id: <20170809070357.28723-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170809070357.28723-1-david@gibson.dropbear.id.au> References: <20170809070357.28723-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 4/6] target/ppc: Add stub implementation of the PSSCR 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: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The PSSCR register added in POWER9 controls certain power saving mode behaviours. Mostly, it's not relevant to TCG, however because qemu doesn't know about it yet, it doesn't synchronize the state with KVM, and thus it doesn't get migrated. To fix that, this adds a minimal stub implementation of the register. This isn't complete, even to the extent that an implementation is possible in TCG, just enough to get migration working. We need to come back later and at least properly filter the various fields in the register based on privilege level. Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Reviewed-by: Thomas Huth --- target/ppc/cpu.h | 1 + target/ppc/translate_init.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index f6e5413fad..46d3dd88f6 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1771,6 +1771,7 @@ void ppc_compat_add_property(Object *obj, const char = *name, #define SPR_IC (0x350) #define SPR_VTB (0x351) #define SPR_MMCRC (0x353) +#define SPR_PSSCR (0x357) #define SPR_440_INV0 (0x370) #define SPR_440_INV1 (0x371) #define SPR_440_INV2 (0x372) diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 94800cd29d..8fb407ed73 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8846,6 +8846,11 @@ static void init_proc_POWER9(CPUPPCState *env) spr_read_generic, spr_write_generic, KVM_REG_PPC_TIDR, 0); =20 + /* FIXME: Filter fields properly based on privilege level */ + spr_register_kvm_hv(env, SPR_PSSCR, "PSSCR", NULL, NULL, NULL, NULL, + spr_read_generic, spr_write_generic, + KVM_REG_PPC_PSSCR, 0); + /* env variables */ #if !defined(CONFIG_USER_ONLY) env->slb_nr =3D 32; --=20 2.13.4 From nobody Sun Apr 28 00:54:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502262514428710.9375805888968; Wed, 9 Aug 2017 00:08:34 -0700 (PDT) Received: from localhost ([::1]:46015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL6X-0001Hw-3F for importer@patchew.org; Wed, 09 Aug 2017 03:08:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL2W-0006Dl-7w for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfL2V-00040q-95 for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:24 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:39643) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfL2U-0003zd-Tt; Wed, 09 Aug 2017 03:04:23 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xS2Lh39J2z9sRm; Wed, 9 Aug 2017 17:04:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1502262252; bh=PmJVRH5FDLSvTzPtTPg/Q8/OGgGQ6OvGmsKY0xo13tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJ0ptX/j+QQkY6Wsiq/1taD72zf2qcry6ta5dM7yqGSJBCqSyW31ANTuScoXOvLGe vhsO1K2B1rPOd3tCxUol7sWdUfXh8Dlxv5FjEXWniGlDZxcTHnAOMTWDzoVMn+fDBy 4ghZIN2RDEsvA2/6tCYDHUOwbq8ZbHpVWz9my1jY= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 9 Aug 2017 17:03:56 +1000 Message-Id: <20170809070357.28723-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170809070357.28723-1-david@gibson.dropbear.id.au> References: <20170809070357.28723-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 5/6] spapr_drc: abort if object_property_add_child() fails 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: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, groug@kaod.org, qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Greg Kurz object_property_add_child() can only fail in two cases: - the child already has a parent, which shouldn't happen since the DRC was allocated a few lines above - the parent already has a child with the same name, which would mean the caller tries to create a DRC that already exists In both case, this is a QEMU bug and we should abort. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr_drc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index 47d94e782a..5260b5d363 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -541,7 +541,7 @@ sPAPRDRConnector *spapr_dr_connector_new(Object *owner,= const char *type, drc->owner =3D owner; prop_name =3D g_strdup_printf("dr-connector[%"PRIu32"]", spapr_drc_index(drc)); - object_property_add_child(owner, prop_name, OBJECT(drc), NULL); + object_property_add_child(owner, prop_name, OBJECT(drc), &error_abort); object_property_set_bool(OBJECT(drc), true, "realized", NULL); g_free(prop_name); =20 --=20 2.13.4 From nobody Sun Apr 28 00:54:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502262612079581.5123582290763; Wed, 9 Aug 2017 00:10:12 -0700 (PDT) Received: from localhost ([::1]:46025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL86-0002bR-UB for importer@patchew.org; Wed, 09 Aug 2017 03:10:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dfL2W-0006Dn-B4 for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dfL2V-00040l-8t for qemu-devel@nongnu.org; Wed, 09 Aug 2017 03:04:24 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:37205) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dfL2U-0003zf-TR; Wed, 09 Aug 2017 03:04:23 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3xS2Lh3mY0z9sxR; Wed, 9 Aug 2017 17:04:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1502262252; bh=wxKPoEy2mS2ug1NjsodRRCfM9nRzzAVTrEuLfFYH01s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MuVae8zw/hkApqSOL4BXGcR8mvb5lJODY2KnpnQIDP9poikN+SNeXwButkNwPdaVe JsNbKv/fCelqG+qZ9zMYofYf8pydfMab4LkzCfp742vB3NJKGkGJu7CllurNVWsMyw rSjpyv6UATS0HEEPOnpjPatx0luwoBSyWAfzY7Hw= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 9 Aug 2017 17:03:57 +1000 Message-Id: <20170809070357.28723-7-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.13.4 In-Reply-To: <20170809070357.28723-1-david@gibson.dropbear.id.au> References: <20170809070357.28723-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 6/6] spapr: Fix bug in h_signal_sys_reset() 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: aik@ozlabs.ru, qemu-devel@nongnu.org, agraf@suse.de, groug@kaod.org, qemu-ppc@nongnu.org, Sam Bobroff , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sam Bobroff The unicast case in h_signal_sys_reset() seems to be broken: rather than selecting the target CPU, it looks like it will pick either the first CPU or fail to find one at all. Fix it by using the search function rather than open coding the search. This was found by inspection; the code appears to be unused because the Linux kernel only uses the broadcast target. Signed-off-by: Sam Bobroff Reviewed-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr_hcall.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 72ea5a8247..07b3da8dc4 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1431,11 +1431,10 @@ static target_ulong h_signal_sys_reset(PowerPCCPU *= cpu, =20 } else { /* Unicast */ - CPU_FOREACH(cs) { - if (cpu->cpu_dt_id =3D=3D target) { - run_on_cpu(cs, spapr_do_system_reset_on_cpu, RUN_ON_CPU_NU= LL); - return H_SUCCESS; - } + cs =3D CPU(ppc_get_vcpu_by_dt_id(target)); + if (cs) { + run_on_cpu(cs, spapr_do_system_reset_on_cpu, RUN_ON_CPU_NULL); + return H_SUCCESS; } return H_PARAMETER; } --=20 2.13.4