From patchwork Thu Sep 1 06:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 601802 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp260119mae; Thu, 1 Sep 2022 00:21:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR5CCclz/fz6+fvj7Gjf1Ymu3hTaY+syf468VGgzC++k5CQu5facWn8JRqZP9qw7QTTF5diy X-Received: by 2002:ad4:5bcf:0:b0:498:f054:a847 with SMTP id t15-20020ad45bcf000000b00498f054a847mr22520877qvt.38.1662016874184; Thu, 01 Sep 2022 00:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662016874; cv=none; d=google.com; s=arc-20160816; b=H8Ib0CNL9spsoeoeddb40twwpv/qeHHz8CJ5f7ReBTeoRy40d5QpVWNYpDBrHTjxoq VNR4q3xfTh4+LaXzF0/DtR55dcTr3deMBKRgUqXMceOb/Uim9uBa3BkmGX9juAI4G9dt qOiw7JM3OTSnaIPglx1ybdgeIzsrA+9D6hhySBBw0b24tzLfeXt72iggJETbrGRAj2RR EtKcwyWnS9bLcEkX1dXSheXYyYslAcYTlrCNUfRnHvl8Y0Tq7cGqmALJIxD/O0eAzgSO VB51H8Y1estI4TzItLdDvBIb9LEsjNfi1Jn+t2UipV2Mobb0IUtMszZf6V9QjATtn6j7 +yiQ== 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=Kh1uN4/0ovlH8dCidDvOH33OgIiJlJt8Oo88s09rMG4=; b=XxBZP0gzykzmsGY3UwiyUbNljP6qSGqPbXGBpCTOy5cx55cdJxJyfJBdC7JcsXYEV4 OR+n5uKWFGFr4EmJqekcLinq0Dr+wIYULPSUx5WnNn9EaOSYR+WuU2lQZiNv8t7r5dBy emwuDZHW3cqFfok1zOewn/xwcV0j1nuuEzd+8SMW581/ugV4Vd//+8EQvX7FuFkdGni8 fo4BbRuDN7sr0SpXt1k25hT2it+g3/lREnU4YKrUF3OUgl2czblqvcwpDpZg5UUi9uQZ 3rB5nPgCev45n1MpEPJHRYsVfmh9T3SXyrsFr9TxvSYcA7u8Xv0rr3Xkwj3ApMCKc7HU o39w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nGES2j1z; 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 bl26-20020a05620a1a9a00b006af99337ceesi10008881qkb.15.2022.09.01.00.21.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Sep 2022 00:21:14 -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=nGES2j1z; 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]:36014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTeVl-00078y-O8 for patch@linaro.org; Thu, 01 Sep 2022 03:21:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTe4V-0005y9-So for qemu-devel@nongnu.org; Thu, 01 Sep 2022 02:53:03 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:36760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTe4U-0003HE-3K for qemu-devel@nongnu.org; Thu, 01 Sep 2022 02:53:03 -0400 Received: by mail-wr1-x432.google.com with SMTP id u17so1744826wrp.3 for ; Wed, 31 Aug 2022 23:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=Kh1uN4/0ovlH8dCidDvOH33OgIiJlJt8Oo88s09rMG4=; b=nGES2j1zAYv6xQaIA/Mzd/GEs7tL4t3IGA7KxYeaoCbGfKVR9ko+7LB0A3O0cwcP7B qpeV4Kk1cAuLt9FdcuRiwGFetArRje7HHGGQT1c8HADZjGG2GP3VzkHPRZSCSUv1gn2H 6fYZKknyWyY8J9m6S5Flmnjxa0LC1FsOFZM1VqJPQGx3e9fU/XI2yWNeHAwNUSVcMgxt WvKyne/LLsyRty7s8CLLROS6ujhd30RpCBb7mHyLyYvS78FT14V7cT0huX6fAziGXa4L LQI2jpsAitmkLsAZXOR+tG6azvo78ndWBlA3PzpUvFnyiHCX6pfNISLElw80NDD+5MG1 VqJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=Kh1uN4/0ovlH8dCidDvOH33OgIiJlJt8Oo88s09rMG4=; b=zjkP9+2IYlQ/6wuySWhRJ8K9FsNfE3uh1IxJh2errH3LJY/9BHhcWF2gi5v8WqBD7B GEDT65ws520e/+ge0bvUUiBGCbizxB6OAA7b0J2Zfp8xG9SFanMqaqG8XkfxCG6tZojq oTfDU9TjxaRXjj0QWNMhIxP50oNBRkOFSq7dDf4JQe1vJ+Au3uSswQ3WKVc8U/fn3kYe zBh64+HlttpfqBWt1JQLtVJmF4hyGypGHrTeHB4iN62FpLjS2ZzKLj3Ug4zdx0YRdQWu G1f6+H/jl1IEyPmFi41jl08WCUK4E5CbHzKo4Nm+bUjWj+48Ciftb2jt3cx7G23k7APB t1wQ== X-Gm-Message-State: ACgBeo0fgNOQfrD8p2UvF67w+4v5Hvv+Lk+FQS1NpJF2Dc/aArKIxOrZ 8D7VynbJ6FBBs6cpxtoWhaNxI5j0gkP6kJe+ X-Received: by 2002:a05:6000:799:b0:226:e3e9:e482 with SMTP id bu25-20020a056000079900b00226e3e9e482mr6425475wrb.219.1662015179240; Wed, 31 Aug 2022 23:52:59 -0700 (PDT) Received: from stoup.. ([87.192.221.83]) by smtp.gmail.com with ESMTPSA id a6-20020a5d4d46000000b00226dedf1ab7sm8308153wru.76.2022.08.31.23.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 23:52:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Alistair Francis , Ilya Leoshkevich Subject: [PULL 11/20] accel/tcg: Move qemu_ram_addr_from_host_nofail to physmem.c Date: Thu, 1 Sep 2022 07:52:01 +0100 Message-Id: <20220901065210.117081-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220901065210.117081-1-richard.henderson@linaro.org> References: <20220901065210.117081-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-wr1-x432.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=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" The base qemu_ram_addr_from_host function is already in softmmu/physmem.c; move the nofail version to be adjacent. Reviewed-by: Alistair Francis Acked-by: Ilya Leoshkevich Tested-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- include/exec/cpu-common.h | 1 + accel/tcg/cputlb.c | 12 ------------ softmmu/physmem.c | 12 ++++++++++++ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 2281be4e10..d909429427 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -72,6 +72,7 @@ typedef uintptr_t ram_addr_t; void qemu_ram_remap(ram_addr_t addr, ram_addr_t length); /* This should not be used by devices. */ ram_addr_t qemu_ram_addr_from_host(void *ptr); +ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr); RAMBlock *qemu_ram_block_by_name(const char *name); RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset, ram_addr_t *offset); diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 43bd65c973..80a3eb4f1c 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1283,18 +1283,6 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr, prot, mmu_idx, size); } -static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) -{ - ram_addr_t ram_addr; - - ram_addr = qemu_ram_addr_from_host(ptr); - if (ram_addr == RAM_ADDR_INVALID) { - error_report("Bad ram pointer %p", ptr); - abort(); - } - return ram_addr; -} - /* * Note: tlb_fill() can trigger a resize of the TLB. This means that all of the * caller's prior references to the TLB table (e.g. CPUTLBEntry pointers) must diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 50231bab30..56e03e07b5 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -2443,6 +2443,18 @@ ram_addr_t qemu_ram_addr_from_host(void *ptr) return block->offset + offset; } +ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) +{ + ram_addr_t ram_addr; + + ram_addr = qemu_ram_addr_from_host(ptr); + if (ram_addr == RAM_ADDR_INVALID) { + error_report("Bad ram pointer %p", ptr); + abort(); + } + return ram_addr; +} + static MemTxResult flatview_read(FlatView *fv, hwaddr addr, MemTxAttrs attrs, void *buf, hwaddr len); static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,