From patchwork Mon Feb 27 14:02:11 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: 657029 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2373931wrb; Mon, 27 Feb 2023 06:14:29 -0800 (PST) X-Google-Smtp-Source: AK7set9O1M3sdqDYPIoRF28GeWSMh7WtP15aNbOY0N/EAEc/UFXEe8h9D3O2VJaDk9KFG7PgkMAd X-Received: by 2002:a05:6214:ccd:b0:56f:6ba:af98 with SMTP id 13-20020a0562140ccd00b0056f06baaf98mr46392852qvx.1.1677507269824; Mon, 27 Feb 2023 06:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677507269; cv=none; d=google.com; s=arc-20160816; b=XZNnR5b0eAsYMX6Y3tUJddVOsyP53+HWYlWO4LS7M7Y7F5R4QfDyLtOsnLPy9+fP/p ZuSeXl+HIEyTu6nQ30vX8Guyxb6pZoGodDd7/7kMkjoRX5N88kBxEOL42jdCiMJ8oBx0 6X6l6Rw5A1Hw472bVAtXNzakMFb7bRudzEWCscAVDpzoYv9peAWdOWbvDrIDxITi+VeY gZX+W8lYeLOnAhXTyY1giYLuyCTGwiIvABdVZzrNkctTXTLMx256ITryGjfcWrLs5YB3 nx/OEkl97Tb/jpKUX3WoabLmnoH7vEa/ShXXqEkICzF2Xi6hm3bkE4bz6IEtxGqXQfvh m79g== 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:to:from :dkim-signature; bh=IaVs6FOwXp7HWgaVY9BxYKdINeZMyNNvs9/2KbcKP1Y=; b=HhCYQ6bUP/rbWJB2qqUMVrl+vRkCv/0aQ+OGzjjU1oK02V+9y9b/WMNqzHPtlMtwlT uvWhoDkv76ZNL9apRYxd8SfUm9+2jEmrxuZbLlm+yQ3AEnjQTwQ3JMIarDU34FgOp1SE FGPIbT7/TaxMZUC7HO6LQ7RLljF0yV498IBQXa6tPXpHJRBYWODlgpSqOl2IA3fhwHc2 rJRaIxIz7p22OA5H524DUdIGkK+rXs73XR7nscv26E+PA3cSi26aYK5nSAIHrLdcW0TX y6SHVvZWvrZaqTj9ftgIcSMEMZzaaWZDQ1kXPJiEp+GEl9XZc2MnFAR1JDhK2HTAQoSo 6SPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EXwQ86Rc; 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 s26-20020a0cb31a000000b0056ea94f2164si7172030qve.30.2023.02.27.06.14.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 06:14:29 -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=EXwQ86Rc; 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 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) 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-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) 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) From: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Marc-André 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 #include #ifdef CONFIG_LZO @@ -2126,12 +2123,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)) { @@ -2213,10 +2208,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 */