From nobody Thu Oct 31 00:20:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611874157; cv=none; d=zohomail.com; s=zohoarc; b=D5dgpeVXAFxSoE8O2uORQUqHLB69w63u3ckPFJABdMc9qJpjriZPwKBx/zuuYy79BqVeqiC4OOKJ17Cz59FCXz9vs6ZlNmoLmVw8J3VZ9DQtgsjNZhFoPDjgLSLuTjACc+3tRFBEhKJSidG5DN4b33USRTO83oP3NPxQm1n7noQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611874157; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4REF6cfdA8MQv8viPXefMUo/38x0z3uSDZzFVOD3Xwc=; b=UuPbudO8wUG0+MF/485uBaQoHaG5GdypGSqsxsVbcl9rOOGad4/A5RWdiUqDufkvceozCCa4qF+MCoPflW8St8OhoJmvhAj4bYuyz/uzacKDHTeKz0vkOwZCSXZ1NLmFefEWJacPJgK2Gs0fBH77tyDBkJc5D3VQYOujNFYcC3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611874157012245.3391328215713; Thu, 28 Jan 2021 14:49:17 -0800 (PST) Received: from localhost ([::1]:58882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5G6G-0003Yw-0h for importer@patchew.org; Thu, 28 Jan 2021 17:49:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5FzM-0005X9-1J for qemu-devel@nongnu.org; Thu, 28 Jan 2021 17:42:12 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:54925) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5FzF-00088P-Rr for qemu-devel@nongnu.org; Thu, 28 Jan 2021 17:42:07 -0500 Received: by mail-pj1-x102e.google.com with SMTP id cq1so4717749pjb.4 for ; Thu, 28 Jan 2021 14:42:00 -0800 (PST) Received: from localhost.localdomain (cpe-66-27-222-29.hawaii.res.rr.com. [66.27.222.29]) by smtp.gmail.com with ESMTPSA id m10sm6042358pjs.25.2021.01.28.14.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 14:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4REF6cfdA8MQv8viPXefMUo/38x0z3uSDZzFVOD3Xwc=; b=Aw9NDjqY6PN9drRr+/r4nElPi2eAAbZVnJ+fn1Z7s0D8FWNFXW47STthtTal25DXQh qHZyeD3xL78B8D3btXbY1ByLAWKpBUpr04H14BerHxArgo+E3gOlh5TVD80m3vulh3Fx rsfKisD58WD2thmQWv5xTsBApsH7uGru0HCwDm9blDgeRKHzVfriJ1jIYwQ/bKt10SEV LMH/eXAAu8xEyMfGbXov7Mjiy5geDpDSr+uATldXchscO8ofjtHoB3Q9kX4i0FhqyaDL u6+1u9IblN9g1WIEQYmwHzLuA46QdYBQUGjfm98yo6ryPP/AFG0iYa41XIDo3d6pxoA1 ez2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4REF6cfdA8MQv8viPXefMUo/38x0z3uSDZzFVOD3Xwc=; b=NNVGDtcBsky4yShLyGAwcdV5V6CxSjujL3xgHoY/dkkJj7KhT0Ysy8BLGAz7/OwvfX YP058mbD+d4LDE1ATsiIWuRSxT8Nf84mliERjeP+E6YFYreEG5EniKhNyV4ThywclC77 CKqD5OkfFrazXBgOxQlDTmm11lmQk/y6Xs6oJpnz6yxwFNpFBnM/zdxVXmhFlWiSrMyh mnweB0Ov+FONny+t5wNNl7SgVO3GIQcaU3cuvH2YTDLwetI4IV2eeHYlFRM7GE04u6T2 iIdqs9rcFstiVYB3DByK0kGuWiRutWEve6gabBxZUJtMJF3JYiD8hZogcXcKE83Ecszv ohgA== X-Gm-Message-State: AOAM530uSaBN2y8QkwtdgzLyVgnu7d0YT1gSDThFoL4FuUGQRzlpX01f NnzoD40/z+1eN7SqLB5y5SxUadeynB7LdPBW X-Google-Smtp-Source: ABdhPJyvcZ/prO2NrGDacCA0aBlyyqqHIJdB/JiGfUpoFOQNLt6RqI/lTQAfVGAtT9JVsJ1a9HSFtw== X-Received: by 2002:a17:90b:949:: with SMTP id dw9mr1585322pjb.20.1611873719633; Thu, 28 Jan 2021 14:41:59 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 09/23] linux-user: Do not use guest_addr_valid for h2g_valid Date: Thu, 28 Jan 2021 12:41:27 -1000 Message-Id: <20210128224141.638790-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210128224141.638790-1-richard.henderson@linaro.org> References: <20210128224141.638790-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This is the only use of guest_addr_valid that does not begin with a guest address, but a host address being transformed to a guest address. We will shortly adjust guest_addr_valid to handle guest memory tags, and the host address should not be subjected to that. Move h2g_valid adjacent to the other h2g macros. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- v3: Ditch type changes; retain true for HLB <=3D GAM (pmm). --- include/exec/cpu_ldst.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index 5e8878ee9b..4e6ef3d542 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -77,13 +77,16 @@ typedef uint64_t abi_ptr; #else #define guest_addr_valid(x) ((x) <=3D GUEST_ADDR_MAX) #endif -#define h2g_valid(x) guest_addr_valid((uintptr_t)(x) - guest_base) =20 static inline bool guest_range_valid(abi_ulong start, abi_ulong len) { return len - 1 <=3D GUEST_ADDR_MAX && start <=3D GUEST_ADDR_MAX - len = + 1; } =20 +#define h2g_valid(x) \ + (HOST_LONG_BITS <=3D TARGET_VIRT_ADDR_SPACE_BITS || \ + (uintptr_t)(x) - guest_base <=3D GUEST_ADDR_MAX) + #define h2g_nocheck(x) ({ \ uintptr_t __ret =3D (uintptr_t)(x) - guest_base; \ (abi_ptr)__ret; \ --=20 2.25.1