From patchwork Tue Dec 3 02:29:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 180684 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp952241ile; Mon, 2 Dec 2019 18:52:20 -0800 (PST) X-Google-Smtp-Source: APXvYqwaGKyvvgJL9zpwovLTOHiWJv848jIpZff0qWU31EX7tKlswMKU1iBmuIc1rjGJeabegOee X-Received: by 2002:a50:d0d0:: with SMTP id g16mr576699edf.75.1575341540153; Mon, 02 Dec 2019 18:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575341540; cv=none; d=google.com; s=arc-20160816; b=sg/UMxPkY2kmH3Wv+bYBYqdL5uOrjOVhQFU8pGJ0gA0PA9s2izlwL9doMU0RgpifJB YmD7L6a1kJ35/NbiCTb1skG/wegJtjHm6UpP9/xl+o1FY/VnlfyF4kETkkSYO/yY2oXT +Xf2vU+cbDhVeR7Qj5JTRdxiobZjY2tXTPR/V7hwRXl0NxPUu1tB0oviGeiNuvQGDpTE MyQhO/Fa4qpK4ybBBPgoKHnxPipbQe128+4xCRb91AOIIS1ajma7fjzZMt7xowDoeVIA wBAeupkbo5Jp9wgauoEUKv9W4Qyvi24mrTzDPv6c7+xZUREGzQSbu1Tkqc5vHpe4YbwJ JVNQ== 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=k0XWWezVOhFzaYm0qz5tHBxEXRK+lD5naHKLwWqhpHI=; b=JP/ksc+jG5NPC1ldEnYtY/RVAqwKb5CPXnWVepART7qP+5yOHOShQXiVzHlqV1P+uc JSFxPFYHJErGZOs3hoTyUzOfRVsgXkFnCYx2gHPWgOqxSnv1Uo5kCNZROzVXRHZOFVfc 8ggNXMHYNUV6XkwMF6A8lODfk8od/3tkCz8N1pD5JdAu6ktiykSavumhBR7218zemSJN xJ5TC48+kYD/6qsu2A4AJsJ64LKMVV20d2ifMYGceO04Wl9psRR1zqW4TW/NrvIqhjxf zyGPo+LQkPBnjaUQVPYnpHp+qOad1AwqFvpwUzYB4hg11rzD4RylBtEHLF18FA/rgTeX 3mvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aiqfWNAR; 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 j6si1099749ejb.419.2019.12.02.18.52.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Dec 2019 18:52:20 -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=aiqfWNAR; 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]:47514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibyIU-0004tw-FU for patch@linaro.org; Mon, 02 Dec 2019 21:52:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33627) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ibxxO-0003UC-Og for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ibxxN-0000N1-Eq for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:30 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:34584) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ibxxN-0000KX-2K for qemu-devel@nongnu.org; Mon, 02 Dec 2019 21:30:29 -0500 Received: by mail-pl1-x643.google.com with SMTP id h13so1014551plr.1 for ; Mon, 02 Dec 2019 18:30:28 -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=k0XWWezVOhFzaYm0qz5tHBxEXRK+lD5naHKLwWqhpHI=; b=aiqfWNARXyYW1/8OallmGR59GeT1kMy70QH+mVXvlf6z3mxGUsjV/0NFlv8LehWnGM 60PbnV+bpa23kpyBRPu1apbnhzVsCXluJZXGNE0mdLrI15gP8sJHW+AnECa1ZqfUnU4c kJYjotMwAruV4yacXRCnrnTDLQPj/TQunGi5yaeMwuf/EXleaIXN+SD7e4JgHZEPaTlF 6RK24uwym9UVLGXS2WIAnyb/Kc6vWCsk0ApMGA+a+vkYLBxm5ERzIfbD1jdhp6/POVat kcIwbGrfHV2ZUbI/Jao5JX0/bbvdqobwFvgRBkIJAvsDcwAFK4Yx2K85lW/iYll/wBg0 SjQQ== 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=k0XWWezVOhFzaYm0qz5tHBxEXRK+lD5naHKLwWqhpHI=; b=YM3M6hhjkl3XfzJRvCr/UUnD28LTdNDIuOvWWUidDBTtPiy//jsjZAazOjpblugQJL L7Nw/JQ3MU5BZuOG7HeLo08WsI2DtJ+Ey1nkOQGZ4ZTF5UjnbCeZA/dGNZnmRnbMmclo EJGF4PqAzPvJmo+AQ06YlTDc5nFzDdgIC82idQInovypbkhfSML91qU9scHYgBePXCo0 pcp4M4rC5yBGxAqiUmq1CbZQMhRzWJ4CKk6XRoXyCWJJvkEivZ0yM2N6en2+HAQKWyPD BIBHwJXfJ1iKhsYRpxELSl75k0FE8Kvt/Mbo3pW1bMzbvupSHBDSXAAV4e3jbY/eNTcW R9CA== X-Gm-Message-State: APjAAAWQyNY+XobMjnTsUoLbxey+MyqeNgmrN/un/iIEups/8ffXORMe fPx5gZOSoJE1RaPtV4lZVDNBDsmI+nQ= X-Received: by 2002:a17:902:43:: with SMTP id 61mr2772112pla.88.1575340227615; Mon, 02 Dec 2019 18:30:27 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 18:30:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 38/40] target/arm: Pass more cpu state to arm_excp_unmasked Date: Mon, 2 Dec 2019 18:29:35 -0800 Message-Id: <20191203022937.1474-39-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::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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Avoid redundant computation of cpu state by passing it in from the caller, which has already computed it for itself. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) -- 2.17.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/target/arm/cpu.c b/target/arm/cpu.c index a36344d4c7..7a1177b883 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -411,14 +411,13 @@ static void arm_cpu_reset(CPUState *s) } static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, - unsigned int target_el) + unsigned int target_el, + unsigned int cur_el, bool secure, + uint64_t hcr_el2) { CPUARMState *env = cs->env_ptr; - unsigned int cur_el = arm_current_el(env); - bool secure = arm_is_secure(env); bool pstate_unmasked; int8_t unmasked = 0; - uint64_t hcr_el2; /* * Don't take exceptions if they target a lower EL. @@ -429,8 +428,6 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, return false; } - hcr_el2 = arm_hcr_el2_eff(env); - switch (excp_idx) { case EXCP_FIQ: pstate_unmasked = !(env->daif & PSTATE_F); @@ -535,6 +532,7 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) CPUARMState *env = cs->env_ptr; uint32_t cur_el = arm_current_el(env); bool secure = arm_is_secure(env); + uint64_t hcr_el2 = arm_hcr_el2_eff(env); uint32_t target_el; uint32_t excp_idx; bool ret = false; @@ -542,7 +540,8 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) 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)) { + 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); @@ -552,7 +551,8 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (interrupt_request & CPU_INTERRUPT_HARD) { excp_idx = EXCP_IRQ; target_el = arm_phys_excp_target_el(cs, excp_idx, cur_el, secure); - if (arm_excp_unmasked(cs, excp_idx, target_el)) { + 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); @@ -562,7 +562,8 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (interrupt_request & CPU_INTERRUPT_VIRQ) { excp_idx = EXCP_VIRQ; target_el = 1; - if (arm_excp_unmasked(cs, excp_idx, target_el)) { + 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); @@ -572,7 +573,8 @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) if (interrupt_request & CPU_INTERRUPT_VFIQ) { excp_idx = EXCP_VFIQ; target_el = 1; - if (arm_excp_unmasked(cs, excp_idx, target_el)) { + 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);