From nobody Tue Feb 10 10:55:23 2026 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1677507269; cv=none; d=zohomail.com; s=zohoarc; b=dJQ+xc5cokZHysYupIMMBT45i74lcVSHk+8QG3hrhABFowZh7NTsy/87EIguSaV79h2lqUjBTdvfdhmtgCvNahPMZMZhIMhgVXYNnHaV7Vp5lbsnuRBT8wUjClp1BcB3nMp8dxNY6JtVMrv/azBPJhdjveKfKJWvAUnvtGKEyhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677507269; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IaVs6FOwXp7HWgaVY9BxYKdINeZMyNNvs9/2KbcKP1Y=; b=SQjk5+U3rFDsTZZT9gj213xO3p6jGy/G1jVm7tHXWiGUq/QuJKAqwi3S7Jn6jIIiyIuLYu3iWxx4OUxWA2zqZNhHx3q1U71QrQwYIYeioxMcUf6Xipb9WCj97U9tEo6AUJZxbIyNsCP2CsZcPQGy3dc3ff7fQpURnMMBcDteo7E= 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 1677507269245670.6227520502118; Mon, 27 Feb 2023 06:14:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWeFj-0003o7-Bn; Mon, 27 Feb 2023 09:13:23 -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 1pWeF6-0000p3-DY for qemu-devel@nongnu.org; Mon, 27 Feb 2023 09:12:43 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWeF4-0001Lz-Cw for qemu-devel@nongnu.org; Mon, 27 Feb 2023 09:12:39 -0500 Received: by mail-wr1-x433.google.com with SMTP id t15so6372647wrz.7 for ; Mon, 27 Feb 2023 06:12:37 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id iz10-20020a05600c554a00b003e2243cfe15sm9213969wmb.39.2023.02.27.06.12.35 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 27 Feb 2023 06:12:36 -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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IaVs6FOwXp7HWgaVY9BxYKdINeZMyNNvs9/2KbcKP1Y=; b=EXwQ86RcHS/CX0U5AG8RXdVF3z3BR12ZekRsD85Pip1x26MkCHVnEdjKlG+k/0RDTj cEC1mSH6lsFn1lVHY40VMZlcEKiKUjYKhw5Jl+ax5LqcX5Ztw/axHwz+Lq7DlfhXOWfH KSiiml6XZLYGTOhu3U8XdaQy1gjSGzztfYBux1qwivvqiICpTtZIKkRwfsyu+MUahiLq LnF6E/VWK/GSz1myzModh00e2FP0rNhR923B6PwG1F2d5amqoxdVLA7jdQQiWXpfg3MY ZdWBIih28oNIAUUx6ARWCycE+9BRDybZ94nVuwEy2ArLXxoNEI0Y9tDYpT/BNy7uOUU6 iEbQ== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IaVs6FOwXp7HWgaVY9BxYKdINeZMyNNvs9/2KbcKP1Y=; b=gvV+7YReQw9ePMvTIGDC17uXhuQfs1HFHYNSysrWo8mTw9PDMIz8lz/kkf2LVGnTtS klRgM/qXXadD2U2oKdqkCmBm+vF1f1H7Ap7U8cI47aIAgkt9l6TrYsn3DyGspdi1lCqj 0P0IuxsTIfUCPP6Ls99Eo2FHVf9/6Pq35tNJNN2zzDqLlNIpmc5wh5CjMD+VWsJtfftx LDVPc5iFMuHXbfvUnFL3/qRjMQSwkxkjns/EzKOqbR8yFNMSwlrg1SQps1Z+oYFMbr7t CkPCWup0rGSZ5Fq4jx1qv0L5PLC/+4fG8K1s8YukL+OywYdViGqIO3KMr61RB4po1h7x ROwA== X-Gm-Message-State: AO0yUKUWtmpHXDnCegSoCTfGDibP5DYe9hzjm+UjdgOespldroFRoJji Ghg3j+nPROTfiix+k6LBflzEoLrDQGrpFXjq X-Google-Smtp-Source: AK7set8vJjr4eT8wk9xwG9mN0RaAeiBK1CeI6jKOMR2R/alz38qKOhcDJRyz+SNbP5UbYRCyvTRH1A== X-Received: by 2002:adf:f883:0:b0:2c7:3d5:9faa with SMTP id u3-20020adff883000000b002c703d59faamr18061653wrp.11.1677507156734; Mon, 27 Feb 2023 06:12:36 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 124/126] dump: Simplify compiling win_dump.o by introducing win_dump_available() Date: Mon, 27 Feb 2023 15:02:11 +0100 Message-Id: <20230227140213.35084-115-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230227140213.35084-1-philmd@linaro.org> References: <20230227140213.35084-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::433; envelope-from=philmd@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.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 @linaro.org) X-ZM-MESSAGEID: 1677507269918100001 To make dump.c less target dependent, move the TARGET_X86_64 #ifdef'ry from dump.c to win_dump.c (introducing a win_dump_available() method there). By 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=C3=A9 Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230225094903.53167-5-philmd@linaro.org> --- 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 da63129825..fa650980d8 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 =20 #include #ifdef CONFIG_LZO @@ -2126,12 +2123,10 @@ void qmp_dump_guest_memory(bool paging, const char = *file, } #endif =20 -#ifndef TARGET_X86_64 - if (has_format && format =3D=3D DUMP_GUEST_MEMORY_FORMAT_WIN_DMP) { - error_setg(errp, "Windows dump is only available for x86-64"); + if (has_format && format =3D=3D DUMP_GUEST_MEMORY_FORMAT_WIN_DMP + && !win_dump_available(errp)) { return; } -#endif =20 #if !defined(WIN32) if (strstart(file, "fd:", &p)) { @@ -2213,10 +2208,9 @@ DumpGuestMemoryCapability *qmp_query_dump_guest_memo= ry_capability(Error **errp) QAPI_LIST_APPEND(tail, DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY); #endif =20 - /* 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); + } =20 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')) =20 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" =20 +#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: =20 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 @@ =20 #include "sysemu/dump.h" =20 +/* Check Windows dump availability for the current target */ +bool win_dump_available(Error **errp); + void create_win_dump(DumpState *s, Error **errp); =20 #endif /* WIN_DUMP_H */ --=20 2.38.1