From patchwork Tue Nov 7 03:03:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 741827 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1421605wrr; Mon, 6 Nov 2023 19:13:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQGjURqLHetKe0xH9AVLjKNlICChHBNRyKFs19L+Su06sVo2b2EC6sVIq29BS8QpBDLnHK X-Received: by 2002:a05:620a:45ab:b0:778:96f1:173a with SMTP id bp43-20020a05620a45ab00b0077896f1173amr37626863qkb.17.1699326822310; Mon, 06 Nov 2023 19:13:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699326822; cv=none; d=google.com; s=arc-20160816; b=YtLVG2W5FzSM8t64q1pLbk4w4bd97VXkpCDABeTiDXoI5Dn4urw+Xcj+SaMsMHxnBJ Ghldhq1OuNgbq/oZrADKyri+sGiFIkdIvqEw4E9fYaBl6M4U4kWnw9BnLBndxLm26F7v QDHhRq+UCYftaZ7+QeZdxz1Sp93K16NcdIX0dd3wVwwwIG6ddXPuUVy+qFoh7kAF/2SD f7uMxTQHxpb0cq53mwQmOp4mgNcbMGMjYIKhqXhbNfhyHFwVIcgFhzxMoPeana3znkZQ hXCODIsjs4XkEYfJ5pzasOrzZH134z7R7+fdRWL5pt7crhA2ChOT1glyzyr9xEjysJHr oXmA== 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=zVaSUdm8wIzLLsLpBUjpNJYI2RdNW+CR3uBhuw+VEbI=; fh=wDljmxUHXfz9MGj2//jPHYRc53BMWF157v8rVKELrf4=; b=M5SqAdGMgnswo0FZYLNki+jNR4SJc7Z6ewH8dgvYP+9Cntrc+5rkjTdojZe0iAz+6H FKWu/SE+/YtzUVevfUtCT2A+2FV2zX7sK96IJjSBrIZyMNVc4oKQm1lNehJrLZPXjbaa /L3UQOGdtGyWdGMcodk4UQ4M+R+xGey5nibRz+nDE3wmBojk6LHRSFtcb7IxB9c3Iv5R mSOP2IODrFBa/pXb4ObXIP7ufF9yPVxkgqA8qC+kMhQvMQlbc5smwxB0znAJjsiNVXzb yZpbwXZY7WRR1XlDVGZ2gPHc99O2YXKALlpdvDKD3RJkFJ9bfocvTjoNqX6MpVtCKjfL HHjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YxybFH0O; 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 dv3-20020a05620a1b8300b0076eefa391ebsi6490783qkb.208.2023.11.06.19.13.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2023 19:13:42 -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=pass header.i=@linaro.org header.s=google header.b=YxybFH0O; 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 1r0CRu-0005mT-2d; Mon, 06 Nov 2023 22:08:18 -0500 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 1r0CRi-00057Z-Jw for qemu-devel@nongnu.org; Mon, 06 Nov 2023 22:08:07 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0CRc-0001QS-R0 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 22:08:06 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1cc0d0a0355so39090595ad.3 for ; Mon, 06 Nov 2023 19:08:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699326479; x=1699931279; 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=zVaSUdm8wIzLLsLpBUjpNJYI2RdNW+CR3uBhuw+VEbI=; b=YxybFH0OFrcdmpqL2OZ+Mn9Y9GJwNMywaKpzP9KLa82z1me01AF6Zjqx7h67UgPxkg Yw/IvBQh6FHZH3sdOFuRovDuNOdb5IPuvipnfKCFpW0bz4bq/BiyoUelAd4qxXaJ60cc MSnmooehTqpAT/R4Uq+pfYXxbua/2I5EsPAhO4GiT+XN8ipIZ6o5IUxRBUlqjNQxIk0A CMhWiM69HVJvC83aS04ii7dsThoE02XpPpE6lF7BXENd7zGF5YsoXd5/g4LOQHW1tUHL lfDloK02/0oYL7pSf2eCep3KeEoq8yWw60x25vHK2M3aoAwmptyyqq9r/oTK5feN9zZX qszA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699326479; x=1699931279; 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=zVaSUdm8wIzLLsLpBUjpNJYI2RdNW+CR3uBhuw+VEbI=; b=ONT1EjTNzSpcNujkXpBhtlWtROfoS+SP5d/2svvkzHXbvPn32a26JS27xuAOtd8T9n So7cgEHSgXtzA3RGMQghc/sS/beUxlDR+RuAxf+iStA96CU/3FUObXLF6OOdCI2pZjZ3 DQWy2Dux64zW12dX8kQaox2lzocS9Qmo/hOWBWpMhSIdiZAo9gUqmnXCaxmtk668TBxc rd9r2Soi9YTLYvaofMPlZ1SR8Q0ZLZC9dbkPbpisXsOLcq4H0LKXfToTQQVyhLNNj0T8 VPMVK3AbDf67nUHaWmURVbDhV01tTRRAWTmK0725qVlY3gDyDt12zKwJHfXueVAiE933 FB5g== X-Gm-Message-State: AOJu0Yx8Z0YhVqT5YQ2L8YKFLHj8lpHAeKG3LgMt9ZnB6wD5c3ayo/Es P/3GiDvzYD5KkiaonVQSr0G4FJMZMZM35K98xxo= X-Received: by 2002:a17:90a:ac06:b0:280:200c:2e20 with SMTP id o6-20020a17090aac0600b00280200c2e20mr20255894pjq.27.1699326479460; Mon, 06 Nov 2023 19:07:59 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id 13-20020a17090a004d00b0027782f611d1sm6744883pjb.36.2023.11.06.19.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 19:07:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Helge Deller Subject: [PULL 68/85] target/hppa: Fix interruption based on default PSW Date: Mon, 6 Nov 2023 19:03:50 -0800 Message-Id: <20231107030407.8979-69-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107030407.8979-1-richard.henderson@linaro.org> References: <20231107030407.8979-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 default PSW is set by the operating system with the PDC_PSW firmware call. Use that setting to decide if wide mode is to be enabled for interruptions and EIRR usage. Signed-off-by: Helge Deller Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 2 ++ target/hppa/int_helper.c | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index ea676ba062..ea8e7e99a4 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -137,6 +137,8 @@ #define PSW_SM_W 0x200 /* PA2.0 only : Enable Wide Mode */ #define CR_RC 0 +#define CR_PSW_DEFAULT 6 /* see SeaBIOS PDC_PSW firmware call */ +#define PDC_PSW_WIDE_BIT 2 #define CR_PID1 8 #define CR_PID2 9 #define CR_PID3 12 diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c index f355c4c76b..a11d607b31 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -52,9 +52,17 @@ static void io_eir_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { HPPACPU *cpu = opaque; - int le_bit = ~data & 31; + CPUHPPAState *env = &cpu->env; + int widthm1 = 31; + int le_bit; - cpu->env.cr[CR_EIRR] |= (target_ulong)1 << le_bit; + /* The default PSW.W controls the width of EIRR. */ + if (hppa_is_pa20(env) && env->cr[CR_PSW_DEFAULT] & PDC_PSW_WIDE_BIT) { + widthm1 = 63; + } + le_bit = ~data & widthm1; + + env->cr[CR_EIRR] |= 1ull << le_bit; eval_interrupt(cpu); } @@ -104,8 +112,10 @@ void hppa_cpu_do_interrupt(CPUState *cs) /* step 1 */ env->cr[CR_IPSW] = old_psw = cpu_hppa_get_psw(env); - /* step 2 -- note PSW_W == 0 for !HPPA64. */ - cpu_hppa_put_psw(env, PSW_W | (i == EXCP_HPMC ? PSW_M : 0)); + /* step 2 -- Note PSW_W is masked out again for pa1.x */ + cpu_hppa_put_psw(env, + (env->cr[CR_PSW_DEFAULT] & PDC_PSW_WIDE_BIT ? PSW_W : 0) | + (i == EXCP_HPMC ? PSW_M : 0)); /* step 3 */ env->cr[CR_IIASQ] = iasq_f >> 32;