From patchwork Fri Dec 20 16:15:18 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: 852445 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp2149401wrq; Fri, 20 Dec 2024 08:26:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVifxFRgicvivU+vxrQvaJnMYWKa50+Qyy8NxRJV/tauEHc5m55Z/EEfEhXOrF41LTpXPfiBg==@linaro.org X-Google-Smtp-Source: AGHT+IFlPF4ef9EbQrTp/bBnc3CiQxnJimdOAE+SvCUS27x9Db56iEH3M6TBZq8uqwI7eWdbwDZ/ X-Received: by 2002:a05:620a:2487:b0:7b6:cedf:1b48 with SMTP id af79cd13be357-7b9ba70310cmr492130385a.3.1734711983293; Fri, 20 Dec 2024 08:26:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734711983; cv=none; d=google.com; s=arc-20240605; b=Tdkyf/llF3X6/HEVgaJjNtJGdKm6WqJwFBZFlqz96osKG4Pyln0Itm2PzNQAHlvJx8 kGvTo1rMDnPwWrvtLgDUmNGJhrepKMowGZ4mEMam0a9H8ojKcEi0Mg8vZpE9s+XlhwiM hbVlrwEWy0ySREOTr23L197pK6CpYLwrRMXD4/dF64OWUGsU5CauKpMXcAzot2S76bfU tfnjWmZP0nKsnr8QfkfQZ0oOp8/9BLPLxiDIKrUaPDO9aolamLM22LaOo8AnJl7nzFIL Wqgte/bp2vrFwvohB8zZ4MnRI7eyZOxGx+xTGV6Rr3v6ZCM2YP58RoA7oLeA8KwXwiYV f7UA== 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=VsSwq4xHHCQtvJtv5T9NcsaTQceZkYJfKQ5PctlxJTo=; fh=jDzlsuVfu9yneD3KBOEB0ptb3EY+AtxVXbt7jaKLMXk=; b=dfHwem11t7H1ZoByPbn8oKieQRo+uAxrHhXp1pVUbcF3LLMBKLzDHfZCn2eBR3Fst8 gmaLuGb3w25ZIapyq13wUywY+qjjYHPg0zbgYCJ+eKgc2zFMTMQ1NqIaFVv+MGGu/djO UWRul4a+r0yZukvIyZCCd2CD301YFq3d0OF/KWS3tsMjx2lQD2ILZLymN8qYaB+EmUeu WJFdUViiMG9ARiGKxVBGTXLTf9GjrNumSpIo6caDoX/K/Tf41MPg3ruN7v44maH90THF +oJNvyXGNsrc4Hf6EAYDYMJTHg6Iit80Ao9wXCjFvWz/iC7oXxMaWWU36zzXu04DRMvf xFSg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U0hhFJnG; 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-4b2bfba262esi1422651137.549.2024.12.20.08.26.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Dec 2024 08:26:23 -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=U0hhFJnG; 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 1tOfiZ-0002Jm-RK; Fri, 20 Dec 2024 11:19:11 -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 1tOfhU-00087o-DV for qemu-devel@nongnu.org; Fri, 20 Dec 2024 11:18:05 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOfhR-00086R-Nq for qemu-devel@nongnu.org; Fri, 20 Dec 2024 11:18:03 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3863c36a731so1694420f8f.1 for ; Fri, 20 Dec 2024 08:17:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734711477; x=1735316277; 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=VsSwq4xHHCQtvJtv5T9NcsaTQceZkYJfKQ5PctlxJTo=; b=U0hhFJnGzOsO7Nkux6Rd+2HWf/nBgSmYx14MdGDriYM1Lwzp3UgPLy5HdKQbmtv72y mR3/1A0ZrGjSi8UUNwUtKNUF7dYorOoIYUF5h2Q/IUQ5nmPMObLTdvbN2qW/r6hxCT11 lX7Zr9zsMtgYi79BzLII5XGioAbswUwzxZl1jxZQI9i9J+jOfik0RsXkzLHpPsmZxZ5G s5WCzeH0iJ5o1fHP3FL+ZHfSI6ixDIxUEvAAQsybMExgLXxqUxMKtl0N8wHRKUdMdali iDaC4JWsFqTzifXlKPZFmSVq2rS81XmqZXUeL63RPnGL+OP9Qfg3HJpXF3eRes8WYpBP wQZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734711477; x=1735316277; 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=VsSwq4xHHCQtvJtv5T9NcsaTQceZkYJfKQ5PctlxJTo=; b=U/rQwNU0B9kTrCvrDFlYbo3khz22PCzhAYTxJSAHFRItV6oLIMcdcD9rEBV08+QsnL 0ZnWQCzXJYFxn0Pj4qD7LIYx1Y2HoOLHRUahZsHgd66tZ7pDtgQgKfgB8GDrsLFjIYJv e80ZsNVCiHHj4DDP6moNPLrpRHgD3t3DGSSvgicLpsXV8ek+BL5kg29ewu/voMvndNav IdQ/+WkcJJuWfmQ3fV8skg9zE1cix8Z05ZdWHDfpt36OlJdUEcxDIVbgb9EOw2VUYT5r npq7DpUSyWQAmOuaqq1UrDB78dooDBkxlZ36LrBhB7Kwbrfee1tiw4DSUcI1NLee329Z M7iQ== X-Gm-Message-State: AOJu0YwstWSXZKPRheza8wVb0Sqy2tznQ+6EnScbHLqV3z/0l+mYjrU/ Rdh37dfJ9h3bx5VQE12Ymtpz8ckbyowFaD/S4dLUzJqicnpFYQalaMKPNhYnqEw8Q50sWvR3sPF 6 X-Gm-Gg: ASbGnctLndPX+fBad5kklsi18euWKWgW83PZ0tqSDNXSwBATc/9sqgu5Dn32R6PJRdZ uEHQ+fF6RjQtk+EXZskDJx/5F6HcyG3vcW3LUbdcAcD704pmMifyDhTA5kcamx+LKIHxxdIbE0l Mm85bmGDJ5R35NgswgAsspenfA/Ob+8oaRIt9dnmXV22pGczAd2gOpqO+MhZ6EZPnwMpQvd5uLy 2FJoe+nI1BwNheKMMQBw5CznQ3pE35LiB+RgvhDh8+SWBuFzfHediFoQF4o3GB/w2bzABR+PoM= X-Received: by 2002:a05:6000:178c:b0:381:b68f:d14b with SMTP id ffacd0b85a97d-38a223f75c8mr3729758f8f.45.1734711476897; Fri, 20 Dec 2024 08:17:56 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8471dcsm4418155f8f.48.2024.12.20.08.17.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Dec 2024 08:17:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Richard Henderson Subject: [PULL 27/59] accel/tcg: Move page_[un]protect() to 'user/page-protection.h' Date: Fri, 20 Dec 2024 17:15:18 +0100 Message-ID: <20241220161551.89317-28-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220161551.89317-1-philmd@linaro.org> References: <20241220161551.89317-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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 Reviewed-by: Richard Henderson Message-Id: <20241212185341.2857-7-philmd@linaro.org> --- 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..effd3ab47ef 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -8,6 +8,7 @@ #include "qemu.h" #include "user/tswap-target.h" +#include "user/page-protection.h" #include "exec/page-protection.h" #include "user/guest-base.h" #include "user-internals.h" @@ -3918,7 +3919,6 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) } #ifdef USE_ELF_CORE_DUMP -#include "exec/translate-all.h" /* * Definitions to generate Intel SVR4-like core files.