From nobody Tue Nov 26 14:25:43 2024 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706853197; cv=none; d=zohomail.com; s=zohoarc; b=WOv2hqvKnsXJWpUn02A6WRcBFFDsZ1h5YkpNqqcNc7TUf+4ZGPjnQjqbAw7bmFFwfmj5h6mtI0ZS+0Zx25y2jNZo47obRUO09WMn3E8GeXHx23o3VUYfZmj6DDSSRd6FyjbyNnAMkXy4mWF+lArBHqdkAqYK5Q1bN2CfawGg5FM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706853197; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VAmZNL9zYMPpuAsM9Gmw83HdlClN4X7nwCS0CqUYsPQ=; b=boI40nLONlt2+wlc1q/0FLgrfw4bxVxA25r2jrvxTB6geXn0lZldQivuliS+X1/oo15gEHrRBVGnHrh3nXUesxE178iMcpWgNDtiKvTmLJZ+BgPUWbUBivpD7cQptK0qqtEih+33u/skxEU+IVELBVv0mUJKwGu50e/RSNCHIm8= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706853197930152.27924458554241; Thu, 1 Feb 2024 21:53:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVmSF-0001D4-Ji; Fri, 02 Feb 2024 00:51:11 -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 1rVmSD-0001CX-MZ for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:09 -0500 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVmSC-0001hk-5r for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:09 -0500 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6dfefb490f9so730885b3a.1 for ; Thu, 01 Feb 2024 21:51:06 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id h2-20020aa79f42000000b006dab0d72cd0sm715111pfr.214.2024.02.01.21.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 21:51:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706853065; x=1707457865; 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=VAmZNL9zYMPpuAsM9Gmw83HdlClN4X7nwCS0CqUYsPQ=; b=JZPzlnof9jffflidWcVsmyiFpmOrDvm/aKSfoKMJCeM1U40HsDngqWGTe6oqndNNhK 65jVsINj6jgm7PST6Q4Mw7eCVrf0MIpm3iMZQeM2kHGNlIpENAWYMT9R4xJbKdfHuZfR NWmNzYvHj209Ahxx5GFFpC6u4nCTQeG/1JYLNmvV8CshUF5b3866qdplLemKOaS+OMSD zU2jj0qGBxHp8PAJxK0SU9tse4VSUKIJbmXweKs8uFluWVtn9G68kn89BTNz6uU34zei xaSrcbS4mQ912RA4pA9+d0+H2E7jUidUP7fcN3P67uCR053DvMIGvhdPnbEcZQCNuF4T PpKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706853065; x=1707457865; 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=VAmZNL9zYMPpuAsM9Gmw83HdlClN4X7nwCS0CqUYsPQ=; b=euQe/EDYjEClvkh7Hkv1EA10cuDJNhGqnP22y8O51UGFM9hzTikXMj4fpy3i1LJe+j 7pxijQKADsb18Ha5O3Yfq+eVKg3opTnOg/mHgaNxGnJQKKIjAzpwowaHvPmXb2MsdyMf mmqsfsBjJEaqVJF8Ky1M3cgL9OW+vZXomzVQs3OrJBO/CemHSsDd+hMP+J1G0tH+Hl2B iZWvk5hm62GuAWvP3BmsTyxtemYzpnlRKV1/lI2Z1tlVe7NFeRlSz7AnZ/Ru499ekqrN d+Aw/+zFyWb9EhQOWxqd0P1Stg73Oe1tEowA6XmUDSjTWh7YQy1ffGp8mqZoSzLn9tos Akog== X-Gm-Message-State: AOJu0YyegxtTW8fe+X/JIRxE9LMWRp/qMnDB8uqhDLW4oXZ98WAWQg7J SK8xuY+CFMmYXgXdm5Chmpz/iRGYvVSYeWo/j6kX2xhzl75PcvYSKjhoeKipJNtG6vg1UXmv1vT LJOQ= X-Google-Smtp-Source: AGHT+IElAzn6TmK6qK3yl/KaKEinfRTeQeD3KdsXD0JWJaay0AGqR9lxD7D0HyGo1l8n29wI6v8l2A== X-Received: by 2002:aa7:810e:0:b0:6dd:a086:1e0f with SMTP id b14-20020aa7810e000000b006dda0861e0fmr1208361pfi.32.1706853065709; Thu, 01 Feb 2024 21:51:05 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 11/57] target/loongarch: Populate CPUClass.mmu_index Date: Fri, 2 Feb 2024 15:49:50 +1000 Message-Id: <20240202055036.684176-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202055036.684176-1-richard.henderson@linaro.org> References: <20240202055036.684176-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706853198504100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/loongarch/cpu.h | 6 ++---- target/loongarch/cpu.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index 0fa5e0ca93..5dfcfeb3a4 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -408,15 +408,13 @@ struct LoongArchCPUClass { #define MMU_IDX_USER MMU_PLV_USER #define MMU_IDX_DA 4 =20 +int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch); static inline int cpu_mmu_index(CPULoongArchState *env, bool ifetch) { #ifdef CONFIG_USER_ONLY return MMU_IDX_USER; #else - if (FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG)) { - return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV); - } - return MMU_IDX_DA; + return loongarch_cpu_mmu_index(env_cpu(env), ifetch); #endif } =20 diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index fb8dde7def..cbecc63213 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -375,6 +375,16 @@ static bool loongarch_cpu_has_work(CPUState *cs) #endif } =20 +int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch) +{ + CPULoongArchState *env =3D cpu_env(cs); + + if (FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PG)) { + return FIELD_EX64(env->CSR_CRMD, CSR_CRMD, PLV); + } + return MMU_IDX_DA; +} + static void loongarch_la464_initfn(Object *obj) { LoongArchCPU *cpu =3D LOONGARCH_CPU(obj); @@ -779,6 +789,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, vo= id *data) =20 cc->class_by_name =3D loongarch_cpu_class_by_name; cc->has_work =3D loongarch_cpu_has_work; + cc->mmu_index =3D loongarch_cpu_mmu_index; cc->dump_state =3D loongarch_cpu_dump_state; cc->set_pc =3D loongarch_cpu_set_pc; cc->get_pc =3D loongarch_cpu_get_pc; --=20 2.34.1