From nobody Tue Feb 10 09:57:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610058329; cv=none; d=zohomail.com; s=zohoarc; b=nlwBA42Xsz+xgqAmrP1DPu5qqCPJLPOo8MIyba7SK44025f/VdO6kRUh3eNgx8EKe6dv6ZyopnvEmFTO5ywgExnAbrxSDMilyfs9zc09VjWC2QNo3/DV0Aahvj6ZNly1hgZlK8CQlQ+meTbYfOpRBnhI/JbYORpuiwundxnf9PE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610058329; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6XvVGZx0cqMA0IbQkfNJyPnGsDJniknsO06wunE5/50=; b=c5EAPiaVwZRAfbp6Rwl+eltveWN/dHRZRsuq98QJxugdeuQo+OAcPOLnHzpMjNybj9aX0CByKS4FX3ApzxyWUbZSGqzuUmc4PfSjr/nYCEKza8Ck2ZyiTo3H2xhr5HRZ5W7NWfYef1geY3pYsPxhgI08jwb2gXZc6ZMcogC/ENk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1610058329451577.7651973057995; Thu, 7 Jan 2021 14:25:29 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-mbKqQ26mMpC9Hn8BeM7kUQ-1; Thu, 07 Jan 2021 17:25:26 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 21FEA100C603; Thu, 7 Jan 2021 22:25:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0F9A70951; Thu, 7 Jan 2021 22:25:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B7DEE1809CA8; Thu, 7 Jan 2021 22:25:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 107MPHMk030040 for ; Thu, 7 Jan 2021 17:25:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF9C3D7B10; Thu, 7 Jan 2021 22:25:17 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BA349D7B0E for ; Thu, 7 Jan 2021 22:25:15 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8040B800B3A for ; Thu, 7 Jan 2021 22:25:15 +0000 (UTC) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-gJV0GyK9PPyIF1bQpEejSw-1; Thu, 07 Jan 2021 17:25:12 -0500 Received: by mail-wm1-f45.google.com with SMTP id 3so6819939wmg.4; Thu, 07 Jan 2021 14:25:12 -0800 (PST) Received: from x1w.redhat.com (241.red-88-10-103.dynamicip.rima-tde.net. [88.10.103.241]) by smtp.gmail.com with ESMTPSA id w18sm10304215wrn.2.2021.01.07.14.25.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 14:25:10 -0800 (PST) X-MC-Unique: mbKqQ26mMpC9Hn8BeM7kUQ-1 X-MC-Unique: gJV0GyK9PPyIF1bQpEejSw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6XvVGZx0cqMA0IbQkfNJyPnGsDJniknsO06wunE5/50=; b=XTzqfTmtFUl8S4eP9u3gIJOR3foKs94F1fh7Vot1ebggN8klE1sATiUVfy7hmeuPy1 nrP9qTUc27u6UIBPYf72ZjWSoNmjDYgL8axL823aeqk3TIkpluWIeN41bss3PX4P9THv 0bmq4GmZ4dV+y0LX+/m332HM4PQFJFAImcQbp+lflQIFKplgs6Yn195M9R3oYD9oLRTa DFfWXekZ2oInw63g5CoE5zhSmgTYzdoOHdVn9Sli9iLD8jeooKz97TbF9jq7tdDHS0Tr w1s6saO6KFOgGiaxgytbkz5G+9ADjfATfTDYDFVRzz+xbZncnAqPW83wptri0lGjP+xZ ROog== X-Gm-Message-State: AOAM531Vz0Bq1BAOhOpGoB5dl0/LgqNR91w0HaXgZriBqN0nzrnLyQ76 washRukTHPe0CsFAN/keFKU= X-Google-Smtp-Source: ABdhPJx6x49t860Ji4WBqZXY+0iRVBS0DuxcRHaO7i+LjJx6y6RwOhS5Mayfg4WzxVVZyQstZYej7w== X-Received: by 2002:a7b:ce02:: with SMTP id m2mr482037wmc.111.1610058311180; Thu, 07 Jan 2021 14:25:11 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 26/66] target/mips: Move mmu_init() functions to tlb_helper.c Date: Thu, 7 Jan 2021 23:22:13 +0100 Message-Id: <20210107222253.20382-27-f4bug@amsat.org> In-Reply-To: <20210107222253.20382-1-f4bug@amsat.org> References: <20210107222253.20382-1-f4bug@amsat.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Aleksandar Rikalo , Paul Burton , kvm@vger.kernel.org, libvir-list@redhat.com, Huacai Chen , Richard Henderson , Laurent Vivier , Jiaxun Yang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , Aurelien Jarno X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20201206233949.3783184-15-f4bug@amsat.org> --- target/mips/internal.h | 1 + target/mips/tlb_helper.c | 46 ++++++++++++++++++++++++++++++ target/mips/translate_init.c.inc | 48 -------------------------------- 3 files changed, 47 insertions(+), 48 deletions(-) diff --git a/target/mips/internal.h b/target/mips/internal.h index ae1181d2029..9a7698019e2 100644 --- a/target/mips/internal.h +++ b/target/mips/internal.h @@ -207,6 +207,7 @@ void cpu_mips_start_count(CPUMIPSState *env); void cpu_mips_stop_count(CPUMIPSState *env); =20 /* helper.c */ +void mmu_init(CPUMIPSState *env, const mips_def_t *def); bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c index b02c0479e79..082c17928d3 100644 --- a/target/mips/tlb_helper.c +++ b/target/mips/tlb_helper.c @@ -120,6 +120,52 @@ int r4k_map_address(CPUMIPSState *env, hwaddr *physica= l, int *prot, return TLBRET_NOMATCH; } =20 +static void no_mmu_init(CPUMIPSState *env, const mips_def_t *def) +{ + env->tlb->nb_tlb =3D 1; + env->tlb->map_address =3D &no_mmu_map_address; +} + +static void fixed_mmu_init(CPUMIPSState *env, const mips_def_t *def) +{ + env->tlb->nb_tlb =3D 1; + env->tlb->map_address =3D &fixed_mmu_map_address; +} + +static void r4k_mmu_init(CPUMIPSState *env, const mips_def_t *def) +{ + env->tlb->nb_tlb =3D 1 + ((def->CP0_Config1 >> CP0C1_MMU) & 63); + env->tlb->map_address =3D &r4k_map_address; + env->tlb->helper_tlbwi =3D r4k_helper_tlbwi; + env->tlb->helper_tlbwr =3D r4k_helper_tlbwr; + env->tlb->helper_tlbp =3D r4k_helper_tlbp; + env->tlb->helper_tlbr =3D r4k_helper_tlbr; + env->tlb->helper_tlbinv =3D r4k_helper_tlbinv; + env->tlb->helper_tlbinvf =3D r4k_helper_tlbinvf; +} + +void mmu_init(CPUMIPSState *env, const mips_def_t *def) +{ + env->tlb =3D g_malloc0(sizeof(CPUMIPSTLBContext)); + + switch (def->mmu_type) { + case MMU_TYPE_NONE: + no_mmu_init(env, def); + break; + case MMU_TYPE_R4000: + r4k_mmu_init(env, def); + break; + case MMU_TYPE_FMT: + fixed_mmu_init(env, def); + break; + case MMU_TYPE_R3000: + case MMU_TYPE_R6000: + case MMU_TYPE_R8000: + default: + cpu_abort(env_cpu(env), "MMU type not supported\n"); + } +} + static int is_seg_am_mapped(unsigned int am, bool eu, int mmu_idx) { /* diff --git a/target/mips/translate_init.c.inc b/target/mips/translate_init.= c.inc index 21ee22c05dc..535d4c0c702 100644 --- a/target/mips/translate_init.c.inc +++ b/target/mips/translate_init.c.inc @@ -935,54 +935,6 @@ void mips_cpu_list(void) } } =20 -#ifndef CONFIG_USER_ONLY -static void no_mmu_init(CPUMIPSState *env, const mips_def_t *def) -{ - env->tlb->nb_tlb =3D 1; - env->tlb->map_address =3D &no_mmu_map_address; -} - -static void fixed_mmu_init(CPUMIPSState *env, const mips_def_t *def) -{ - env->tlb->nb_tlb =3D 1; - env->tlb->map_address =3D &fixed_mmu_map_address; -} - -static void r4k_mmu_init(CPUMIPSState *env, const mips_def_t *def) -{ - env->tlb->nb_tlb =3D 1 + ((def->CP0_Config1 >> CP0C1_MMU) & 63); - env->tlb->map_address =3D &r4k_map_address; - env->tlb->helper_tlbwi =3D r4k_helper_tlbwi; - env->tlb->helper_tlbwr =3D r4k_helper_tlbwr; - env->tlb->helper_tlbp =3D r4k_helper_tlbp; - env->tlb->helper_tlbr =3D r4k_helper_tlbr; - env->tlb->helper_tlbinv =3D r4k_helper_tlbinv; - env->tlb->helper_tlbinvf =3D r4k_helper_tlbinvf; -} - -static void mmu_init(CPUMIPSState *env, const mips_def_t *def) -{ - env->tlb =3D g_malloc0(sizeof(CPUMIPSTLBContext)); - - switch (def->mmu_type) { - case MMU_TYPE_NONE: - no_mmu_init(env, def); - break; - case MMU_TYPE_R4000: - r4k_mmu_init(env, def); - break; - case MMU_TYPE_FMT: - fixed_mmu_init(env, def); - break; - case MMU_TYPE_R3000: - case MMU_TYPE_R6000: - case MMU_TYPE_R8000: - default: - cpu_abort(env_cpu(env), "MMU type not supported\n"); - } -} -#endif /* CONFIG_USER_ONLY */ - static void fpu_init (CPUMIPSState *env, const mips_def_t *def) { int i; --=20 2.26.2