From patchwork Thu Dec 12 18:53:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 849741 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1103035wry; Thu, 12 Dec 2024 10:55:15 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWXcHGvERQMLzPCmsuQb21kn1dor4F6+5Ns0TmY0aQjkiI+z7eNVf9ntepbgwBG0zbHNQUuWA==@linaro.org X-Google-Smtp-Source: AGHT+IHAalnLKjXu13yVgvMBUw39h//qd0AB/rVbIqkoSzPBxijI49img6cR52U23zQrDEweESQp X-Received: by 2002:a05:6102:c0d:b0:4af:de38:dff7 with SMTP id ada2fe7eead31-4b25d6d83a1mr5988137.0.1734029715299; Thu, 12 Dec 2024 10:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734029715; cv=none; d=google.com; s=arc-20240605; b=LKIBbMrvwA2uJJMNXq4yt5JN7G8wb8+jYwK1D449tthbYLVb10mH33Xgw6FvdC3Cfi ZTtuE7Av0eS6NNO/FSpeG1hHVZTalUzxC2ajYC3oNTqs/oA+9/Dus4X0plyZIQmBNKmd btk6SpmCc8LwDTpLlAn1FRvmURzKDAbONVFBmuOvk6P9r2ZxioSw99ODsybXzxo9+p/h i1I9bCJAnKFZ9oEArEt4eGWc8J28r8Uob7W4wypELu0SfGbZSFG0VHQqKdTbZLv6nPyi NU2L1qFntMUzR2gzhCNODyKSlt04BUFmmRY+hOxjf8kjdnEPQIX5CCY8638bjVoSQJDl sYsA== 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=wzjyx87cr+skPITGE7mdTMDmXSYN6jRMWc7DyfPZwow=; fh=pnqwS/3OtHZ8LqG0NTMbRB51yilWjG1VtPDdq2UnsIY=; b=UbylALwfWmhLy/Q5tI5gCQEWupHWyb5JLGNNrPFqSUYd8bODbQhOcsr0jiq/4bqW1B EW/zFvGgJB4UCbaDexXUZDL/+nRgLuUkzitqraWKaerED7NTnWhLqpzSvrcf9M92Pxnx Zj/mDedQqMsY5FEh0T2madp/KcAsxzApEmqEhAj2ME0n/5TAT7D9pNpW3j/miQGhDV4F sYj4sGh4zYp4mdwKNKmYqN5uIM7/vDGu7kfgshAqR2+FI/JKOG6TTRN0OicUiVjqm+Cv pf63s2oSwCiaksnrgjWW5f2kOMK+gCsVEQFhQch9yMevZNVib1dS9jB9QYE3jTVTd/Gu Q5Cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YhHQ769n; 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; dara=neutral 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 ada2fe7eead31-4aff7baeddfsi3156055137.747.2024.12.12.10.55.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Dec 2024 10:55:15 -0800 (PST) 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=YhHQ769n; 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; dara=neutral 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 1tLoL2-0005Pt-1E; Thu, 12 Dec 2024 13:55:04 -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 1tLoL0-0005MR-7o for qemu-devel@nongnu.org; Thu, 12 Dec 2024 13:55:02 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLoKy-0006ah-Gw for qemu-devel@nongnu.org; Thu, 12 Dec 2024 13:55:01 -0500 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2eeb4d643a5so797642a91.3 for ; Thu, 12 Dec 2024 10:55:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734029699; x=1734634499; 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=wzjyx87cr+skPITGE7mdTMDmXSYN6jRMWc7DyfPZwow=; b=YhHQ769nD7Xxa6qwvZJ4RlhDc+cy/LyLYfkNVNG6EC7S97dUUBXSJ38dcQdnlc3cxC ypkzCsjKUYxQrtiQyDaVJ+HDWXc1HASzTMlaT8euncCCCQq2UhuiO2V79msxhjdoyyhd 1pc8Rpqw7wzvDYsuaSufgCVAKz5eVxdJVB+mWJqb6dUOlBAbhrf/lfXRL33bhESSFQAI wX0Tr30zgJhIo1LvJX4cCrNbMW6d1ia4st2ToHUUBgRa90zl6aadMZT5RX7LXsB8OxoE woIpJ6d5jMNmsssPbsZ6Gky8fbdpjThCad3eI7a+nzomDxOyDvKtF5UKGuv2XKwMQci0 3KKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734029699; x=1734634499; 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=wzjyx87cr+skPITGE7mdTMDmXSYN6jRMWc7DyfPZwow=; b=sQho6znuCzRm40FxnVaFdraVXkQOrBvVr6xZ5yZx0ik0I0Tm07KIWPN9V+lqK1KFwN SEDwaOkDZwDMzTVj1An7kxFBsfb64qkqie27brq36xN3WIeV9V6HHElOy7b3t7Sje+UB qaYcQp7761voKEUubJvPalUdkxkF074GkIuJH++5MaSp+tGdoII+UxCSFzM9NIPVj2QO MnrAoRet+ERYXQFylV38wGqf3P1zdZJF7fPCKjh1/2IAS370k3WIqIXjc/T8g0sDD85A GKZ8/rTKygEgoLb36ZMHWXZ4pkJX2J3GH13nkPtBaYfH7HPYf1gBpDijNAkw3scNts4v RGnQ== X-Gm-Message-State: AOJu0YxDdGgkm0Kndl0P30+6opZxCwh8hCy+LaKq6lSZV1RcAEpXD/hK PzYTqfOPTx7rYux/UapGLIQQ3Owzg7e6eMF9rWVr4BoVgMR9L11PE0OhCWyDrLOb5bwUrRfnmhP 0 X-Gm-Gg: ASbGnctUd+hFEZbIesjsd8rjwPemQCft0NW/lW9UOKsIfh0OClDRsKnr/D42Uv8JA1t okDoKfif5Htuqr5CIKP85xs9uuiv9CYywWzEgcczS9lD0V2CU7XSZrEXIrp+3unbwmYRV8pXKj0 b0D26t/Z8lhLckg9WRrq/D4GLPLaOALLK5oir8vlqKvQ3eDA0QhpNzNkh4Fu0iDgec4gBU1pSt6 XfFKUgroGUU9HA9u3KrPTlJLt1VlG5CKZdfKIVR3fiC9Dw+rUdIiu6PONka2W0U0OJKSTuESeem mHl+D7sIJeHEsB00eD8HpjoWxhXd/As= X-Received: by 2002:a17:90b:1647:b0:2ee:b2e6:4276 with SMTP id 98e67ed59e1d1-2f12802cf81mr11413213a91.27.1734029698931; Thu, 12 Dec 2024 10:54:58 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f142daeed8sm1740256a91.16.2024.12.12.10.54.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 12 Dec 2024 10:54:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [PATCH 06/18] accel/tcg: Move page_[un]protect() to 'user/page-protection.h' Date: Thu, 12 Dec 2024 19:53:29 +0100 Message-ID: <20241212185341.2857-7-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 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=philmd@linaro.org; helo=mail-pj1-x1031.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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier --- accel/tcg/internal-target.h | 1 + include/exec/translate-all.h | 5 ----- include/user/page-protection.h | 20 ++++++++++++++++++++ accel/tcg/user-exec.c | 2 +- linux-user/elfload.c | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 include/user/page-protection.h diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h index fe109724c68..a03c05315a4 100644 --- a/accel/tcg/internal-target.h +++ b/accel/tcg/internal-target.h @@ -37,6 +37,7 @@ void page_table_config_init(void); #endif #ifdef CONFIG_USER_ONLY +#include "user/page-protection.h" /* * For user-only, page_protect sets the page read-only. * Since most execution is already on read-only pages, and we'd need to diff --git a/include/exec/translate-all.h b/include/exec/translate-all.h index c50661a05d5..039668ff8ac 100644 --- a/include/exec/translate-all.h +++ b/include/exec/translate-all.h @@ -25,9 +25,4 @@ /* translate-all.c */ void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr); -#ifdef CONFIG_USER_ONLY -void page_protect(tb_page_addr_t page_addr); -int page_unprotect(tb_page_addr_t address, uintptr_t pc); -#endif - #endif /* TRANSLATE_ALL_H */ diff --git a/include/user/page-protection.h b/include/user/page-protection.h new file mode 100644 index 00000000000..448c7a03449 --- /dev/null +++ b/include/user/page-protection.h @@ -0,0 +1,20 @@ +/* + * QEMU page protection declarations. + * + * Copyright (c) 2003 Fabrice Bellard + * + * SPDX-License-Identifier: LGPL-2.1+ + */ +#ifndef USER_PAGE_PROTECTION_H +#define USER_PAGE_PROTECTION_H + +#ifndef CONFIG_USER_ONLY +#error Cannot include this header from system emulation +#endif + +#include "exec/translation-block.h" + +void page_protect(tb_page_addr_t page_addr); +int page_unprotect(tb_page_addr_t address, uintptr_t pc); + +#endif diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 4ed6dd19f30..636932303bb 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -25,7 +25,7 @@ #include "qemu/rcu.h" #include "exec/cpu_ldst.h" #include "qemu/main-loop.h" -#include "exec/translate-all.h" +#include "user/page-protection.h" #include "exec/page-protection.h" #include "exec/helper-proto.h" #include "qemu/atomic128.h" diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 471a384b222..521fdde0aa2 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -3918,7 +3918,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) } #ifdef USE_ELF_CORE_DUMP -#include "exec/translate-all.h" +#include "user/page-protection.h" /* * Definitions to generate Intel SVR4-like core files.