From patchwork Mon Jul 13 14:10:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 235420 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2885909ilg; Mon, 13 Jul 2020 07:23:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVc1WbA/tUlVjk0gzlQJM2Msa5ucQShBttiHKcdXghboW886NdsA+Jtl/OVi+2vDdJomfQ X-Received: by 2002:a25:7755:: with SMTP id s82mr312096ybc.275.1594650203664; Mon, 13 Jul 2020 07:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594650203; cv=none; d=google.com; s=arc-20160816; b=ZtMcc6vkI++aOliexI0t9R/JTVJKLDIpWCuub6zN4d6f33Ml7FGAaI3snveqAFUEp/ DB3c9n4p8WskySFxzuviO77oj9tqrF9V3iJlZ2/r0/Z3/L4xUA/unFRTAXK8JPk7sVR1 U7Kb8z3x8ljMXQsdKvNaXQvvcf7HyyViFjYXlaZOYRiG84gZHIGMPv8P68VWuyCVXMXg xBRn87ExDz3kAMJXW41/mqbdVYmbcxDdbKcUbfGcLyFAetEwQ7eV9efwEAIcqWNjtYov tiCqIqKAzZfSTr9BZ1TQt3CbiRgA9is7NlVMR+djLe/joojyZMoj/NnShEonWj8K5XES WJrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Cdhqjn6DC+tyL4mM8vOGKC1yiyZ8aG8bFSKcjvY6BCA=; b=QoOl3jIzkic7yTi5MeZlnoWTnjgdnzvyHBBglM6k2MUl6f5DKvT66vZ9udhSg48kBg 1YP+8B4a40xVlitmG8ggkOATlK6858683N+WCw1t1tz0goQhfH6e7Bvy3ILw6BpQZOVy R9cTRgDRdcAGQvkwzOcpguuyQiSgS+Lt/6kcJYVllEcdtBQr9t9uB+9e0gOfQpo8EJBr YSENYavcuLCSuouViCdm0D2PVgK20YkGEQr5OqRLkCr7Y0+lp+pTvfdAJLBw+D6O4ljP 7lppJQnM9iArp7bO/PCVKsO3pwW+vFQ6EwMOJEs3KREbNklNCc4BKdVB/ZsYbssYh7NA Sbww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ddd+bg16; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r78si16033674ybc.42.2020.07.13.07.23.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Jul 2020 07:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ddd+bg16; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juzMZ-0000o6-2S for patch@linaro.org; Mon, 13 Jul 2020 10:23:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juzB7-0005fi-Qe for qemu-devel@nongnu.org; Mon, 13 Jul 2020 10:11:33 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:38397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1juzB4-0006fX-JX for qemu-devel@nongnu.org; Mon, 13 Jul 2020 10:11:33 -0400 Received: by mail-wm1-x32e.google.com with SMTP id f18so13314615wml.3 for ; Mon, 13 Jul 2020 07:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Cdhqjn6DC+tyL4mM8vOGKC1yiyZ8aG8bFSKcjvY6BCA=; b=ddd+bg16ye3YpIR55s7DTgTJ3Q/eYBt/i5KRdpawkacrwJioidzHPROl3wWTN5GWsK 15AsLXheXop8FlPL0R9ZpmzrNtqObyynutOGyVCjM7lNTGNz79fk/FS2q3mBykR1GmVH U50VU6GlJMlSjoWlahodHq17zm2890bxNRkAW581tAF49zwM8onoFRbNd1bZAkPH9KJJ ry9F6yopoE2mhrjxJl29/cZf6UTtNOGyXaTWTRZ+PNj27u+ebuPzhackdqRnK8tcr94N ZnJc8a0ZVwDpWnsQIPgYhXJiTV78NsSxL/E262xNYyxAOXtmafERPqq1SyzkQysTDueO NfOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cdhqjn6DC+tyL4mM8vOGKC1yiyZ8aG8bFSKcjvY6BCA=; b=VG8gM0JEzIdL6WkC1FbrM4/q+n9cbfha+G8N8r0dL/CnLueWlGeCGC1ev9QDiFNd+9 v0K7mavK9ZznWgvDecGjgS15d0WpfV17b2n71YinwyWg5Mzp668p/iSlnWLz6PnZveF9 vmrkIpxht0p+sRLI9U9HxQv3laJsluuyw+bbWbb5qve/DuXSOfRckFpDDvdw2dCWXuiQ 1BakOpj5XpZcbiCavOvwN6Xd/6zX1u/JIUjt5yX0Kz8j6bULdY3BaGnI8OlqzLJXsRJ/ 9AEIctl9YMDuXJRExmz2x9Q8d/iZNR0J9djQVrCLfAmRp4f+Xs0BZrbpIdA7eDKbwLLH 0WSQ== X-Gm-Message-State: AOAM532kA56+w8a7R2qyar61t420bIjseKBdNdkW2wZptP4WwkQ98Y0X C/QYbZQQ31wim8tG4hgbq9/zxbse3fiSvg== X-Received: by 2002:a1c:7313:: with SMTP id d19mr123377wmb.147.1594649488783; Mon, 13 Jul 2020 07:11:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c136sm24031297wmd.10.2020.07.13.07.11.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 07:11:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/25] hw/nios2: exit to main CPU loop only when unmasking interrupts Date: Mon, 13 Jul 2020 15:10:59 +0100 Message-Id: <20200713141104.5139-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200713141104.5139-1-peter.maydell@linaro.org> References: <20200713141104.5139-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Wentong Wu Only when guest code is unmasking interrupts, terminate the excution of translated code and exit to the main CPU loop to handle previous pended interrupts because of the interrupts mask by guest code. Signed-off-by: Wentong Wu Message-id: 20200710233433.19729-4-wentong.wu@intel.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/nios2/cpu_pic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/hw/nios2/cpu_pic.c b/hw/nios2/cpu_pic.c index 1c1989d56a0..5ea7e52ab83 100644 --- a/hw/nios2/cpu_pic.c +++ b/hw/nios2/cpu_pic.c @@ -54,7 +54,8 @@ static void nios2_pic_cpu_handler(void *opaque, int irq, int level) void nios2_check_interrupts(CPUNios2State *env) { - if (env->irq_pending) { + if (env->irq_pending && + (env->regs[CR_STATUS] & CR_STATUS_PIE)) { env->irq_pending = 0; cpu_interrupt(env_cpu(env), CPU_INTERRUPT_HARD); }