From patchwork Fri Feb 24 07:38:49 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: 656247 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp763738wrb; Thu, 23 Feb 2023 23:40:48 -0800 (PST) X-Google-Smtp-Source: AK7set8NazhQWeQK82v3Go3AXzuc7fhrAoo8zy80WBXL4rexQxAWrRVlYTiHJofTeFxAoENAhAIY X-Received: by 2002:ac8:7d96:0:b0:3bf:a1e2:be3 with SMTP id c22-20020ac87d96000000b003bfa1e20be3mr21645199qtd.62.1677224448003; Thu, 23 Feb 2023 23:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677224447; cv=none; d=google.com; s=arc-20160816; b=RtkmugFxXFkaN/bAiLjfIduzUIlttWeg2zlMTaJkQAQj6rBKNA8aRWIbxFa7/A1dyL ecXwgCsG6iDMWIaT5RNaydRYpJ0ikIXQrW7rpjupbCyhA350QMFdSWrfnqVHKHHWJ6iK M8DxC6AGrC8Ov3tPEdGkXmk6LmmmIB7EIfOqbqibnAuTfbsQ3vAoNnymt4SD57EJMxzp tfEJXSIZAVawbThHTx8JKw5BSXkjlVFXoGsoQ9rKnCBx0q3Z56mioj+xRh9NLnrvBw2P COYUD+Wqzj1dwFNwnRg610BCE5lyA7z2LB+bVncP0o+Dx+rSL3Z8ARQBM7lyOi0K3akm bxbw== 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=9ZaRLGS+UsXq7QOBPAlysCOmaXDe7m6nmzn2gCUNK2s=; b=C0zVbOoraSbf7EZ5O2NESSFPJG+QxULv26R9QKQZoCRFXf0hTRU0ba/6hIrDNjFcNx ohkvVjb3twQ4JFuskcr8WaiSpiqqpaa+6W6+6mleAxwZxDz9+GdgUy893fA9ZvuwK88j u37fI2ccS+cHFRgToH0nf1boECM9yLS/yxU6MIzZYKjAb7WpGZm5PBnN0sNAStP85iLj kj6Ce6JT4r0EVPgOcVw482vnUvfwjzmAJgqZydA8Rqw2U4rdnUXnylF1QNvlW1DvCj/h YQ4brhisldD1/Gvue4L1Otgc3y+PBiu4Mnfah6TcTYjruIZULAtQt9zOokNMTiuViCq5 qLhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mDK+unA+; 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 f5-20020a05620a280500b00738dd5fd4d1si8832795qkp.573.2023.02.23.23.40.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Feb 2023 23:40:47 -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=mDK+unA+; 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 1pVSfm-0006Wy-LQ; Fri, 24 Feb 2023 02:39:21 -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 1pVSfj-0006Wl-FS for qemu-devel@nongnu.org; Fri, 24 Feb 2023 02:39:15 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVSfh-0006pH-SV for qemu-devel@nongnu.org; Fri, 24 Feb 2023 02:39:15 -0500 Received: by mail-wm1-x32b.google.com with SMTP id az36so1204252wmb.1 for ; Thu, 23 Feb 2023 23:39:13 -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=9ZaRLGS+UsXq7QOBPAlysCOmaXDe7m6nmzn2gCUNK2s=; b=mDK+unA+UobpE/At4UULbnHHpurnAPbgvCEyDpO2RIEqeYhB0dXwabJBrirswzTFj1 nqSVcVghFkAnhth+zuIRlpoUCJFjK2luK4ripGCKRvIToQlKIpldPFwnDzR3sDDTLVfH XqzyeICvgys6W8eM3jzjMr1uh4UwgpPbCsVid1aWzOurVMJM2qNemnzwxNjYigb96POp cGjEp/3KSPsGe6PIiW3zI8Ezf79+PJ1n4xmbyt5LffZXRz5cpMoHWp6mSdTyYIRcmwjZ blS7YgAt1TyBdAYdq8Fm5DJempbVd0H+VFqF1TihWKsFf7s9l3yk+XISjBzoBNi+21ON JmPg== 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=9ZaRLGS+UsXq7QOBPAlysCOmaXDe7m6nmzn2gCUNK2s=; b=jFQwEA+LEIs+9M4mc9GxbYFuRpuPpyunGOr4awmTHlFy02wU0PeilcKjzaAUzHMPvw 2K6gsL2RgkTntccVYUp8HLn3lNGk20FHVb/LznrOm2sfP75Ymcj6kxAOCrm9Kp2ucB0H IhtKWUEMCc+pADwtDO/38knztJOxVjXxu1YEWhR1i1yLKjTEnlM/4WcQIf8c1hfIyOMk c+GiRXAbuiIvtROQ4/omBx4417ahUjmEzyVubHrvvUFfUtAR6QMSMFgI711CKHTEuBTr VSL0Cn59yQfSnbfbE5+jKeGBAC+iU1qKkkKmV0ylPM9tmJH9z0E8wVpCGQRwoJ78xWQX fxrw== X-Gm-Message-State: AO0yUKUyZor9MKkhdsaL/cRq83UGa/agaJYyZCB32TZ+TIOiB9XiqMxU RQXJsj/8iISFhlSElEWZVV9raXOf2Ic9/Azf X-Received: by 2002:a05:600c:3b8b:b0:3ea:ea6b:f9ad with SMTP id n11-20020a05600c3b8b00b003eaea6bf9admr2162638wms.31.1677224352066; Thu, 23 Feb 2023 23:39:12 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id x15-20020a1c7c0f000000b003e20a6fd604sm1854794wmc.4.2023.02.23.23.39.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 23 Feb 2023 23:39:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Janosch Frank , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v5 4/5] dump: Introduce win_dump_available() Date: Fri, 24 Feb 2023 08:38:49 +0100 Message-Id: <20230224073850.84913-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230224073850.84913-1-philmd@linaro.org> References: <20230224073850.84913-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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. Doing so we can build win_dump.c on any target, and simplify the meson rule. Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé --- dump/dump.c | 16 +++++----------- dump/meson.build | 2 +- dump/win_dump.c | 18 ++++++++++++++++++ dump/win_dump.h | 3 +++ 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index a84f78738a..0c96c6e735 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -28,10 +28,7 @@ #include "hw/misc/vmcoreinfo.h" #include "migration/blocker.h" #include "hw/core/cpu.h" - -#ifdef TARGET_X86_64 #include "win_dump.h" -#endif #include #ifdef CONFIG_LZO @@ -2128,12 +2125,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)) { @@ -2215,10 +2210,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/meson.build b/dump/meson.build index 2eff29c3ea..f13b29a849 100644 --- a/dump/meson.build +++ b/dump/meson.build @@ -1,4 +1,4 @@ softmmu_ss.add(files('dump-hmp-cmds.c')) specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: [files('dump.c'), snappy, lzo]) -specific_ss.add(when: ['CONFIG_SOFTMMU', 'TARGET_X86_64'], if_true: files('win_dump.c')) +specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('win_dump.c')) diff --git a/dump/win_dump.c b/dump/win_dump.c index ba7fa404fe..ff9c5bd339 100644 --- a/dump/win_dump.c +++ b/dump/win_dump.c @@ -18,6 +18,13 @@ #include "win_dump.h" #include "cpu.h" +#if defined(TARGET_X86_64) + +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); @@ -470,3 +477,14 @@ out_cr3: return; } + +#else /* !TARGET_X86_64 */ + +bool win_dump_available(Error **errp) +{ + error_setg(errp, "Windows dump is only available for x86-64"); + + return false; +} + +#endif diff --git a/dump/win_dump.h b/dump/win_dump.h index 56f63683c3..c9b49f87dc 100644 --- a/dump/win_dump.h +++ b/dump/win_dump.h @@ -13,6 +13,9 @@ #include "sysemu/dump.h" +/* Check Windows dump availability for the current target */ +bool win_dump_available(Error **errp); + void create_win_dump(DumpState *s, Error **errp); #endif /* WIN_DUMP_H */