From nobody Wed Nov 19 20:16:35 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=1702384939; cv=none; d=zohomail.com; s=zohoarc; b=SJOV8LX0fmBtbgBVVe0O9hWYvKLcRTC2SMCxA/m8qZbu+zWLDLKtbUlpzqROYyc8wN8bJkX6ch6oiTXr+ja3ikzXCqRiyY30tXVds2DdEHEqFI4l8IVNWvNBUSPcRC32j5hwTlUVVp50FItqUpCS2nAprznqcRfR8SKE24Veemw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1702384939; 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=UFHPuaJlGIZrE/w+wBk6CARRnPU80SYEtnM2ju+CrtY=; b=YQ/yswYraUPGESvqCp0tbpl6f+IZrs+Rma3OUHbymJve35k2z+DwszfisDv33mBiYKpN27ZGTdQb4i2GNMbP8GgGY4H7rFJvVHr4KAIr24ThJbuaTLMYNR9mzaCX14XFCxdPiOLYAzvC7Qacx56JirUsk8LGQefwY28d7z46BlE= 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 1702384939981993.9655333260504; Tue, 12 Dec 2023 04:42:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rD20m-0004dG-1g; Tue, 12 Dec 2023 07:37:20 -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 1rD20B-0003f3-1F for qemu-devel@nongnu.org; Tue, 12 Dec 2023 07:36:45 -0500 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rD206-0000qB-FX for qemu-devel@nongnu.org; Tue, 12 Dec 2023 07:36:42 -0500 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a1915034144so742353966b.0 for ; Tue, 12 Dec 2023 04:36:35 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id ll9-20020a170907190900b00a1cbb289a7csm6155242ejc.183.2023.12.12.04.36.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Dec 2023 04:36:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702384594; x=1702989394; 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=UFHPuaJlGIZrE/w+wBk6CARRnPU80SYEtnM2ju+CrtY=; b=ThPacPTpcNdd5Qb/M3Onu6B3EWSayIYppvhq421UAml+0njkTiCuas2ahYCFA437vO n3UuEAX6oeclRmhiAyxpCVSGgEXTmZaPuAF0wN841n6KQXEkd0wPzP0d0T7S7eDWACrc rUyUQLciXYzpeJ2zPh0Er3VwUluhZuvChyo2icGHIdVmvLNLNeX4hvbBZ7co1s1JNS65 H7umbEySev1OgxEjrrAvAPri6uS9f1RVdE0albT4CDNgCpTraJ0eLAZ/saSXbrHq6JTz fIMm39ZjIeClKz/MuO0W730eYgXXVCz5tBT397UCRwSaolyfnOqkhHQhb5M4LEwipAHx Wy4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702384594; x=1702989394; 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=UFHPuaJlGIZrE/w+wBk6CARRnPU80SYEtnM2ju+CrtY=; b=O22/keaD6pXtyOSFL0ELaqUMKYryWQ8QSYrVjD1jjFzZmcGW73zfT/cIHte4BJC3i+ BU7rvmKYiH8hzLYXEZk89k/VX8a44GZhJzc/7FDsh8pIVyNEzC/bE0HRodmRx6NX/rNy 2liedAEa8jgoZ8XUhRcppm7jbaHAxEGz5dkdmWIb74MK+EIZkTzlqOBizAyJq50lhgXe MGfHyirCfuY8ygYhu5Za5FU0npMR5QNloSUxuq8B6IxnUz+NnYLoj/r6H+Y68506CjMI 9f+mCxbmwtuBMYIEHSBYqnfteNh1uKHoZeA2FL2yPzu0I0QOZFWg8VQrR5PDTPC9TjXk U8cg== X-Gm-Message-State: AOJu0YxaIRhY9c/Xcy22tPH79PqPexEj7rvy+TXuduK0iVAbNdfNPGra huF8OjrgUYma3V6NgPen7oLsh+kzU7sNSE4+ccYSLw== X-Google-Smtp-Source: AGHT+IGNAmk6pXo2b3cLPD4XysG56TpqFrfp7UlChY4rorxaBCoksAKV4l1tnnkqqSdoViFdZ/pQhg== X-Received: by 2002:a17:906:44a:b0:a1b:86e5:4e1 with SMTP id e10-20020a170906044a00b00a1b86e504e1mr3066964eja.108.1702384594559; Tue, 12 Dec 2023 04:36:34 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Claudio Fontana , qemu-ppc@nongnu.org, qemu-s390x@nongnu.org, Richard Henderson , qemu-riscv@nongnu.org, Brian Cain , Thomas Huth , Paolo Bonzini , qemu-arm@nongnu.org, Manos Pitsidianakis , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Anton Johansson , Warner Losh , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kyle Evans , Laurent Vivier Subject: [PATCH v2 21/23] exec/cpu-all: Restrict inclusion of 'exec/user/guest-base.h' Date: Tue, 12 Dec 2023 13:33:57 +0100 Message-ID: <20231212123401.37493-22-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231212123401.37493-1-philmd@linaro.org> References: <20231212123401.37493-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=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1702384941970100001 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=C3=A9 Reviewed-by: Richard Henderson --- include/exec/cpu-all.h | 3 --- include/exec/cpu_ldst.h | 2 ++ include/exec/user/guest-base.h | 6 ++++++ bsd-user/main.c | 1 + linux-user/elfload.c | 1 + linux-user/main.c | 1 + 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 95af418920..d2ddfae286 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -65,9 +65,6 @@ =20 #if defined(CONFIG_USER_ONLY) #include "exec/user/abitypes.h" -#include "exec/user/guest-base.h" - -extern bool have_guest_base; =20 /* * If non-zero, the guest virtual address space is a contiguous subset diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 64e0319996..e039cc7f80 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -69,6 +69,8 @@ =20 #if defined(CONFIG_USER_ONLY) =20 +#include "exec/user/guest-base.h" + #ifndef TARGET_TAGGED_ADDRESSES static inline abi_ptr cpu_untagged_addr(CPUState *cs, abi_ptr x) { 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 =20 +#ifndef CONFIG_USER_ONLY +#error Cannot include this header from system emulation +#endif + extern uintptr_t guest_base; =20 +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 debea5c355..a8c106ec0c 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -7,6 +7,7 @@ =20 #include "qemu.h" #include "exec/user/tswap-target.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" --=20 2.41.0