From nobody Fri Dec 19 04:27:49 2025 Delivered-To: importer@patchew.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=1734029791; cv=none; d=zohomail.com; s=zohoarc; b=H42/ltz2lI5y3WUpiGiUJ6pMuhyCp68+WeInn8ExzNo0klVrzbDd3Lmmn3NY9vpiqZFdhV1wRTy71v/rEY4YOIwIqkQk7iZn1ZA8lqipuJHy/6UYlZMfgRxC0P2hlMM33i7yj39oo7ww5t8MdCb1bzNRRgzbMiSYz3p7Gq8mXEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734029791; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rY7v3gnKlkSHCmEQoYs8O0U0xsJ45+WLP88dw8tMIX4=; b=idTVLebgpFfcpSHtGr7UTgK7PiT7ACA0O3RPfY0qaCRa5+kM/ONLeZ/HjpCyw8UrKsX1U/U4PjrEXzg6BczqWmqaMx7ErjV+oQ711KVzDtchTW7VMCFSHUmR3NRPmdU64yQx1WFelgdKShRkEzwBDEVZUZqFfST89lntpCgXcS4= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1734029791151629.3855664761264; Thu, 12 Dec 2024 10:56:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLoMB-0000VW-VP; Thu, 12 Dec 2024 13:56:16 -0500 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 1tLoM9-0000II-KU for qemu-devel@nongnu.org; Thu, 12 Dec 2024 13:56:13 -0500 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLoM4-0006rv-Nt for qemu-devel@nongnu.org; Thu, 12 Dec 2024 13:56:13 -0500 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7fd51285746so645565a12.3 for ; Thu, 12 Dec 2024 10:56:08 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725e62bb302sm8328220b3a.139.2024.12.12.10.56.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 12 Dec 2024 10:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734029766; x=1734634566; 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=rY7v3gnKlkSHCmEQoYs8O0U0xsJ45+WLP88dw8tMIX4=; b=twmqpiSxb3y7EY05D7DASlTZDg9F+7CguE6NRWWKjGeX4DbBBwyPM5rL8u2Dtgkf+r GyZ8PEPvfdLlzolDSssPGfxCwXBqgi+BqS1dfrRVozfPksdwQZ+dMo5FO66IDRaYO0Ij ZTpXJxLZFFjtF4LYSuzqtlWmocNOTSeEh+SaP/XZrnlZCJ1m2GqTPxkS5PjDti4VZR3V xvE+bWLRWy7atriEmyUBpeq8KxjAoY1MbZ3qpgFlWt5HLSDT9C+TZIfvHXfXJBd4+HXK 0xGqkXSmNoBtwu5iEF7Njns6FNwwtvM/vtETEbueHGuM5+QuywdExGIs7CTFrMI0NUmo 6Jew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734029766; x=1734634566; 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=rY7v3gnKlkSHCmEQoYs8O0U0xsJ45+WLP88dw8tMIX4=; b=dWxYonaF9SFy3a4cjA72BkopyVSCJdAWBxAW9pMcXKwqU5CT8bzmM8XSspo8sQJIwx xrf9T1PPLqB0C/EwFT3DJ2PokdTMF8mnlRZY+MzZjSDwf+jjtRRlOHzkNoYYPu4gN4vj aZp6Pz4+48U8WD93A2XqbLdt0Ux1mEvmcTGVXMlxzgzJcmDALMNbvDKQxfzAOir6oakn Tx8xxzvipNIwEdRVgiupd5RPe/J9IrCRxzA3EyG6CLWMeQF3hdLFkFL0NOh69faXdTa4 sTZjfTXdAi9f5IJ5P8AodEdSposCeRJMLmXipqTNxFGS/vOe8ZRV+BaGhalQiu56HRei qI6g== X-Gm-Message-State: AOJu0YyC31d1YqEXNwzRgir9yLko5QKZLmokzbO7C+BqKgeR99i0EeLm UrwcQPyDF18MbFb0QXwUJiFEQIzk+6mEO2VjDs9fqbMq7qOeIKm2e3oBHoPOQfKPQoAxnC+OR5/ T X-Gm-Gg: ASbGnctptcZ+eDXzhmbACFR2T+AebhRIgyi3ME3OIdTzW7TrqhyFnS5MHVhKWmee/Qh kWWztJbz2pbocrLmbRoxQIZCq2mL+5SBNCgdriVfjMjzNFWkD337eQCEMmdDG+Y8pLZGKIY86gb yKq8C5K4RyMCJ2K9fxEfv4a8xP1+8VGETrVOJvLSSRuUFRV4LdPWWMaaPPQtZoIuTQzOJx63gkH IdXkGndfajex1cpu/wcZfOWXj2Fe1altVi4SrlSTZrJcjTcku3Mo2kmb+hCzQZmVPlvnAqs+lav HhliL+YS+jjbIvALABxjRlpik6z5rYE= X-Google-Smtp-Source: AGHT+IGVriHepJXLt9Oqlkoyemt+3qI5X+c5gNt7ub/QiFf6Yux5eB90Xk6ywMjw2pELro7JQeUIoQ== X-Received: by 2002:a05:6a21:390:b0:1e0:d2f5:6eca with SMTP id adf61e73a8af0-1e1dac0ef09mr1813449637.46.1734029766200; Thu, 12 Dec 2024 10:56:06 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 12/18] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (2/4) Date: Thu, 12 Dec 2024 19:53:35 +0100 Message-ID: <20241212185341.2857-13-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241212185341.2857-1-philmd@linaro.org> References: <20241212185341.2857-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=philmd@linaro.org; helo=mail-pg1-x532.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1734029793002116600 Move declarations related to page protection under user emulation from "exec/cpu-all.h" to "user/page-protection.h". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier --- bsd-user/bsd-mem.h | 1 + include/exec/cpu-all.h | 55 -------------------------------- include/user/page-protection.h | 57 ++++++++++++++++++++++++++++++++++ target/arm/tcg/mte_helper.c | 3 ++ 4 files changed, 61 insertions(+), 55 deletions(-) diff --git a/bsd-user/bsd-mem.h b/bsd-user/bsd-mem.h index eef6b222d9e..f5ec0de24ca 100644 --- a/bsd-user/bsd-mem.h +++ b/bsd-user/bsd-mem.h @@ -57,6 +57,7 @@ =20 #include "qemu-bsd.h" #include "exec/page-protection.h" +#include "user/page-protection.h" =20 extern struct bsd_shm_regions bsd_shm_regions[]; extern abi_ulong target_brk; diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 3d97323893b..86cd40020c9 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -130,21 +130,6 @@ extern const TargetPageBits target_page; =20 int page_get_flags(target_ulong address); =20 -/** - * page_set_flags: - * @start: first byte of range - * @last: last byte of range - * @flags: flags to set - * Context: holding mmap lock - * - * Modify the flags of a page and invalidate the code if necessary. - * The flag PAGE_WRITE_ORG is positioned automatically depending - * on PAGE_WRITE. The mmap_lock should already be held. - */ -void page_set_flags(target_ulong start, target_ulong last, int flags); - -void page_reset_target_data(target_ulong start, target_ulong last); - /** * page_check_range * @start: first byte of range @@ -157,46 +142,6 @@ void page_reset_target_data(target_ulong start, target= _ulong last); */ bool page_check_range(target_ulong start, target_ulong last, int flags); =20 -/** - * page_check_range_empty: - * @start: first byte of range - * @last: last byte of range - * Context: holding mmap lock - * - * Return true if the entire range [@start, @last] is unmapped. - * The memory lock must be held so that the caller will can ensure - * the result stays true until a new mapping can be installed. - */ -bool page_check_range_empty(target_ulong start, target_ulong last); - -/** - * page_find_range_empty - * @min: first byte of search range - * @max: last byte of search range - * @len: size of the hole required - * @align: alignment of the hole required (power of 2) - * - * If there is a range [x, x+@len) within [@min, @max] such that - * x % @align =3D=3D 0, then return x. Otherwise return -1. - * The memory lock must be held, as the caller will want to ensure - * the returned range stays empty until a new mapping can be installed. - */ -target_ulong page_find_range_empty(target_ulong min, target_ulong max, - target_ulong len, target_ulong align); - -/** - * page_get_target_data(address) - * @address: guest virtual address - * - * Return TARGET_PAGE_DATA_SIZE bytes of out-of-band data to associate - * with the guest page at @address, allocating it if necessary. The - * caller should already have verified that the address is valid. - * - * The memory will be freed when the guest page is deallocated, - * e.g. with the munmap system call. - */ -void *page_get_target_data(target_ulong address) - __attribute__((returns_nonnull)); #endif =20 CPUArchState *cpu_copy(CPUArchState *env); diff --git a/include/user/page-protection.h b/include/user/page-protection.h index ea11cf9e328..d21fab1aaf9 100644 --- a/include/user/page-protection.h +++ b/include/user/page-protection.h @@ -18,6 +18,63 @@ =20 void page_protect(tb_page_addr_t page_addr); int page_unprotect(tb_page_addr_t address, uintptr_t pc); + +/** + * page_set_flags: + * @start: first byte of range + * @last: last byte of range + * @flags: flags to set + * Context: holding mmap lock + * + * Modify the flags of a page and invalidate the code if necessary. + * The flag PAGE_WRITE_ORG is positioned automatically depending + * on PAGE_WRITE. The mmap_lock should already be held. + */ +void page_set_flags(target_ulong start, target_ulong last, int flags); + +void page_reset_target_data(target_ulong start, target_ulong last); + +/** + * page_check_range_empty: + * @start: first byte of range + * @last: last byte of range + * Context: holding mmap lock + * + * Return true if the entire range [@start, @last] is unmapped. + * The memory lock must be held so that the caller will can ensure + * the result stays true until a new mapping can be installed. + */ +bool page_check_range_empty(target_ulong start, target_ulong last); + +/** + * page_find_range_empty + * @min: first byte of search range + * @max: last byte of search range + * @len: size of the hole required + * @align: alignment of the hole required (power of 2) + * + * If there is a range [x, x+@len) within [@min, @max] such that + * x % @align =3D=3D 0, then return x. Otherwise return -1. + * The memory lock must be held, as the caller will want to ensure + * the returned range stays empty until a new mapping can be installed. + */ +target_ulong page_find_range_empty(target_ulong min, target_ulong max, + target_ulong len, target_ulong align); + +/** + * page_get_target_data(address) + * @address: guest virtual address + * + * Return TARGET_PAGE_DATA_SIZE bytes of out-of-band data to associate + * with the guest page at @address, allocating it if necessary. The + * caller should already have verified that the address is valid. + * + * The memory will be freed when the guest page is deallocated, + * e.g. with the munmap system call. + */ +__attribute__((returns_nonnull)) +void *page_get_target_data(target_ulong address); + typedef int (*walk_memory_regions_fn)(void *, target_ulong, target_ulong, unsigned long); =20 diff --git a/target/arm/tcg/mte_helper.c b/target/arm/tcg/mte_helper.c index 9d2ba287eeb..ae037dc9143 100644 --- a/target/arm/tcg/mte_helper.c +++ b/target/arm/tcg/mte_helper.c @@ -23,6 +23,9 @@ #include "internals.h" #include "exec/exec-all.h" #include "exec/page-protection.h" +#ifdef CONFIG_USER_ONLY +#include "user/page-protection.h" +#endif #include "exec/ram_addr.h" #include "exec/cpu_ldst.h" #include "exec/helper-proto.h" --=20 2.45.2