From patchwork Thu Jan 19 17:05:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 717283 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 3v4BGR6pVTz9syB for ; Fri, 20 Jan 2017 04:51:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OVvK9NBz"; dkim-atps=neutral Received: from localhost ([::1]:50070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUGrb-0006LY-L8 for incoming@patchwork.ozlabs.org; Thu, 19 Jan 2017 12:51:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUGGU-0005Tv-QB for qemu-devel@nongnu.org; Thu, 19 Jan 2017 12:12:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUGGT-0001fx-HR for qemu-devel@nongnu.org; Thu, 19 Jan 2017 12:12:46 -0500 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:34895) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cUGGT-0001fW-B1 for qemu-devel@nongnu.org; Thu, 19 Jan 2017 12:12:45 -0500 Received: by mail-wm0-x234.google.com with SMTP id r126so2706236wmr.0 for ; Thu, 19 Jan 2017 09:12:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/FQ0bNIQzLc1pO8btpl1ngB9PNmG3OsBYmDWGFhaBYI=; b=OVvK9NBzcTTcMu38iW/naj/+SVJAAnvDzHBqe6JukfJ0/0kJRmhmZBKhBLgD+/pthT PratG5PeWFBlnYsJo+layOd3QfZhwvNoRVMGlAQ81NJTux5cjF6FYxfW4H/XJPqg2xQt +8YHrb/p1Q4EG929U3wKCNV+ExB/IWKsjsOHc= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=/FQ0bNIQzLc1pO8btpl1ngB9PNmG3OsBYmDWGFhaBYI=; b=VEAU9qT5eHRFMxx05RPTdJo+4E34nW81Su5UNamzDN5WuHdiwZQUnCUZNfSxvykHwx EMsLrHGGDs9glsgMVYvbA08hkvmLkpwqg/JMfnCbXLQ4a23dzC7DO4uWQoiNHU82LNHz M9wYRSxli9z9I8rgSB651LbTbeihKdY9SbrHe3XVZT8/qld9xmrhJA/zpWZyD+V9AQZp VmE5indPyOzzXntI8HG6WXm2oxSukJzKeqApk+pXBzLe3B0CZAObGhMeZ3eihBucFxTh J+GRmZNQF7vOr2xoBkCPsZd+LSgmoLlvJQQHJ+X/D71hHtITO1Of5dfhHvUJoBDS1WlA M+Dw== X-Gm-Message-State: AIkVDXKSJTLZohtNStrTXgSOiDEOceDm4K2Sbgi5cwjzxW8kwUlnor22nXVwahrLa0/FajUj X-Received: by 10.28.206.136 with SMTP id e130mr3727182wmg.121.1484845964036; Thu, 19 Jan 2017 09:12:44 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g197sm54627514wmd.15.2017.01.19.09.12.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jan 2017 09:12:42 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B90C13E2A49; Thu, 19 Jan 2017 17:05:09 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, qemu-devel@nongnu.org, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com Date: Thu, 19 Jan 2017 17:05:07 +0000 Message-Id: <20170119170507.16185-28-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170119170507.16185-1-alex.bennee@linaro.org> References: <20170119170507.16185-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::234 Subject: [Qemu-devel] [PATCH v7 27/27] target-ppc: take global mutex for set_irq 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: peter.maydell@linaro.org, claudio.fontana@huawei.com, jan.kiszka@siemens.com, mark.burton@greensocs.com, Alexander Graf , "open list:PowerPC" , serge.fdrv@gmail.com, pbonzini@redhat.com, David Gibson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , bamvor.zhangjian@linaro.org, rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We have to do this conditionally as the reset paths can trigger IRQ setting when the machine is first brought up. Signed-off-by: Alex Bennée --- hw/ppc/ppc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index 8945869009..59c3faa6c8 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -62,7 +62,16 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; - unsigned int old_pending = env->pending_interrupts; + unsigned int old_pending; + bool locked = false; + + /* We may already have the BQL if coming from the reset path */ + if (!qemu_mutex_iothread_locked()) { + locked = true; + qemu_mutex_lock_iothread(); + } + + old_pending = env->pending_interrupts; if (level) { env->pending_interrupts |= 1 << n_IRQ; @@ -80,9 +89,14 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level) #endif } + LOG_IRQ("%s: %p n_IRQ %d level %d => pending %08" PRIx32 "req %08x\n", __func__, env, n_IRQ, level, env->pending_interrupts, CPU(cpu)->interrupt_request); + + if (locked) { + qemu_mutex_unlock_iothread(); + } } /* PowerPC 6xx / 7xx internal IRQ controller */