From patchwork Wed Jan 29 23:56:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 1231231 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=Sd1HmgEI; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 487LWz2TxRz9sNF for ; Thu, 30 Jan 2020 11:17:19 +1100 (AEDT) Received: from localhost ([::1]:53980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwxWH-0003mY-2o for incoming@patchwork.ozlabs.org; Wed, 29 Jan 2020 19:17:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45783) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwxCo-0004hq-Rq for qemu-devel@nongnu.org; Wed, 29 Jan 2020 18:57:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwxCn-0000d9-Ox for qemu-devel@nongnu.org; Wed, 29 Jan 2020 18:57:10 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:44507) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iwxCn-0000aP-Ik for qemu-devel@nongnu.org; Wed, 29 Jan 2020 18:57:09 -0500 Received: by mail-pl1-x643.google.com with SMTP id d9so583902plo.11 for ; Wed, 29 Jan 2020 15:57:09 -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=+IcLBVINlWFp15bwGPClMMXcW2UX7TXl5ScSRzLV8s8=; b=Sd1HmgEImCAPDy8h78uIk35Vaxeiaa4KHBkSf4wisaBIjRWQNfgP5fTH2vmu+18vVB mAhev6gG4KvT/4LuADmz0oAGLwNHvFmh+Y7TMl/dtJwTYBl3RLE7JTk8i72qS2qtr26h 8uaCzWLSgjG3d3RJi9xNPPiUsLlkIRueuOpN/3FFSqIJVq4r8X9EMjmA4aN0vNTfmgi+ C3n6BlBCQOzaiHdCBBXZ9/x+KxrrZqFQHjKyFU41wf23K8J5MoUCiPnCfuSvPgW6UMiu Ae1wNnld3tjxT8ZelQ4pEVNMSqUt0gzq3rWORZDvmBiIFXGb6tJnObyjwsalAaF/mePK NSJA== 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=+IcLBVINlWFp15bwGPClMMXcW2UX7TXl5ScSRzLV8s8=; b=dtJN1V+GUejL1hKncWWuWAqw9udxlKUwJ5cQaPD0SH8MH7nMDub6xAJ1/D2UiOjgxO sDLhukr1/wx6R6KmUN4BL6u71STX22mk4Mwc/g6mqyCFZKpqooQxbUbZpNQqLaUItFGy 4S402iAnNgydiB+uaMKlEFZsP9xa0PXagtRbI5sUmEXeFyrsreQY27XhI6BMVa9RGHIj vbHyLxeVJU/y2B2YQi81uI/84aO8w0fuO36HaTb96qjU1mfoaONxiJRoQuCCgZxo9CK4 5WowR4i7zuSe7c8LB9Ij8NccGJfeTHD0nUxmJwiBiTPaHSeI54+JGLzuOyl+Nx30kl2J Pdmg== X-Gm-Message-State: APjAAAVF/QWgox6c+U74eTejpOsaYphl2GuG037mmSuZng7GI9WO2y9n 9pvk2ycGmZSHUvJ8VFA8LUPipCOjLRc= X-Google-Smtp-Source: APXvYqyY+eM9zx7RyztB5gEglyk5tdQ+U2ei8LZH/cPAc27IztaswG+AeZJKrDslokDk8Xa+ml/ifQ== X-Received: by 2002:a17:90b:3cc:: with SMTP id go12mr2480433pjb.89.1580342228315; Wed, 29 Jan 2020 15:57:08 -0800 (PST) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id r3sm3953626pfg.145.2020.01.29.15.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jan 2020 15:57:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 41/41] target/arm: Raise only one interrupt in arm_cpu_exec_interrupt Date: Wed, 29 Jan 2020 15:56:14 -0800 Message-Id: <20200129235614.29829-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200129235614.29829-1-richard.henderson@linaro.org> References: <20200129235614.29829-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 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: , Cc: peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The fall through organization of this function meant that we would raise an interrupt, then might overwrite that with another. Since interrupt prioritization is IMPLEMENTATION DEFINED, we can recognize these in any order we choose. Unify the code to raise the interrupt in a block at the end. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 06d72ac9d6..3ce809306e 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -535,17 +535,15 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) uint64_t hcr_el2 = arm_hcr_el2_eff(env); uint32_t target_el; uint32_t excp_idx; - bool ret = false; + + /* The prioritization of interrupts is IMPLEMENTATION DEFINED. */ if (interrupt_request & CPU_INTERRUPT_FIQ) { excp_idx = EXCP_FIQ; target_el = arm_phys_excp_target_el(cs, excp_idx, cur_el, secure); if (arm_excp_unmasked(cs, excp_idx, target_el, cur_el, secure, hcr_el2)) { - cs->exception_index = excp_idx; - env->exception.target_el = target_el; - cc->do_interrupt(cs); - ret = true; + goto found; } } if (interrupt_request & CPU_INTERRUPT_HARD) { @@ -553,10 +551,7 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) target_el = arm_phys_excp_target_el(cs, excp_idx, cur_el, secure); if (arm_excp_unmasked(cs, excp_idx, target_el, cur_el, secure, hcr_el2)) { - cs->exception_index = excp_idx; - env->exception.target_el = target_el; - cc->do_interrupt(cs); - ret = true; + goto found; } } if (interrupt_request & CPU_INTERRUPT_VIRQ) { @@ -564,10 +559,7 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) target_el = 1; if (arm_excp_unmasked(cs, excp_idx, target_el, cur_el, secure, hcr_el2)) { - cs->exception_index = excp_idx; - env->exception.target_el = target_el; - cc->do_interrupt(cs); - ret = true; + goto found; } } if (interrupt_request & CPU_INTERRUPT_VFIQ) { @@ -575,14 +567,16 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) target_el = 1; if (arm_excp_unmasked(cs, excp_idx, target_el, cur_el, secure, hcr_el2)) { - cs->exception_index = excp_idx; - env->exception.target_el = target_el; - cc->do_interrupt(cs); - ret = true; + goto found; } } + return false; - return ret; + found: + cs->exception_index = excp_idx; + env->exception.target_el = target_el; + cc->do_interrupt(cs); + return true; } #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)