From patchwork Thu Feb 23 23:17:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 656010 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp600792wrb; Thu, 23 Feb 2023 15:18:41 -0800 (PST) X-Google-Smtp-Source: AK7set/D1lV+1eEB1PLfC9U7LjZ8Xqr5TQo9bKSHwoKiMrstCnVygihKBOWrLvdMB8Vbr8rogVok X-Received: by 2002:a05:622a:1b86:b0:3bf:b8b9:1b45 with SMTP id bp6-20020a05622a1b8600b003bfb8b91b45mr2527702qtb.41.1677194321699; Thu, 23 Feb 2023 15:18:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677194321; cv=none; d=google.com; s=arc-20160816; b=QjO80/FybDOPbYcfxkul60+MRaUO+wDHBRSBKdIms0lYc5XmhsQfDoIhh6retmqx30 /ohG2iAvuyJLA29bnq215oGS2lPAmj5w2be2Vl2ahIr/RATTyIizJUF6dpWTOMaPqGiV fohgGgNO7LIO7aTA/19461NfzeuCkazeMTKl7Hehjwer/7uf1m0uqAHbeD0Y1a8L0fi+ 2YmLlPk5wnTGdqRO0CDaZhsYgRt6TMJVqdwlM7ke7BPhifm0GI97MeFQHgvXZjDD4xGG AOllUgNF8ael8tAPLq7ssKH1sJi6Ujj9ps5vJeIQ+4tuVVSLOm9tclcJfheMoSBG+0bl x0aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=3swxdcDHt7SWz/NHP9p3WXbEpqYOBVxykbO5R3hJM2k=; b=wFMJyLMvfhVpqAIcx62fikai5GLjRWHNP0/gmNLfR9I3S1blSVf8o1edaITwG/riqs hKgiOiQlW8KhCz8l1C7W+VM4W0Werva4RlmB27NcwcgoAMb8h3MWzYDiSBnaIUztpI9l LwMu3ClzOvv703eNaB3j7i74CNwclvHHghtXMx2Z7APa75Jreo5vtbpeLfAh94UtXotF ekGOSqQ7gLClGU06/YBVAadhN9zgA9WjgmyGWuzR9KWb8d6XiydZE/LbUEHKCfT5IMhL PrDrtLreiYEDLlbQ0m5ewJYzAq0iMzzTZxEtpV/cp5up5Qp7054Xk9cIxgqmhUtt5rGC V1/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GUhG9Cp/"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f7-20020a05622a1a0700b003b85176c841si8632109qtb.527.2023.02.23.15.18.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Feb 2023 15:18:41 -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="GUhG9Cp/"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVKr4-00006c-IO; Thu, 23 Feb 2023 18:18:26 -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 1pVKr2-00006L-Nu for qemu-devel@nongnu.org; Thu, 23 Feb 2023 18:18:24 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVKr0-0000Uc-1r for qemu-devel@nongnu.org; Thu, 23 Feb 2023 18:18:23 -0500 Received: by mail-wm1-x332.google.com with SMTP id l7-20020a05600c4f0700b003e79fa98ce1so637688wmq.2 for ; Thu, 23 Feb 2023 15:18:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=3swxdcDHt7SWz/NHP9p3WXbEpqYOBVxykbO5R3hJM2k=; b=GUhG9Cp/xmzJeun4ct0s9wOfLBSh+VPuuF80imKKQYwKfRqBaYxOATm0jNXvCcZV50 GYSjyB75lrdpys5KLTsXPMyl70vCOmXN3091zF8q63QuNwUmk6T0xvMf0HQn/PL8BPrg w6vMxlC9E6Wt+3LPAAV3nKKnHXqx+ZXAUE3PvZQ4UxxnuWAnaoAHUQJzVtuuVrOpnj+T bFXU/67CpeQTnpy3JK9bROAXZvD4l3U2C1CIATVaU6SsBkR1Nx2XRocGGtH/iPHSOf3S oBzAy/t12w1mxVdl7MkFQDnU3nbEL5rTE2axnJG0MHZ56zuoYo83BbRlyTSsO6WCF+5m 5ATw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=3swxdcDHt7SWz/NHP9p3WXbEpqYOBVxykbO5R3hJM2k=; b=urYYRXJd7ycVNLpqhpQI8MzEfu4bueRh/AuIR9WoDHhq8AEciXJ9SJy/jecP5sa+5K ohXuSqDqLLYpT3Uq9z5ITpCE3WibpQEiT7TH/3Vqk3lP/0R/+bUiS5XbfAsBvAKL8DOM aEnOTmMk52EtABdBWxz+AMuBru4oDEZPFjNhCHX6rvCGHOuV1ybicruKs4p8/owfKkpN J732drFoW6izDCSlcgG/wvb8g5kiPhcpwUTxnqRwzxXfHbAT0dFACkCMUmWSAM8PdwFu 52k1RqH6pWGjqDA+MExrX8Piep72WAAfX6uG5Sw7cSWv2I55e4ESrgvdWr0Qf0shQOt5 KayQ== X-Gm-Message-State: AO0yUKXjbt1vKVuKkRmv0Q4gE49zQiiD5A8tL4oS/LGTyRPlhjPCcMEf U41cm8a0BN0bAw+Tp2/6/R9UcEnwsohHOg3h X-Received: by 2002:a05:600c:3b85:b0:3ea:e7f7:65e2 with SMTP id n5-20020a05600c3b8500b003eae7f765e2mr1155976wms.26.1677194299096; Thu, 23 Feb 2023 15:18:19 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id n33-20020a05600c502100b003e8dc7a03basm744716wmr.41.2023.02.23.15.18.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Feb 2023 15:18:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Janosch Frank , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , =?utf-8?q?Philippe?= =?utf-8?q?_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 4/7] dump: Introduce win_dump_available() Date: Fri, 24 Feb 2023 00:17:52 +0100 Message-Id: <20230223231755.81633-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230223231755.81633-1-philmd@linaro.org> References: <20230223231755.81633-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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 Remove a pair of TARGET_X86_64 #ifdef'ry by introducing the win_dump_available() method. We'll soon extract it to a stub file for non-x86 targets. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- dump/dump.c | 23 +++++++++++++---------- dump/win_dump.c | 5 +++++ dump/win_dump.h | 3 +++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index 3784a9054d..c356a88be1 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -30,9 +30,15 @@ #include "qemu/main-loop.h" #include "hw/misc/vmcoreinfo.h" #include "migration/blocker.h" - -#ifdef TARGET_X86_64 #include "win_dump.h" + +#ifndef TARGET_X86_64 +bool win_dump_available(Error **errp) +{ + error_setg(errp, "Windows dump is only available for x86-64"); + + return false; +} #endif #include @@ -2130,12 +2136,10 @@ void qmp_dump_guest_memory(bool paging, const char *file, } #endif -#ifndef TARGET_X86_64 - if (has_format && format == DUMP_GUEST_MEMORY_FORMAT_WIN_DMP) { - error_setg(errp, "Windows dump is only available for x86-64"); + if (has_format && format == DUMP_GUEST_MEMORY_FORMAT_WIN_DMP + && !win_dump_available(errp)) { return; } -#endif #if !defined(WIN32) if (strstart(file, "fd:", &p)) { @@ -2217,10 +2221,9 @@ DumpGuestMemoryCapability *qmp_query_dump_guest_memory_capability(Error **errp) QAPI_LIST_APPEND(tail, DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY); #endif - /* Windows dump is available only if target is x86_64 */ -#ifdef TARGET_X86_64 - QAPI_LIST_APPEND(tail, DUMP_GUEST_MEMORY_FORMAT_WIN_DMP); -#endif + if (win_dump_available(NULL)) { + QAPI_LIST_APPEND(tail, DUMP_GUEST_MEMORY_FORMAT_WIN_DMP); + } return cap; } diff --git a/dump/win_dump.c b/dump/win_dump.c index 12b7da5da0..ffeef4b738 100644 --- a/dump/win_dump.c +++ b/dump/win_dump.c @@ -24,6 +24,11 @@ #include "qemu/win_dump_defs.h" #include "win_dump.h" +bool win_dump_available(Error **errp) +{ + return true; +} + static size_t win_dump_ptr_size(bool x64) { return x64 ? sizeof(uint64_t) : sizeof(uint32_t); diff --git a/dump/win_dump.h b/dump/win_dump.h index 56f63683c3..9abce289ac 100644 --- a/dump/win_dump.h +++ b/dump/win_dump.h @@ -13,6 +13,9 @@ #include "sysemu/dump.h" +/* Windows dump is available only if target is x86_64 */ +bool win_dump_available(Error **errp); + void create_win_dump(DumpState *s, Error **errp); #endif /* WIN_DUMP_H */