From patchwork Wed Oct 26 02:10:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 618763 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp112907pvb; Tue, 25 Oct 2022 19:18:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BRJzpcivaxgofifMpWhtTAcd1Y0AGjakDXtDaAQWdqWPrNYXuzeyuie5c4+EHnyYDLATX X-Received: by 2002:a05:620a:4547:b0:6ee:dc16:d67a with SMTP id u7-20020a05620a454700b006eedc16d67amr29551863qkp.23.1666750732802; Tue, 25 Oct 2022 19:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666750732; cv=none; d=google.com; s=arc-20160816; b=RzGFxNoLbHhI9RlnBIcQKKkoAhXXhUissCojSk5kxMwQe2/GUfMOXMfYok1M3WDMEu 6xm+RYUUDgMJsBEyIgvw929YcTzY0VrgBQndtZ6kd1Lsy1/azyi7glIC+/KX+OB3Q/KR SiYI51cyo45h08ohZdOVwqWPamfFG7dOlfGpQ12VGyvAvV12A4+dUA6doM43IUa01knY W2lSp4ff0GFOh7ZurNajHZZ793OHaTw18sgwd6qqO6eTb/RwJK26WVehj+Uc/LBmHbF9 rbRxflHpLyd2dUOIV5kWMJOB+aydeBZcwMDXkwuHoe4Jqx3Fddn+JtTBPNIEilwzKCra dggw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender: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=2O2lTkgF9rzGFGHASrYzq+88u+IS7lRPeNlhOf/ZoVg=; b=StqicAFY9a47sOZfEaUYjtHLrU1DEnhTZbMYRHf31yIccaUC0sE4uznLxO3HfqB7MQ QCTly8eGAvOXyk0AzY50U/015rbdPXwIH+ryBdPMyXasdrHHorIWtuXp3cpO1UE5b0/Y TuZix4tGY6G/WUG2tKkhbxArbOpFah4VZGNwj3F+rZid2vvRUA9PQNIpQDSmn+McYlEK IN1miB2P82gEFLxhbd2yHPsa4b/QLfGXJOrvxt5dDDYJ5KesklvzsUSrEa8zgeIA7dQn ZaB9QYmws3b7xeRs9LWeH6BuoZxfjubJnlsnpkWbiCM/8Z9Y+jOnlF4U07kydysLsUmZ sqGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mNLHtAww; 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 jr1-20020a0562142a8100b004b5136cfe97si2799651qvb.109.2022.10.25.19.18.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Oct 2022 19:18:52 -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=mNLHtAww; 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 1onVtf-0004t1-Pc; Tue, 25 Oct 2022 22:11:59 -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 1onVtb-0004sX-93 for qemu-devel@nongnu.org; Tue, 25 Oct 2022 22:11:58 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onVtZ-00010z-Nb for qemu-devel@nongnu.org; Tue, 25 Oct 2022 22:11:55 -0400 Received: by mail-pf1-x429.google.com with SMTP id w189so12449432pfw.4 for ; Tue, 25 Oct 2022 19:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=2O2lTkgF9rzGFGHASrYzq+88u+IS7lRPeNlhOf/ZoVg=; b=mNLHtAwwYwZa7OlV3Z1/fw7UTst7REdsks7oNNGZT5/pB2TgCxmqoPyMVfY07CAvRq Lkrw3TCmDqh5r361smbgM8CDVC5XIWIsAVpWgKMKvQe/KBpxQj2muAF1lYyotGdyKLbl Asy+JtGtGiw9jUgg6c8p4sSF9DmjP4UggjIrZL/pZFrI2lxR+skmknDyRelmWPqMFUtb 6YlFr8QRfedH2vGUkHve0Xb7VVdoVI+xgEZDvAI0rfb2y6ntYFO49gF0yHapojH7eLpL Jz/cnacz3z1XkzHc4KardiVwR0zfwLvBT4642P89xtynb05dbMhuyE9Rx7SObwKKeYjA ciYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=2O2lTkgF9rzGFGHASrYzq+88u+IS7lRPeNlhOf/ZoVg=; b=uFICcPGJi3ZVS4e7Fe3WxbcaTIeVEluOLjz02cRxrPuv6BYFPdEhHa82o+0VpYmIh6 gpZaFmhwby0XQsFjFdzsdHfZ9jkfHunnGQQOWaexBs4U0gYJmWJl0kE7XksguGMGhLcT ELRCYaXJm4BsCOThdpu/E2y6eL/sG5muSRXXppqh4nmpEFzVM6islujcjsAMsfZiMrNu ZjlhIxapbYX9yKW7lqTIWKSdKGQM5pG02HKsZ19OnCWGPA7fRsbXeqSBpOcK8Jfr1YWP 8cvRG88DvzDpHunGOXAE6S4vU7mPE09c6A+w9+AtOhoEoXuCS5zaHO6oCvqWYQnyihPP qpZA== X-Gm-Message-State: ACrzQf0yDFC3SIoq8NYNRcQ1wegbBOcWHDv50qZ9Rr4uBxrtc1SrfCPM +GNN4813p7840IjfgVoAzVrn/6cTu7BPHMaG X-Received: by 2002:a05:6a00:1414:b0:563:ae66:3103 with SMTP id l20-20020a056a00141400b00563ae663103mr41258678pfu.17.1666750312851; Tue, 25 Oct 2022 19:11:52 -0700 (PDT) Received: from stoup.hotspotlogin.services ([103.100.225.182]) by smtp.gmail.com with ESMTPSA id o29-20020a635d5d000000b0043c9da02729sm1897833pgm.6.2022.10.25.19.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 19:11:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 10/47] accel/tcg: Split out PageDesc to internal.h Date: Wed, 26 Oct 2022 12:10:39 +1000 Message-Id: <20221026021116.1988449-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221026021116.1988449-1-richard.henderson@linaro.org> References: <20221026021116.1988449-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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 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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- accel/tcg/internal.h | 31 +++++++++++++++++++++++++++++++ accel/tcg/translate-all.c | 31 +------------------------------ 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h index dc800fd485..62da49ed52 100644 --- a/accel/tcg/internal.h +++ b/accel/tcg/internal.h @@ -11,6 +11,37 @@ #include "exec/exec-all.h" +/* + * Access to the various translations structures need to be serialised + * via locks for consistency. In user-mode emulation access to the + * memory related structures are protected with mmap_lock. + * In !user-mode we use per-page locks. + */ +#ifdef CONFIG_SOFTMMU +#define assert_memory_lock() +#else +#define assert_memory_lock() tcg_debug_assert(have_mmap_lock()) +#endif + +typedef struct PageDesc { + /* list of TBs intersecting this ram page */ + uintptr_t first_tb; +#ifdef CONFIG_USER_ONLY + unsigned long flags; + void *target_data; +#endif +#ifdef CONFIG_SOFTMMU + QemuSpin lock; +#endif +} PageDesc; + +PageDesc *page_find_alloc(tb_page_addr_t index, bool alloc); + +static inline PageDesc *page_find(tb_page_addr_t index) +{ + return page_find_alloc(index, false); +} + TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, uint32_t flags, int cflags); diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 42385fa032..86848c6743 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -65,30 +65,6 @@ /* make various TB consistency checks */ -/* Access to the various translations structures need to be serialised via locks - * for consistency. - * In user-mode emulation access to the memory related structures are protected - * with mmap_lock. - * In !user-mode we use per-page locks. - */ -#ifdef CONFIG_SOFTMMU -#define assert_memory_lock() -#else -#define assert_memory_lock() tcg_debug_assert(have_mmap_lock()) -#endif - -typedef struct PageDesc { - /* list of TBs intersecting this ram page */ - uintptr_t first_tb; -#ifdef CONFIG_USER_ONLY - unsigned long flags; - void *target_data; -#endif -#ifdef CONFIG_SOFTMMU - QemuSpin lock; -#endif -} PageDesc; - /** * struct page_entry - page descriptor entry * @pd: pointer to the &struct PageDesc of the page this entry represents @@ -445,7 +421,7 @@ void page_init(void) #endif } -static PageDesc *page_find_alloc(tb_page_addr_t index, bool alloc) +PageDesc *page_find_alloc(tb_page_addr_t index, bool alloc) { PageDesc *pd; void **lp; @@ -511,11 +487,6 @@ static PageDesc *page_find_alloc(tb_page_addr_t index, bool alloc) return pd + (index & (V_L2_SIZE - 1)); } -static inline PageDesc *page_find(tb_page_addr_t index) -{ - return page_find_alloc(index, false); -} - static void page_lock_pair(PageDesc **ret_p1, tb_page_addr_t phys1, PageDesc **ret_p2, tb_page_addr_t phys2, bool alloc);