From nobody Wed Nov 5 20:14:39 2025 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; 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 1537203490327897.8004263593541; Mon, 17 Sep 2018 09:58:10 -0700 (PDT) Received: from localhost ([::1]:36591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wqf-0003eG-4k for importer@patchew.org; Mon, 17 Sep 2018 12:58:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1wR0-0006bN-F3 for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1wQv-0002ct-JD for qemu-devel@nongnu.org; Mon, 17 Sep 2018 12:31:37 -0400 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:55279) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1wQv-0001qF-5q; Mon, 17 Sep 2018 12:31:33 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 63A7E54B; Mon, 17 Sep 2018 12:31:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 17 Sep 2018 12:31:10 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B0DBAE49C7; Mon, 17 Sep 2018 12:31:09 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=DYXSELIhOnJIB7 cPToGKI8cVq8y3XY7NX/hFu+ANjXY=; b=vpC8G7PvwRmNUPhN9SF0kJ3B3hPZsI J1SnbcLSwdQCc3SoJ7YOzK23++4byzBFyr0FGKP9S4ygR/jMzAr2cuRFAB1b9ZVs Kv37nEF7AhGaImE3Lx4HtS5YXw13+T/55uAsiUDnK0HGJBvsbAOfKZSy0KIKVSuH YKj14yZVU8Bm4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=DYXSELIhOnJIB7cPToGKI8cVq8y3XY7NX/hFu+ANjXY=; b=qkzfAqvs aL26qquO+ibYkUIEexytVc5rFOWQa84p945R1qQunwgtziYzKXpSNaIAs4mOxyTo EDu0prDG6NcUjWhB+No6zE8O34CSLK+RMyQfeRu1rslhjjbg/yjph7FSVGeJUMJ1 NdmYRzoDXf/puHsbMoaNRqf8pBlxIohJsJtd2ZoGzcGoUpmV6wYx8TD2mk2lDUkN kpt3Uzpbkds/b8agkUXQJkL7GKHbQTl0XDskAvKz0CbZBkEWsFDPXRPFtIU6UPXu Fv76gZnYT8cdvYRI2bIgGyl87X9s+m/25JGYdMFNqRSWiQRHhVdD1VGlHMPa/IiB khcdtWYCZVkNAA== X-ME-Proxy: X-ME-Sender: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 17 Sep 2018 12:30:50 -0400 Message-Id: <20180917163103.6113-23-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180917163103.6113-1-cota@braap.org> References: <20180917163103.6113-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [PATCH 22/35] target/ppc: access cpu->interrupt_request with atomics 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: Paolo Bonzini , qemu-ppc@nongnu.org, Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini Cc: David Gibson Cc: Alexander Graf Cc: qemu-ppc@nongnu.org Signed-off-by: Paolo Bonzini Signed-off-by: Emilio G. Cota --- hw/ppc/ppc.c | 2 +- target/ppc/excp_helper.c | 3 ++- target/ppc/kvm.c | 4 ++-- target/ppc/translate_init.inc.c | 17 ++++++++++------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index ec4be25f49..ad0cfb2f7c 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -91,7 +91,7 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) =20 LOG_IRQ("%s: %p n_IRQ %d level %d =3D> pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, - env->pending_interrupts, CPU(cpu)->interrupt_request); + env->pending_interrupts, atomic_read(&CPU(cpu)->interrupt_requ= est)); =20 if (locked) { qemu_mutex_unlock_iothread(); diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 6ffa762033..70ac10e23b 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -753,7 +753,8 @@ static void ppc_hw_interrupt(CPUPPCState *env) =20 qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n= ", __func__, env, env->pending_interrupts, - cs->interrupt_request, (int)msr_me, (int)msr_ee); + atomic_read(&cs->interrupt_request), + (int)msr_me, (int)msr_ee); #endif /* External reset */ if (env->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) { diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 9211ee2ee1..8214738c20 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -1336,7 +1336,7 @@ void kvm_arch_pre_run(CPUState *cs, struct kvm_run *r= un) * interrupt, reset, etc) in PPC-specific env->irq_input_state. */ if (!cap_interrupt_level && run->ready_for_interrupt_injection && - (cs->interrupt_request & CPU_INTERRUPT_HARD) && + (atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) && (env->irq_input_state & (1<env; =20 - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD) && (msr_ee)) { + if (!(atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_HARD) && msr= _ee) { cs->halted =3D 1; cs->exception_index =3D EXCP_HLT; } diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index d920d3e538..3ed8298bc7 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -8442,11 +8442,12 @@ static bool ppc_pvr_match_power7(PowerPCCPUClass *p= cc, uint32_t pvr) =20 static bool cpu_has_work_POWER7(CPUState *cs) { + uint32_t interrupt_request =3D atomic_read(&cs->interrupt_request); PowerPCCPU *cpu =3D POWERPC_CPU(cs); CPUPPCState *env =3D &cpu->env; =20 if (cs->halted) { - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(interrupt_request & CPU_INTERRUPT_HARD)) { return false; } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && @@ -8470,7 +8471,7 @@ static bool cpu_has_work_POWER7(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (interrupt_request & CPU_INTERRUPT_HARD); } } =20 @@ -8596,11 +8597,12 @@ static bool ppc_pvr_match_power8(PowerPCCPUClass *p= cc, uint32_t pvr) =20 static bool cpu_has_work_POWER8(CPUState *cs) { + uint32_t interrupt_request =3D atomic_read(&cs->interrupt_request); PowerPCCPU *cpu =3D POWERPC_CPU(cs); CPUPPCState *env =3D &cpu->env; =20 if (cs->halted) { - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(interrupt_request & CPU_INTERRUPT_HARD)) { return false; } if ((env->pending_interrupts & (1u << PPC_INTERRUPT_EXT)) && @@ -8632,7 +8634,7 @@ static bool cpu_has_work_POWER8(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (interrupt_request & CPU_INTERRUPT_HARD); } } =20 @@ -8788,11 +8790,12 @@ static bool ppc_pvr_match_power9(PowerPCCPUClass *p= cc, uint32_t pvr) =20 static bool cpu_has_work_POWER9(CPUState *cs) { + uint32_t interrupt_request =3D atomic_read(&cs->interrupt_request); PowerPCCPU *cpu =3D POWERPC_CPU(cs); CPUPPCState *env =3D &cpu->env; =20 if (cs->halted) { - if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) { + if (!(interrupt_request & CPU_INTERRUPT_HARD)) { return false; } /* External Exception */ @@ -8825,7 +8828,7 @@ static bool cpu_has_work_POWER9(CPUState *cs) } return false; } else { - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (interrupt_request & CPU_INTERRUPT_HARD); } } =20 @@ -10269,7 +10272,7 @@ static bool ppc_cpu_has_work(CPUState *cs) PowerPCCPU *cpu =3D POWERPC_CPU(cs); CPUPPCState *env =3D &cpu->env; =20 - return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD); + return msr_ee && (atomic_read(&cs->interrupt_request) & CPU_INTERRUPT_= HARD); } =20 /* CPUClass::reset() */ --=20 2.17.1