From patchwork Thu Nov 2 01:29:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 740345 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp593697wrv; Wed, 1 Nov 2023 18:32:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpI6fVMvmiWgILGjl2jo7iIVSIQqEPKAVpcKEvXUhceXc9ArGAFYuaifZq8VWQWWSzIXOn X-Received: by 2002:a05:620a:4b4c:b0:76e:e352:667a with SMTP id su12-20020a05620a4b4c00b0076ee352667amr15882931qkn.35.1698888760218; Wed, 01 Nov 2023 18:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698888760; cv=none; d=google.com; s=arc-20160816; b=xrU0AwWerfzVIAZcYWLhmJWXNAIRdl/w0i40ESjReGR/aMLcf7Ms38wIgW5E4gDRO2 VhdGWszyYim6MePVIEe0kM7GCss2CkmgZbLn/0A0pkU6T1ZwXAOkrah5YoTjN91Frj2a QDPJfBAG+PcZbamxNtDHOrSRyDhQ9cRJ0R79GC8LzA3SHZhQ6ZKBYb4vMcq3YF3OOSgu LZg6IpOs/ACsFqsr1qQFn3CHFHdfMypcXAb+TAz4Jo8PnQBVC1dexo4xvOalmlh2rpKw MlMgPM9N2pdIk6h407kcbHG49Blexp0TWm7N3Pz9R9yuQBdERXZ1S7URDDQHXpRjguu1 xhvg== 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=U8V0B4qGaX44SCne6/GgXw2vrmkaH/ySdpZ5z2aNKfw=; fh=AzeAcdP3m8QbCrR9JX5pAsbSbmsQq+UaJF2pdbgiiNs=; b=xlbUSqhmkR0KczlzPOz3eWI/VvtrFIdWQzbVl1ugdsLcN8kOX0cxor8vEvg/bUfgPK ginGEeq2LYy19Vax+kIeEEhT7vD052OFrYfqADPhTge2Xo6MH/8Ooy+Ain1kaPbVnqB4 t/Zk3b+YZWdjyo0QKLFNGwneyMJYA3AB51CNPgZOU9Wifwpeft1vfV86+j1nGBTm5a+T /RoHR9bKbc4TGKMJyvivx+1xRLTFDLISTk2KHlJZx+gzIXj2MOWl3IwyOdg8t5wJWDir WIRTBshaPH7X+5P3NZvWSxJMhNzUDayagr2vcEBQlpuRsHP+DoV/ANZVIN/lYWvZA587 dxlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=skqsTeK+; 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 pb27-20020a05620a839b00b0076da127884csi3838291qkn.223.2023.11.01.18.32.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Nov 2023 18:32:40 -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=skqsTeK+; 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 1qyMYK-0005qK-6O; Wed, 01 Nov 2023 21:31:20 -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 1qyMXf-0005f3-Tr for qemu-devel@nongnu.org; Wed, 01 Nov 2023 21:30:40 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyMXc-0001YE-1T for qemu-devel@nongnu.org; Wed, 01 Nov 2023 21:30:39 -0400 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3b2df2fb611so299494b6e.0 for ; Wed, 01 Nov 2023 18:30:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698888633; x=1699493433; 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=U8V0B4qGaX44SCne6/GgXw2vrmkaH/ySdpZ5z2aNKfw=; b=skqsTeK+mlne45DhxWQv1A18XpO25pScBJnTh9sD54UZTnX1gLeba1VQZDdcstaYtF NNQayOvtCxgpWiGX7S8FxxPvspRCo3G0ulIjQt550gLXYtMMuBoj1lquS+uUHDTtsBfs Jeb/YHYaxIcw4fdooQLB4sAq6/goc3NKN8n6caJe8wxWoNNNE94LWE7iPwH3MzDKrMiH qrmbCRaOD3W+MrE972ccsWJJ7//NCBN9nT/wW/z8weKkqN+mmqQKpRcvSf5FlnoYJPlg w+vf0Tb3aX/lGZrzBvTHlzY4qs2YZb57lBMikaLcFTkdE8OAJetELSlc/GzOhEgvd6+o e4QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698888633; x=1699493433; 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=U8V0B4qGaX44SCne6/GgXw2vrmkaH/ySdpZ5z2aNKfw=; b=k9b4vEz/TY1g65BqabvxeL4xESrJsdqVu2jYS8f7Le/3lzwr9qjHKfSeyaG0EHGM1T QPE8PjzcX+67+2Q5x683E8So64EH/XnLgVk7OcQeXqxZIEI1fkdT2UXwlYb4Z3rd4Wt/ vW06MHcNU0pHpyBeyAZ2Lv9hheSCkFRgPEQOATtgcUC4RbwonzSgDRPglr9pPWLFmPis cPI1gZo07r8/4OBtRjvXkipuGpXgR+TdgJ/NEU7ZmjKmbv+N4MXIMN+6/MXHmLHxWDMk uM5pcH/4Z+xgPtcMIX3vE8f4sKjXxi4GdYy8esRnCrSjhpQUe8MMci3hxzQdmMy07kp3 4KJA== X-Gm-Message-State: AOJu0Yxuhkq/MHxtGmxdqDK26TRXC03YyG8eYxn3l24A6IvmZ0+BiioV 0fl7WKuWjLTCoryU1UfVnCdNp72xwGabN8yK2M4= X-Received: by 2002:aca:d16:0:b0:3a6:fbe3:45cf with SMTP id 22-20020aca0d16000000b003a6fbe345cfmr19045412oin.35.1698888633444; Wed, 01 Nov 2023 18:30:33 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id r23-20020aa78457000000b006979f70fdd5sm1784191pfn.219.2023.11.01.18.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 18:30:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: deller@gmx.de, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 19/88] target/hppa: Introduce TYPE_HPPA64_CPU Date: Wed, 1 Nov 2023 18:29:07 -0700 Message-Id: <20231102013016.369010-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231102013016.369010-1-richard.henderson@linaro.org> References: <20231102013016.369010-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22c.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 Prepare for the qemu binary supporting both pa10 and pa20 at the same time. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/hppa/cpu-qom.h | 1 + target/hppa/cpu.h | 5 +++++ target/hppa/cpu.c | 33 ++++++++++++++++++--------------- target/hppa/translate.c | 2 ++ 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/target/hppa/cpu-qom.h b/target/hppa/cpu-qom.h index b96e0318c7..4a85ebf5e0 100644 --- a/target/hppa/cpu-qom.h +++ b/target/hppa/cpu-qom.h @@ -24,6 +24,7 @@ #include "qom/object.h" #define TYPE_HPPA_CPU "hppa-cpu" +#define TYPE_HPPA64_CPU "hppa64-cpu" OBJECT_DECLARE_CPU_TYPE(HPPACPU, HPPACPUClass, HPPA_CPU) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 08de894393..0ac307e0e9 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -272,6 +272,11 @@ struct ArchCPU { #include "exec/cpu-all.h" +static inline bool hppa_is_pa20(CPUHPPAState *env) +{ + return object_dynamic_cast(OBJECT(env_cpu(env)), TYPE_HPPA64_CPU) != NULL; +} + static inline int cpu_mmu_index(CPUHPPAState *env, bool ifetch) { #ifdef CONFIG_USER_ONLY diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 5e1240c631..07fae42bb8 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -209,20 +209,23 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data) cc->tcg_ops = &hppa_tcg_ops; } -static const TypeInfo hppa_cpu_type_info = { - .name = TYPE_HPPA_CPU, - .parent = TYPE_CPU, - .instance_size = sizeof(HPPACPU), - .instance_align = __alignof(HPPACPU), - .instance_init = hppa_cpu_initfn, - .abstract = false, - .class_size = sizeof(HPPACPUClass), - .class_init = hppa_cpu_class_init, +static const TypeInfo hppa_cpu_type_infos[] = { + { + .name = TYPE_HPPA_CPU, + .parent = TYPE_CPU, + .instance_size = sizeof(HPPACPU), + .instance_align = __alignof(HPPACPU), + .instance_init = hppa_cpu_initfn, + .abstract = false, + .class_size = sizeof(HPPACPUClass), + .class_init = hppa_cpu_class_init, + }, +#ifdef TARGET_HPPA64 + { + .name = TYPE_HPPA64_CPU, + .parent = TYPE_HPPA_CPU, + }, +#endif }; -static void hppa_cpu_register_types(void) -{ - type_register_static(&hppa_cpu_type_info); -} - -type_init(hppa_cpu_register_types) +DEFINE_TYPES(hppa_cpu_type_infos) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index ed88f724ce..44c9911720 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -262,6 +262,7 @@ typedef struct DisasContext { int mmu_idx; int privilege; bool psw_n_nonzero; + bool is_pa20; #ifdef CONFIG_USER_ONLY MemOp unalign; @@ -4091,6 +4092,7 @@ static void hppa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->cs = cs; ctx->tb_flags = ctx->base.tb->flags; + ctx->is_pa20 = hppa_is_pa20(cpu_env(cs)); #ifdef CONFIG_USER_ONLY ctx->privilege = MMU_IDX_TO_PRIV(MMU_USER_IDX);