From patchwork Thu May 2 21:15:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 794135 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp456446wrr; Thu, 2 May 2024 14:17:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW001Aw+KFIaw0wQGPGd8Is/h0hrkN5JsRiNHWK1J4g9zsuELLBuVheXTt+1eeETsyjrtlbHjyYTvy50d8x59Bm X-Google-Smtp-Source: AGHT+IFM9T+TtD4ze4CydsPhFiLS/qFZEV/gN8HHwBKcZehXHz/oSQwAOC/L2nwIyYKYk24+4HE3 X-Received: by 2002:a05:6122:d86:b0:4c0:24e6:f49d with SMTP id bc6-20020a0561220d8600b004c024e6f49dmr1082867vkb.1.1714684620629; Thu, 02 May 2024 14:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714684620; cv=none; d=google.com; s=arc-20160816; b=ZdTvjekF1hYn8K2KrpDzq1yM1Rxyk5DiDBEL8NYL2MV8WwywFExyidFaYsBe90Ossw Iyr0k7Wp7rBQV778cXAv5NLV4yKHfiIMbSwaEbriAKaI4oa0N8ow0WZmZSX1zP3nn27E JRvVlKOs72G8Z4S/mIMMwwZZzoMGbWo//9WSCcs0LBEjB6/PpW5aCakQJCh69Wgj0SRf MTsR3dfHlNefWRHNsIKdyQpu3uhNv2Thiep2gh3dyQ1YWI8Z5KHx+Jx3MqBvo3qOLCmB 4fxm+OkBbNPDi9utNC36AQZuKAitacGS/VIQr6tqc3l7Qb/0XgO/r8mRhNu5abJnWWC4 uqgg== 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=c/LO5tC874FLSEu8fk1T5CBIMYOJ6qSGhK9i0Ks4R2w=; fh=9xGhv+1UliIX34j+rhFuVtnm9fBdMYzeJdXCJAB33Zg=; b=tOPlrilKziB9Usrg2Kdy6OZlHXVMb8XyGjo6dqwegdYt8yZO2j648U0Uk44c/Qh0Le weAQZD1WZcAUBWCdqpa1qntvHGAZ7AW+6vexX6BCfcZzNe2k8uKUy71KgBeK3jumcsEL 8f9o3IuW1RMTpXLTHRzT04WV1St3t23kw2QRNwZGosi5Cle5oikEw+I/fnRRrwvn6w52 VY0ohZS2ytBVhHlaXNc2sI3/FAuV2GTiCkklafQ66z9lLJorjkeCM5awb/niNCmtQLOk +b4qIYHxSDJWEHA6XvrEzKm2FQiNy6EIxzLIa1eqIIR33fja+7G2x2y5MSJDR03B8s9G DxDw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tjPAMAq9; 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 ge2-20020a05621427c200b006a08edc0b81si1861060qvb.313.2024.05.02.14.17.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2024 14:17:00 -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=tjPAMAq9; 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 1s2dmX-0008Vq-UF; Thu, 02 May 2024 17:15:58 -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 1s2dmV-0008VH-OF for qemu-devel@nongnu.org; Thu, 02 May 2024 17:15:55 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2dmP-00030q-Ho for qemu-devel@nongnu.org; Thu, 02 May 2024 17:15:55 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6ed9fc77bbfso6811315b3a.1 for ; Thu, 02 May 2024 14:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714684547; x=1715289347; 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=c/LO5tC874FLSEu8fk1T5CBIMYOJ6qSGhK9i0Ks4R2w=; b=tjPAMAq9/KC1Qgum3OhJobN1iP3fKs1h2nx1tM6KIqrQze9IWGJSbr4finHhyrifQt +27YEha5OwBwi1QgGAdIRqxgjT8jN1nMYAl+FfcgfbO6Uc08IAPVidL/RYOqa0zoCUlW FWPip93BBbmunY/c4DSVA0J/9eKmIZJtng1HAcZagx5RRP9P+IkTWn6oeGzkPTN1W/Nt ND2zYLLs/XLeAYi7QNAidFZ8Ka2HPBaPOdMBbjj9rCNx2rqDIxpdLC6JYCxSOzSuxgey +UO5dL3IcNGIOnTcfETSj2WsjYARkFtHe0558INf7Btp3F5895Y4yT7zx0oyijmPtqax 4BPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714684547; x=1715289347; 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=c/LO5tC874FLSEu8fk1T5CBIMYOJ6qSGhK9i0Ks4R2w=; b=vpmUuhm7tETiinKXiAj0vBJYtYtGCgtlTHtKnfWlAYWICtgQJYlyPxuHVLHpBTf/Tq 7wCJIuLdCywM+V1LInE2liUyLmFQvmHXN5jjKxk0/4bWlVh55Jof7GbRXd/DxToGQSGW kDVEbvbXez62bNcKCkW5JIIEalM0G3KzhJaG2iO7BVhX0cIx48YWbkFCN6ZzmNEkOrra SNnCWaMy/Zx9Kmz5qzxEVgIjVZ2NFbc40cHa9pnt3b/KYJkmqe1F1gFN6JvrzyzdPfy+ kxpF+udl6KVCigxsIRpfeBsOAa3krNGvA/H5tSs4HKeztWZDUyDB1F9wTw0woaeDvITN XXPQ== X-Gm-Message-State: AOJu0YzQxsDH7J9jB/UJ40ZcFsKERCVg4amghIniWntojE7Ftvq6m0Wx kdWueilUPZhgYtafSNmx6y/lj3BSFJV6zn29vQNYWgxSsdAa4vgxi+Hu6sk7hm1MZG4krbWcPVp 91sE= X-Received: by 2002:a05:6a20:8c2a:b0:1a7:a435:1388 with SMTP id j42-20020a056a208c2a00b001a7a4351388mr932631pzh.49.1714684547595; Thu, 02 May 2024 14:15:47 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::ecd0]) by smtp.gmail.com with ESMTPSA id d14-20020a63f24e000000b0060063c4be3bsm1700915pgk.14.2024.05.02.14.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 14:15:46 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Mahmoud Mandour , Alexandre Iooss , Richard Henderson , Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v6 9/9] plugins: remove op from qemu_plugin_inline_cb Date: Thu, 2 May 2024 14:15:22 -0700 Message-Id: <20240502211522.346467-10-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240502211522.346467-1-pierrick.bouvier@linaro.org> References: <20240502211522.346467-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x430.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 This field is not needed as the callback type already holds this information. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- include/qemu/plugin.h | 1 - plugins/plugin.h | 4 +++- plugins/core.c | 13 +++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 313b7c72684..1ad8a59209b 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -83,7 +83,6 @@ struct qemu_plugin_regular_cb { struct qemu_plugin_inline_cb { qemu_plugin_u64 entry; - enum qemu_plugin_op op; uint64_t imm; enum qemu_plugin_mem_rw rw; }; diff --git a/plugins/plugin.h b/plugins/plugin.h index 80d5daa9171..30e2299a54d 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -108,7 +108,9 @@ void plugin_register_vcpu_mem_cb(GArray **arr, enum qemu_plugin_mem_rw rw, void *udata); -void exec_inline_op(struct qemu_plugin_inline_cb *cb, int cpu_index); +void exec_inline_op(enum plugin_dyn_cb_type type, + struct qemu_plugin_inline_cb *cb, + int cpu_index); int plugin_num_vcpus(void); diff --git a/plugins/core.c b/plugins/core.c index 7ea2ee208db..a9f19e197aa 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -338,7 +338,6 @@ void plugin_register_inline_op_on_entry(GArray **arr, struct qemu_plugin_inline_cb inline_cb = { .rw = rw, .entry = entry, - .op = op, .imm = imm }; dyn_cb = plugin_get_dyn_cb(arr); dyn_cb->type = op_to_cb_type(op); @@ -557,7 +556,9 @@ void qemu_plugin_flush_cb(void) plugin_cb__simple(QEMU_PLUGIN_EV_FLUSH); } -void exec_inline_op(struct qemu_plugin_inline_cb *cb, int cpu_index) +void exec_inline_op(enum plugin_dyn_cb_type type, + struct qemu_plugin_inline_cb *cb, + int cpu_index) { char *ptr = cb->entry.score->data->data; size_t elem_size = g_array_get_element_size( @@ -565,11 +566,11 @@ void exec_inline_op(struct qemu_plugin_inline_cb *cb, int cpu_index) size_t offset = cb->entry.offset; uint64_t *val = (uint64_t *)(ptr + offset + cpu_index * elem_size); - switch (cb->op) { - case QEMU_PLUGIN_INLINE_ADD_U64: + switch (type) { + case PLUGIN_CB_INLINE_ADD_U64: *val += cb->imm; break; - case QEMU_PLUGIN_INLINE_STORE_U64: + case PLUGIN_CB_INLINE_STORE_U64: *val = cb->imm; break; default: @@ -601,7 +602,7 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, case PLUGIN_CB_INLINE_ADD_U64: case PLUGIN_CB_INLINE_STORE_U64: if (rw && cb->inline_insn.rw) { - exec_inline_op(&cb->inline_insn, cpu->cpu_index); + exec_inline_op(cb->type, &cb->inline_insn, cpu->cpu_index); } break; default: