From patchwork Thu May 2 18:08:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 794124 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp387786wrr; Thu, 2 May 2024 11:10:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVPZ7t00ZrqPYmjE8awy+fCNMlZ0CFJiAcWlUau/HFtVFKqhthpoDIIMi5y+6yYmFMqERGRI7yfwLqBAsCbzsrl X-Google-Smtp-Source: AGHT+IH4qKFueWFTxtPTKHRR8oVuexo9wN+H3HFuEe5RbpKKuGHjtMDuBi0lR40YJlyR3sWu6B6q X-Received: by 2002:a05:6102:5d3:b0:47c:3033:5faa with SMTP id v19-20020a05610205d300b0047c30335faamr495895vsf.20.1714673407130; Thu, 02 May 2024 11:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714673407; cv=none; d=google.com; s=arc-20160816; b=v7Td+FxFfmfrU8S9vkWGubIdN/ZITpGWBH6ox6hJH9I68SGajr+CBWO/YVzFufoZe5 cUlgEEW8cJUGOL5CmpLMzxk+JTneRro0X6YEJbHYFnxDbQ9EntUwvSd/Y0y2fayK8CLC yUwER0fTFi+s9vY+USY0RmeFgLn1ObSO5R/uBvmFIUxbm/M50r5L31DgxUTowFzQeNLL ox/WJc0snTwXfVaQojfA2JXUjWWLspHtfID5jQYIvsmBzs2tZNM3Npd/JmW2+foFnqNh 0XXjdBRqnrbFehW5heesBdmmrjSVYnCXFJtRvnybD+yxWnbO0cyRs8rLqaN4GZJMxXPg 6Sjw== 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=FLV/GYrIEX0gQTx5Yxot837zR7KR8Gz9r47zkNmBYYY=; fh=cGQQHKa+VmgbxLLxTvBCsw0Hx1TzppraI5gmJtpkFxg=; b=S9KVSyV/4EcNi4OUdKruS0ghURMEwhrOYHvXAIqAHFqytudB0me3yB0drwlJtAUi3S +IhZrHcZcHR1XNYiB0c98l9cMNG2xqtJGvsxKuJf89zLk1lildDyS+B/dVdvXPMh4RwE kjtzZGNGEiOz3iksNB+jtk4C1Xep+cWKU6HFCQ0+YwlkdHJhbw3pi0bL3M2byXlShLq5 i/kGqz1GgHEd/i1f+h24cd0TVWrRHsKRGEtiln9Hp0S/Z18azjPVw3NoydRNbIGqBXZA nR4+Dvp6UNM6JXyugMsABoQS8m+GCwqfackMmWiZWGAT/awSovqZU+RyvHIl8LOeUW6u U7vg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cr0kDxMr; 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 g12-20020a056102158c00b0047b916c8231si551562vsv.564.2024.05.02.11.10.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2024 11:10:07 -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=Cr0kDxMr; 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 1s2arn-0003BR-3i; Thu, 02 May 2024 14:09:11 -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 1s2arg-00039q-F7 for qemu-devel@nongnu.org; Thu, 02 May 2024 14:09:04 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2are-0003QG-M0 for qemu-devel@nongnu.org; Thu, 02 May 2024 14:09:04 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1eb24e3a2d9so59303375ad.1 for ; Thu, 02 May 2024 11:09:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714673340; x=1715278140; 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=FLV/GYrIEX0gQTx5Yxot837zR7KR8Gz9r47zkNmBYYY=; b=Cr0kDxMrP10E4nwTqTXVq/Cedma/FHeJDKD9U2DfHQ9l1BmNTSspZ7stnDyX1GQUzt 4ywuYLhbNBEZ6VrDj4iwlwqvlZCaUkut2BKZ+AH7WYW9x5mS0xLM98JHQk1Z1uQzAIte vKQ0mxAUYHKOgizbmOrRi6OQW+6wmCjQ/UxxKLjJ+R1y99/VJTneldZjtKEfTLej6Ghj Bne5uP3MAovmh3qN3Ks7wNMcKG7b6E5TrmJIxPqd0TYzypg+lJO2WDJs8YLQvfsO7Y3G IIURaKNnfBlh8FmeorPNDC8aVy5aJJJZDU37zTPYY4An1IWKjOo4N4YsNI72wqIAuD6s 1CIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714673340; x=1715278140; 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=FLV/GYrIEX0gQTx5Yxot837zR7KR8Gz9r47zkNmBYYY=; b=UX4+/ZcU0+JioeFXNQbtn0N/gO/cJ/+sBY7jA7sp7TQGpBUfDuPrGlSh/AoFqiHu5G kPpC/DI87joUub7wB2YDZHgepRpsz02D8snGl9xO4RMh7KXObhaPkrd7A8VGJhI8MOXN pi/8Kh3Wbg69zMj7/4PTcWOvZ5zMdwHChBPi4A4HlWGtR7qllU2LP+c5sgTChBSwbThl Co/w2Sxgk4xEZPltXMkeHoXgeAl/sglDocE8F3taTzJuvYi6C/rublSoDx25Pa3E7aQD jc6avcgZHJIyh/dEANBSM4M/U7P0MWOHiF6ojawOcbG0T2i2a0OqLTyYiMgLUXrPCDn0 DZug== X-Gm-Message-State: AOJu0YxblCUcKmomKMCGZPImGHYoKAJ0K0PxYczpeDnbuikLzKklDN56 rsqtitc8Qds26Mf5UTtf+DVPRSP6zLe2a5ngtuNe/QAcJaWJlnI+Akk0qepipNZduZLNzRSuWek Y/v4= X-Received: by 2002:a17:902:f648:b0:1e4:19e3:56cb with SMTP id m8-20020a170902f64800b001e419e356cbmr624624plg.12.1714673340285; Thu, 02 May 2024 11:09:00 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::ecd0]) by smtp.gmail.com with ESMTPSA id c17-20020a170902d49100b001ebd73f61fcsm1615605plg.121.2024.05.02.11.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 11:08:59 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mahmoud Mandour , Richard Henderson , Alexandre Iooss , Paolo Bonzini Subject: [PATCH v5 1/9] plugins: prepare introduction of new inline ops Date: Thu, 2 May 2024 11:08:39 -0700 Message-Id: <20240502180847.287673-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240502180847.287673-1-pierrick.bouvier@linaro.org> References: <20240502180847.287673-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62f.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 18062528c17..bee1647cfc4 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -69,7 +69,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 3db74ae9bfe..8028ae76c3a 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -113,7 +113,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; @@ -158,8 +158,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: