From patchwork Fri Mar 12 17:28:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 398701 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1434049jai; Fri, 12 Mar 2021 10:38:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6zE24rpENTVXI24p4cNufX0MrgW650qaJThv30dtrIpEPlAxyPD87alACXO8irM43wUMN X-Received: by 2002:a5e:c911:: with SMTP id z17mr437380iol.153.1615574314466; Fri, 12 Mar 2021 10:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615574314; cv=none; d=google.com; s=arc-20160816; b=V5HeN3ul91PHGsoxB0hZSsVRjV3a+0+waammdvq/2yWZv9rEAQBkbdyPClReq/94Cz phGf1jhGrO+eigVpVbrJl2NzP5cXQIwNhf3wLkH2ldZ1vfJG8GujUD3iiLB0kl249oqb 4wPjAs3S1vqNauWgu30uWkJHliamvMcFOUJsVk0XJGTWWXmTNnGFFuyOQprgjLWwXlbQ 8MI1yTxGAN9yZUbh8UKBFSim+A0gnU6HVbOSkWLPJqlL2lb4uaYvcGMf8luqO/cQZu0M a1HSUgOU8R1gVCbBR/Pb2JBSJywy6T/NZ4YQAS0LTUHoSI2DlRt+UDIgjf7OMI24NKbc sANg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=D25/pl4BFCseo4QTY1mxuXFeITzdlqswyd6ddGYq3qQ=; b=RN5Gfdyx75pRDcMXJ/t8EwcJw6oD+mSzJdF5Puv70kY29JAYRd6hVoc2eidstrbRy5 TLEJCUiKdWbpXuwQcf8ze8c1dx6FQPHnihIu3O1sYLTTgL1gvNLYqUUCtVc8M7ML6eKA UlyPzCKbF/cet8Qt/RkLs35jYJLIlkOg/Y/8Ib3uNHbT8qrHZZBC3pa1B+FEhBH0hDVh Vv/sFRO+fOiIPJ7lcnAln+bVea6SHxDcSNShdEwYuOFlIQlduYQt9nT+YHru46VWg6qV 5Q3R/uiWJVfffUMgPsunHHuI6m/y2AZHd+/QfDv59sTSrGsfaYCAnk6PVdh29wZHhsZ6 OW1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Bshb7rtn; 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=fail (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 y11si6199520jat.103.2021.03.12.10.38.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Mar 2021 10:38:34 -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=fail header.i=@linaro.org header.s=google header.b=Bshb7rtn; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:45180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKmg1-0001pB-Sr for patch@linaro.org; Fri, 12 Mar 2021 13:38:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKlam-0004LJ-57 for qemu-devel@nongnu.org; Fri, 12 Mar 2021 12:28:52 -0500 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:41595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lKlaX-0002DV-TJ for qemu-devel@nongnu.org; Fri, 12 Mar 2021 12:28:51 -0500 Received: by mail-ed1-x52d.google.com with SMTP id z1so9066516edb.8 for ; Fri, 12 Mar 2021 09:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D25/pl4BFCseo4QTY1mxuXFeITzdlqswyd6ddGYq3qQ=; b=Bshb7rtn95O/oN+mT2xU7Lv1ZxHBd1ouOhS/ffBzYqM0jdyJ/8GjmnwoTFYlZrpYwn fhS2eI7YDzy7Rzbi1wMLb2WOriiMdHV/3qb/A6qg19Gj52LX5SGrCRYCeow6xuhznrpi JqV58bcQ7wsY8NJe9geFsEMdGfOzYZhJi14pu6QF+0yJAf7IjUAF+rXo2Zzxel70Xo7v Z1yFsfVfc2vaDZTRgEYk4RF1Rx9k/mE+DHxW2+quFpm5wQOe+hFyQQJyHSydcZjeWf35 +40PmiDr3pVunt1VXIYZOqanV/YggpApxWwQsu7ANYl/R1UNsA2+yn9BSR5WfF78gZwq gj3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D25/pl4BFCseo4QTY1mxuXFeITzdlqswyd6ddGYq3qQ=; b=qchaDBWbc+Uns1Rd642PBkhWNSQlm9bTtRA36zhhz07zCHiaN0M5xsz6NmxFLZBg4N VJhoMf/1dT3WoBQs8nXkca6I8XMkgDH8srwjmSnehXSTzRsyY+mpOkLCH1YYSN2Vs/Rb KgFwOxMYyPD77+nruXW9pcfyyBRCnO4uwPILYHWPmicNLT2oTx0BQuUHeP/IbC/PFuqF Xi0NPINBrOzVmF0FSEShGgNstLsUwmdd3oDUOdk1Lwp4l0a1BcWasxGwkTpp3v8GS3my wlG36+3Y8IKEN2Ne/kN/5rYbCjLzsi8RtN9IB/dPg366pXb3fNiv3Iyd8tqDKdKmctgL L89w== X-Gm-Message-State: AOAM530MQZAv1otCewLebAjiz3SY0PTxBcr+G+j4l1DwqbzmkVnw0OH/ axTDRxiC5FUDLE6mSA3e9dumyg== X-Received: by 2002:aa7:db0c:: with SMTP id t12mr15181022eds.34.1615570116571; Fri, 12 Mar 2021 09:28:36 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r17sm3274316edt.70.2021.03.12.09.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 09:28:28 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B84C51FF9A; Fri, 12 Mar 2021 17:28:22 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 11/14] plugins: expand kernel-doc for instruction query and instrumentation Date: Fri, 12 Mar 2021 17:28:18 +0000 Message-Id: <20210312172821.31647-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210312172821.31647-1-alex.bennee@linaro.org> References: <20210312172821.31647-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52d.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- include/qemu/qemu-plugin.h | 52 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index dc05fc1932..d4adce730a 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -327,21 +327,69 @@ void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *insn, enum qemu_plugin_op op, void *ptr, uint64_t imm); -/* - * Helpers to query information about the instructions in a block +/** + * qemu_plugin_tb_n_insns() - query helper for number of insns in TB + * @tb: opaque handle to TB passed to callback + * + * Returns: number of instructions in this block */ size_t qemu_plugin_tb_n_insns(const struct qemu_plugin_tb *tb); +/** + * qemu_plugin_tb_vaddr() - query helper for vaddr of TB start + * @tb: opaque handle to TB passed to callback + * + * Returns: virtual address of block start + */ uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb); +/** + * qemu_plugin_tb_get_insn() - retrieve handle for instruction + * @tb: opaque handle to TB passed to callback + * @idx: instruction number, 0 indexed + * + * The returned handle can be used in follow up helper queries as well + * as when instrumenting an instruction. It is only valid for the + * lifetime of the callback. + * + * Returns: opaque handle to instruction + */ struct qemu_plugin_insn * qemu_plugin_tb_get_insn(const struct qemu_plugin_tb *tb, size_t idx); +/** + * qemu_plugin_insn_data() - return ptr to instruction data + * @insn: opaque instruction handle from qemu_plugin_tb_get_insn() + * + * Note: data is only valid for duration of callback. See + * qemu_plugin_insn_size() to calculate size of stream. + * + * Returns: pointer to a stream of bytes + */ const void *qemu_plugin_insn_data(const struct qemu_plugin_insn *insn); +/** + * qemu_plugin_insn_size() - return size of instruction + * @insn: opaque instruction handle from qemu_plugin_tb_get_insn() + * + * Returns: size of instruction + */ size_t qemu_plugin_insn_size(const struct qemu_plugin_insn *insn); +/** + * qemu_plugin_insn_vaddr() - return vaddr of instruction + * @insn: opaque instruction handle from qemu_plugin_tb_get_insn() + * + * Returns: virtual address of instruction + */ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn); + +/** + * qemu_plugin_insn_haddr() - return vaddr of instruction + * @insn: opaque instruction handle from qemu_plugin_tb_get_insn() + * + * Returns: hardware (physical) address of instruction + */ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); /*