From patchwork Wed Jul 14 15:00:21 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: 476791 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp674092jao; Wed, 14 Jul 2021 08:28:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRJ8vwbdEIVMcp1lhwNTg21o010U35WrHpGCbfZZDpXZya9jY0VYdN2opSjFlqKBDMN3Oa X-Received: by 2002:adf:f592:: with SMTP id f18mr13550137wro.179.1626276487842; Wed, 14 Jul 2021 08:28:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626276487; cv=none; d=google.com; s=arc-20160816; b=mJ0x+t82iytxpcb97wkhD+nwh5XQtx0G//jkDaMopFrxrosoAQH7kH8w+bBD8pdZqt TpDDfjPfVhxvnqM3LfmCtYUWyMXXkpMtiNedbdMPcyWGi/HZdJ4WENkqjkQIVotITOxh bZGg56Awi0HBXWfLo6KBZ2QZ596Gciw4qT0vdlidnC8iIVUvePgOpNrluaRBAL+Tpkl0 6x7koGCJP+/Iz6JosmLtLuOCugz2ICVTRSfV+NIFMwGrBFouyIVXImEmFY4YEDGrmFTf xGtFc0NP00ONwMlsZ1gDe/Fvv6xGMGPdulsR+iwF0ME9+5bBnwBGDFK74cVYea5if0Jv +DmQ== 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=M4a4hkRuBEQt9TEANpahd3PHF5TviVz8w9QDC7d2mAXx2fznyNGRk/LwUxzj6aMcsG PisWeq5uvg2XE3XJJsfpH88zYiIgum25ommP5hMDGsFuUOlQKqCTt84ZEfPEKkXUh3OC n2brbCZJp0r2fdEYwvIgH4iFPZWLmIT4L4rIwjrYaaHmBO7HeE+gG5zbKjWWQd3p9njr UoD7U65SWohA+gRsTkVVobJposx9vPqdg2/TOa67fFMaUfGmg1inNuDsQ2WAeOo4dq55 xvOFbjQ1aqJYZXlwv/rkGZt4+xsiQ1aD+Lc+c6E3EZV4XOwzpBg1P0135+y+FfgR5VaX Ia/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Vb23rUyT; 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 t7si3488178wmq.207.2021.07.14.08.28.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Jul 2021 08:28:07 -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=Vb23rUyT; 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]:54428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3gnu-000311-SY for patch@linaro.org; Wed, 14 Jul 2021 11:28:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3gV0-0007Af-Gs for qemu-devel@nongnu.org; Wed, 14 Jul 2021 11:08:34 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:44924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3gUy-00045F-TI for qemu-devel@nongnu.org; Wed, 14 Jul 2021 11:08:34 -0400 Received: by mail-wr1-x433.google.com with SMTP id f9so3612011wrq.11 for ; Wed, 14 Jul 2021 08:08:32 -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=Vb23rUyThkzOSQ5V7Z0HQuRSFK5Oj1TM2dOqika8Nq0B/+J/DYlGoj/mdfGTexs9g1 Hj5mhyu2KZ4baBQ17k/cqxJ9EVSrX+DTFP3vn4pT36Erpv1A48oKyGpKvTM8SOQ7cIji Xn9B+r+0/rS0zQMONRD40iD2VlfoWFoV1LEdXWepmfa8LfYUKdOvrq789wlQDFX2t28u 5yetS68vB3E5JtdfRrx2zJaMwAqsWhk8K6JjlXa1EHjVORgeeJv9T3TVcaAP05MWoVCB IRS+YLOyk8NGk/l7gjyTtFWjQkvN9t2KKP9E/Mf7MaJTIYCnDiVusKVfHFteVW6DkZnG 7vvA== 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=Cr6phQZYZjvOu5JP8qqDbOBKrmu4rX/JZ3StXJdhuzyqYG3k5oHgnhrSEqefuJS1Ft WAJa7hL/SPvhR3eBt7I6N2qXS64vavlHYIhsc/DL33an6KDCKIh7IPZ5tWZLHxT1oLs+ L/fh4P5ZFbs31G79REXbsrICxngR8uFoOyWhQXycWust7+RBERevXXGHYMWLgZJwQCay Te8LgBywukEEmHELn3QcNqq0m2SI3hkz2sySiZ2XjPqldYiaXKbeRNRie2dJuGAA4iZa kn6X6VFxDeowTx+SV7/QIaqQkhwfzc43hgahbYO6bOWHHwmDQWxpWlhjFZAqrHFYjnNE WcDw== X-Gm-Message-State: AOAM530aPk4J/mUBo5WatW3bDr5tS50h7TL2Ac/jewNvhYgtqaStaytA l+COLdFzHUAvG+yP8HSGmUJYx/mL8pAbgQ== X-Received: by 2002:adf:e409:: with SMTP id g9mr1965992wrm.66.1626275311552; Wed, 14 Jul 2021 08:08:31 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f26sm2344648wmc.29.2021.07.14.08.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 08:08:25 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E38D01FF87; Wed, 14 Jul 2021 16:00:39 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v5 29/44] plugins: fix-up handling of internal hostaddr for 32 bit Date: Wed, 14 Jul 2021 16:00:21 +0100 Message-Id: <20210714150036.21060-30-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210714150036.21060-1-alex.bennee@linaro.org> References: <20210714150036.21060-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.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(); }