From patchwork Wed Mar 17 07:22:12 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: 403040 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp233931jai; Wed, 17 Mar 2021 00:31:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdc4YBokT+Vsxwdd3LyCG0NB1HvSXyNyEpcOmOVFEfBz1vTQLbf84geo7ILZNVWfHjJNyQ X-Received: by 2002:a25:a286:: with SMTP id c6mr2901922ybi.146.1615966270104; Wed, 17 Mar 2021 00:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615966270; cv=none; d=google.com; s=arc-20160816; b=SNFCrwOq/x0jG0IuazoGxoOMtwlwfhFRdLPSiq+gZXicWft1Lbv3qcQ1srFe8nQ5c+ nWW5FMT2aWj5Jvoftewb+BNJq2xi/MAGYKKbWcPesohIZk1qtkxKaq596Hi/gzxFoEwx 8aPjpG1ZiwXCU73v7hTZagJ2HcpPkN/fTZ+9YzOWMLoJONcNXPghsC5Iuf5bnP7IFcYF I9t2v/kKs4Br9lV1868qbXlQjLiJ9boeTDFonhZeESoWP+J3pIZGVxGQCZMfly7buz5D sODby1MqL/mvkmqoPPe9m1kvd5go6HBB3u0d8iTFKxHqUZa8lzZGR+pIBpXtrXl5wge8 yxmw== 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=V1k83nSOBQHKX3KyY5kO2YVliDyi+4QoKl7OCC4rWPk=; b=OO30MmipFOKMBIrfUqNSPw/rfeNUirFC5ZA022G85khSnD/p2aQ8g2yppCTaLRyqdC Bc3n0vdAoXvH83xGpQGZm3Hjaq//Nsh4eBSCb73mJMzGonTGOfrLTQ6lNqhydOsVsTGj mOm1EzoLvSyR1fRJdcUPuCZ0fCLsTX0we6KG9djsAFBmHA8PiybCHpwo01tNAHXwnYWz fAQwuxvGloZ05ubyxxH929w3AI3OQC7lxKTrG78p22mHpPwGMr4MWYobcKfX7rDDUXPe fSMv05hZTzI5NUGpmpEUVvqOgSfBAlGngir6lRyBRfj0NGSX/fNIqa6dHTL0lN+esJb5 gp/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YIg0u2dF; 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 s12si19336434ybg.149.2021.03.17.00.31.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Mar 2021 00:31:10 -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=fail header.i=@linaro.org header.s=google header.b=YIg0u2dF; 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]:51706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMQe5-0005wQ-IK for patch@linaro.org; Wed, 17 Mar 2021 03:31:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMQVs-0003zO-9V for qemu-devel@nongnu.org; Wed, 17 Mar 2021 03:22:40 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:33152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lMQVq-00080I-9H for qemu-devel@nongnu.org; Wed, 17 Mar 2021 03:22:40 -0400 Received: by mail-ej1-x62c.google.com with SMTP id jt13so954249ejb.0 for ; Wed, 17 Mar 2021 00:22:37 -0700 (PDT) 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=V1k83nSOBQHKX3KyY5kO2YVliDyi+4QoKl7OCC4rWPk=; b=YIg0u2dFh5+c3E5JAVrd5/R9nhrSIV/kDrAHKzyXxpSzPVvJRL1gk9d6NGmE7nbOsb xqYAQWq/JdV8M6AemeTVIfJOgp1qdTB8f/3yXW6HpofR7w+FfRXGVUV+TQhZoUvIhpeI cnGi7CM3Dhz5yUJi1AOF4J+lgF4ijjvjER9N2rHyhTbL8ecxrklzJVZJF5sIy/6MKfy1 u7IV35VeIeWTzZtqexox2CX7sZebKHxg6lXjMiRTS+Mcbt9NOAAXTivJgzHm8kS8EdQm ywmckWVxlHyBq0Y2478WJaHBFGQDTteVx+zq3mNWBFpBxD/78drJZZpUTMgPoUicLMFn eq3A== 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=V1k83nSOBQHKX3KyY5kO2YVliDyi+4QoKl7OCC4rWPk=; b=jt4P4LbTpHkd4Y5+XOHaL+AspDgeGrIhsx5pY1LbHGx9lsGeeDzJWrFwhvZULDYzjc BAY/zXRBGWhwLUSYlUCld/jWSRHbcDEOrxWJeoGZ4/pd5pS3SuC4PjBYMhOd6tV3kcRJ egKQT5u6f0YXLlGRfElsils73QQcm2P1MILHte9V+SEAac9GvY041SqTETTWP9TLNlCY oXm36OKNe/pSvFZFf8NzQPkEmQEL4ai1hOoA0gpdMmLiBWzxF/LnyHU2JlBr6e/ygPI2 iWnHRBCDmdxmAXIzP2HzxHkScBHNcDjFrk1XEEipnd9uk5u/KAZ81yBJoDodXDEudgqc +LQg== X-Gm-Message-State: AOAM532w0+phwa9i/QjEF7SbDOjeYe5fED5TqV+4FzT/LjvnD9fJjip0 kryBXnI44qf8C14hg+wdbVUYgw== X-Received: by 2002:a17:906:1c41:: with SMTP id l1mr33671066ejg.299.1615965756888; Wed, 17 Mar 2021 00:22:36 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id v1sm10347155ejd.3.2021.03.17.00.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 00:22:29 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A07021FF9A; Wed, 17 Mar 2021 07:22:17 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 11/15] plugins: expand kernel-doc for instruction query and instrumentation Date: Wed, 17 Mar 2021 07:22:12 +0000 Message-Id: <20210317072216.16316-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210317072216.16316-1-alex.bennee@linaro.org> References: <20210317072216.16316-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62c.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: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée Message-Id: <20210312172821.31647-12-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index a3805bb299..ad9dc4b69d 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -327,21 +327,70 @@ 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 containing the value of this + * instructions opcode. + */ 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 in bytes + */ 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 hardware addr of instruction + * @insn: opaque instruction handle from qemu_plugin_tb_get_insn() + * + * Returns: hardware (physical) target address of instruction + */ void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn); /*