From nobody Tue Apr 15 10:55:53 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=1622073361; cv=none; d=zohomail.com; s=zohoarc; b=JOwWtE9XIkDQi7j6vFYj6ZVUnV4LFg2qj2B0MC1BxCr0eyjBuA3j6LuTgOSIWcmXmulpNMahhJBE7K7mk6pHg3zLwCfyazf27Lrw8Ay8LOaS2HwL2Eo7WFZ38IZlG6zYCfM35tGpIjWpud9sJKjq2aqnajKJjxe5qmQZ4d4/atU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622073361; h=Content-Type: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=3ARrLoFwXR1lt0nxT5/xfumNrF8VDU+n1L83DReLwYo=; b=dya3Y7WXtXHQxZjMYvkU+ERNkc3B6E0z9oXhoBOqt1VzuzOIXKp7Ts8+bQEFFUkHfs0BF7GSEZ54nnyYkhGAgnM/+aErFIh5qJ5wVCwj3eC5ge2fz+O32lnJneQ79jHqHJeVAtIlSTI7GnFkjIXQoqPvxezFIZoo1lp/ZPLWJQI= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1622073361228594.6835119899673; Wed, 26 May 2021 16:56:01 -0700 (PDT) Received: from localhost ([::1]:51200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3NY-0005OC-2J for importer@patchew.org; Wed, 26 May 2021 19:56:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FN-0005gi-5c for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:33 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:34479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FH-0004VO-D2 for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:32 -0400 Received: by mail-pf1-x430.google.com with SMTP id q25so2223040pfn.1 for ; Wed, 26 May 2021 16:47:24 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:23 -0700 (PDT) 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=3ARrLoFwXR1lt0nxT5/xfumNrF8VDU+n1L83DReLwYo=; b=FZ7pCA+ESF2vvwvDu4UthPFH+5FRV1x0fUOGD+6HGWYMLZoAEsYcU/hEGHpYcgPijK 4RKjPHMqpqd4UmaiwbUqvlAvskj+6pfM4Ka4GSe2JXnId+KWGr/+lE/2pbu/NpSkprIk fTOOowg93nB8k3lBFhh/tBQplYr8g+55LAvZa/mTVHB17IDErpNj5aPKZCQpWktzdipn 8cvthT1Bbr2yCws6ya2FWbHCw+ccfy0FcTUzGULkXY5Yu6rMON5rg2NK/4b5xM+CKxzO ompXO0JGaQMM35+CHUipFiOLo9gQ4DeFuuIy8nYJB+ECK7Cj8lca2R3ZAX8LzbtgwHqO 1IGA== 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=3ARrLoFwXR1lt0nxT5/xfumNrF8VDU+n1L83DReLwYo=; b=Cne/9xQkchz5H5G32RIA47qcXiUZprDx7coD1BiVC3xaAYEjHV5hfU1dVC2d9ehSBF yqAG7124NS2YA15bxR2VVeqA3dkhj5x2/yEulMHqvA8s6r685yrZ153LZvn0PBJ8V2uS acjk67nYcOovW+nnNgGg+CaIJgigtTZwbqRPzTPOxF1/1l2QsvuhqOkSsgkRjqN7vR56 646b6iWorS3Ut1SJMo90HBYU+KIFSe7+cRoHjsCZNcekbKnlMCIn+jMnoCKVX9Iud3ZK fPpmltd0ETXj5Y3MmAU8LNBRl9gsMse6heKYygH246UOMQYih3Pamzomss6AsAlb+tZF SW5A== X-Gm-Message-State: AOAM5301h0UuITVORqSSuhifaX/V9lNt3hKBfQ6uPYAEXjjTp5EM9dKP vrrSllQsWAUjCzALeZOJbFS+mCSdblN0LQ== X-Google-Smtp-Source: ABdhPJw6Pxytvwqr4kEidNcBqbh/3rf1MohIpsdbRMnlcDTXTjXHx4+cILwcpeAHm9JZ9rALRBsleg== X-Received: by 2002:a65:6549:: with SMTP id a9mr972403pgw.213.1622072843610; Wed, 26 May 2021 16:47:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 13/31] cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs Date: Wed, 26 May 2021 16:46:52 -0700 Message-Id: <20210526234710.125396-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@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=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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=ham 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, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 To be able to later extract the cpu_get_phys_page_debug() and cpu_asidx_from_attrs() handlers from CPUClass, un-inline them from "hw/core/cpu.h". Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-7-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/hw/core/cpu.h | 33 ++++----------------------------- hw/core/cpu-sysemu.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index d45f78290e..df49528785 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -586,18 +586,8 @@ void cpu_dump_statistics(CPUState *cpu, int flags); * * Returns: Corresponding physical page address or -1 if no page found. */ -static inline hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr ad= dr, - MemTxAttrs *attrs) -{ - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->get_phys_page_attrs_debug) { - return cc->get_phys_page_attrs_debug(cpu, addr, attrs); - } - /* Fallback for CPUs which don't implement the _attrs_ hook */ - *attrs =3D MEMTXATTRS_UNSPECIFIED; - return cc->get_phys_page_debug(cpu, addr); -} +hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, + MemTxAttrs *attrs); =20 /** * cpu_get_phys_page_debug: @@ -609,12 +599,7 @@ static inline hwaddr cpu_get_phys_page_attrs_debug(CPU= State *cpu, vaddr addr, * * Returns: Corresponding physical page address or -1 if no page found. */ -static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) -{ - MemTxAttrs attrs =3D {}; - - return cpu_get_phys_page_attrs_debug(cpu, addr, &attrs); -} +hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); =20 /** cpu_asidx_from_attrs: * @cpu: CPU @@ -623,17 +608,7 @@ static inline hwaddr cpu_get_phys_page_debug(CPUState = *cpu, vaddr addr) * Returns the address space index specifying the CPU AddressSpace * to use for a memory access with the given transaction attributes. */ -static inline int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) -{ - CPUClass *cc =3D CPU_GET_CLASS(cpu); - int ret =3D 0; - - if (cc->asidx_from_attrs) { - ret =3D cc->asidx_from_attrs(cpu, attrs); - assert(ret < cpu->num_ases && ret >=3D 0); - } - return ret; -} +int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs); =20 #endif /* CONFIG_USER_ONLY */ =20 diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index f517ef5d46..fe90dde868 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -22,6 +22,38 @@ #include "qapi/error.h" #include "hw/core/cpu.h" =20 +hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, + MemTxAttrs *attrs) +{ + CPUClass *cc =3D CPU_GET_CLASS(cpu); + + if (cc->get_phys_page_attrs_debug) { + return cc->get_phys_page_attrs_debug(cpu, addr, attrs); + } + /* Fallback for CPUs which don't implement the _attrs_ hook */ + *attrs =3D MEMTXATTRS_UNSPECIFIED; + return cc->get_phys_page_debug(cpu, addr); +} + +hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) +{ + MemTxAttrs attrs =3D {}; + + return cpu_get_phys_page_attrs_debug(cpu, addr, &attrs); +} + +int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) +{ + CPUClass *cc =3D CPU_GET_CLASS(cpu); + int ret =3D 0; + + if (cc->asidx_from_attrs) { + ret =3D cc->asidx_from_attrs(cpu, attrs); + assert(ret < cpu->num_ases && ret >=3D 0); + } + return ret; +} + GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) { CPUClass *cc =3D CPU_GET_CLASS(cpu); --=20 2.25.1