From patchwork Wed Oct 18 21:51:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 735128 Delivered-To: patch@linaro.org Received: by 2002:adf:f0cd:0:b0:32d:baff:b0ca with SMTP id x13csp1227852wro; Wed, 18 Oct 2023 15:02:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrU4QOgqlnDPgja20XgIzPTHMmEuPwAo/9cbiiCWP1impf8cV04zQ1x2VNbRfty6tq7jwS X-Received: by 2002:a05:620a:84c:b0:774:2dc0:649b with SMTP id u12-20020a05620a084c00b007742dc0649bmr139166qku.18.1697666569029; Wed, 18 Oct 2023 15:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697666569; cv=none; d=google.com; s=arc-20160816; b=GeOj5+ZapI0zy17MaZsA5+LHgC4xuTMwkMMFGrxfLL0VQ8/mICzMFX+RyM8sEYFevx 4GvSEuO5gOm5fUvJ11sw6pvqS5TpmYu4JHZN3MOuBriMMFFXoHQ29rD6f87kqFk6y6ru /KMkDCL9W+phrz8mJblwOMKf7Y6WxtEtUeTD9vvIIwbfYBsIdeUWK6UVYrMihBdaK7aZ +7TMxXxHJmA+8wkkgPKWEmxTcmkIn7F/cqQP7GkywplckdqhBflwxeQNJX5jOvUgEJ71 8iK06osm3zkon6a/e8m3eMA1ef2pMqx5puQPTxdzF6MHMwvPie9PTQE+wnwYjXu4oxGZ N/Xg== 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=IfXXjPSCAekTKnfIpCckOL6yHpkL7tvWXEcAjeu6hPU=; fh=f2WZoDMBYjCKWIIOoPI+rQtxlv4fmOm4u+dLdQLqpOk=; b=T3yCazynlbIGmtY4g3igOpizwpqy6aX9w20qv1vxe8nQOLB6fxfYeLjVhH/nMNymHh Jhmmax3ih9vdw3M0zWf6tt5Ac4K6Hwdy1GvQYmnatLdT4utUCNMXL0fp/LbEIDXiyb9n O4A3OuHAKbfHOi9w1IGYAUEH+3aifcwUlJ+BYntEnrmqq866K0+QsC1onX8h7jvr73oF ygayZbJAqLYmGcRR3AREW9AHRU0tdrfNOo24ijpepL9KiPho07oRD5CGBxkVuTIyzcdm a/jnYIee4Vh4D1mZkUVJH00nOyNcgCvwSSWJOmwCDoMF/JuF27tqG67xm+4vdzCbyfru wWxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jv1wp4dy; 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 u28-20020a05620a085c00b0077592c33673si642162qku.53.2023.10.18.15.02.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Oct 2023 15:02:49 -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=Jv1wp4dy; 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 1qtEVn-0002Kf-8V; Wed, 18 Oct 2023 17:55:31 -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 1qtEVl-0002Gh-MN for qemu-devel@nongnu.org; Wed, 18 Oct 2023 17:55:29 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtEVk-00058J-3w for qemu-devel@nongnu.org; Wed, 18 Oct 2023 17:55:29 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6bd73395bceso124875b3a.0 for ; Wed, 18 Oct 2023 14:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697666127; x=1698270927; 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=IfXXjPSCAekTKnfIpCckOL6yHpkL7tvWXEcAjeu6hPU=; b=Jv1wp4dy/uMbbKRKlcXmBIXFn8ZmG7/7xM7twHvg5FN9fQCH3D0U5SESPRUd02aBI1 z5+mymZr/YCX/E/dGiGdcX8ObZ8x7pUEqhm2i2kSz0D6KdAOrooRBPSD8zAc2LReRrb9 zGUVEFpQRDKDangngRz9tY4YruZYzsYQAfPus3NIhwSKhYGEbhOHDNZqsVwnQJovdgIw 7bZwCIbPAJXFG93SEI75lb6/NNfXGa0P5uwLEvGyLlm8BSgdwmKW9hbkJuAsN11vXGe6 UsvdeU/F/Sues5eotk+A2G9TAZEAFmIRZdYmBOze3WIWI+Uc0mThyLaYt4g0cu2q3P3D BLFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697666127; x=1698270927; 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=IfXXjPSCAekTKnfIpCckOL6yHpkL7tvWXEcAjeu6hPU=; b=JH1/ZNq1vw2pYbZiM0ftEFFAffcNMwnRBwqWwc0msKKv1XmEcfGa7gy6VShks6Bclh Wmv4UE4AfH2xa2oYMZEVlQn3NJFbevs/QPpDVNtbnYU9BHYY9p35ewxL0xAqpkpeX4Y2 pk9ghIr7k7Tn3tjAUb3jUapOP8EUG63PXIq2GRMFG5RykDp+plCp9M4i8ACCvwZAZH+x vkAASC2k0p4JisrswXV7rcbj483yHoTT0l8/jiKhvSAOKLb+3mcD3ymcxr6nwEixzU0p A7eSN3JSTVIMKqzYbAB8hvodxAlBcRfJ39u/NSBlW+hpCxOUHONpTWuSFEHfuEKghwyJ e1sw== X-Gm-Message-State: AOJu0YwoHQs1E7qPQDESl+DTEkEErCoa/o2Q9G0aJgl/RsN3K1+Txgb/ LKjVAWTPukD0x7x3U4Vy2v8EJU7ujuyluFp0/2k= X-Received: by 2002:a05:6a00:2789:b0:68a:5cf8:dae4 with SMTP id bd9-20020a056a00278900b0068a5cf8dae4mr168682pfb.3.1697666126834; Wed, 18 Oct 2023 14:55:26 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id r15-20020aa7962f000000b006889348ba6esm3796263pfg.127.2023.10.18.14.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 14:55:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de Subject: [PATCH 58/61] target/hppa: Fix interruption based on default PSW Date: Wed, 18 Oct 2023 14:51:32 -0700 Message-Id: <20231018215135.1561375-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018215135.1561375-1-richard.henderson@linaro.org> References: <20231018215135.1561375-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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 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 | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 5ce05046c0..5c7fddbc2b 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -124,6 +124,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..021f410bef 100644 --- a/target/hppa/int_helper.c +++ b/target/hppa/int_helper.c @@ -52,9 +52,16 @@ static void io_eir_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { HPPACPU *cpu = opaque; - int le_bit = ~data & 31; + 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 (cpu->is_pa20 && cpu->env.cr[CR_PSW_DEFAULT] & PDC_PSW_WIDE_BIT) { + widthm1 = 63; + } + le_bit = ~data & widthm1; + + cpu->env.cr[CR_EIRR] |= 1ull << le_bit; eval_interrupt(cpu); } @@ -104,8 +111,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;