From patchwork Wed Jan 24 07:56:06 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: 765622 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1993163wrx; Tue, 23 Jan 2024 23:57:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEY5o9vwiLMNa4TPVZijL5fQU9q1eTiunZv3HhiOG4VqezqjuAl+B+EmYq4gElLyScw56mc X-Received: by 2002:a05:620a:4485:b0:783:b7a5:c29b with SMTP id x5-20020a05620a448500b00783b7a5c29bmr81522qkp.66.1706083035171; Tue, 23 Jan 2024 23:57:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706083035; cv=none; d=google.com; s=arc-20160816; b=oXhRqImbBvU+2JqIJuuvIFMrF3wNDZ2k1BYJDUYIQ1yNWdb1iBGRwiXx707nZaJ2H+ gn2rUN4kUPORQPrU9sk0RrV/cDwEmjwJNaPOOibmEpoB624IIQyeJcEimnRSopY9CQvz XFMgZ7RwJTtKXHnx6xnI23oZsG2yrh4XYjMAZR6rXBOXn0G3gf9a5u2dZSTn/o0ASja0 t5iW0J+XJ+FSL6Nn5CgHiEi0f7t5Yv6Sv/42zLW61g5sSVXom+B1R04jPgcmhm+aZAdi DpABW1w7YAIjvfyvn4j0Zw4He5pHTQe+A7CsmH4EcwRQIptLfl6OQGDA+Lr7Z35jFYvz fi1A== 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=hGEZ+UuvywEJsfyGGnlTWqRmH+qv3Bs4CRVZRGITqsY=; fh=B50oqVc00OWaVdizTqYR6m8+DZOaWemCvxBHsGRcQPg=; b=qiY1bqKHeMp2cY08Z/BJTbofy3sP7teUJKNQdnFTUMx9/w5x9VAVbiwB/ryRA/Bvcl Gn64kmQ5ivvjP4BQvLEGSztuMcReh9hYgyvKXKwulRW6PJOJQzX42UmnT0tkwFFBU2Ux R0jaslh7q3JCTWfDPG+bSUoz+ayNxSMwhsZjN9c/DxWezQ/Rhbz/MhJZRcrHvaIF7oMc l7Uxyl44CO4Il5c57tsAmPIa8rB9lyVrPw2EkXQGjYbw2ZHiwUuhwy5GnlMUZ/re8idn I2w15gd0Fd5WwH0+2bFfF+EMzzq7fpM6U1BvgtvkxGAJRIkqVVoEXgsFnjULk2xUTNN1 RGDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vORECSnx; 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 b28-20020a05620a04fc00b00783b14a9eacsi1697612qkh.140.2024.01.23.23.57.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 23:57:15 -0800 (PST) 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=vORECSnx; 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 1rSY7T-0001S7-He; Wed, 24 Jan 2024 02:56:23 -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 1rSY7S-0001Rl-8H for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:56:22 -0500 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSY7P-0005ST-M1 for qemu-devel@nongnu.org; Wed, 24 Jan 2024 02:56:22 -0500 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a3082d450adso312069666b.1 for ; Tue, 23 Jan 2024 23:56:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706082978; x=1706687778; 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=hGEZ+UuvywEJsfyGGnlTWqRmH+qv3Bs4CRVZRGITqsY=; b=vORECSnxiN7LOZfyCygpaLV5zOFahBtHgieiPedPKBsFmPbBaQ6tTNpzWq857tT6Vi LzL6PiQ62eOsbrMOlxmG5nfyiAr63FwiDbu/9wth4CfQtAVJTCQWe+KUn7uBGjKm/bzT /p82vCNvvRcaCHNtuvpYRNqrsmkQERqPuZ3hoXsEmumLxV12kcOfA/qOC3bgkc9twyoY C29l6pF79HqGMGRorhyEgakYMnepRcYTub+HV1iG9yGrTMdZnQZIfBvDJX5TourJ+eaG jp2iRlXOAPb+PHOWtDlap5L9mFFUjkIGwAy4pDPqD5MgJfURNY1t+TX86XYn56roRFpC ew7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706082978; x=1706687778; 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=hGEZ+UuvywEJsfyGGnlTWqRmH+qv3Bs4CRVZRGITqsY=; b=hcp1wfvSO/l1C00lqHumR6h2QcGQrxBI3rWjkr+y488ptgzfq7AFHgCgTPhA4jDvsE EbVs2lBDHGKQPUYLc6yfrXnQDvaUngVLCzQlnr5M1iKp0wPoxYqVATn2MG/Pe2lXO5Vx n87Id3hNWZx99IoNZWWyjQ2zrsGz5SyBCRVjQlzutgqr1q8IBBX+Z/NC2Tcdt/l7jhku PPwomeCdoy05ZNPIex2TI12iKrgR6fGWkEtnldHkVxrEqS5mryLJeBlztNEtOJ4C1VWO pl4tVaik0RTqfGbB3I6EqZY8OYNLsekoJzjNlXE1v6GoMYs9DOcvvSfwGjkqTUUQs3wx fqCg== X-Gm-Message-State: AOJu0YzfhpIR6hVyxvszk6tt0TZXcgHpCjXNvdotrxAitxqz+BLG1zeL KZNe6dvJlU2Tuew8NHaxqIQLpG6lyM/BdU8ZkI981Eql0JFEkqquv7We3yCCR3A75ZBy9Jxb9OX A X-Received: by 2002:a17:907:d309:b0:a31:35c2:9238 with SMTP id vg9-20020a170907d30900b00a3135c29238mr116943ejc.107.1706082977941; Tue, 23 Jan 2024 23:56:17 -0800 (PST) Received: from m1x-phil.lan (lgp44-h02-176-184-8-67.dsl.sta.abo.bbox.fr. [176.184.8.67]) by smtp.gmail.com with ESMTPSA id cu15-20020a170906ba8f00b00a2ec877d3a6sm8212455ejd.167.2024.01.23.23.56.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 23 Jan 2024 23:56:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Paolo Bonzini , Ilya Leoshkevich , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , David Hildenbrand Subject: [PATCH v5 1/4] target: Make qemu_target_page_mask() available for *-user Date: Wed, 24 Jan 2024 08:56:06 +0100 Message-ID: <20240124075609.14756-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240124075609.14756-1-philmd@linaro.org> References: <20240124075609.14756-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Currently qemu_target_page_mask() is usable only from the softmmu code. Make it possible to use it from the *-user code as well. Make use of it in perf.c. Signed-off-by: Ilya Leoshkevich Message-ID: <20231208003754.3688038-2-iii@linux.ibm.com> Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/perf.c | 3 ++- system/physmem.c | 5 ----- target/target-common.c | 10 ++++++++++ target/meson.build | 2 ++ 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 target/target-common.c diff --git a/accel/tcg/perf.c b/accel/tcg/perf.c index cd1aa99a7e..ba75c1bbe4 100644 --- a/accel/tcg/perf.c +++ b/accel/tcg/perf.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include "elf.h" +#include "exec/target_page.h" #include "exec/exec-all.h" #include "qemu/timer.h" #include "tcg/tcg.h" @@ -335,7 +336,7 @@ void perf_report_code(uint64_t guest_pc, TranslationBlock *tb, /* FIXME: This replicates the restore_state_to_opc() logic. */ q[insn].address = gen_insn_data[insn * start_words + 0]; if (tb_cflags(tb) & CF_PCREL) { - q[insn].address |= (guest_pc & TARGET_PAGE_MASK); + q[insn].address |= (guest_pc & qemu_target_page_mask()); } else { #if defined(TARGET_I386) q[insn].address -= tb->cs_base; diff --git a/system/physmem.c b/system/physmem.c index cc68a79763..5e66d9ae36 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -3431,11 +3431,6 @@ size_t qemu_target_page_size(void) return TARGET_PAGE_SIZE; } -int qemu_target_page_mask(void) -{ - return TARGET_PAGE_MASK; -} - int qemu_target_page_bits(void) { return TARGET_PAGE_BITS; diff --git a/target/target-common.c b/target/target-common.c new file mode 100644 index 0000000000..903b10cfe4 --- /dev/null +++ b/target/target-common.c @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/osdep.h" + +#include "cpu.h" +#include "exec/target_page.h" + +int qemu_target_page_mask(void) +{ + return TARGET_PAGE_MASK; +} diff --git a/target/meson.build b/target/meson.build index a53a60486f..dee2ac47e0 100644 --- a/target/meson.build +++ b/target/meson.build @@ -19,3 +19,5 @@ subdir('sh4') subdir('sparc') subdir('tricore') subdir('xtensa') + +specific_ss.add(files('target-common.c'))