From patchwork Wed May 15 09:40:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 796916 Delivered-To: patch@linaro.org Received: by 2002:a5d:452e:0:b0:34e:ceec:bfcd with SMTP id j14csp2890120wra; Wed, 15 May 2024 02:41:52 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXXufZ8oPC7+6PWh8AnoErOq5yxPAMZyGkYwDu5gVqFjNqQwFRPTSpTlG1iMWbyJf70KVlkp0TfF6r+oiDS0zKn X-Google-Smtp-Source: AGHT+IELRVOTNQk3u1fYDQR+S6K9REt/sI/ActFY1i9LyDAAdJqr+DjjXim2Jt7b6l6TAhUnF4my X-Received: by 2002:a05:622a:409:b0:43e:1ce3:139e with SMTP id d75a77b69052e-43e1ce314ffmr127634991cf.11.1715766112036; Wed, 15 May 2024 02:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715766112; cv=none; d=google.com; s=arc-20160816; b=ppI49FWwtGmqvVMSxFBb/RjbExU9w4g9mco6Lyb14rE7FoxcfjzMFW0lV7Z1BvuOYe MaFJ8m7dZY2JQE2oaW0Uyse9bfM8zZFrUxk35F/ggjBKH5BLTesLxpHWpx+wcKZIUO6m IhTD9Ae5nrxGHYTSsyTL6xWGxDUNX/06VBIDl8d9MrwKX0tIKkPXgXFme9rbRdPFU7Su 0Gx61P9BFCcC8HvtdfVCmhXG7oORa7st0In/OSBsl48bx+e8K9GoumZ7cV3gZnPkQz0v o+2WtGTEmKXVNFoNq5RE8cGVBcN4mIM4Rnpf5+tglHzgh+UsmS2JbDBLUAyWu1P/NMds NKAQ== 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:cc:to :from:dkim-signature; bh=ZG3aV8qfAUE4eaqYaKoPcSH0wJlV80ibYaxpI2XwiLk=; fh=wDljmxUHXfz9MGj2//jPHYRc53BMWF157v8rVKELrf4=; b=WsOjRhTrRsea0VqpiHQkpopBiQTRY9djJ0/Ct0dGOsTwVGTIs0LzMV/GyHFEBr8vU7 +2PV3HYgDN5dQzfHnzoMC4GaKmE+hIhVuU7W03kdcZfjQsQLJX1Zc7CdLRIdsam6trOj UUiUsAhotTMIGkWdg49SDJrnPNnRfozN5ZfqSxmpayQrcdNhWYI7u2gbzKROmg1WRuP6 A40x2jGhYNUGloPVaABJnR/S9+1YL/4iw/KoxFysgplMWQQzc4hagV+QDW76P6jrMs6G fBHW4xFX35P3CdNwoi7PULZSo+bYHLe8VfU6MO0/Sysrry+hEz6TQWODYRFtBbVrQbGH gmxg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="W8qSh/zo"; 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 d75a77b69052e-43e2a4e476dsi28671971cf.437.2024.05.15.02.41.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 May 2024 02:41:52 -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="W8qSh/zo"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7B8C-0005pB-5I; Wed, 15 May 2024 05:41:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7B7y-0005hE-5C for qemu-devel@nongnu.org; Wed, 15 May 2024 05:40:50 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s7B7v-0001bo-Al for qemu-devel@nongnu.org; Wed, 15 May 2024 05:40:49 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-34dc129accaso4880164f8f.0 for ; Wed, 15 May 2024 02:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715766045; x=1716370845; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZG3aV8qfAUE4eaqYaKoPcSH0wJlV80ibYaxpI2XwiLk=; b=W8qSh/zoMd4lsT+ZTc5miOjwkabELlAkn+E8MBG0qa0rirqGh2vTrFv60ucPEhI4cw gNMBMPASONZM6waNdwwqW8xCSi8fu2gfKIg6cZymPySFzm78vaEzVYFL5cWwpad3VamU E69HcrJH97VRICh3w1TG9fjuWPt5OxYp+o4ubCLPPhf61FJbOamdKuTSoqOWf2O4z2JR lT+VMvDC9jck4FdpYy63pP4YVVRh424aSh8hezTv/E8Dbyf2ps4RPhbwIMuiRoULQfyf m/KR3plxxexe/GZ1i0DkUg8Ng41O1Qdq4D8c9FIwZsl/sWp4wupOVGJg51KyZvZZocZM m7WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715766045; x=1716370845; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZG3aV8qfAUE4eaqYaKoPcSH0wJlV80ibYaxpI2XwiLk=; b=JoQZPayJvglujJmcMcHQ0S8ypLt7VWfp/jNF2JtdGikmmTPzXS0yFwmqtPI/+thw3k sn7wS75xpEXw7EmgSmYMwSrB/CWCKzLUX2xmD3qwBvIs1rkJLH+yjhLzFYEDwbMzszOo 9TLn2qJQ5s0gVbUyTgXbGmjGZkuOjwGZskiAH5D3NWxnWQp3162eQwuOak//7sb+/+X/ 1dE3LpvSWcBDGqEUcLk5kNDjN+g+Bi91mrJWd8M3o9J44LlkJt2TS3hxfKvymkJMxLni FG7gXdDo7ei8XmKotk17Q55jLs/RBjaD7EX1DXv/7OOnG31hFbzUE/kphkiOD1MVQhmC Mq5Q== X-Gm-Message-State: AOJu0YyBIOWZs014pHnW3HdAN9vycXAx8I2y9aCx/yM205hUmaLk+L8q pqCVzr/KXTap3kcySu40U0xxrW6CiKp41drvG8TV4oxqmPvvNbVQHQbHiZsQTTv4b9VHLoobc0E ORCA= X-Received: by 2002:adf:f287:0:b0:34d:87bc:e79c with SMTP id ffacd0b85a97d-3504a633178mr13432596f8f.6.1715766045295; Wed, 15 May 2024 02:40:45 -0700 (PDT) Received: from stoup.. ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502bbbbefdsm15897058f8f.94.2024.05.15.02.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 02:40:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 01/43] target/hppa: Move cpu_get_tb_cpu_state out of line Date: Wed, 15 May 2024 11:40:01 +0200 Message-Id: <20240515094043.82850-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240515094043.82850-1-richard.henderson@linaro.org> References: <20240515094043.82850-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x431.google.com 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.29 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-bounces+patch=linaro.org@nongnu.org Reviewed-by: Helge Deller Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 43 ++----------------------------------------- target/hppa/cpu.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index fb2e4c4a98..61f1353133 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -314,47 +314,8 @@ hwaddr hppa_abs_to_phys_pa2_w1(vaddr addr); #define TB_FLAG_PRIV_SHIFT 8 #define TB_FLAG_UNALIGN 0x400 -static inline void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, - uint64_t *cs_base, uint32_t *pflags) -{ - uint32_t flags = env->psw_n * PSW_N; - - /* TB lookup assumes that PC contains the complete virtual address. - If we leave space+offset separate, we'll get ITLB misses to an - incomplete virtual address. This also means that we must separate - out current cpu privilege from the low bits of IAOQ_F. */ -#ifdef CONFIG_USER_ONLY - *pc = env->iaoq_f & -4; - *cs_base = env->iaoq_b & -4; - flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; -#else - /* ??? E, T, H, L, B bits need to be here, when implemented. */ - flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); - flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT; - - *pc = hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0), - env->iaoq_f & -4); - *cs_base = env->iasq_f; - - /* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero - low 32-bits of CS_BASE. This will succeed for all direct branches, - which is the primary case we care about -- using goto_tb within a page. - Failure is indicated by a zero difference. */ - if (env->iasq_f == env->iasq_b) { - target_long diff = env->iaoq_b - env->iaoq_f; - if (diff == (int32_t)diff) { - *cs_base |= (uint32_t)diff; - } - } - if ((env->sr[4] == env->sr[5]) - & (env->sr[4] == env->sr[6]) - & (env->sr[4] == env->sr[7])) { - flags |= TB_FLAG_SR_SAME; - } -#endif - - *pflags = flags; -} +void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, + uint64_t *cs_base, uint32_t *pflags); target_ulong cpu_hppa_get_psw(CPUHPPAState *env); void cpu_hppa_put_psw(CPUHPPAState *env, target_ulong); diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 393a81988d..582036b31e 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -43,6 +43,48 @@ static vaddr hppa_cpu_get_pc(CPUState *cs) return cpu->env.iaoq_f; } +void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc, + uint64_t *cs_base, uint32_t *pflags) +{ + uint32_t flags = env->psw_n * PSW_N; + + /* TB lookup assumes that PC contains the complete virtual address. + If we leave space+offset separate, we'll get ITLB misses to an + incomplete virtual address. This also means that we must separate + out current cpu privilege from the low bits of IAOQ_F. */ +#ifdef CONFIG_USER_ONLY + *pc = env->iaoq_f & -4; + *cs_base = env->iaoq_b & -4; + flags |= TB_FLAG_UNALIGN * !env_cpu(env)->prctl_unalign_sigbus; +#else + /* ??? E, T, H, L, B bits need to be here, when implemented. */ + flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P); + flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT; + + *pc = hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0), + env->iaoq_f & -4); + *cs_base = env->iasq_f; + + /* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero + low 32-bits of CS_BASE. This will succeed for all direct branches, + which is the primary case we care about -- using goto_tb within a page. + Failure is indicated by a zero difference. */ + if (env->iasq_f == env->iasq_b) { + target_long diff = env->iaoq_b - env->iaoq_f; + if (diff == (int32_t)diff) { + *cs_base |= (uint32_t)diff; + } + } + if ((env->sr[4] == env->sr[5]) + & (env->sr[4] == env->sr[6]) + & (env->sr[4] == env->sr[7])) { + flags |= TB_FLAG_SR_SAME; + } +#endif + + *pflags = flags; +} + static void hppa_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb) {