From nobody Mon Nov 25 11:26:37 2024 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=1715708642; cv=none; d=zohomail.com; s=zohoarc; b=nj4EqLWh8qcM4heLs6SPU6QNQshE/KYBsgFWOzWWM+OEeqD8GCUd8HlPXX4TOF2Isk0QzUmN5kz04/BF04Jk4InlGA33e+YDCN2n6ZDsfb8nO5ZG6tWsI05qoUwF+Cp82uwlAUq04z2eg304hyFXSZlE/pHjIJCDUaVu1FeXiE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715708642; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=twX/8e3VB4vFn+Ywb8v/U/pjCAfPckcQOZEEgaIZtXs=; b=PIv8FmdkESLdj1Sw1498T5jH2XpjXtL1ZEHh8gQ4hxyvIglaKEMYo2qDC5HY8esXAvOnSXxFWxZ50/HlWqzL6QQ8S5HqugvrGR5BaKAB4BjUjl4dsnmyc/QAVq1XE8XcWoWWlD21Z9rBZ40GIKDyZkJPBlL0fs41rZj/mnFJDhg= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715708642739406.5314283784852; Tue, 14 May 2024 10:44:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6wBq-00050d-LF; Tue, 14 May 2024 13:43:50 -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 1s6wBY-0004s3-8v for qemu-devel@nongnu.org; Tue, 14 May 2024 13:43:39 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s6wBH-0004td-8X for qemu-devel@nongnu.org; Tue, 14 May 2024 13:43:24 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-56e69888a36so545771a12.3 for ; Tue, 14 May 2024 10:42:59 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-574d8f5501esm1666982a12.75.2024.05.14.10.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 10:42:56 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4D8C45FA1B; Tue, 14 May 2024 18:42:54 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715708578; x=1716313378; 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=twX/8e3VB4vFn+Ywb8v/U/pjCAfPckcQOZEEgaIZtXs=; b=Lnin70D690uYXX73jV5V8DKsFcZiZEOwc2XmpzfPPmtgTDW+YY1O0vsDJUbabfsn8E TC/a//OFE8wwiOdRSM2WFzT4lVCww+9OgfqFB1Sq7xw/LdtN2aaCdNkI0uVPEYErH0iQ 3+pGFI+yZx1UmRikp6HNZaVp0qEdUWW4T99KG28vqtlbej4SfXaeDcoVe5uq2FflaPpQ AHIcLl4Qcd3Korw1Y4e2ZhI6Hx/CT0qFaGI3kVJXOs0DhPLZLR2tgcJNQpyuoQG1UR06 D6gzLrtV9lQkWvcB59uHcyXE4M4WkRUMHdW4VCLn7uIbuTvMjy1zjxs8vBX3iMWBLv/L pNNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715708578; x=1716313378; 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=twX/8e3VB4vFn+Ywb8v/U/pjCAfPckcQOZEEgaIZtXs=; b=wYbLcP229itou4MPXH33YWHOvzkBJQbEbJ5nvMztDsMDHXCVq07Pb7+HDEDbpQlFFp svCwTMApuKe9DYnavnhJ+Uv+tVCKc80ulbQBlb9dvKsLPvVGpybi5yQwAXuf4WhknxM6 N2MGqhKv+PneXyCUFTzDonA8H0lQzCICdzZqNDBjq0ZC8kDQ/tL3KAwzdb8nzVGNLnaw p5dV3x1i5vGhTcanTkqx7UwZits4/Yjlo+LbMDlHSv6Ea81VH+0NXf0X6tLyMp3ry78f OC5Z48+TFxBZV2NatT7qDFh0F/zx1mgH/xQ389PpROPoTS2YrsdBaVmrRvAFcqoqbrke NiPQ== X-Gm-Message-State: AOJu0YwWX75ynRq8RN5qi8/CEBiD/pfN4XZMXctfF9LQscoqfLzeEr6I sALDC+4TgJ8eHfuIvCMvXF/h5AWL66rt0GzfR+QYu1ffqym1Ql/lWWn9/vMj/h4= X-Google-Smtp-Source: AGHT+IEgui2TCQPdksyLnyyGmQwCrcvfptvCTdMhRb7gl7p1OmstJ7mOC/2Ys9bJKgGvU1CFVgknDQ== X-Received: by 2002:a50:aa94:0:b0:572:a731:dd14 with SMTP id 4fb4d7f45d1cf-5734d6edacemr9923609a12.28.1715708578095; Tue, 14 May 2024 10:42:58 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , qemu-arm@nongnu.org, Richard Henderson , Alexandre Iooss , Pierrick Bouvier , Cornelia Huck , Peter Maydell , "Michael S. Tsirkin" , Mahmoud Mandour Subject: [PATCH 04/11] plugins: extract generate ptr for qemu_plugin_u64 Date: Tue, 14 May 2024 18:42:46 +0100 Message-Id: <20240514174253.694591-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240514174253.694591-1-alex.bennee@linaro.org> References: <20240514174253.694591-1-alex.bennee@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=2a00:1450:4864:20::529; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x529.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1715708643235100001 From: Pierrick Bouvier Plugin operations can access a scoreboard. This function factorizes code generation for accessing entry associated to a given vcpu. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20240502211522.346467-3-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/tcg/plugin-gen.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 4069d51daf..97868781fe 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -113,24 +113,33 @@ static void gen_udata_cb(struct qemu_plugin_dyn_cb *c= b) tcg_temp_free_i32(cpu_index); } =20 -static void gen_inline_add_u64_cb(struct qemu_plugin_dyn_cb *cb) +static TCGv_ptr gen_plugin_u64_ptr(qemu_plugin_u64 entry) { - GArray *arr =3D cb->inline_insn.entry.score->data; - size_t offset =3D cb->inline_insn.entry.offset; - TCGv_i32 cpu_index =3D tcg_temp_ebb_new_i32(); - TCGv_i64 val =3D tcg_temp_ebb_new_i64(); TCGv_ptr ptr =3D tcg_temp_ebb_new_ptr(); =20 + GArray *arr =3D entry.score->data; + char *base_ptr =3D arr->data + entry.offset; + size_t entry_size =3D g_array_get_element_size(arr); + + TCGv_i32 cpu_index =3D tcg_temp_ebb_new_i32(); tcg_gen_ld_i32(cpu_index, tcg_env, -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)= ); - tcg_gen_muli_i32(cpu_index, cpu_index, g_array_get_element_size(arr)); + tcg_gen_muli_i32(cpu_index, cpu_index, entry_size); tcg_gen_ext_i32_ptr(ptr, cpu_index); tcg_temp_free_i32(cpu_index); + tcg_gen_addi_ptr(ptr, ptr, (intptr_t) base_ptr); + + return ptr; +} + +static void gen_inline_add_u64_cb(struct qemu_plugin_dyn_cb *cb) +{ + TCGv_ptr ptr =3D gen_plugin_u64_ptr(cb->inline_insn.entry); + TCGv_i64 val =3D tcg_temp_ebb_new_i64(); =20 - tcg_gen_addi_ptr(ptr, ptr, (intptr_t)arr->data); - tcg_gen_ld_i64(val, ptr, offset); + tcg_gen_ld_i64(val, ptr, 0); tcg_gen_addi_i64(val, val, cb->inline_insn.imm); - tcg_gen_st_i64(val, ptr, offset); + tcg_gen_st_i64(val, ptr, 0); =20 tcg_temp_free_i64(val); tcg_temp_free_ptr(ptr); --=20 2.39.2