From patchwork Fri Jan 17 13:42:35 2025 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: 858173 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp704594wrb; Fri, 17 Jan 2025 05:44:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX0oQTLECjJrrbQoYy3mLoJgxW+1ODAKr6KgvNsM5tskfR3Z9kSex2KTCvf0Di1gJ4d8mqVFw==@linaro.org X-Google-Smtp-Source: AGHT+IH+B3e+NcPkc/+hogDjfcCqoL9Oeb4zlcD9TtLDzAUf5TzF//LSOfQtzt2XSXYNAyIBPWWq X-Received: by 2002:a05:6102:e0f:b0:4b2:5d10:58f2 with SMTP id ada2fe7eead31-4b690c22632mr1966497137.14.1737121440923; Fri, 17 Jan 2025 05:44:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737121440; cv=none; d=google.com; s=arc-20240605; b=FhemT483Oak3ziJ67wlPM4B1kYgTGIe2t0//GeWBDVx7mv/MMdppsqwVUqSpzVJwlU +3GPTuNNwMj3J00IUk/qyKKfHBiFmwfuwcdjBwlwm1wrryRyRM/A9Xtop4TyWf+CQies w6Sx0ClHICJznCtVSFPZYNOxNox4HLZyp4Tdz3monV4suXAC0GD5o0FfHYnDbQAtOgXe jzAJhIJbvSJMtBq+lNYX0DTs81y4CTewKRDgiEIpYQrtT+YYyfpuL0Desn9FEV2bvrDC n2vZfZADANfgGiSZ9mvuZUTxTkqmKa4BDwZNdUgk+HC/9uipU5bdJQlrc7+lk2VfWFzY qrew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=wtbti+nfIC33MIZ1eYW+qTFtToL57v/F5KN9R+uVCLw=; fh=yu0InTeBwSZcLajIY49SmB6DXvx9wTO9ThO8p5pbR7k=; b=km+hwaugVbpBwVcZ8YgT/oDzoY+YkJgph0POkuePhWdAdlRDK0gV+hBB6GsN1m0D0k cv8Im4lMwuwW/lu2o63KjHR3zyByJ40KNrl0gWLhslus6VRn5jrE/kvs2YDXaaKCHTw9 53hbFYNmVTGweCMcRMlVltWxNJzdhDW1cszO6ScWaD+06VAI+i2wyzw5S+5NbFxnsvYX bLu+90sanokmEtQC1Qn7JrdzTVHFsg7raF5qGDorBqzMcqqrboruV87IWFe/PpnMvfIM u0yJDCc6RlXih8oO7olwNjBbC9lNwO6RbPB7t4jC5s5TCZTOM/Ew4kJz4YB/fCsB3+qV lPHw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vu0SOSet; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4b68a3260eesi786805137.451.2025.01.17.05.44.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Jan 2025 05:44:00 -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=pass header.i=@linaro.org header.s=google header.b=vu0SOSet; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tYmdN-0001JR-Rf; Fri, 17 Jan 2025 08:43:37 -0500 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 1tYmcy-00010u-7d for qemu-devel@nongnu.org; Fri, 17 Jan 2025 08:43:12 -0500 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYmcu-0002ES-TC for qemu-devel@nongnu.org; Fri, 17 Jan 2025 08:43:11 -0500 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-ab34a170526so292284866b.0 for ; Fri, 17 Jan 2025 05:43:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737121387; x=1737726187; 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=wtbti+nfIC33MIZ1eYW+qTFtToL57v/F5KN9R+uVCLw=; b=vu0SOSet9ldPkOTJU6GXws1FUpz0D37fktPafwMKpnqIxM7xyMtqTqzS8NSm4n/ObW +bQSSmC4+y3IJGYEXMNPNMeq/GKv05zaYv6iS+8IFxz+tdyda4RmpUj+22yyM6XjFa5v x/2qrBNsOSCTRX9hL7XACCoE8+fHvxq+3cs4GQ6o5fbkGxSYkU79JPTGd0I8yDCOrMxp BZhJ5u/tQCVSuXRT7zNrMoinlcCeVQ9/kZGGrMC49/26afoypj5KqiCNI0F1dB4Sig+8 +H86Hrj/oXfc2n54NjMMRAh/UWDbjHpmsGOIBGIFaFT4bzbqwKrpAgEdK1YEZZhFBq1s IwQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737121387; x=1737726187; 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=wtbti+nfIC33MIZ1eYW+qTFtToL57v/F5KN9R+uVCLw=; b=SC2Gw6r4zh2uYMiZkw3cnVHrztQrRRGkI0yeLfzmZepSYcPTEQ7s4W+Jy75acsT3ww 9HVzG2wIENP3/cApwI1EFOJDq4NUZ6RbfCQtTs7JTQu6vrCICAkhhPpTImecLDCuUa/r MszH6IMCpm/4hGiLq8Jp+M7fSjgEh6lfjPCCodjB3F74ue7PK+uiW67AgIfiuzTN9S0M 9KytZMQ0Xts5sBkEL9s2wOMdaIkdvxMdJ22VwGDd5QZefyU/ggXQ3pAsF0997vmA/LYe lHYxOPZM78BtTFnjNpLTulLAVLNs5yv8Qs6jrSQzmCPZA8s1xEWxfiWLDJ477fJj4vOS bHng== X-Gm-Message-State: AOJu0YzjoVeMcYJzQOxrS3ND1vTYNQ9vxkXHtOAkNITbZQsormoF7w3N JUzGw5hfnd2r+7CI5/LRNuVP0UtPKvPnRQ0l+m+bG01EOKzIf+pYcM8Tk9WU0c0= X-Gm-Gg: ASbGncvgI/Hj6kwF0D0RttlI4K4vcGtQpOm23hpwDlAHjfXgZ19vcJn6gQxWlqR4MXK LA3vh2L1CzwQssRF2tja6YeLrvvfv2vyYuxvJaQFkrE5JvCRwfVS8pk4IuNCWmXZrxOT0irabmc k7ghfHOW9Tx8X+RAI0f1goIlvgpa2YlxoBxJZTFCkR/D+qktItbdEwaYA2SpifitiSNk2pnXVft gKjRNvhJpV6fh8A8d+q8uc4LJHSGL70AmkEyxtpmCutdx1tJIqNh1Y= X-Received: by 2002:a17:907:96a5:b0:ab3:6734:99da with SMTP id a640c23a62f3a-ab38b3841d7mr255257566b.37.1737121387499; Fri, 17 Jan 2025 05:43:07 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab384ce2295sm175622866b.64.2025.01.17.05.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 05:43:03 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 69A34608B4; Fri, 17 Jan 2025 13:42:58 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 16/37] contrib/plugins/cache: fix 32-bit build Date: Fri, 17 Jan 2025 13:42:35 +0000 Message-Id: <20250117134256.2079356-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250117134256.2079356-1-alex.bennee@linaro.org> References: <20250117134256.2079356-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62a.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 From: Pierrick Bouvier Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-Id: <20241217224306.2900490-7-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20250116160306.1709518-17-alex.bennee@linaro.org> diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index 512ef6776b..7baff86860 100644 --- a/contrib/plugins/cache.c +++ b/contrib/plugins/cache.c @@ -208,7 +208,7 @@ static int fifo_get_first_block(Cache *cache, int set) static void fifo_update_on_miss(Cache *cache, int set, int blk_idx) { GQueue *q = cache->sets[set].fifo_queue; - g_queue_push_head(q, GINT_TO_POINTER(blk_idx)); + g_queue_push_head(q, (gpointer)(intptr_t) blk_idx); } static void fifo_destroy(Cache *cache) @@ -471,13 +471,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) n_insns = qemu_plugin_tb_n_insns(tb); for (i = 0; i < n_insns; i++) { struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i); - uint64_t effective_addr; - - if (sys) { - effective_addr = (uint64_t) qemu_plugin_insn_haddr(insn); - } else { - effective_addr = (uint64_t) qemu_plugin_insn_vaddr(insn); - } + uint64_t effective_addr = sys ? (uintptr_t) qemu_plugin_insn_haddr(insn) : + qemu_plugin_insn_vaddr(insn); /* * Instructions might get translated multiple times, we do not create @@ -485,14 +480,13 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) * entry from the hash table and register it for the callback again. */ g_mutex_lock(&hashtable_lock); - data = g_hash_table_lookup(miss_ht, GUINT_TO_POINTER(effective_addr)); + data = g_hash_table_lookup(miss_ht, &effective_addr); if (data == NULL) { data = g_new0(InsnData, 1); data->disas_str = qemu_plugin_insn_disas(insn); data->symbol = qemu_plugin_insn_symbol(insn); data->addr = effective_addr; - g_hash_table_insert(miss_ht, GUINT_TO_POINTER(effective_addr), - (gpointer) data); + g_hash_table_insert(miss_ht, &data->addr, data); } g_mutex_unlock(&hashtable_lock); @@ -853,7 +847,7 @@ int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); - miss_ht = g_hash_table_new_full(NULL, g_direct_equal, NULL, insn_free); + miss_ht = g_hash_table_new_full(g_int64_hash, g_int64_equal, NULL, insn_free); return 0; }