From patchwork Mon Jul 12 12:26:40 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: 473102 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2906358jao; Mon, 12 Jul 2021 05:46:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJqnJ02PKQOry8LPusdG4no4DgZKYdv6LWLf4pNsx+z0N113UDTGt+uKDmClO2MqbdcHlZ X-Received: by 2002:a5d:6482:: with SMTP id o2mr2162447wri.367.1626094016085; Mon, 12 Jul 2021 05:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626094016; cv=none; d=google.com; s=arc-20160816; b=p4zVDCwhhl2UT1QD3Pyfp6tko6KhaWAtGMtJW6e02m5h1ysKbLZo1ghs9UqJTRn72f zztAvemlbY0gGvtGALAq1VZq7e6Zj9ishcxmaaEI+JdvlMBKO5JIS0gX/sPCMS32Z6T4 mMlyzmQ8PChKWZUyNoJyIYMiswaJ2fIC08KJwaQmps6ym2cCiM+l67Mz0EvW6s+9NJd/ gtEBG6ULuGHeGScnxV0dBosDZTq04rRTiVimms/PqgQ2hje+l6harfC4JgqbT6sht4qY qIvAgHZbt8xlAu8aKtLjjgM9itf329Glir5axyao4HiUUcZ4K5cTghM/T+FdiUBzCYnV prMg== 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=NwsUwBTLZFfTsKglJpuTCG7rL3bqmkHOdoMoH79RLik=; b=KDU1dA84ST4Z9cAZHhMtgn0r/KKxhR8Y4SfDCrAkFktIShpY165mX90EoVM1kKzBAE XApuYjvHMPLBb0o2Ta6x4S0SWHfiDA4SEKyI99U9vEo58hlkW7YclIF6uJ5Qh5ELWEMn WIdQEIDFUyvA7T5pNfGCxdQo5zSUa0EE42rfyHuvSTv89dXv/tu+75SqVxORVOJf8azL F6bDsLzCaH2wFGnsOy3T5pNoF3VskzNf//76wCyZLQMmD71I4thznrFd4XjXbg3g/trZ shWCcgGPzLceWfPxwYsMd4qxNNTLkhrQW8zYMjRznS3UAd6Xmfzrz/i1Dx6fN2SynMkN CFyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="xIr/u/hD"; 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 m9si13766868wml.209.2021.07.12.05.46.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Jul 2021 05:46: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="xIr/u/hD"; 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]:38618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2vKp-0002yp-3P for patch@linaro.org; Mon, 12 Jul 2021 08:46:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2v1t-0004RQ-Op for qemu-devel@nongnu.org; Mon, 12 Jul 2021 08:27:22 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:37700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2v1s-0008E5-8F for qemu-devel@nongnu.org; Mon, 12 Jul 2021 08:27:21 -0400 Received: by mail-wr1-x436.google.com with SMTP id i94so25337439wri.4 for ; Mon, 12 Jul 2021 05:27:19 -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=NwsUwBTLZFfTsKglJpuTCG7rL3bqmkHOdoMoH79RLik=; b=xIr/u/hDJxP5B/JgezcRz07IiklTl7wtn7qrIbP6dMJD9cgT2a0j2k/lXTVij1wMzP BXj07fYG8I1WX4i3YCvIzp3msymoYCprBd4K67pkUyszkfl1QRqR7X1wLbsUg3Gg6nJi ZbY9I7MBzVdJBkxxxRRGZDEA1KnfVZxTz+LvN1aq7AJb/tl9NMIKz71drvtJiMycm3Xc +6JReQgenl/HtTZ9Sjygn+eZRFPni+WMK7Hoa625bYT6/PHNuwHIiCzsU1Eo37Qtc7OQ 7+H0aFPZvHoaB00Fo2WksP10VTM4pJffro+f/JItop/AY/RtbLcySQmjWaTgEq3T0CrD LI/g== 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=NwsUwBTLZFfTsKglJpuTCG7rL3bqmkHOdoMoH79RLik=; b=Ijn7Min1VuAvbpg+QziLzniqt3GXT87NnsxwS+ZaC4S0qRQL1SkqFcM8KNxzmgLnsG sOuj5KCXViMtZdtzoAbzP6zwrR1A7rANL6QCHZS6A4ehHWS2em9EaqXbyMtDd/1tq/ZB jXccFXh9YR3DZR0BnB54dqPXWp0wKftQa5XtoRusGxmKaFijU7m9F3Vi4IUvk1mMfvIb GzYzibN5mzXoU+nseGUwekFc0nu47c9/nJwxlEEOKdhvhmaEjXKkqTF6xSXm29pW7wxs e+DOsUXyeUbEUb97of/WsPgJtEigPTlLGwbc9rSEvLwBf1EfWWuVR/qCXjI4FHB34ymd ULDw== X-Gm-Message-State: AOAM533dW3s4bTIDjiE00zI6h0UL2aivaANbV6eHpo0GVoQW/gk6gYfY zeK74mfOQhKG/gwOr7Zj0RuBuQ== X-Received: by 2002:a05:6000:1281:: with SMTP id f1mr22363333wrx.114.1626092838547; Mon, 12 Jul 2021 05:27:18 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id x17sm14587472wru.6.2021.07.12.05.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 05:27:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B4EB21FFB3; Mon, 12 Jul 2021 13:26:56 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 27/40] plugins: fix-up handling of internal hostaddr for 32 bit Date: Mon, 12 Jul 2021 13:26:40 +0100 Message-Id: <20210712122653.11354-28-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210712122653.11354-1-alex.bennee@linaro.org> References: <20210712122653.11354-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.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: Richard Henderson , qemu-devel@nongnu.org, Paolo Bonzini , Alexandre Iooss , Mahmoud Mandour , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The compiler rightly complains when we build on 32 bit that casting uint64_t into a void is a bad idea. We are really dealing with a host pointer at this point so treat it as such. This does involve a uintptr_t cast of the result of the TLB addend as we know that has to point to the host memory. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20210709143005.1554-28-alex.bennee@linaro.org> -- 2.20.1 diff --git a/include/qemu/plugin-memory.h b/include/qemu/plugin-memory.h index b36def27d7..0f59226727 100644 --- a/include/qemu/plugin-memory.h +++ b/include/qemu/plugin-memory.h @@ -18,7 +18,7 @@ struct qemu_plugin_hwaddr { hwaddr offset; } io; struct { - uint64_t hostaddr; + void *hostaddr; } ram; } v; }; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index b6d5fc6326..b4e15b6aad 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1728,7 +1728,7 @@ bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr, int mmu_idx, data->v.io.offset = (iotlbentry->addr & TARGET_PAGE_MASK) + addr; } else { data->is_io = false; - data->v.ram.hostaddr = addr + tlbe->addend; + data->v.ram.hostaddr = (void *)((uintptr_t)addr + tlbe->addend); } return true; } else { diff --git a/plugins/api.c b/plugins/api.c index 332e2c60e2..78b563c5c5 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -308,11 +308,11 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr) if (!haddr->is_io) { RAMBlock *block; ram_addr_t offset; - void *hostaddr = (void *) haddr->v.ram.hostaddr; + void *hostaddr = haddr->v.ram.hostaddr; block = qemu_ram_block_from_host(hostaddr, false, &offset); if (!block) { - error_report("Bad ram pointer %"PRIx64"", haddr->v.ram.hostaddr); + error_report("Bad host ram pointer %p", haddr->v.ram.hostaddr); abort(); }