From patchwork Tue Mar 26 12:34:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 782601 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp1656396wrt; Tue, 26 Mar 2024 05:35:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVPHCmmc33N69S+5XkNDCXGu//ZxIZGqoMZDaWhmz9J1fYF6j3/LbtgfdXGNnRgDDVjWnD4O0JaO7tOsK0rhXga X-Google-Smtp-Source: AGHT+IGYPKzW9dihlHZqE3aYKd3HqGEzbs4EaQBG1qL0SUAZvrAOwRPEyxHkxAr8Oi1qg3J3HqNE X-Received: by 2002:a05:6808:d4a:b0:3c3:dcbc:c677 with SMTP id w10-20020a0568080d4a00b003c3dcbcc677mr381380oik.26.1711456533952; Tue, 26 Mar 2024 05:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711456533; cv=none; d=google.com; s=arc-20160816; b=h5CVdAKnzRbPm40Enmmna7W/pwUet2o9AR7/YP1r2vqM78rjm+t9I/W1xMOcPTETP9 qzFFl51bns1a29wkKc/3AmeB6ys0SNNtPzzPEr2ihbNlylKdB3zzl+do9M0yRP+b/xay g2jIS7A7LOWG6XCQnh3dV8q8Uc7Y6XVBxQ0zBGjAEEtyfjnGi1uKrahl1ZMpzJilBFwS AsqnFvduitaZGlN/gFTWMGs/JrPCMzNiyVfGhihV4DRa8EFyXDJgyB1AEs8yhULlsaqy pprra4kr6m0q6ZOpdZf+etHh2hXyTTeTebqnGX23HuyIq+sXPrUKUCEG7OmFSTJ3vwUh InFA== 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=jrYhcbQiD/iBdvr35vsxxSuWauM+6gxOSzxNrMmsmbY=; fh=sPT8jK0hpUYw2nA3qnRx+CfMFrlQBSyMr7RtKrxXrvY=; b=yM032p+hOktlU9Cdm+JuX5deVLtMmS9ruuUPDJPxu7zz+YUnQPHEvTgvgo4ix8P0Tk Dt3zU27oYgnQBsZ51q/uWPcWpdMH62bt0WyeJJGxwcdeaRr/CC+6p4qhmGmowstKs8eT bmCoK+wvPQCnGuEwW4bsnyl6P63fWxfTWjsxK6C426WwCeO9qvNplHe37R6e0BKzbm2/ f6hkdCvblv4DOAeuosj5yOTsqq+cpnnBh/gjuGZhQ3m2v4Y0WjbapDDDKizTEmf0YYhz aF8IWCyDqsAYNr1jViLDWc084IGtGlRcq17+6tyS7DhpI83HPVCthdGu9Jk8s7V297w0 p4hQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oe8RA2DV; 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 u22-20020a05622a199600b0043162088668si2812267qtc.431.2024.03.26.05.35.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Mar 2024 05:35:33 -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=oe8RA2DV; 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 1rp60w-00057R-Qy; Tue, 26 Mar 2024 08:34: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 1rp60v-00056t-HO for qemu-devel@nongnu.org; Tue, 26 Mar 2024 08:34:49 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rp60t-0000dO-WE for qemu-devel@nongnu.org; Tue, 26 Mar 2024 08:34:49 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4148c6af2d3so8335315e9.1 for ; Tue, 26 Mar 2024 05:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711456485; x=1712061285; 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=jrYhcbQiD/iBdvr35vsxxSuWauM+6gxOSzxNrMmsmbY=; b=oe8RA2DVOAn5RiG1nUh+bmU2nGBfsx58517XEvbczx0JHmN0BWatEOL/+Rp/i3IOjt 74K+ZEZWTenfxBGUE2EmYDzC50f5BBpBL7RxlW5hFaqu8IWavRv+75qAvsNU0BeeMuZw M8rwT4KoU/gRjKi+Xzs0d0SvJk/Cn6t+CZ9pFaOiFJQa/TqfpF9JbjrX3XeI8cnBH37w xWCWUE7OmnW4aNxOGvsFuYi7OnVIHMmdj1P9CNFFRVKlI+MQ+DQ7FnO1G1V2pqoyEYgq yDcAiQpnkVwkb4yIk228eEmY5YhNRMGjs7vQgVNHO8odgZ8UoC8DD3NI1w3OKCFr21+5 aFSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711456485; x=1712061285; 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=jrYhcbQiD/iBdvr35vsxxSuWauM+6gxOSzxNrMmsmbY=; b=Ao6mALPOWdY4oxCA6aOHRDQKPWTCLnIF3S8tbPn9KdwcwizQhLFHnE/9vJgkwAGY1m 0GW0TiHBSAFSGf2CETvnDitE5QxkL0IxmNZX1GABWDBlze6LJb2sc93I6U2QUEmA4DQ8 lcdwQ0L0wGFXhGOBM2izXrgakQG7qk4EgowdQ5UlOyHkQsfrKY5t2atiQxYhh/EoLu86 qn8Op8RDvhKVnD4VUFcKVsv3bECQXl5hvZxvVUFjqllJRYmqH3VLPJ4xRvIUlkZOKAtE Q4T+jUO6Vf7UBl/v7DPJllul9rI5JFMZU/gR1aFTawPgq3G7wqXwAMl62CEsbomdBL4u imYg== X-Gm-Message-State: AOJu0Yw642NER4cI5dpiK4pGtoDc0/Src9exmS89LNwkSvnNEyQCIRsC DTQzH2YqPv7yHCN7nzrrsXYXm6u/TbrlZk8nl5eH3ITXGtU42AnKEIzWRpeQqkxqqp9k0rpOlC+ /C9w= X-Received: by 2002:a05:600c:2e51:b0:414:250:ccaa with SMTP id q17-20020a05600c2e5100b004140250ccaamr7189953wmf.12.1711456485419; Tue, 26 Mar 2024 05:34:45 -0700 (PDT) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id y19-20020a1c4b13000000b004148090cf85sm716317wma.0.2024.03.26.05.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 05:34:45 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Mahmoud Mandour , Paolo Bonzini , Alexandre Iooss , Pierrick Bouvier Subject: [PATCH v4 1/9] plugins: prepare introduction of new inline ops Date: Tue, 26 Mar 2024 16:34:18 +0400 Message-Id: <20240326123426.761473-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240326123426.761473-1-pierrick.bouvier@linaro.org> References: <20240326123426.761473-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=pierrick.bouvier@linaro.org; helo=mail-wm1-x329.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Until now, only add_u64 was available, and all functions assumed this or were named uniquely. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- include/qemu/plugin.h | 2 +- accel/tcg/plugin-gen.c | 6 +++--- plugins/core.c | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 201889cbeec..23271fbe36a 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -68,7 +68,7 @@ union qemu_plugin_cb_sig { enum plugin_dyn_cb_type { PLUGIN_CB_REGULAR, PLUGIN_CB_MEM_REGULAR, - PLUGIN_CB_INLINE, + PLUGIN_CB_INLINE_ADD_U64, }; /* diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index c3548257798..41d4d83f547 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -120,7 +120,7 @@ static void gen_udata_cb(struct qemu_plugin_dyn_cb *cb) tcg_temp_free_i32(cpu_index); } -static void gen_inline_cb(struct qemu_plugin_dyn_cb *cb) +static void gen_inline_add_u64_cb(struct qemu_plugin_dyn_cb *cb) { GArray *arr = cb->inline_insn.entry.score->data; size_t offset = cb->inline_insn.entry.offset; @@ -165,8 +165,8 @@ static void inject_cb(struct qemu_plugin_dyn_cb *cb) case PLUGIN_CB_REGULAR: gen_udata_cb(cb); break; - case PLUGIN_CB_INLINE: - gen_inline_cb(cb); + case PLUGIN_CB_INLINE_ADD_U64: + gen_inline_add_u64_cb(cb); break; default: g_assert_not_reached(); diff --git a/plugins/core.c b/plugins/core.c index 0213513ec65..a8557b54ff7 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -316,6 +316,16 @@ static struct qemu_plugin_dyn_cb *plugin_get_dyn_cb(GArray **arr) return &g_array_index(cbs, struct qemu_plugin_dyn_cb, cbs->len - 1); } +static enum plugin_dyn_cb_type op_to_cb_type(enum qemu_plugin_op op) +{ + switch (op) { + case QEMU_PLUGIN_INLINE_ADD_U64: + return PLUGIN_CB_INLINE_ADD_U64; + default: + g_assert_not_reached(); + } +} + void plugin_register_inline_op_on_entry(GArray **arr, enum qemu_plugin_mem_rw rw, enum qemu_plugin_op op, @@ -326,7 +336,7 @@ void plugin_register_inline_op_on_entry(GArray **arr, dyn_cb = plugin_get_dyn_cb(arr); dyn_cb->userp = NULL; - dyn_cb->type = PLUGIN_CB_INLINE; + dyn_cb->type = op_to_cb_type(op); dyn_cb->rw = rw; dyn_cb->inline_insn.entry = entry; dyn_cb->inline_insn.op = op; @@ -551,7 +561,7 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, cb->regular.f.vcpu_mem(cpu->cpu_index, make_plugin_meminfo(oi, rw), vaddr, cb->userp); break; - case PLUGIN_CB_INLINE: + case PLUGIN_CB_INLINE_ADD_U64: exec_inline_op(cb, cpu->cpu_index); break; default: