From nobody Sun Nov 24 14:23:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1722844810; cv=none; d=zohomail.com; s=zohoarc; b=nhIfvHfAT01pVIgUJ/JWUIKEHyJKoN/Gr5IqWX4r09gG7yJquKvgKjlP8DW6ZBmeN/q6nXsidCD2IHvXUFW+0PHfymT4V9o4wFgzds5ySf4QzsiSv7yyCHCeTgk2r3po7wgmg+S0VCOQs9jK7SYBfXjlUSuc3aDMQ/E28XMgeys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722844810; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HSpIet5B0ReF8Cn59W+S8kCRPEbJtdYOgQKiYtmPygE=; b=CuvN222T5YapFdHgIRmcrskcXiczlF1gGrBd/6HhHU+7QoLGsDXd7r913j2+eQSmllSqn8EGG6ztZnEfsupQyQ8YIdYT8Kg3oulHIH96vKK2e9zBjuWvJM/bGrvTBwKjV8JRTXIGTgiIpz8SqTrFsgRJme+W4v06K1DstC5TAvY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1722844810229898.0898680541924; Mon, 5 Aug 2024 01:00:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sasd1-0000FD-Cq; Mon, 05 Aug 2024 03:59:39 -0400 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 1sasd0-0000E6-4Z for qemu-devel@nongnu.org; Mon, 05 Aug 2024 03:59:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sascx-0005P4-Gn for qemu-devel@nongnu.org; Mon, 05 Aug 2024 03:59:37 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-192-sJHOfHv_PFW9IX85WOaLxw-1; Mon, 05 Aug 2024 03:59:29 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48C7B1955D47; Mon, 5 Aug 2024 07:59:28 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.65]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D2C611955D44; Mon, 5 Aug 2024 07:59:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id AC88021F4B8C; Mon, 5 Aug 2024 09:59:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722844773; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HSpIet5B0ReF8Cn59W+S8kCRPEbJtdYOgQKiYtmPygE=; b=AvRXNwEIIooWLOZGmSeN96WpLVfN0yb4kiIBd6Fm3TLtNdyH5dMTirI7/19j4jjK/bIemb 4ulQQyphgVWP9XwNbqln07FW2RcSAEMgtYXMjSpd12cFgGPuDoqIrNy3gt6fbN6iQLs+5C TOn9mmTWj6n3ZTC9DnMPvgiFwJ1d8R0= X-MC-Unique: sJHOfHv_PFW9IX85WOaLxw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, Josh Junon Subject: [PULL 2/2] qmp: Fix higher half vaddrs for [p]memsave Date: Mon, 5 Aug 2024 09:59:25 +0200 Message-ID: <20240805075925.2062973-3-armbru@redhat.com> In-Reply-To: <20240805075925.2062973-1-armbru@redhat.com> References: <20240805075925.2062973-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1722844811077116600 Content-Type: text/plain; charset="utf-8" From: Josh Junon Fixes higher-half address parsing for QMP commands `[p]memsave`. Signed-off-by: Josh Junon Message-ID: <20240802140704.13591-1-junon@oro.sh> Reviewed-by: Markus Armbruster [Subject tweaked, and one PRId64 updated to PRIu64] Signed-off-by: Markus Armbruster --- qapi/machine.json | 11 +++++++++-- system/cpus.c | 12 ++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 4582e58f7d..d4317435e7 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -852,7 +852,11 @@ # <- { "return": {} } ## { 'command': 'memsave', - 'data': {'val': 'int', 'size': 'int', 'filename': 'str', '*cpu-index': '= int'} } + 'data': { + 'val': 'uint64', + 'size': 'size', + 'filename': 'str', + '*cpu-index': 'int' } } =20 ## # @pmemsave: @@ -878,7 +882,10 @@ # <- { "return": {} } ## { 'command': 'pmemsave', - 'data': {'val': 'int', 'size': 'int', 'filename': 'str'} } + 'data': { + 'val': 'uint64', + 'size': 'size', + 'filename': 'str' } } =20 ## # @Memdev: diff --git a/system/cpus.c b/system/cpus.c index 5e3a988a0a..1c818ff682 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -792,14 +792,14 @@ int vm_stop_force_state(RunState state) } } =20 -void qmp_memsave(int64_t addr, int64_t size, const char *filename, +void qmp_memsave(uint64_t addr, uint64_t size, const char *filename, bool has_cpu, int64_t cpu_index, Error **errp) { FILE *f; - uint32_t l; + uint64_t l; CPUState *cpu; uint8_t buf[1024]; - int64_t orig_addr =3D addr, orig_size =3D size; + uint64_t orig_addr =3D addr, orig_size =3D size; =20 if (!has_cpu) { cpu_index =3D 0; @@ -823,7 +823,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char= *filename, if (l > size) l =3D size; if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) !=3D 0) { - error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRId64 + error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRIu64 " specified", orig_addr, orig_size); goto exit; } @@ -840,11 +840,11 @@ exit: fclose(f); } =20 -void qmp_pmemsave(int64_t addr, int64_t size, const char *filename, +void qmp_pmemsave(uint64_t addr, uint64_t size, const char *filename, Error **errp) { FILE *f; - uint32_t l; + uint64_t l; uint8_t buf[1024]; =20 f =3D fopen(filename, "wb"); --=20 2.45.0