From patchwork Wed Jul 21 19:59:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 483326 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp6519186jao; Wed, 21 Jul 2021 13:06:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJT53t266C3vfRPJSom94DAiNV8kd0bjm/gZgxNA2U+wk/vSdBQfgzUE+3fHBIFIqFM9tt X-Received: by 2002:a05:6102:34c5:: with SMTP id a5mr9844445vst.21.1626898017002; Wed, 21 Jul 2021 13:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626898016; cv=none; d=google.com; s=arc-20160816; b=zGxoHO7Nu0s7O6Vwj65lvUD4OUAZ+V88SwczGQ4z6znfmSmcAohx/ikn2cVN6XJYm4 gGNVijGNHBRDlgKBPayXkxdhk3oNhX3QvCC+yG7BZvWTfEK44/x2GOhNWBmC+MR4mIzG 9vta3n9qMKpgAbrb0qqumctEnCHvTBy1j7KbjHt5Vfb0b3keh2iY/IT7woEwhM5PGzR8 cUocivq4dulJ5QwzbBqbDjcnue/Ij/QIRogsXRgtl/DVSS9qFLNzVF6s186JpTlHFdLf WOLMFM6ynqgR8Y4WEMRx9/vLQdBb21yH4UJveubhhwUwIsi332nb0ekT8NILeNNrhUsG ArXw== 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=lxWc/RvP2HP3ROUQi7CWrSdIRxEa6wVjFG+/s3ElqKw=; b=fG3vfUdRyagUe/nTs7BgYNpbQOlv4iwahhEhBwTVLe3FGzMk7YzLs7Df1ISljlyKt1 zdvZ8zR6YeKe/uLIJzAkJnYd+nltyI9oWcCljbdfHeQSnjKIp5KGaPjAyFsTCrddpz/o tq2ETuEKqIO0/0x5QPGmV8MZlctkUOFIwW3EH25/MjHhuM2+IKbiOWol1sydSA63C8ny N++6w72YLCpRq6ndwmBu4OQMBhLcdNqA9eW85l8jGdJsZnuFdo6N2Qditl6Vj38hN3St WSrnlquihuT48aX9aNfQpVajl5ut8Q1kWxL5LvjiyyLedk4fbGCAZytKfzOCvNCpLmGG 0sXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="JFfR/aft"; 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 x2si3464523uaq.121.2021.07.21.13.06.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Jul 2021 13:06:56 -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="JFfR/aft"; 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]:38254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6IUa-00068Y-9t for patch@linaro.org; Wed, 21 Jul 2021 16:06:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6IO4-0002kT-QM for qemu-devel@nongnu.org; Wed, 21 Jul 2021 16:00:12 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:37812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m6IO3-0005ik-3J for qemu-devel@nongnu.org; Wed, 21 Jul 2021 16:00:12 -0400 Received: by mail-pl1-x62d.google.com with SMTP id y3so1646956plp.4 for ; Wed, 21 Jul 2021 13:00:10 -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=lxWc/RvP2HP3ROUQi7CWrSdIRxEa6wVjFG+/s3ElqKw=; b=JFfR/aftAGjAQ0wcUTUf2A3PuXn/DyS1H5IjkntwDDTy4XuaRrgQMpRFE/3rlg284H 7V0lrHNsLb+eAn8pM1T9GcuPq9NKgTejICrPnLZzjgZD9asFj7fhdgNgxfT0We0TX0ut TsZpVnZGlTb/jiVBe7iGlHa/ieSzCNAPT8Z8F80vPgYgtfq/RGwz68mI628PUV/C0W2w gAMIMYanLJHGG3rpiiFHSRuxUS73Lkr6K7pSAWYvvHc164KXoQJiso9o6FqRnFBjhg2e SWLqoH+TUArWnvcG5d0C8hUqkb7HapdeWgPLG8eugI+wzYTaVVUuBTjDV2fccSLLpIq4 I+gA== 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=lxWc/RvP2HP3ROUQi7CWrSdIRxEa6wVjFG+/s3ElqKw=; b=A3vfl9XtaNmwBSgJtqTa0xUwMgrHLpSE1oyROW7XBiN6CzYCxvo2HMkLwnIqWsyA+e iEs0evpfn2RWARC0cJvcxbo9T4lqPSr7Vmt0H314fnd06eakw9jh9KwC/hKws4EJJLQQ 4cN6C4vxsP+MpzRNSUzR/buujGYJjAVT6NAL2/x522KD/4PnH3K9aUq3EEPiV6LKhQ54 uFcrdMD2KI03wUclJYJ2c4wqHNdYMq8RXiDvKPFx+mw7X2Xt8yzPO82XAEqGU+Kwb8L7 UWWAo+FUtzfxOE0eWrat5LvZDGqb4a6+CBSW29OFXVRGnS5hC3DrCejHFz7l1qDKkCZ7 zZ0A== X-Gm-Message-State: AOAM533MgSEp7zVWBK1K5haDcmRnWwLy770tZCdNV00Y+N7rVpUvzVPf 0hWJZvB08HcD8BY5y961fCicFgayINtThA== X-Received: by 2002:a17:90a:e453:: with SMTP id jp19mr5486083pjb.19.1626897609728; Wed, 21 Jul 2021 13:00:09 -0700 (PDT) Received: from localhost.localdomain (204-210-126-223.res.spectrum.com. [204.210.126.223]) by smtp.gmail.com with ESMTPSA id w3sm706028pjq.12.2021.07.21.13.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 13:00:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/27] trace: Fold mem-internal.h into mem.h Date: Wed, 21 Jul 2021 09:59:36 -1000 Message-Id: <20210721195954.879535-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210721195954.879535-1-richard.henderson@linaro.org> References: <20210721195954.879535-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cole Robinson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Since the last thing that mem.h does is include mem-internal.h, the symbols are not actually private. Tested-by: Cole Robinson Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- trace/mem-internal.h | 50 -------------------------------------------- trace/mem.h | 50 ++++++++++++++++++++++++++++++++++---------- plugins/core.c | 2 +- 3 files changed, 40 insertions(+), 62 deletions(-) delete mode 100644 trace/mem-internal.h -- 2.25.1 diff --git a/trace/mem-internal.h b/trace/mem-internal.h deleted file mode 100644 index 8b72b678fa..0000000000 --- a/trace/mem-internal.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Helper functions for guest memory tracing - * - * Copyright (C) 2016 Lluís Vilanova - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef TRACE__MEM_INTERNAL_H -#define TRACE__MEM_INTERNAL_H - -#define TRACE_MEM_SZ_SHIFT_MASK 0xf /* size shift mask */ -#define TRACE_MEM_SE (1ULL << 4) /* sign extended (y/n) */ -#define TRACE_MEM_BE (1ULL << 5) /* big endian (y/n) */ -#define TRACE_MEM_ST (1ULL << 6) /* store (y/n) */ -#define TRACE_MEM_MMU_SHIFT 8 /* mmu idx */ - -static inline uint16_t trace_mem_build_info( - int size_shift, bool sign_extend, MemOp endianness, - bool store, unsigned int mmu_idx) -{ - uint16_t res; - - res = size_shift & TRACE_MEM_SZ_SHIFT_MASK; - if (sign_extend) { - res |= TRACE_MEM_SE; - } - if (endianness == MO_BE) { - res |= TRACE_MEM_BE; - } - if (store) { - res |= TRACE_MEM_ST; - } -#ifdef CONFIG_SOFTMMU - res |= mmu_idx << TRACE_MEM_MMU_SHIFT; -#endif - return res; -} - -static inline uint16_t trace_mem_get_info(MemOp op, - unsigned int mmu_idx, - bool store) -{ - return trace_mem_build_info(op & MO_SIZE, !!(op & MO_SIGN), - op & MO_BSWAP, store, - mmu_idx); -} - -#endif /* TRACE__MEM_INTERNAL_H */ diff --git a/trace/mem.h b/trace/mem.h index 9644f592b4..2f27e7bdf0 100644 --- a/trace/mem.h +++ b/trace/mem.h @@ -12,24 +12,52 @@ #include "tcg/tcg.h" - -/** - * trace_mem_get_info: - * - * Return a value for the 'info' argument in guest memory access traces. - */ -static uint16_t trace_mem_get_info(MemOp op, unsigned int mmu_idx, bool store); +#define TRACE_MEM_SZ_SHIFT_MASK 0xf /* size shift mask */ +#define TRACE_MEM_SE (1ULL << 4) /* sign extended (y/n) */ +#define TRACE_MEM_BE (1ULL << 5) /* big endian (y/n) */ +#define TRACE_MEM_ST (1ULL << 6) /* store (y/n) */ +#define TRACE_MEM_MMU_SHIFT 8 /* mmu idx */ /** * trace_mem_build_info: * * Return a value for the 'info' argument in guest memory access traces. */ -static uint16_t trace_mem_build_info(int size_shift, bool sign_extend, - MemOp endianness, bool store, - unsigned int mmuidx); +static inline uint16_t trace_mem_build_info(int size_shift, bool sign_extend, + MemOp endianness, bool store, + unsigned int mmu_idx) +{ + uint16_t res; + + res = size_shift & TRACE_MEM_SZ_SHIFT_MASK; + if (sign_extend) { + res |= TRACE_MEM_SE; + } + if (endianness == MO_BE) { + res |= TRACE_MEM_BE; + } + if (store) { + res |= TRACE_MEM_ST; + } +#ifdef CONFIG_SOFTMMU + res |= mmu_idx << TRACE_MEM_MMU_SHIFT; +#endif + return res; +} -#include "trace/mem-internal.h" +/** + * trace_mem_get_info: + * + * Return a value for the 'info' argument in guest memory access traces. + */ +static inline uint16_t trace_mem_get_info(MemOp op, + unsigned int mmu_idx, + bool store) +{ + return trace_mem_build_info(op & MO_SIZE, !!(op & MO_SIGN), + op & MO_BSWAP, store, + mmu_idx); +} #endif /* TRACE__MEM_H */ diff --git a/plugins/core.c b/plugins/core.c index e1bcdb570d..474db287cb 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -27,7 +27,7 @@ #include "exec/helper-proto.h" #include "tcg/tcg.h" #include "tcg/tcg-op.h" -#include "trace/mem-internal.h" /* mem_info macros */ +#include "trace/mem.h" /* mem_info macros */ #include "plugin.h" #include "qemu/compiler.h"