From patchwork Tue Mar 19 06:28:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 781070 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1777847wrs; Mon, 18 Mar 2024 23:30:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9iKad/uPkoWirMB7m6YAOq+T8UxxBPC7aZtVcZUeEcr8DjdyibSbYbzv9ejJBN4BUKidojmzwYuQm5wKND4gK X-Google-Smtp-Source: AGHT+IFmTwuU8dcEIR5fzxTVr5Aa6BFouQyEcm+GN7bO3tZcF+lQc8nYW1wLqMlJa5/efpqxMeDw X-Received: by 2002:ae9:f443:0:b0:789:e512:2cc4 with SMTP id z3-20020ae9f443000000b00789e5122cc4mr12997890qkl.11.1710829830997; Mon, 18 Mar 2024 23:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710829830; cv=none; d=google.com; s=arc-20160816; b=AH/og18D57SXFsDdY3d5LphfcE3AZKJSWuFkK+N7XRQ7PkowrmzjYoCPKTiCm8h7Wt V5md5Sl5ICmneAVMOSPv5EaZNYiAgZawP5asXjRW4teo3fmh7fgzo5dzEl/PBIi+9vQp y1JOKOzlmcJ3RU8E+EUp/uhCOJSAwyFcEbJ7Z4zl+wUz7C8NjibYOlTjpAB/xQeWzrsR xWWg7lAESjuqL/Ut4fmhpVL97MI4qnjrlUfo6uMDFeLYEGIiglaiHRLHr45T/YinX5Kr ib7B3pm6ui8+PmuWAiqiT6MLsKzmUqR3LIYoZFfL+sXgf8JTahLI50kmoNtD9A/j3gFO iHkg== 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=qcBm1WCPymqKaSwa7fzwzI3+ewkz+Zw4jwIqPMQqMRg=; fh=gePD3z8dMUYjJ8/ZZTN9tznSOiGIRTnAzPrBTUj0xb0=; b=O8Cw5ydFvGOCrzTBa3ViMwuDu4LtyDeW8bJNZn8PONziOk910i+uxwrQdGaI+lhfqB Srgnp6LfRIuMftyLEzDE+mOiQzcXLmQ9HSbF3/Sxi8tvil9d2zpLI/gsCUpHLpE2/ZSc prayW1+MDiq4QzXWVnj6HuNp2+lcyNOAoZzbYUR7xmLga1ccoFqppQs+5wB6zPuah4aU 2jRFCxPA5M4wpKf0SOA2kLSOSVedtzBlJEPB2RVvY4m4yVW/9avMqgY1Q9UNPlBPaDC0 QpYWTr2NouNf1+artxztbjP3K0YXAGjMLeOwSiC/YjMvJSD79p+FDs7JP4uCrtQKIofs wXpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W7OcNObL; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a10-20020a05620a066a00b00789f0f147d5si5791099qkh.497.2024.03.18.23.30.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Mar 2024 23:30:30 -0700 (PDT) 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=W7OcNObL; 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 1rmSyy-0006X0-SU; Tue, 19 Mar 2024 02:29:56 -0400 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 1rmSyw-0006Mp-TT for qemu-devel@nongnu.org; Tue, 19 Mar 2024 02:29:54 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rmSyh-0005gL-Ib for qemu-devel@nongnu.org; Tue, 19 Mar 2024 02:29:54 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-41461c256c4so5250535e9.0 for ; Mon, 18 Mar 2024 23:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710829777; x=1711434577; 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=qcBm1WCPymqKaSwa7fzwzI3+ewkz+Zw4jwIqPMQqMRg=; b=W7OcNObLAT1qv5oSj4Lvp4rPID97WylZ1KXmKJOGcK21H13v9FkkMLH4gllWemOenr U1f9BKLEIAf7bO0gynpf/CsJH/tk7nf0CuNmSSi/3XLm1VZyGwmA+lrFQ4VkJpAK4IhG dJTkVKqNFE0O6lyXM1XJHCtSuBgtj1Sz30fTdxUQJU224hIGck4rHGFaIOpQHqKMJRmC 98MKHE4b3YF6EXi6ArKBv8wKsiD2ixOmNT/VZiGqDmgg43rPvnE/kdEZhmu81dXVjqFB 20DuOE5DshAsAJVBaEWeiQSbp9ksmK5341O9bqBfFIEkahJnoYGy5Bb/XWiCUXHlwX4z Gb/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710829777; x=1711434577; 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=qcBm1WCPymqKaSwa7fzwzI3+ewkz+Zw4jwIqPMQqMRg=; b=W6Ih8otiw/ZUHW97AD8iH75W/Zt4RFtbBue+aCaeJtYEaq0sekRZJLHnD72Ci4S/VG 4wO6f21Gi1xUBmD+xysXIIP55H8yJCf4VSBW/52CFYqEjpqQ6ruPvoqJFDB+Ant68Xz0 TYMcGRiMM/AO0iSQn4ambWC9HXM6UXojWukB7oB3BPfqetcD8XyQ57mIU/C++ga47cMm Enq0GzQNQjV7FeDeHntOcHFyjsCxiHB3V98izQ5O5AXWAUeIvGJuJTCQwPs29igPiL2w swd8If0VmXyanPewolZwKYaYohXdvW4nNRNZiUGIYG9N9EUmnRVEitU7dKqD/XMtHTJZ iI4w== X-Gm-Message-State: AOJu0Yy4gxZF7VCTePEUFHBuTPyru/337ubFk7YmT8I7lg6r95I1Q7ig ur5Dehqbrzkw3FHav9gr1mcn5zJT7X+vhuSyXDPcAtKUdnKYs8AW3TflCcPbtZa1XjWSngWGKFF w X-Received: by 2002:a5d:4112:0:b0:33e:48f9:169d with SMTP id l18-20020a5d4112000000b0033e48f9169dmr944178wrp.31.1710829777460; Mon, 18 Mar 2024 23:29:37 -0700 (PDT) Received: from m1x-phil.lan ([176.176.166.129]) by smtp.gmail.com with ESMTPSA id y4-20020a5d4704000000b0033e7603987dsm11513647wrq.12.2024.03.18.23.29.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Mar 2024 23:29:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , "Edgar E. Iglesias" , Laurent Vivier , Anton Johansson , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH-for-9.1 7/8] target/microblaze: Move MMU helpers to sys_helper.c Date: Tue, 19 Mar 2024 07:28:54 +0100 Message-ID: <20240319062855.8025-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240319062855.8025-1-philmd@linaro.org> References: <20240319062855.8025-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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, 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 MMU helpers are only used during system emulation, move them to sys_helper.c. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Reviewed-by: Edgar E. Iglesias --- target/microblaze/op_helper.c | 48 ---------------------------------- target/microblaze/sys_helper.c | 47 +++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c index f6378030b7..45dbed4aaa 100644 --- a/target/microblaze/op_helper.c +++ b/target/microblaze/op_helper.c @@ -381,51 +381,3 @@ void helper_stackprot(CPUMBState *env, target_ulong addr) cpu_loop_exit_restore(cs, GETPC()); } } - -#if !defined(CONFIG_USER_ONLY) -/* Writes/reads to the MMU's special regs end up here. */ -uint32_t helper_mmu_read(CPUMBState *env, uint32_t ext, uint32_t rn) -{ - return mmu_read(env, ext, rn); -} - -void helper_mmu_write(CPUMBState *env, uint32_t ext, uint32_t rn, uint32_t v) -{ - mmu_write(env, ext, rn, v); -} - -void mb_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, - unsigned size, MMUAccessType access_type, - int mmu_idx, MemTxAttrs attrs, - MemTxResult response, uintptr_t retaddr) -{ - MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); - CPUMBState *env = &cpu->env; - - qemu_log_mask(CPU_LOG_INT, "Transaction failed: vaddr 0x%" VADDR_PRIx - " physaddr 0x" HWADDR_FMT_plx " size %d access type %s\n", - addr, physaddr, size, - access_type == MMU_INST_FETCH ? "INST_FETCH" : - (access_type == MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_STORE")); - - if (!(env->msr & MSR_EE)) { - return; - } - - if (access_type == MMU_INST_FETCH) { - if (!cpu->cfg.iopb_bus_exception) { - return; - } - env->esr = ESR_EC_INSN_BUS; - } else { - if (!cpu->cfg.dopb_bus_exception) { - return; - } - env->esr = ESR_EC_DATA_BUS; - } - - env->ear = addr; - cs->exception_index = EXCP_HW_EXCP; - cpu_loop_exit_restore(cs, retaddr); -} -#endif diff --git a/target/microblaze/sys_helper.c b/target/microblaze/sys_helper.c index 5180500354..7531f95ca7 100644 --- a/target/microblaze/sys_helper.c +++ b/target/microblaze/sys_helper.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "exec/log.h" @@ -292,3 +293,49 @@ void mb_cpu_do_unaligned_access(CPUState *cs, vaddr addr, cs->exception_index = EXCP_HW_EXCP; cpu_loop_exit(cs); } + +/* Writes/reads to the MMU's special regs end up here. */ +uint32_t helper_mmu_read(CPUMBState *env, uint32_t ext, uint32_t rn) +{ + return mmu_read(env, ext, rn); +} + +void helper_mmu_write(CPUMBState *env, uint32_t ext, uint32_t rn, uint32_t v) +{ + mmu_write(env, ext, rn, v); +} + +void mb_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, + unsigned size, MMUAccessType access_type, + int mmu_idx, MemTxAttrs attrs, + MemTxResult response, uintptr_t retaddr) +{ + MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); + CPUMBState *env = &cpu->env; + + qemu_log_mask(CPU_LOG_INT, "Transaction failed: vaddr 0x%" VADDR_PRIx + " physaddr 0x" HWADDR_FMT_plx " size %d access type %s\n", + addr, physaddr, size, + access_type == MMU_INST_FETCH ? "INST_FETCH" : + (access_type == MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_STORE")); + + if (!(env->msr & MSR_EE)) { + return; + } + + if (access_type == MMU_INST_FETCH) { + if (!cpu->cfg.iopb_bus_exception) { + return; + } + env->esr = ESR_EC_INSN_BUS; + } else { + if (!cpu->cfg.dopb_bus_exception) { + return; + } + env->esr = ESR_EC_DATA_BUS; + } + + env->ear = addr; + cs->exception_index = EXCP_HW_EXCP; + cpu_loop_exit_restore(cs, retaddr); +}