From patchwork Thu Jul 8 19:09:29 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: 471328 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp601383jao; Thu, 8 Jul 2021 12:52:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0VN9hLsJcqMBnSgBJ1tgBYuH9vhdXr1olhCAIiM7NcqVZLB1w1R4eXtNpuNnGp+DeDS93 X-Received: by 2002:ab0:3b18:: with SMTP id n24mr832435uaw.95.1625773956691; Thu, 08 Jul 2021 12:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625773956; cv=none; d=google.com; s=arc-20160816; b=RJUWAlwkj4lL2KiJl97kaxqlIsGgoJIXPmXK1Q+cNY/aKN25WHs1E0bcHI8dRYgezZ y0fySXpezlypod/S7mM01s9ooOebisEDsy2TSAisCtQefzAwzDQoipWMRuK+fRQqd000 P95eVBKkxoFE5WeK02LAlSL5WMhIT8uJIG9da2H9al6f7RhQDc27jWds5KW00DbFESw1 3NI2uRDGp+kJQrAcefjWZD5ENnFBH2tFGv+fWQPeip6GsSP+uhc+C50XPC3kWS7XXppL vHfc1MUhgSTQJbPssLs1LtfwwIffwnBRADziaYrzP4ySoLRO2xZPPYh/Kx7GEDlWrWk2 r7NA== 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=2VymeSF+HdKxVWyy9+ZA+5+qTRIVWKC1/sXMZ3ShAgc=; b=M+NVGXXSj5PBzbykrkoJlCrFphif0w59addCMf8TFSOJu54d2K01pBdnBr7TxoLdtG 9vKRAgz0PmC2pY1+UmUUQLOuPFqWFNKVItAw9XR6KtHKdAWD+d5WDg9/xBi071/iofej HNIRfbkQmQHMsNcLDlBE94tUDmipVOZ/58Y1i+lBlwLo+gelYzBIZEOvmsSqq+0Aw8cH G42gD3BuBzElZVOFAKsEh7U84kFy0ajbwm3Om47931HcFex5me3Hk0TdU4hqAX0KzcL0 iHjrATSraPFMKRPiNijnF7etQEk0BW4UqPYZuHKjHpUYVGQUi8XvuYWLTd2f3NyI6XNr zvFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fF4lYccg; 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 y18si3507115uan.171.2021.07.08.12.52.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Jul 2021 12:52:36 -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=fF4lYccg; 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]:51088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1a4a-00050S-2x for patch@linaro.org; Thu, 08 Jul 2021 15:52:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1ZgB-0005Wb-F1 for qemu-devel@nongnu.org; Thu, 08 Jul 2021 15:27:24 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:33302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m1Zg6-0001yT-Q9 for qemu-devel@nongnu.org; Thu, 08 Jul 2021 15:27:23 -0400 Received: by mail-wr1-x42e.google.com with SMTP id d2so8963886wrn.0 for ; Thu, 08 Jul 2021 12:27:17 -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=2VymeSF+HdKxVWyy9+ZA+5+qTRIVWKC1/sXMZ3ShAgc=; b=fF4lYccgE5zaRkXbcGb1m0QOi+mPXnbTmm1l2Oe7MmCEcNvAVn35MUIpMJ6+o1OQcc 3Ik2RP2yuvOo56emb7UbWj2Yk0UVDxftxmQMdMHscd8pW9RBMM23k1Wh8afuwGBZJSdU 0Jp0C3PaVI/40PtRpqDZKT74YCqUUAavnFQSCW0dhfSXoCpknsNobtq5nZ13/1s/x5TJ Jtdc5HhQa5AN6wPNBImXvWzmSF3o7uatgoMrGVecx06AHi4WXnMPKiWLx172zBX4YubN HKpU5X/RMijePABBCSzKF56eVFAqtJP0ILmsJOn82BwSyCNGUv2uBRet+hAdqwu+N2ZP DICg== 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=2VymeSF+HdKxVWyy9+ZA+5+qTRIVWKC1/sXMZ3ShAgc=; b=ACUA0Apzcm6eQeyE5pVz29cUMUFxnfyshXcH/kcr9pc3iUBjyEijdYd0HZQr5uV/VP /CjqGErecx9oFbgULB80BGl2DE5+3/rbYcZUCDLrFgsO3jF8bjYpvPtkb1EaqUbIo/wF pmsl/lQHk2L5kBWqcdKW7qar5uiEy78pfi5XR3Cpr807Ki0keLxYI24jffM6/KTNb+lK +elMvav6o8cXo5yaMjLzeyCXAMew0Bl/m2s9G9AFo8vIoZluqlwhwVhrbuyF/vsK7HA/ XDp1BYFs7QSPJHuS3bGrxvXipYnTsGfcQPjklR0EcJbVA7kEt3r+PXwFNjaQr4kNsKou /YUg== X-Gm-Message-State: AOAM531sHLWRMWo4sOv36lfJwcCfYFWPVRc6kVNIZlghRq5OQXDSHmht ZsxHFJF52AXWPZq27BtpKr24GA== X-Received: by 2002:adf:e8cc:: with SMTP id k12mr36244891wrn.163.1625772436605; Thu, 08 Jul 2021 12:27:16 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id x21sm9844150wmj.6.2021.07.08.12.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 12:27:12 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EAE8C1FFB1; Thu, 8 Jul 2021 20:09:44 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 27/39] plugins: fix-up handling of internal hostaddr for 32 bit Date: Thu, 8 Jul 2021 20:09:29 +0100 Message-Id: <20210708190941.16980-28-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210708190941.16980-1-alex.bennee@linaro.org> References: <20210708190941.16980-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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: fam@euphon.net, minyihh@uci.edu, berrange@redhat.com, kuhn.chenqun@huawei.com, Richard Henderson , f4bug@amsat.org, robhenry@microsoft.com, mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, crosa@redhat.com, pbonzini@redhat.com, ma.mandourr@gmail.com, Alexandre Iooss , =?utf-8?q?Alex_Benn=C3=A9e?= , aurelien@aurel32.net 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 --- include/qemu/plugin-memory.h | 2 +- accel/tcg/cputlb.c | 2 +- plugins/api.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson 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(); }