From patchwork Fri Mar 29 22:31:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 784102 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp3429377wrt; Fri, 29 Mar 2024 15:33:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHhGJ1c9a5Ljwx/d3amtyGqZMxotFkzXLVG51oimakVDfAKzRMZOVsgP5+ZiQBNgtCcvsgB9zaPj0rXHLEkglR X-Google-Smtp-Source: AGHT+IH+2+wJ+ABS52HqxPoxXG43YdWVTnPWK3KhFAuu3uWzBc6MholzVeDVWXscM9GeLqhqhxIW X-Received: by 2002:a05:622a:1ba3:b0:431:3420:f60d with SMTP id bp35-20020a05622a1ba300b004313420f60dmr3690345qtb.42.1711751625076; Fri, 29 Mar 2024 15:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711751625; cv=none; d=google.com; s=arc-20160816; b=tOASb6tEyiyKe1AQtK1SC1za/mC5lAArZZj0C2n/Wf4pgmF9fcJrMo0uEMepRExcaH gwoDISLhZGfG7M7LgJ5URbhcEv3SO+n00QgD78ovwejI043Ix+MP+xe+5/jk+U/1LEes CA+HorIN4qQKAeQsfkbr3E/+qcLfj5hWaF0UIdD5LkbNaBMf3/qhZduM8rlbAzvJgrQp aE+Y/cI5h80r8gkJKbiUGXUkGEZscvtguYNjgvQLoM5Kfo5aY5QIHGJj0CRMqfYKbs9l yCJbuRP7khRpVqgL8bt02RH90G206NmL27tuMQoKkRqYDf8SCI3Fv3N2gZZ9OPeKwZQK pK6w== 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=uX24NXcgU6IiX12Wm/xfyInlmTJOdDVKWFpfbbYjENA=; fh=L/zcBenwEF5glhwyLP21Krd2deVqVkTL6GpZ6TwRGPk=; b=GZAngCIoXzKQqkTv8eosi0KenGCNpDoeML0seALmYFWkF4Vflw6+4LuQKsBTxM7X5w PI4KgN7+vVFY8NNJfuICSv++NvnieCKLYVvn0DXnJzadzSiKUKBkc0ayBhoBfVMl95Ha 4a86yjAH/v8xtKelUObLpgN4AM3mAnU3IO/ort04Set+RPVappRifJglqQTFJafXedJv Vj0OvlUkyayVCheF0I+bdPaMXoHFx35feFANr92rSHiE7WYzoj2Pvvp6ZCNwLO2Yzsaj sKz5IcaeT1p0q79zGxntbpuFvJq7DuC/DHWgCbzH41rhQMHFtLAFpXrpcCx/TTrh9dXE eHtg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OQvZuSeZ; 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 et5-20020a05622a4b0500b00432c4c20a01si1593221qtb.645.2024.03.29.15.33.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2024 15:33:45 -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=OQvZuSeZ; 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 1rqKlP-0002eT-DK; Fri, 29 Mar 2024 18:31:55 -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 1rqKlC-0002aw-NI for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:31:43 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rqKlA-0003YS-DQ for qemu-devel@nongnu.org; Fri, 29 Mar 2024 18:31:41 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e0b213efa3so21816085ad.0 for ; Fri, 29 Mar 2024 15:31:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711751499; x=1712356299; 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=uX24NXcgU6IiX12Wm/xfyInlmTJOdDVKWFpfbbYjENA=; b=OQvZuSeZldBeu0fXHKc0jzrY1CZCImKC7H362h3/nW4fwZXdOB60dfjft2Fwz84/sx pPUQH9kuRxV3POaudSdEZsECApdKOBRkFRJoDUKxaq20QuEk3wdU+i+CcDk/0kwn3HT5 l/K3y28ErVDBkHYCEk2rpEjE7sTy1/pX0RD6RiwamJGRDqNBDqwJ+CXmF6KgqSRUw2Lu 5oklnatBHCGW88t9zBKRhLwb5LRQ0bAe7DTiXshW8klbsuTeW020OTsa70lYMX+xTUlg e5LXPwv72T1h26KXylG8Oss5bYc4uyya9dGzpGzZzJtd6BcTTGlY1B5c6DtjNdIaI/P/ nwJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711751499; x=1712356299; 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=uX24NXcgU6IiX12Wm/xfyInlmTJOdDVKWFpfbbYjENA=; b=fuyNCAd/UG+KnmVAHlRo2TYqhUpbmARPdbzDB8JxwkW92EwGAMtmtl7S9hzrz5R1ay LX2FD/d7/wIvrlYg4pwsMF8KGOGTFZsjlNOtYh/3wsL1WTxh8kLRgXtru0V6DbQ/1zjn cmGYIhoTefVrBOflH+uq5v9U02k6dD35b5+M8ZTiG3HTStHfZngUJYkxE1OFBSLtb3mW Cx+yXqRD/c55yESTeUnswlh3XtpK4ojiEwhlqO+nESO1/xssTly0p843mz1Kt6cN8qph 7AMKmGea8ZRe9w0zkJfQoKgKXuZZ9evAi6my+WRoWpyinxBMBLD9P4AfQYyRF6Oq3peP /kRQ== X-Gm-Message-State: AOJu0YxnIvHlj2xiNonkD9D6evnD38+cUDncHnBx93vns6BKyq2d3XZB G5W3QhtVk2FOmKcKkUEsbx+JMCr1fLDD14FxNoR6bKHVmoOXpfXZEo/ow8tOGp9KSOtOw15YnhV 7 X-Received: by 2002:a17:902:d508:b0:1e0:cdbf:24c2 with SMTP id b8-20020a170902d50800b001e0cdbf24c2mr4464153plg.29.1711751499093; Fri, 29 Mar 2024 15:31:39 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id f8-20020a170902684800b001e09b636cafsm4000955pln.287.2024.03.29.15.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 15:31:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller , Helge Deller Subject: [PULL 17/18] target/hppa: Add diag instructions to set/restore shadow registers Date: Fri, 29 Mar 2024 12:31:10 -1000 Message-Id: <20240329223111.1735826-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240329223111.1735826-1-richard.henderson@linaro.org> References: <20240329223111.1735826-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.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 From: Helge Deller The 32-bit PA-7300LC (PCX-L2) CPU and the 64-bit PA8700 (PCX-W2) CPU use different diag instructions to save or restore the CPU registers to/from the shadow registers. Implement those per-CPU architecture diag instructions to fix those parts of the HP ODE testcases (L2DIAG and WDIAG, section 1) which test the shadow registers. Signed-off-by: Helge Deller [rth: Use decodetree to distinguish cases] Signed-off-by: Richard Henderson Reviewed-by: Helge Deller Tested-by: Helge Deller --- target/hppa/insns.decode | 10 ++++++++++ target/hppa/translate.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode index 9f6ffd8e2c..71074a64c1 100644 --- a/target/hppa/insns.decode +++ b/target/hppa/insns.decode @@ -65,6 +65,8 @@ # Argument set definitions #### +&empty + # All insns that need to form a virtual address should use this set. &ldst t b x disp sp m scale size @@ -638,6 +640,14 @@ xmpyu 001110 ..... ..... 010 .0111 .00 t:5 r1=%ra64 r2=%rb64 [ diag_btlb 000101 00 0000 0000 0000 0001 0000 0000 diag_cout 000101 00 0000 0000 0000 0001 0000 0001 + + # For 32-bit PA-7300LC (PCX-L2) + diag_getshadowregs_pa1 000101 00 0000 0000 0001 1010 0000 0000 + diag_putshadowregs_pa1 000101 00 0000 0000 0001 1010 0100 0000 + + # For 64-bit PA8700 (PCX-W2) + diag_getshadowregs_pa2 000101 00 0111 1000 0001 1000 0100 0000 + diag_putshadowregs_pa2 000101 00 0111 0000 0001 1000 0100 0000 ] diag_unimp 000101 i:26 } diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 42dd3f2c8d..143818c2d9 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2399,6 +2399,20 @@ static bool do_getshadowregs(DisasContext *ctx) return nullify_end(ctx); } +static bool do_putshadowregs(DisasContext *ctx) +{ + CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); + nullify_over(ctx); + tcg_gen_st_i64(cpu_gr[1], tcg_env, offsetof(CPUHPPAState, shadow[0])); + tcg_gen_st_i64(cpu_gr[8], tcg_env, offsetof(CPUHPPAState, shadow[1])); + tcg_gen_st_i64(cpu_gr[9], tcg_env, offsetof(CPUHPPAState, shadow[2])); + tcg_gen_st_i64(cpu_gr[16], tcg_env, offsetof(CPUHPPAState, shadow[3])); + tcg_gen_st_i64(cpu_gr[17], tcg_env, offsetof(CPUHPPAState, shadow[4])); + tcg_gen_st_i64(cpu_gr[24], tcg_env, offsetof(CPUHPPAState, shadow[5])); + tcg_gen_st_i64(cpu_gr[25], tcg_env, offsetof(CPUHPPAState, shadow[6])); + return nullify_end(ctx); +} + static bool trans_getshadowregs(DisasContext *ctx, arg_getshadowregs *a) { return do_getshadowregs(ctx); @@ -4594,6 +4608,26 @@ static bool trans_diag_cout(DisasContext *ctx, arg_diag_cout *a) #endif } +static bool trans_diag_getshadowregs_pa1(DisasContext *ctx, arg_empty *a) +{ + return !ctx->is_pa20 && do_getshadowregs(ctx); +} + +static bool trans_diag_getshadowregs_pa2(DisasContext *ctx, arg_empty *a) +{ + return ctx->is_pa20 && do_getshadowregs(ctx); +} + +static bool trans_diag_putshadowregs_pa1(DisasContext *ctx, arg_empty *a) +{ + return !ctx->is_pa20 && do_putshadowregs(ctx); +} + +static bool trans_diag_putshadowregs_pa2(DisasContext *ctx, arg_empty *a) +{ + return ctx->is_pa20 && do_putshadowregs(ctx); +} + static bool trans_diag_unimp(DisasContext *ctx, arg_diag_unimp *a) { CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR);