From nobody Fri Dec 19 17:15:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1594079342; cv=none; d=zohomail.com; s=zohoarc; b=T/9FJCku2wtImS9UL/oOuamEMHby+3XvQ9abUd/pBtP6n1EH5MxiZrV9wng+4c4ApumMVJDdwoq2Gu+Ba/KobgU3VFtXpFnA//cLnJP7C633L9qx+eQqU+EqQHwfqnW99h4j3Mr7z5plPHT9+9UVfeVt1w4O22s5WV9hbavusRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594079342; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WZrxDgWWXXP9PmlZyyBGjdv9eqT/iSmUhBtmo9zxmiE=; b=l3JH5DzVDbFLw3sf2Mv31PWIAo5nvb9uxJPvsz9uIb7YL0u+Qo0kdIkF/bEC88ptqb6D70zqNvjfSI9cPyX0k2auDlX75SW20+FnQLzAshdjvZ6dIacndjJjvFA53spCdnUfffAJ+YdA6z5sm4+hXj0Pfn65XzPKr2t23hAyMGU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594079342613369.5173160448877; Mon, 6 Jul 2020 16:49:02 -0700 (PDT) Received: from localhost ([::1]:37032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jsar7-0002ce-EQ for importer@patchew.org; Mon, 06 Jul 2020 19:49:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsaq6-0000rh-EF for qemu-devel@nongnu.org; Mon, 06 Jul 2020 19:47:58 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:38315) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jsaq4-0000or-RU for qemu-devel@nongnu.org; Mon, 06 Jul 2020 19:47:58 -0400 Received: by mail-pj1-x1032.google.com with SMTP id k5so8126097pjg.3 for ; Mon, 06 Jul 2020 16:47:56 -0700 (PDT) Received: from octofox.cadence.com ([2601:641:400:e00:19b7:f650:7bbe:a7fb]) by smtp.gmail.com with ESMTPSA id e15sm19647649pgt.17.2020.07.06.16.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2020 16:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WZrxDgWWXXP9PmlZyyBGjdv9eqT/iSmUhBtmo9zxmiE=; b=LQGKeTSaur4jfDn2clIb3qHJzsVFcPr3tmYKuaLGwUlMeOHbldkOxomtVxkX2r/HRT hg8YhyRNczLF7mDQURX0cDKir0wB0xCFL8wwdRdk0WzIKrpg1mQQ4qGd+JSMThZinBau CriAiEGzX1nvR/Fzah0zL6+yldpHoVgJoHCUPfxwBDp6NoHBkTwAUTBB4DzIR6B0GFyS yaKz/QZLrS3wElxIxLFuP+ZVglz5gS02N1NLT/X1du5ObmBYeo8ipeLkkXt+dNASlSf7 a+gUGXXy+gvKGkrOxJ87tKWWTpewQEAOlkDXJEInAv2qc3D4K7wzxKGMThErWx/RH+6+ RIiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WZrxDgWWXXP9PmlZyyBGjdv9eqT/iSmUhBtmo9zxmiE=; b=koY8PTiTm9yiOARde+8smvL5Hqbz6Mh8zpIWFdn1I/0P3eQ6XGSXVkkXVvAOKoJryT xlWR22XBTyy3YYDrFQsU6GfBsorfFU4pFB7mGgp9VIxtQGpHOih0kj1mqXn6oPOWkRps BnUUR/v+dDLjGShbJ9B3TQUwH3MkH5WnXjB18Agdjg8g+9sHf7IXVwmG1fePlnzh26RX FMxI6dR6ANJd/Kl7ddGs2DJzqZT9XvTLDg8Ho5dWLuE41AhiCMyZZ2tbJLv1HUK5ouyq jeOI1XuY4aBpOc0Y+/W+xPViYJvPqUlWZJErMINRirm9L/6o1UsPQExFv3cPcSEBNOVU pJOg== X-Gm-Message-State: AOAM530unJsQlzxPozP587CbZS53iyVo4y1mwshsq/L4pWTWhtbsfE40 Xp81GUSSanQtPwpH6jHbCWxSX/fl X-Google-Smtp-Source: ABdhPJxmk7BTsnXEllQwPRIPePeS7svrlo9nl9CBUIKoROaqfWTq3ls2LA4q45JjQRUMNVWB5zGl6Q== X-Received: by 2002:a17:902:8d87:: with SMTP id v7mr42105297plo.73.1594079275062; Mon, 06 Jul 2020 16:47:55 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Subject: [PATCH 04/21] target/xtensa: add geometry to xtensa_get_regfile_by_name Date: Mon, 6 Jul 2020 16:47:20 -0700 Message-Id: <20200706234737.32378-5-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200706234737.32378-1-jcmvbkbc@gmail.com> References: <20200706234737.32378-1-jcmvbkbc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=jcmvbkbc@gmail.com; helo=mail-pj1-x1032.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, HK_RANDOM_ENVFROM=0.001, HK_RANDOM_FROM=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Register file name may not uniquely identify a register file in the set of configurations. E.g. floating point registers may have different size in different configurations. Use register file geometry as additional identifier. Signed-off-by: Max Filippov --- target/xtensa/cpu.h | 2 +- target/xtensa/helper.c | 4 +++- target/xtensa/translate.c | 35 +++++++++++++++++++++++++++-------- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index 0c96181212a5..0409aa6189cf 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -598,7 +598,7 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vadd= r addr, =20 void xtensa_collect_sr_names(const XtensaConfig *config); void xtensa_translate_init(void); -void **xtensa_get_regfile_by_name(const char *name); +void **xtensa_get_regfile_by_name(const char *name, int entries, int bits); void xtensa_breakpoint_handler(CPUState *cs); void xtensa_register_core(XtensaConfigList *node); void xtensa_sim_open_console(Chardev *chr); diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index 7073381f03b2..05e2b7f70a1e 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -133,8 +133,10 @@ static void init_libisa(XtensaConfig *config) config->regfile =3D g_new(void **, regfiles); for (i =3D 0; i < regfiles; ++i) { const char *name =3D xtensa_regfile_name(config->isa, i); + int entries =3D xtensa_regfile_num_entries(config->isa, i); + int bits =3D xtensa_regfile_num_bits(config->isa, i); =20 - config->regfile[i] =3D xtensa_get_regfile_by_name(name); + config->regfile[i] =3D xtensa_get_regfile_by_name(name, entries, b= its); #ifdef DEBUG if (config->regfile[i] =3D=3D NULL) { fprintf(stderr, "regfile '%s' not found for %s\n", diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 03d796d7a1ed..9838bf6b3ec5 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -227,24 +227,43 @@ void xtensa_translate_init(void) "exclusive_val"); } =20 -void **xtensa_get_regfile_by_name(const char *name) +void **xtensa_get_regfile_by_name(const char *name, int entries, int bits) { + char *geometry_name; + void **res; + if (xtensa_regfile_table =3D=3D NULL) { xtensa_regfile_table =3D g_hash_table_new(g_str_hash, g_str_equal); + /* + * AR is special. Xtensa translator uses it as a current register + * window, but configuration overlays represent it as a complete + * physical register file. + */ g_hash_table_insert(xtensa_regfile_table, - (void *)"AR", (void *)cpu_R); + (void *)"AR 16x32", (void *)cpu_R); g_hash_table_insert(xtensa_regfile_table, - (void *)"MR", (void *)cpu_MR); + (void *)"AR 32x32", (void *)cpu_R); g_hash_table_insert(xtensa_regfile_table, - (void *)"FR", (void *)cpu_FR); + (void *)"AR 64x32", (void *)cpu_R); + g_hash_table_insert(xtensa_regfile_table, - (void *)"BR", (void *)cpu_BR); + (void *)"MR 4x32", (void *)cpu_MR); + g_hash_table_insert(xtensa_regfile_table, - (void *)"BR4", (void *)cpu_BR4); + (void *)"FR 16x32", (void *)cpu_FR); + g_hash_table_insert(xtensa_regfile_table, - (void *)"BR8", (void *)cpu_BR8); + (void *)"BR 16x1", (void *)cpu_BR); + g_hash_table_insert(xtensa_regfile_table, + (void *)"BR4 4x4", (void *)cpu_BR4); + g_hash_table_insert(xtensa_regfile_table, + (void *)"BR8 2x8", (void *)cpu_BR8); } - return (void **)g_hash_table_lookup(xtensa_regfile_table, (void *)name= ); + + geometry_name =3D g_strdup_printf("%s %dx%d", name, entries, bits); + res =3D (void **)g_hash_table_lookup(xtensa_regfile_table, geometry_na= me); + g_free(geometry_name); + return res; } =20 static inline bool option_enabled(DisasContext *dc, int opt) --=20 2.20.1