From patchwork Thu Apr 24 00:48:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 883796 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp3199237wrs; Wed, 23 Apr 2025 17:56:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWTtCAdGiivhIY/AdLKnJfVUJXoxRlPb8yWyjqyKO4vZM6ecY86+nwYurKuoMAwb93XSjb55A==@linaro.org X-Google-Smtp-Source: AGHT+IFDy30MCYCne5sgvltc3VCYGPdhJhNZ/jMZPd+0zMy6uBDcBDsDUCHY/pJj26HITYQo6L/A X-Received: by 2002:a05:620a:1b92:b0:7c5:5e5b:2ff2 with SMTP id af79cd13be357-7c956f20bfemr140274685a.39.1745456197765; Wed, 23 Apr 2025 17:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745456197; cv=none; d=google.com; s=arc-20240605; b=diaTPnEGgse+yykBVDZYWkLIVpSyf5D80WKGhk98LO1s3lScEbOqoIaMkYgnhNJ5+o CsU48PXbbh+tFxLGW2Rvj/JsTKnUcpiixtggOicKSt+PO0t0VRKvyNnaWlqKUyzug1HP HBXF10KZZ6gQdi27lDxEJOFlwNEdgyibxLYdZT60r+72w6BEUi0quWCW8H/STvttKH0B vc0WRXdhFGO3hCGsQQxjD74/DsGmqxtBzTrXoXP3mOn922BD2XAnpTrBgBb7V6W0LNFO koqxz5G43F/eTVASuJmhvV6RDLIjsxEm4JyijC6EnGoEFRjYew7Di9kiMh2dhGc2XbNP Y5eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=tlaPgaqu+RlzrqR3gxsyz4cZtfxx2Xq8XD/b6ALmxlQ=; fh=vm85eyWrvOAHduw3sqEA+cYBqvHB7M0MHFcRJg7VWOo=; b=Esrcjvg4Hjwa6My9qUKBu1+BB/7n2wnmyw0Fw/euhRJDmbGYeZQY8SdJ/DUdEyYntt O/t9O2eboQYFCIp9fMrA6owx50300h0km5+iTIInn4Sjm4Gx7UWzqqTBHyArdNBPGc3j DJ2/nMAz3SFzZhBRXPLew/SnYexd9aNwCrA0e1uN1miiOqYj81soKheTIedEuGP7FqnM ShDwNshxPEqI2YuQhB/81J/Srjl9sZPd5cRn0kZ4VOESTPNLAHQutcHPkvN3asvG44jS Eizxz2CdJ7DHeCXRwKFX19TqVYqv4oLL9RisF8A3q1P1c6k3HGjnpteE8GaN6iEq/aV7 addA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ioD6t+8o; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c958ee2482si19007285a.641.2025.04.23.17.56.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Apr 2025 17:56:37 -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=fail header.i=@linaro.org header.s=google header.b=ioD6t+8o; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=fail header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7ks2-0007Wp-4d; Wed, 23 Apr 2025 20:55:18 -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 1u7kqX-00015b-TU for qemu-devel@nongnu.org; Wed, 23 Apr 2025 20:53:46 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u7kqF-0004js-Cg for qemu-devel@nongnu.org; Wed, 23 Apr 2025 20:53:29 -0400 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-af5139ad9a2so252104a12.1 for ; Wed, 23 Apr 2025 17:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745456006; x=1746060806; 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=tlaPgaqu+RlzrqR3gxsyz4cZtfxx2Xq8XD/b6ALmxlQ=; b=ioD6t+8oNLjmL/6xIxjXBN+YYBI8qE4O+EqS/CAN1NN0U0Mqn0ZHkdut70Re5dp2d8 9CTdNY4WS93LFEad+JrHpNj5CJcOsioHEm98sQ4YkTT/P+b00mhiX6Tlep7y832ZTYRm p0k9mjubImw6jIdFU+Q2OBYM3WI3fEhQ2xI21fqr88uG9wp2rk+1Loe5oTI7JWM76x5a 3yXopKFD/r/RPIQGvyDtmS3W3QFPuYlg7wRsa0HnzjyUSOOgAmdoKTWmgQP3hTwPTJQT xvN91UnX6kEAjrWoZlXlnZ1SOtJqTkNfGPOqVXBibnWGa1wf5vVGapRWWW81v8QhoGLO s7tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745456006; x=1746060806; 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=tlaPgaqu+RlzrqR3gxsyz4cZtfxx2Xq8XD/b6ALmxlQ=; b=I7G5yTaRM2O/q5/S+uPfXCXQz2oZDaf/0jLZrj37BYzHylrXlzOlEKlHM1Gs9lEP2J MiGiOxS9y83BjamHK4ZIs/p7Fme2cSmeJQ9AdmgpCkDnGVuE12eYLmL0rpG8bLcVYVcL DXYsN8HTscXJtHKPAI5IAmpSZOVcMQAa9MQogOWuwGmUl0h8ZXZc3MGv6SuAukek42yH EX3p0nqXaRkmbhznYOmvPlYTtgmu4NmgdbmpLw3QgMQeBUCSMWUCVV6wtwVIxcO4cqa0 5xg6PwHg11wCZJQIhxyeEviVbZY1vop+GuJB+X98MS2YcJQ4smp0c7eiPfBWHxrlHT/C eb7A== X-Gm-Message-State: AOJu0YwarnA/Jve5A4ZKFW6aDFHawTi0UFxvxPxMC6600NPhKpkSCiPd zDweS/SooNMbn1mwSbpQlEddD6e79K8Kg5T8zqxsRdjr8wUftdJXNj6obwAN27+WeaJa00gcNES J X-Gm-Gg: ASbGncu1Z1IWl601Au6+XjENA5AdUyif159FC0Cdw8/V9RsibEj4nlD1/ZJizwf2KLj 0hZF+c6U+QBJPKzTiSFSXKm3uiZ7xH5kyFEQHjMv5Hm8vZWBGZ6l3zN+tKpGoyol9+AL9CsQdW1 O7KC4Jsj8U6tw7Jy1V1AqB8c2BHy6pHr4oTrI/bdbJ4SS8Wv/dww/4Hcr5HbxcZrmHGdKCcrGQd BvICP7UqAZ+bJMRkiKgKktXKFxZLOGr0RfeEmZh3C5O8BFsjlm2zQ16+i9RZ7FmNrxyPAuNmp3g cxxGAtr7v8f/Ys6LaPVuxhFY3aBnDgI906de0eQkPbksa9GwcHGDz/oPnAri0q2O31phYP+nerF SFkRtONtfmQ== X-Received: by 2002:a05:6a21:3e0a:b0:204:4573:d855 with SMTP id adf61e73a8af0-2044573d9d4mr546203637.9.1745456005880; Wed, 23 Apr 2025 17:53:25 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73e25a6a971sm209353b3a.103.2025.04.23.17.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Apr 2025 17:53:25 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 067/148] include/exec: Move tb_{, set_}page_addr[01] to translation-block.h Date: Wed, 23 Apr 2025 17:48:12 -0700 Message-ID: <20250424004934.598783-68-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250424004934.598783-1-richard.henderson@linaro.org> References: <20250424004934.598783-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move the accessor functions for TranslationBlock into the header related to the structure. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 49 ------------------------------- include/exec/translation-block.h | 50 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 19b0eda44a..fcad3446fe 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -123,55 +123,6 @@ int probe_access_full_mmu(CPUArchState *env, vaddr addr, int size, #endif /* !CONFIG_USER_ONLY */ #endif /* CONFIG_TCG */ -static inline tb_page_addr_t tb_page_addr0(const TranslationBlock *tb) -{ -#ifdef CONFIG_USER_ONLY - return tb->itree.start; -#else - return tb->page_addr[0]; -#endif -} - -static inline tb_page_addr_t tb_page_addr1(const TranslationBlock *tb) -{ -#ifdef CONFIG_USER_ONLY - tb_page_addr_t next = tb->itree.last & TARGET_PAGE_MASK; - return next == (tb->itree.start & TARGET_PAGE_MASK) ? -1 : next; -#else - return tb->page_addr[1]; -#endif -} - -static inline void tb_set_page_addr0(TranslationBlock *tb, - tb_page_addr_t addr) -{ -#ifdef CONFIG_USER_ONLY - tb->itree.start = addr; - /* - * To begin, we record an interval of one byte. When the translation - * loop encounters a second page, the interval will be extended to - * include the first byte of the second page, which is sufficient to - * allow tb_page_addr1() above to work properly. The final corrected - * interval will be set by tb_page_add() from tb->size before the - * node is added to the interval tree. - */ - tb->itree.last = addr; -#else - tb->page_addr[0] = addr; -#endif -} - -static inline void tb_set_page_addr1(TranslationBlock *tb, - tb_page_addr_t addr) -{ -#ifdef CONFIG_USER_ONLY - /* Extend the interval to the first byte of the second page. See above. */ - tb->itree.last = addr; -#else - tb->page_addr[1] = addr; -#endif -} - /* TranslationBlock invalidate API */ void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t last); diff --git a/include/exec/translation-block.h b/include/exec/translation-block.h index 3c69bc71a9..8b8e730561 100644 --- a/include/exec/translation-block.h +++ b/include/exec/translation-block.h @@ -13,6 +13,7 @@ #include "exec/vaddr.h" #ifdef CONFIG_USER_ONLY #include "qemu/interval-tree.h" +#include "exec/target_page.h" #endif /* @@ -157,4 +158,53 @@ static inline uint32_t tb_cflags(const TranslationBlock *tb) bool tcg_cflags_has(CPUState *cpu, uint32_t flags); void tcg_cflags_set(CPUState *cpu, uint32_t flags); +static inline tb_page_addr_t tb_page_addr0(const TranslationBlock *tb) +{ +#ifdef CONFIG_USER_ONLY + return tb->itree.start; +#else + return tb->page_addr[0]; +#endif +} + +static inline tb_page_addr_t tb_page_addr1(const TranslationBlock *tb) +{ +#ifdef CONFIG_USER_ONLY + tb_page_addr_t next = tb->itree.last & TARGET_PAGE_MASK; + return next == (tb->itree.start & TARGET_PAGE_MASK) ? -1 : next; +#else + return tb->page_addr[1]; +#endif +} + +static inline void tb_set_page_addr0(TranslationBlock *tb, + tb_page_addr_t addr) +{ +#ifdef CONFIG_USER_ONLY + tb->itree.start = addr; + /* + * To begin, we record an interval of one byte. When the translation + * loop encounters a second page, the interval will be extended to + * include the first byte of the second page, which is sufficient to + * allow tb_page_addr1() above to work properly. The final corrected + * interval will be set by tb_page_add() from tb->size before the + * node is added to the interval tree. + */ + tb->itree.last = addr; +#else + tb->page_addr[0] = addr; +#endif +} + +static inline void tb_set_page_addr1(TranslationBlock *tb, + tb_page_addr_t addr) +{ +#ifdef CONFIG_USER_ONLY + /* Extend the interval to the first byte of the second page. See above. */ + tb->itree.last = addr; +#else + tb->page_addr[1] = addr; +#endif +} + #endif /* EXEC_TRANSLATION_BLOCK_H */