From patchwork Fri Feb 2 05:49:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 769133 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp753496wrc; Thu, 1 Feb 2024 21:51:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKo01c+pux4kO6Ko7nBbLF81WZQJSN11hdP8Gx/Gulk5mhOylx5uEjOvudaA5p4NhsifeA X-Received: by 2002:a05:6102:34eb:b0:46a:fd10:45a5 with SMTP id bi11-20020a05610234eb00b0046afd1045a5mr6638854vsb.34.1706853105783; Thu, 01 Feb 2024 21:51:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706853105; cv=none; d=google.com; s=arc-20160816; b=qvc9a9NWJSTgX8EQ8lDGrx8JOhUGOVeuGDtXSD7SHfw8hhl4OhNb/yM36T0Hz9G+4G I3QIFkQXyIHoMhKv5KyI0MbFT7EeldBf0lq7wcBb46v6OhXDTsyTvqJkDUbepk3L6Pv/ ycL6jn16eFRfQvzdmrsOo1fLd0DNohhgVJM4ww7h0FYXtJQ8Ko0gktLK+rlUl9v4ZteG 0AM743Ryi3Yf8CykNL96q/xzrdvrF9HSGkejaYBhDbECHxAn4bx79NPycumFftrl1HUK wqhTqugzDZtQEIF/VOxEmwDEmQDLNh3X8I7xWvmqByeaqdlR3bvQnzgfkpOX7gsaxBFo mlrg== 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=voMoBx+DmSX4jwUUR+hNTm+Nb2/rGq7GF3Qy4EBDmqw=; fh=E5xrCsR1SBnYEd+jDmu2kWcMcFUsxM08u6m2Oa9sbK8=; b=XVD74l7NJ/TOzzPq8MK5c/b+XwTVIM6gn4mORo9x/jVt5LF+zVyYSo9A5oH1HUeOkk 37bi3Unh1eOJW8mWd/MrAA6usOsdfsF1lw2vq6r+OuXBaU8dwRxjhZfLNYr4JxOkRIvV zWr2fQhelnbyN95jGp8SLN3opQY+0xXD4rPuIKdbc1IYcSstt8WvVQxDnOOgqTwpBVMv iCoUb/YSJzy7Qmg+64W6loGTRvnp1xDLbypSEfzZdYfnGfDuJ6S7EZCdnXRXgpBxd7yf JHr7S6HbEOzaOrwZacVJVogDMinrKdAU+I09y7c40vyhfAJ6xm57LghBDIy9JxN9oPuA wE5w==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N05zfNNW; 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 X-Forwarded-Encrypted: i=0; AJvYcCXI3JREOgoe+GFZKrkGqAEhuS6drA2WAh4H7tVaMnCie1ZjttsABROZWXyTKbVPdtG2+QjEAeYXZS+OBZQPIqTG Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g1-20020ac87d01000000b0042a92a88b56si1256519qtb.698.2024.02.01.21.51.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2024 21:51:45 -0800 (PST) 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=N05zfNNW; 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 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Philippe Mathieu-Daudé 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 physaddr, vaddr addr, MemTxResult response, uintptr_t retaddr); #endif +int mb_cpu_mmu_index(CPUState *cs, bool ifetch); static inline int cpu_mmu_index(CPUMBState *env, bool ifetch) { - MicroBlazeCPU *cpu = 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); } #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); } +int mb_cpu_mmu_index(CPUState *cs, bool ifetch) +{ + CPUMBState *env = cpu_env(cs); + MicroBlazeCPU *cpu = 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 *data) cc->class_by_name = mb_cpu_class_by_name; cc->has_work = mb_cpu_has_work; - + cc->mmu_index = mb_cpu_mmu_index; cc->dump_state = mb_cpu_dump_state; cc->set_pc = mb_cpu_set_pc; cc->get_pc = mb_cpu_get_pc;