From patchwork Thu Apr 18 19:25:15 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: 789840 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp735567wrm; Thu, 18 Apr 2024 12:30:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtbcZ5cgMNYjr7VI80d2LnEaxVTD6HSKMBL6Z7Jdd4A8NEtUmQXvgmAic2bwrJugw7AHsJ+oPWplfEck8yBa6h X-Google-Smtp-Source: AGHT+IEGAtRFSiIkPy78xwkIq0lml1uSlNPt/6WaIdLAcAAMxleuS4hpuvzQwGOxugzrxdMnFhX7 X-Received: by 2002:a05:620a:51cf:b0:78e:22c:c82d with SMTP id cx15-20020a05620a51cf00b0078e022cc82dmr111532qkb.36.1713468621297; Thu, 18 Apr 2024 12:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713468621; cv=none; d=google.com; s=arc-20160816; b=xFDCYJECD94DUDm0lq1DvwhGEL9/rMlGzd9T/u/7zAvwLamKk0EUIfUdS5QG2SHZzL PSeMyd+F0VP7YjuD+tx5d2aLt+W1+dT43XltceXYo2+4J10H7qi/jARslF9x2Z2EoOOL th2ZwYbGakdVWNFmlMnZ/l7lYDBcDwNtC2r0+IMcGQueyka+IBRNASXnT6hXJc2HhOlH +FPEd5JD+qsGBFKEXhTCj7OjXHb8dVfLyr0mWmZBCt9i7x+ibz7cx3aG7BmBYsp0bPIw b87tx1ei3G8CBj8FXVCkQzK6kaevSIyshx6khVM0hqfdwSYz0lXklX1OQKitMvJEl2g1 DbQg== 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=koVgyajCEgUVl/LMvNKONPGr1ZhJ2eug5WfoAqRNjUs=; fh=OldoyVsnxIotb3oLwZzdNfaQktZrdXn2xfyEQOuGV+M=; b=MLIGZ9MlSqunn1jZwQCgrc4AVJOcEwu4D42Arh74WVFDEp5OMf+HwRy7VsCDmOdT2/ aSZznnVSjXGtaRKQFdHBHLGqLgpvBCoV6e7SvKikLL0HkwpKRyvcjAtS6p0NdIpHOFaR IzokcQSuQ1lhSJ1cKBn/yGsgNsTuBmxuCI7k+CjekNTmY3VFLNa6ooVVEENOj8gJUnCf JCjOdh5sz5mOKLnfVP0DqWnnSQ7VcmaP9ro2XVoSK8X3y/rxCEikerYEKyvuOfwTVjYT GJHTlIbwQsx/WRZaiwLPcMN8tL56uVifCUoTFBuPdX5s+ZUI2LhFxwX+P2EFj5imLE9E ZoUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zqKavEvU; 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 d16-20020a05620a167000b0078ecb975c13si2101109qko.253.2024.04.18.12.30.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Apr 2024 12:30:21 -0700 (PDT) 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=zqKavEvU; 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 1rxXRP-0004Ma-BZ; Thu, 18 Apr 2024 15:29:03 -0400 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 1rxXPn-0000RQ-8g for qemu-devel@nongnu.org; Thu, 18 Apr 2024 15:27:25 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rxXPl-0007cD-Ap for qemu-devel@nongnu.org; Thu, 18 Apr 2024 15:27:22 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a519e1b0e2dso125156766b.2 for ; Thu, 18 Apr 2024 12:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713468439; x=1714073239; 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=koVgyajCEgUVl/LMvNKONPGr1ZhJ2eug5WfoAqRNjUs=; b=zqKavEvUwmpktzeC+ZkyMOS6iqmafM6qsXVAEzNYS8OxOXD0h7Li/SUtH2QlGSV42v gtGr1aErMgYhJG8t6ttnlJYHRlT5s6csBUSDJvKUUgKwztK9bgxfoht0Jo8n566f9xw5 WJCPSisaHKLFFhBiVCqkCZGHBtCeSRgWZo/nc6Va/Nx+1SGtZ3etaTNi0SHVMgrMNSd5 jZTvmsADsT/EuGy7blU6vJQ1I46vFsxOrstT972mzuA6rwqIh7SOEPKHLLGWIo1TYQ6o /W9EqRv6gjsOqagQZSxouEan0y/1CtFQ/QmvNJhe7Oz7fTIPkMAVefFne69uufMQ5WuQ XPJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713468439; x=1714073239; 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=koVgyajCEgUVl/LMvNKONPGr1ZhJ2eug5WfoAqRNjUs=; b=KrDZl11Lzdq6Kcy4g4p5NpVVE11McaWcxMo+sSqb1Rgh3ZynCVn7apahSwH/F8Anal eRjsWjlQuKr6eB7uqIYakKc/Mj87BacPKQz2d+69tvi4GQDWwju7il2UWSfmnLPMpP4x ILJIeig1ojS/h3XkJ1k4yCqEXg7wa2MDwJ60kl5WAXdOI8xyMax2FZrBAZ1ZFZakXSOT CtlNQlW2sHksUwHrjCQyutqdcuL+eemvbpYo24SBvHzlg+Sdi+OA6OkIY8zreS8tUHRz ae3LMgAnToMfkx9qs8IkS3TtLFHrGZIcfOtKMUUw5C+rrcmhuqRu8XeX4DmYKLqp9cjX bhUw== X-Gm-Message-State: AOJu0YyseKuP//XSVJRCk9DGCQrw8bd5GstV++uslcggRF7CgZLoxVvw h45V2Z7GQeypX0OlDSCFxJAazcXT4GG2oH07lUnxbFV1vB1VzDH0hyzfsehxpFk97U1epqFGJSo a X-Received: by 2002:a17:906:6013:b0:a52:ec:a87d with SMTP id o19-20020a170906601300b00a5200eca87dmr48021ejj.74.1713468439142; Thu, 18 Apr 2024 12:27:19 -0700 (PDT) Received: from m1x-phil.lan ([176.176.151.213]) by smtp.gmail.com with ESMTPSA id n22-20020a170906119600b00a51a9d87570sm1269573eja.17.2024.04.18.12.27.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 18 Apr 2024 12:27:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 16/24] exec: Move GUEST_ADDR_MAX definition to 'cpu_ldst.h' Date: Thu, 18 Apr 2024 21:25:15 +0200 Message-ID: <20240418192525.97451-17-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240418192525.97451-1-philmd@linaro.org> References: <20240418192525.97451-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.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=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 GUEST_ADDR_MAX is only used in accel/tcg/user-exec.c and "exec/cpu_ldst.h". Move it from "exec/cpu-all.h" to "exec/cpu_ldst.h" so we can avoid including "exec/cpu-all.h" in accel/tcg/user-exec.c. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson --- include/exec/cpu-all.h | 34 +--------------------------------- include/exec/cpu_ldst.h | 30 ++++++++++++++++++++++++++++++ accel/tcg/cpu-exec.c | 1 - 3 files changed, 31 insertions(+), 34 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index e75ec13cd0..554b937ddb 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -63,39 +63,7 @@ /* MMU memory access macros */ -#if defined(CONFIG_USER_ONLY) -#include "exec/user/abitypes.h" - -/* - * If non-zero, the guest virtual address space is a contiguous subset - * of the host virtual address space, i.e. '-R reserved_va' is in effect - * either from the command-line or by default. The value is the last - * byte of the guest address space e.g. UINT32_MAX. - * - * If zero, the host and guest virtual address spaces are intermingled. - */ -extern unsigned long reserved_va; - -/* - * Limit the guest addresses as best we can. - * - * When not using -R reserved_va, we cannot really limit the guest - * to less address space than the host. For 32-bit guests, this - * acts as a sanity check that we're not giving the guest an address - * that it cannot even represent. For 64-bit guests... the address - * might not be what the real kernel would give, but it is at least - * representable in the guest. - * - * TODO: Improve address allocation to avoid this problem, and to - * avoid setting bits at the top of guest addresses that might need - * to be used for tags. - */ -#define GUEST_ADDR_MAX_ \ - ((MIN_CONST(TARGET_VIRT_ADDR_SPACE_BITS, TARGET_ABI_BITS) <= 32) ? \ - UINT32_MAX : ~0ul) -#define GUEST_ADDR_MAX (reserved_va ? : GUEST_ADDR_MAX_) - -#else +#if !defined(CONFIG_USER_ONLY) #include "exec/hwaddr.h" diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 6d47d3114a..07649a01c1 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -73,8 +73,38 @@ #if defined(CONFIG_USER_ONLY) +#include "user/abitypes.h" #include "user/guest-base.h" +/* + * If non-zero, the guest virtual address space is a contiguous subset + * of the host virtual address space, i.e. '-R reserved_va' is in effect + * either from the command-line or by default. The value is the last + * byte of the guest address space e.g. UINT32_MAX. + * + * If zero, the host and guest virtual address spaces are intermingled. + */ +extern unsigned long reserved_va; + +/* + * Limit the guest addresses as best we can. + * + * When not using -R reserved_va, we cannot really limit the guest + * to less address space than the host. For 32-bit guests, this + * acts as a sanity check that we're not giving the guest an address + * that it cannot even represent. For 64-bit guests... the address + * might not be what the real kernel would give, but it is at least + * representable in the guest. + * + * TODO: Improve address allocation to avoid this problem, and to + * avoid setting bits at the top of guest addresses that might need + * to be used for tags. + */ +#define GUEST_ADDR_MAX_ \ + ((MIN_CONST(TARGET_VIRT_ADDR_SPACE_BITS, TARGET_ABI_BITS) <= 32) ? \ + UINT32_MAX : ~0ul) +#define GUEST_ADDR_MAX (reserved_va ? : GUEST_ADDR_MAX_) + #ifndef TARGET_TAGGED_ADDRESSES static inline abi_ptr cpu_untagged_addr(CPUState *cs, abi_ptr x) { diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 225e5fbd3e..7bfd558027 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -31,7 +31,6 @@ #include "exec/log.h" #include "qemu/main-loop.h" #include "sysemu/cpus.h" -#include "exec/cpu-all.h" #include "sysemu/cpu-timers.h" #include "exec/replay-core.h" #include "sysemu/tcg.h"