From nobody Tue Feb 10 03:39:31 2026 Delivered-To: importer@patchew.org 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; 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=1578538446; cv=none; d=zohomail.com; s=zohoarc; b=oKq9WNDdm/w4f5FIkVwZEyUU8ZvP3ll6t41Jq8PgRYc7nTOdhADkGMk35+vzVwKKsTjBnk49aICP8zUre2VoJuw1w2l+qFeafXZRX0oFqcuyndd1txZHxCZ7CMyi3VDqryCOqtzBjpFiUySBXUxQBgMy0XVj/RWxEMUnxEh5PwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578538446; h=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=2Otsrpp3foKLNa1SqB84R8O87zHmU0sZwfC3eLGqWD8=; b=ntYYEL8o4XxCNQy7zdQQ9hkNA700Q1teaCGPgYISo3F5RxkCPD+tLBSGMKOkOa6DaBWRrXOyN2zHx3E9u8EVcwxof/mRJ8hvXkxafsjvowOOBP92cb6kw3P/AWRrP+mx8df1dZq1IeVeOYp0EhjwLFKW5plVTg1Rhfp9BBau7hI= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1578538446484851.5094658024982; Wed, 8 Jan 2020 18:54:06 -0800 (PST) Received: from localhost ([::1]:54034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNxT-000820-Rp for importer@patchew.org; Wed, 08 Jan 2020 21:54:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53471) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ipNt7-00034n-FJ for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ipNt4-0006Pm-Gw for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:33 -0500 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:50669) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ipNt4-0006Oi-Ao for qemu-devel@nongnu.org; Wed, 08 Jan 2020 21:49:30 -0500 Received: by mail-pj1-x1043.google.com with SMTP id r67so478243pjb.0 for ; Wed, 08 Jan 2020 18:49:30 -0800 (PST) Received: from localhost.localdomain (alanje.lnk.telstra.net. [120.151.179.201]) by smtp.gmail.com with ESMTPSA id b4sm5337844pfd.18.2020.01.08.18.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 18:49:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2Otsrpp3foKLNa1SqB84R8O87zHmU0sZwfC3eLGqWD8=; b=l7+pey/eFmdAM/QTyGWQo+Ehd9CIHQROPHKV0opg1OXFqLPK3FiB2IaXrg9GhnTf1r I3zwqx5qP3Nkx7pz+RTM1VIkFfVTgi2oml0KFhUFS/KHhwm4TYrveaDAlp7AkPT5KAsp wpX1h/tRbc14yqnGdLDe0Uyq/uz5S8AH8wkAq0RlpblpOlr8JFJlXfT23MwFshR4JON1 bQAZSUODOmEw7EJIFc0silViTUe+iilJuQQfLEhUFspwFb7ZKDTFN1HnHtuy9MGrzYdx IgUr3yFMSZBwfmEgs7Cfuc2PY+4f6nF8i179cTprNz0aB88HQls0X883JDskoyDeGUOS KsTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2Otsrpp3foKLNa1SqB84R8O87zHmU0sZwfC3eLGqWD8=; b=P2ujKTaKnUjtWJClzkB5mcKyzXkcXX/Yo5ewXSnyRxJmo0Zxi0UcxLAFUzkCiotBtK qigjFqaISmGzfT/bpP6zwgVV1Qf1/kpnZiGazRXEj3hDvMOpPdv9WjjqttwTWnuSWcfr nZaRi3k3aXce77wi3psQpvn+2EIWCGAXDW+oIcV0E6OtlBX9npMex5VvK68Wuv4eX77m GYO7pcwTJNC7KwoKcdzGGuek+xTeGtcsPJrVDyhiswxD7iCEJy5uxWB0L7ag4AGFofZV c6KGpjJNSMltec6VgbF8aBZ6bIWeBxqEVVLTUQ8FjvA0cAAk2W82cijt8ObaXi7i0XPt Herw== X-Gm-Message-State: APjAAAXuY1UIgktfWOyC/u79DvtzJ+4vzoX5DbPM5OlbWQ5EQF1OTJEc pa28L+RarY+bVy4fmro36P4ufU89vvH8/w== X-Google-Smtp-Source: APXvYqzEq9EPGkmd0JZXFcehwH3kk3gxzfUMC9v5NVGRlkgJR1X2cknFPGG7wficvX/DdWF4WVFuSQ== X-Received: by 2002:a17:902:8207:: with SMTP id x7mr8907127pln.286.1578538169014; Wed, 08 Jan 2020 18:49:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 7/9] cputlb: Partially merge tlb_dyn_init into tlb_init Date: Thu, 9 Jan 2020 13:49:05 +1100 Message-Id: <20200109024907.2730-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200109024907.2730-1-richard.henderson@linaro.org> References: <20200109024907.2730-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1043 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair.francis@wdc.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Merge into the only caller, but at the same time split out tlb_mmu_init to initialize a single tlb entry. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/cputlb.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index e60e501334..c7c34b185b 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -97,22 +97,6 @@ static void tlb_window_reset(CPUTLBDesc *desc, int64_t n= s, desc->window_max_entries =3D max_entries; } =20 -static void tlb_dyn_init(CPUArchState *env) -{ - int i; - - for (i =3D 0; i < NB_MMU_MODES; i++) { - CPUTLBDesc *desc =3D &env_tlb(env)->d[i]; - size_t n_entries =3D 1 << CPU_TLB_DYN_DEFAULT_BITS; - - tlb_window_reset(desc, get_clock_realtime(), 0); - desc->n_used_entries =3D 0; - env_tlb(env)->f[i].mask =3D (n_entries - 1) << CPU_TLB_ENTRY_BITS; - env_tlb(env)->f[i].table =3D g_new(CPUTLBEntry, n_entries); - env_tlb(env)->d[i].iotlb =3D g_new(CPUIOTLBEntry, n_entries); - } -} - /** * tlb_mmu_resize_locked() - perform TLB resize bookkeeping; resize if nec= essary * @desc: The CPUTLBDesc portion of the TLB @@ -247,6 +231,17 @@ static void tlb_flush_one_mmuidx_locked(CPUArchState *= env, int mmu_idx) tlb_mmu_flush_locked(desc, fast); } =20 +static void tlb_mmu_init(CPUTLBDesc *desc, CPUTLBDescFast *fast, int64_t n= ow) +{ + size_t n_entries =3D 1 << CPU_TLB_DYN_DEFAULT_BITS; + + tlb_window_reset(desc, now, 0); + desc->n_used_entries =3D 0; + fast->mask =3D (n_entries - 1) << CPU_TLB_ENTRY_BITS; + fast->table =3D g_new(CPUTLBEntry, n_entries); + desc->iotlb =3D g_new(CPUIOTLBEntry, n_entries); +} + static inline void tlb_n_used_entries_inc(CPUArchState *env, uintptr_t mmu= _idx) { env_tlb(env)->d[mmu_idx].n_used_entries++; @@ -260,13 +255,17 @@ static inline void tlb_n_used_entries_dec(CPUArchStat= e *env, uintptr_t mmu_idx) void tlb_init(CPUState *cpu) { CPUArchState *env =3D cpu->env_ptr; + int64_t now =3D get_clock_realtime(); + int i; =20 qemu_spin_init(&env_tlb(env)->c.lock); =20 /* Ensure that cpu_reset performs a full flush. */ env_tlb(env)->c.dirty =3D ALL_MMUIDX_BITS; =20 - tlb_dyn_init(env); + for (i =3D 0; i < NB_MMU_MODES; i++) { + tlb_mmu_init(&env_tlb(env)->d[i], &env_tlb(env)->f[i], now); + } } =20 /* flush_all_helper: run fn across all cpus --=20 2.20.1