From nobody Tue Nov 26 15:31:10 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=1706853229; cv=none; d=zohomail.com; s=zohoarc; b=EXXKj5cUz9WCw4r1vAg7EBtEVnnwcRcKOqWcFuDOZGHr1YyGOBI5bwVtcq4UcudgPKgWun/Lfn8Mv4HrTVrSL+LTYUWMFi2VSeMW4r7o48Yf6Oylflf1Rfc2cLRz4YyxXHmfblkkMGHQ3DTxoIagPuOnulAs44nhBFGhUuZHtNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706853229; 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=2tz+hZT+/jj7B5V0fs8mig9BK9nxx7zGxdWkFBgn124=; b=RHtMyfZDeMml/0mKYYGr6pCvX8HwlJNtghmyW0XKEjInkBddj4AaSJumAe1E/ivTiCBTllw+mvIgNXGBRj4I6yJBT/kjMNzn5AYq/HZquOlRRAtZzT5nXa30m0vPpAFLpzZirl2DSQUOePtOcaWP7fDxsscI0RjgfNBvWZIHPWo= 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 1706853229044105.0115023866598; Thu, 1 Feb 2024 21:53:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVmSZ-0001Hl-NE; Fri, 02 Feb 2024 00:51:31 -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 1rVmST-0001GN-FX for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:25 -0500 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVmSS-0001os-1m for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:25 -0500 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3beb504c985so909887b6e.0 for ; Thu, 01 Feb 2024 21:51:23 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id h2-20020aa79f42000000b006dab0d72cd0sm715111pfr.214.2024.02.01.21.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 21:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706853082; x=1707457882; 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=2tz+hZT+/jj7B5V0fs8mig9BK9nxx7zGxdWkFBgn124=; b=WdJEf4dzq4RaTvYC6zJkQgSq89K5j2/aGr2hWPPnsPkjhTOivr+m1R+LI0j7VMai73 HpuHU9r1t2E6oa1fl+ZKyjOLAGiBdOBZYo0gtQ9H4VanpksyYP+Wy87X0J7rIzor7M6Z OxeUiX/aUbgjYz2gqwYRIEHLyEBVliuPw6+5c6AZDENAFRySsxOy8mBrZXso5+tXMXGy o+x6RsxFgFYH+stoAqY6lRNS2nRhsBuZDOT9qNOft+5vE/UN6lSLzMmX4Tm1JQkihYi2 9LrM9MCaU+piwXuZb2i+a/X1Z6XXCdQx2fx+KM2TNibjbZuMgd3yttsbVr2o0HXl6WyR b0SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706853082; x=1707457882; 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=2tz+hZT+/jj7B5V0fs8mig9BK9nxx7zGxdWkFBgn124=; b=KKd2UMvgRDj241GgQJ4+213J/y+33jzeMe0ImFD7UJ2u7W1T/jhu1uItWRTdVN62tl nppDZ1lGhFM3Bskla9k8f3jc38j86JainxrWrQO9rYIaJ+aBz/gGX3UVpCk4LLnj9/WM g7PKxRHMaMJxjB+RGPSXnS7Zr6AvnjOdpxSB3ibzrwl99XxkIQCKPA/3nnn0uY9RtCJe w0TBi97/yYEdftUsytcslahi0N1eLlt1QAoVxrYmE4Fl+UeLtelBSE7Yvta6Cu8Zp1ar 7K++mlYjB4k7EQ7PWAqEEbj38DW8xeAL+G524v2aP3+tJfkfeQcfJA0Xp4f5Ni/Eyzec WTNA== X-Gm-Message-State: AOJu0YyUdFBUq+AOEmx3sur2dwasbyYRA/LkmIvcBuE0muBExSAUswGs 5EhOZcyzhylehDBgUIS62fWOZnhM7u0vO2jk6t95HhYg8nexLlPFS4JhlriaoOOz+8ZuXh7Jbv+ TjH4= X-Google-Smtp-Source: AGHT+IFn5LB9C5Z8+1h902WWekza8vND9DBwFzX6tGKRPAe1+zHdIAv5qyp3+iLsyxGHJhJUhVM/4g== X-Received: by 2002:a05:6808:2098:b0:3be:c43a:97c7 with SMTP id s24-20020a056808209800b003bec43a97c7mr7787786oiw.24.1706853082234; Thu, 01 Feb 2024 21:51:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 19/57] target/openrisc: Populate CPUClass.mmu_index Date: Fri, 2 Feb 2024 15:49:58 +1000 Message-Id: <20240202055036.684176-21-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::22e; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x22e.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: 1706853230732100003 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/openrisc/cpu.h | 10 ++-------- target/openrisc/cpu.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index b454014ddd..7dbed8d8be 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -361,16 +361,10 @@ static inline void cpu_get_tb_cpu_state(CPUOpenRISCSt= ate *env, vaddr *pc, | (env->sr & (SR_SM | SR_DME | SR_IME | SR_OVE)); } =20 +int openrisc_cpu_mmu_index(CPUState *cs, bool ifetch); static inline int cpu_mmu_index(CPUOpenRISCState *env, bool ifetch) { - int ret =3D MMU_NOMMU_IDX; /* mmu is disabled */ - - if (env->sr & (ifetch ? SR_IME : SR_DME)) { - /* The mmu is enabled; test supervisor state. */ - ret =3D env->sr & SR_SM ? MMU_SUPERVISOR_IDX : MMU_USER_IDX; - } - - return ret; + return openrisc_cpu_mmu_index(env_cpu(env), ifetch); } =20 static inline uint32_t cpu_get_sr(const CPUOpenRISCState *env) diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 477d49d4bc..8670152c84 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -68,6 +68,18 @@ static bool openrisc_cpu_has_work(CPUState *cs) CPU_INTERRUPT_TIMER); } =20 +int openrisc_cpu_mmu_index(CPUState *cs, bool ifetch) +{ + CPUOpenRISCState *env =3D cpu_env(cs); + + if (env->sr & (ifetch ? SR_IME : SR_DME)) { + /* The mmu is enabled; test supervisor state. */ + return env->sr & SR_SM ? MMU_SUPERVISOR_IDX : MMU_USER_IDX; + } + + return MMU_NOMMU_IDX; /* mmu is disabled */ +} + static void openrisc_disas_set_info(CPUState *cpu, disassemble_info *info) { info->print_insn =3D print_insn_or1k; @@ -239,6 +251,7 @@ static void openrisc_cpu_class_init(ObjectClass *oc, vo= id *data) =20 cc->class_by_name =3D openrisc_cpu_class_by_name; cc->has_work =3D openrisc_cpu_has_work; + cc->mmu_index =3D openrisc_cpu_mmu_index; cc->dump_state =3D openrisc_cpu_dump_state; cc->set_pc =3D openrisc_cpu_set_pc; cc->get_pc =3D openrisc_cpu_get_pc; --=20 2.34.1