From nobody Tue Nov 26 14:51:52 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=1706853106; cv=none; d=zohomail.com; s=zohoarc; b=Y43EvY27GWozCajqzHCM3Tb5/m5iSUhxPtNqoXZazKxUmOaDWWdtWnrPId5UcWGXSQ4X2I3Kjl68+9Gf+pEo/kKEp3G3/lKC+xlko9/mncQhY2xsZyk/vjebETpMWyet5olsjCz3935HfFlVrvi47qkiqITXIicGpt5DemQ0iGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706853106; 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=voMoBx+DmSX4jwUUR+hNTm+Nb2/rGq7GF3Qy4EBDmqw=; b=YmEaCkjKW7JSqyILYpjWm2k42/q9AKeJ/oQ3sHSuFZk3mnuSvESDkIsoJpvDXXJEzrnLd/zNSMiukd2qp+KWc/H6pFB63UCJHyecIfYYp3X9Vc8gBLT0yh90WJiblCm4knCyj5Vr81gJXi0OBzbQimTXFZEFBC16uBB+p92KXJA= 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 1706853106117883.8855375431382; Thu, 1 Feb 2024 21:51:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVmSV-0001GR-TF; Fri, 02 Feb 2024 00:51:27 -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 1rVmSK-0001FM-GL for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:19 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVmSH-0001k4-S4 for qemu-devel@nongnu.org; Fri, 02 Feb 2024 00:51:16 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6daf694b439so1369188b3a.1 for ; Thu, 01 Feb 2024 21:51:12 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id h2-20020aa79f42000000b006dab0d72cd0sm715111pfr.214.2024.02.01.21.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 21:51:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706853072; x=1707457872; 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=voMoBx+DmSX4jwUUR+hNTm+Nb2/rGq7GF3Qy4EBDmqw=; b=N05zfNNWmVD7zurq195LhbXtXMayMfUJ1KME1DyFJk8NAjE0Bcm4CDVoX2w2LlCqDQ ophazy0uruAH1YBAaj/i2lfSl83tNgKp6c8HALU0RYwkUJisrFgcZcEFi8cfGMwjUVoM fG3bnLj+u62FYRjb5FCHyc0yJPYq6vnFBSQSnkAzV7DJbPybNQiUd4mlUi4/4d04KKWi AqeaMGtz4yjukf/gJ4/pSxuTUmWgrn1xXx2E74HuBZsPOwHXoR5Iw4vt47s8hok7+I9b Ibk61lBedKDRGK0E2TWoDIPa/xRLSjF0fCZOx0NKLH4FYbKKIs3TgC2TYKZulr32Wuyd 299g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706853072; x=1707457872; 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=voMoBx+DmSX4jwUUR+hNTm+Nb2/rGq7GF3Qy4EBDmqw=; b=RH6sQN/y0Wruq3MXIizEm5NFewKC3OZSYEgCibUUPnL49nme8o96i8J9Jqd5N/BtiA pbb4bWLz0ZHHc4U+QYDjrBUb8eiwThiVV09V/xT3IIzQfMeyDQtLGLOaF4mqM8AW7zsn TL673bhlo9MW5dd1Zq1rpijK54Eck31+foxI2ymr2Wd4L331C8bZZMRh8NDMU+feUAF0 V33SUGCexEIWvCrE5tY3sv7n91td3kOQi4QymJE8+fQTlG5nyTiy57xT1vCf5UIom8wU drWEspNd9S3yckrRcwErHa/pOzLiSUchV+X/YgBsHbtpQaBt8RVuRl8j1w/VHzfWorSL D5xg== X-Gm-Message-State: AOJu0Yz2AgK2vvoDKVfB5npsLlYOolyQgALs9nXieZjUbUVP0FfzTyyh 5qNMLCAMyGc8hmaAXj9HnaWW28J01KrZyAPEK6kXSnts/T6sgPK2AQoGBNobGtqO+U1rCqqENy9 90h4= X-Google-Smtp-Source: AGHT+IGKQyGmzzqcCIimDmP8oXYIXHSqdkEPUZ3hmDg2VFDsk2PZ1QTegQpmACAgtEBmHb1pRz7N5A== X-Received: by 2002:a05:6a00:3d53:b0:6df:f6a2:508d with SMTP id lp19-20020a056a003d5300b006dff6a2508dmr1578803pfb.22.1706853071934; Thu, 01 Feb 2024 21:51:11 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 14/57] target/microblaze: Populate CPUClass.mmu_index Date: Fri, 2 Feb 2024 15:49:53 +1000 Message-Id: <20240202055036.684176-16-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::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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: 1706853106378100001 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- target/microblaze/cpu.h | 13 ++----------- target/microblaze/cpu.c | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index b5374365f5..90ab796de9 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -434,19 +434,10 @@ void mb_cpu_transaction_failed(CPUState *cs, hwaddr p= hysaddr, vaddr addr, MemTxResult response, uintptr_t retaddr); #endif =20 +int mb_cpu_mmu_index(CPUState *cs, bool ifetch); static inline int cpu_mmu_index(CPUMBState *env, bool ifetch) { - MicroBlazeCPU *cpu =3D env_archcpu(env); - - /* Are we in nommu mode?. */ - if (!(env->msr & MSR_VM) || !cpu->cfg.use_mmu) { - return MMU_NOMMU_IDX; - } - - if (env->msr & MSR_UM) { - return MMU_USER_IDX; - } - return MMU_KERNEL_IDX; + return mb_cpu_mmu_index(env_cpu(env), ifetch); } =20 #ifndef CONFIG_USER_ONLY diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 2318ad7013..6dad11905b 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -118,6 +118,22 @@ static bool mb_cpu_has_work(CPUState *cs) return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI= ); } =20 +int mb_cpu_mmu_index(CPUState *cs, bool ifetch) +{ + CPUMBState *env =3D cpu_env(cs); + MicroBlazeCPU *cpu =3D env_archcpu(env); + + /* Are we in nommu mode?. */ + if (!(env->msr & MSR_VM) || !cpu->cfg.use_mmu) { + return MMU_NOMMU_IDX; + } + + if (env->msr & MSR_UM) { + return MMU_USER_IDX; + } + return MMU_KERNEL_IDX; +} + #ifndef CONFIG_USER_ONLY static void mb_cpu_ns_axi_dp(void *opaque, int irq, int level) { @@ -415,7 +431,7 @@ static void mb_cpu_class_init(ObjectClass *oc, void *da= ta) =20 cc->class_by_name =3D mb_cpu_class_by_name; cc->has_work =3D mb_cpu_has_work; - + cc->mmu_index =3D mb_cpu_mmu_index; cc->dump_state =3D mb_cpu_dump_state; cc->set_pc =3D mb_cpu_set_pc; cc->get_pc =3D mb_cpu_get_pc; --=20 2.34.1