From patchwork Mon Dec 11 21:19:59 2023 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: 752546 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1549605wrs; Mon, 11 Dec 2023 13:29:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMYuwmR6/Ytfi5gsa/q5Ido87bcg33ZtkCyeHU6pgYuAjU3O0xyQnPgEAagkxsuw/Md1TV X-Received: by 2002:a0d:ea43:0:b0:5d7:1941:355d with SMTP id t64-20020a0dea43000000b005d71941355dmr3401050ywe.68.1702330149785; Mon, 11 Dec 2023 13:29:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702330149; cv=none; d=google.com; s=arc-20160816; b=a5Ax6KWwKrhsLM/Sl9W680/DaNCapgeOTFVKyMp3NMkbFAwcJlyAWFESpunKrApXdo borIw+XYUuGN5VxwG16XpeSKHzx+dvn25LQjcHS1e4mad0brymNNQzWwwgTeKYMHJ/ts Gj3x6hCW3JMft1RZcJ+qWNRBQ3UtgPn0Tp7PvPxsNu6TUADyCzIade4U7p6aFihSV4t5 MlrgJSbTRUfSQ3/evcZ3LHz5z/pY4qDqBEMTDafURidSGPrNXavkxT4Ps9A30OkltyKx uBMV+7rrELrKrOB5bLiZv1m7lCOGYy3Osnbj5Ze3f5C7lBQ8bi5mgyiKiQQAsc/ljFyE MOgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=fz8HKxM7VVSIi3osZUv3wojb8Ys1Hua/IsYgZ7swcCg=; fh=ogyy/JNPeEdVnpId/GDwwe0pe92olXpzP0mQGo1nC0s=; b=uTEdYcu7fxan8K+sZXkB0tEhChJnpWFGPOnIkxkUZ+mRI7sl8VD4gIj+B2ryeA/te3 dOggOyKL2RVsFP0cOGURmH/mTuF+Xg0jyZkPFvZEAmlkaZg2WbAx2bvIkJUJzu2nB8+s gUUfvRjVHmc1H4dYmrDCEbXsTlg5rksCT1t4kEQ/J7vLgbByRhIU0VknjKAK0pvqYEj9 HhBxS6WMvavCsxPBcLfm+wHJrPeNEntiGKbA5CnOO7ZGnBjgyJIVSUo6OrPaLXxvCLj8 +FahEziZBjn5YTAi/zMay6YYFfJjyQoHjAcUd5pFIfLVeMH2czC2bu0Bbxc3piRlEC06 q7wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQP3i49J; 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 eb1-20020ad44e41000000b0067ae55fd9f3si8925402qvb.169.2023.12.11.13.29.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Dec 2023 13:29:09 -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=AQP3i49J; 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 1rCnk9-0005Yh-6i; Mon, 11 Dec 2023 16:23:13 -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 1rCnk7-0005Kz-1N for qemu-devel@nongnu.org; Mon, 11 Dec 2023 16:23:11 -0500 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rCnk4-0005sM-SC for qemu-devel@nongnu.org; Mon, 11 Dec 2023 16:23:10 -0500 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a1f8a1e9637so425099266b.1 for ; Mon, 11 Dec 2023 13:23:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702329787; x=1702934587; 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=fz8HKxM7VVSIi3osZUv3wojb8Ys1Hua/IsYgZ7swcCg=; b=AQP3i49Jx/MZR9E0744/rwo1Ou+6QctPa4kcMbfLGvQYgeFDX31El/X4bseM/hQ8g8 AHbr4JKSfHCryjyRjNodZwE66BxtprRw4+LwDGrv8TcEqpd9FHtfdhMw+ioBXuaYU6gc q5b8g8qvzdJ44DQwNWoL3IV4tROPgPpG6F2nCHgwKGmQY3P3lptvdo6TfVRW37xVzl89 M0f08Mil3zhpCZec0kiC0SUO3OHAE/R6RYTXXgVg8r8C3NbDP4CXycZFcbFVfwDMVWYN VOeqpP8/PfXd39wmYtnoRYUiUkTFpugtNuDxJzNP8AVI8K07BWReL8UWKsEp4QFHPoED lsUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702329787; x=1702934587; 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=fz8HKxM7VVSIi3osZUv3wojb8Ys1Hua/IsYgZ7swcCg=; b=W31nGdZuYM5KxFa6Wj4ZkCc9PP0vB0gjmgFwn1cuxfTYrj7sy3iG4JVcUWnSQ5fORb Lcpy89anCySsiLANftjWylSzTH64pUEOuAg7/q3bH5K+hS0e1enEz3fwhmE6yE2c3lyB vinpAV5oYZI5R1BMG/0/TPcQnEnCUxx4aWpxYpWvQ85lNN/QXFuYVU30YTiuzmxlszD7 4buhE8ZEhMylt54V8Vyi3KYVM8h6h8yealroqGfVmnBOmGIwMmCNm1T9fx4SCYRloj2Q vFaba3BytGFj6O2aTppdQc+e2233cF6GDGNlk0/j5z3DW2iDaSKAgX5EyeaTLhepBsVi EEMA== X-Gm-Message-State: AOJu0Ywg/KgxpYNbk0cEiiPcCInk1ZkAGGRxQgfwlu4/Sdf6WB1G0pjG 9L86iVA8fwjILJnsNyWBM6l1TSqwRAyomBT6b7dsxg== X-Received: by 2002:a17:907:2723:b0:a1f:8149:558c with SMTP id d3-20020a170907272300b00a1f8149558cmr4160576ejl.30.1702329787041; Mon, 11 Dec 2023 13:23:07 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id qo14-20020a170907874e00b00a1f6737be65sm5109488ejc.82.2023.12.11.13.23.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 11 Dec 2023 13:23:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , Peter Xu , Liu Zhiwei , Peter Maydell , Mark Cave-Ayland , Eduardo Habkost , qemu-arm@nongnu.org, Paolo Bonzini , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-riscv@nongnu.org, David Hildenbrand , Warner Losh , Claudio Fontana , Brian Cain , Daniel Henrique Barboza , Richard Henderson , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Kyle Evans , Laurent Vivier Subject: [PATCH 22/24] exec/cpu-all: Restrict inclusion of 'exec/user/guest-base.h' Date: Mon, 11 Dec 2023 22:19:59 +0100 Message-ID: <20231211212003.21686-23-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231211212003.21686-1-philmd@linaro.org> References: <20231211212003.21686-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=philmd@linaro.org; helo=mail-ej1-x634.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Declare 'have_guest_base' in "exec/user/guest-base.h". Very few files require this header, so explicitly include it there instead of "exec/cpu-all.h" which is used in many source files. Assert this user-specific header is only included from user emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/exec/cpu-all.h | 3 --- include/exec/user/guest-base.h | 6 ++++++ bsd-user/main.c | 1 + linux-user/elfload.c | 1 + linux-user/main.c | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 2d568ae4f0..5b75d04ff6 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -74,9 +74,6 @@ #if defined(CONFIG_USER_ONLY) #include "exec/user/abitypes.h" -#include "exec/user/guest-base.h" - -extern bool have_guest_base; /* * If non-zero, the guest virtual address space is a contiguous subset diff --git a/include/exec/user/guest-base.h b/include/exec/user/guest-base.h index afe2ab7fbb..cf40151360 100644 --- a/include/exec/user/guest-base.h +++ b/include/exec/user/guest-base.h @@ -7,6 +7,12 @@ #ifndef EXEC_USER_GUEST_BASE_H #define EXEC_USER_GUEST_BASE_H +#ifndef CONFIG_USER_ONLY +#error Cannot include this header from system emulation +#endif + extern uintptr_t guest_base; +extern bool have_guest_base; + #endif diff --git a/bsd-user/main.c b/bsd-user/main.c index e6014f517e..c331d727e1 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -36,6 +36,7 @@ #include "qemu/help_option.h" #include "qemu/module.h" #include "exec/exec-all.h" +#include "exec/user/guest-base.h" #include "tcg/startup.h" #include "qemu/timer.h" #include "qemu/envlist.h" diff --git a/linux-user/elfload.c b/linux-user/elfload.c index cf9e74468b..f9e9ac1760 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -6,6 +6,7 @@ #include #include "qemu.h" +#include "exec/user/guest-base.h" #include "user-internals.h" #include "signal-common.h" #include "loader.h" diff --git a/linux-user/main.c b/linux-user/main.c index 0cdaf30d34..84691d707b 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -38,6 +38,7 @@ #include "qemu/help_option.h" #include "qemu/module.h" #include "qemu/plugin.h" +#include "exec/user/guest-base.h" #include "exec/exec-all.h" #include "exec/gdbstub.h" #include "gdbstub/user.h"