From patchwork Tue Dec 3 02:29:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 180695 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp960990ile; Mon, 2 Dec 2019 19:02:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzcj0U9D1FbJo5dVvYhmX/Vms/oD11CJ61xvUFvaJvt8e2zebSw5JZCtWF3OJitiJlBIVVs X-Received: by 2002:ac8:21fd:: with SMTP id 58mr3091296qtz.90.1575342149637; Mon, 02 Dec 2019 19:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575342149; cv=none; d=google.com; s=arc-20160816; b=U6Au4xhkpa7hlYa507UWiopGqib4zJakqAsjdnV7X433FrpOCRm51BsuECzlpNtCt4 FRHfuTJ/O/9sNAErmgleoprVdAMDYmQGxqwVWDIADEoLw4s7OFR4kaV3uYS+KsBa9rfS t/o0QJ9cfqEXNgRkCQZkeEnO28qf+gnVjF04bDacF4NltLzSbmTgTSuyntRAJB6iMmRH Pxh8U2/K1HueQhTPS5iPXXGxnYAowpJhEH24fzvW1bzXlCLHA+gbzWcrEgBv8myTDbNP 1gb/VHvtZ/9JCDn9GCGBhvaQq65vEq6naIWmAC732cgq/1lVryKU/wNmHQKIl7tLEp9Z SV/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=s9VJVdTUiMlwkcjgw0/3sV/2Ka0DCPLGSdMwx4oTNII=; b=kaCmYq4ypn6vFLgky5UhO5GFzrZWDn+jpt8C4NOrzOgWso6QXSfJON0eCUMdn8GdYX hdkv802EvCkeJ0debOLwsFyT/TRvWExPRGR2nGoaPN9aSrI9NAB0CcJ+SMlVwF/+tchX UcKL/7K5TuZWdmQxhUmWF3LeCPZ5/PiAfmzEKwGS87gqmTV5aYEZ89YzGOayyPoZgDtW wWrmAkyl1GUnsxRQ4dDZAmhhEUMicN796ln+66097NgCkaQe2BDu1RZg1y/eB3MOivsU jjBRV6rVSM7GUMlp9s9zJYdD/qpNY4HcU+e9nT9VS5ZTBB8BdnOZsVQt4HIzyS0XGE/4 2XRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=V0p4GsWs; 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=fail (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 n8si1152887qtr.152.2019.12.02.19.02.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Dec 2019 19:02:29 -0800 (PST) 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=fail header.i=@linaro.org header.s=google header.b=V0p4GsWs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibySL-0000uU-51 for patch@linaro.org; Mon, 02 Dec 2019 22:02:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33955) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibxxQ-0003Xi-Og for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibxxP-0000Tm-98 for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:32 -0500 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:35715) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibxxO-0000RW-WB for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:31 -0500 Received: by mail-pj1-x1041.google.com with SMTP id s8so829838pji.2 for ; Mon, 02 Dec 2019 18:30:30 -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; bh=s9VJVdTUiMlwkcjgw0/3sV/2Ka0DCPLGSdMwx4oTNII=; b=V0p4GsWs+jcwUzHv4bb8Yz8DP1b1lGHslfoJocTsXr/CU50SNzcn8TLxMED8zLq4f6 NfHYTW2woNYsEBhvG3M8+ORu6M4WHsEANzTO+na5PgxHVxK+J8Ooi9V2FUkar/0bXpGu ePLgeZFcNVmYlzHzS6D5jmB2dpcL2tIDu/CfdWPcVb6t3VgPHxCtAqArpAI0AnqRaVsn hFSvcJDIT4OFCvxi8MccdMN4ggBXA1pGlC9gadXU1AAJi2YXQpWmKKKQxba1qXSNccjq wx+mwSp/SJ11kgkdHYf18amU6pRQHrhMidLmFelF1PZqMfinxDDObaN32daBrHO+KoPm sY8w== 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; bh=s9VJVdTUiMlwkcjgw0/3sV/2Ka0DCPLGSdMwx4oTNII=; b=o3YZCCXS6CwEOqlxQlR3pKqPAXgpHR3teKZV1YTirJUBm1vqpgV3a/6aOlu6n9Yp5A Vjhi/DUP0ucFBFcOElE1ODKc/4zAR2c7QB55J0ex4NZYBLOrly0wYawtNKh1TYO7Gn2R PMOa/1H8aJpTlgCf5GVUR3AvdjsH/RIrCZ9K6zKjEQm7ytTIfYQn2qCwzaCLMa3HKD5k sqUzoSoruX69cPQGQihGsD+5zhWDqHjkbeff5mgOO13Rj4MXWTPW0lbhO4Lq1yrF29C/ iKQGkPxw/bf5O5yLY1TUopL4K6ZSncQzjc+aEhiP8+xdckTMaU0PBm+OMuuQj20kgzaz EMrA== X-Gm-Message-State: APjAAAVXshOVe9j/zHNH87fUXFnsE7kIR7BS7+4OZz61X9BUi2DlT07F w4csgUUdk5nBwQpqhdr2TywNW8uGoKI= X-Received: by 2002:a17:902:142:: with SMTP id 60mr2767564plb.38.1575340229666; Mon, 02 Dec 2019 18:30:29 -0800 (PST) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id q22sm873695pfg.170.2019.12.02.18.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 18:30:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 40/40] target/arm: Raise only one interrupt in arm_cpu_exec_interrupt Date: Mon, 2 Dec 2019 18:29:37 -0800 Message-Id: <20191203022937.1474-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203022937.1474-1-richard.henderson@linaro.org> References: <20191203022937.1474-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1041 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+patch=linaro.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. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/cpu.c b/target/arm/cpu.c index a366448c6d..f3360dbb98 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)