From patchwork Tue Mar 11 19:57:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 872501 Delivered-To: patch@linaro.org Received: by 2002:a5d:64ce:0:b0:38f:210b:807b with SMTP id f14csp1663154wri; Tue, 11 Mar 2025 13:03:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/TEK+NAxxfWv2FiMJ842I7FgrWHZuvwh0JFdjAfPmGIm4DxwPhybMafEHKx8TkHO/HkC1+w==@linaro.org X-Google-Smtp-Source: AGHT+IFTGZfoZhIw+2wMYW5DcWyiCpt/YeK/VaOEfVUp/+6x4y0grmsualXKR/pGc4NA+5n21qqi X-Received: by 2002:a05:6214:5603:b0:6ea:c5be:f21b with SMTP id 6a1803df08f44-6eac5bef2a2mr37807766d6.13.1741723401330; Tue, 11 Mar 2025 13:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741723401; cv=none; d=google.com; s=arc-20240605; b=HczCGf/70LKmWf5LrjA9VnUWbZMJETxdh3aECN8p4JQils5FVOb0wPhd77i6boswzj FWNP95gHotCbLoZavzA0HTICTNY2tZ/nWWBZnunWtAYe4o6FXJyFxSLBMsvxWnur2jR2 hSTGp3Rvmm2in709TaE9Ly524x1OamS3ha5Cw2n+ghSQs3QDYnovCVITj7J90KopHZyd xjtstrVjUTbxBXUTOjuqQuhKqAyuD/9cThUbGshmgnM/RSPoJyiWR4Mb1mjcmaPbmbsb N8DCN5yVXVES7WSzwvisH+671Cw0SDM4S/+vkHQEwLnGyfFGUTeFF6PTGYGNof4hNSFp Hskw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=YZcwoIie6BtZ5Bqo8BYW0CKBTK95znA0iA8YHmiy7v4=; fh=kEoQpoDeYKqqTWMOc0Iq2e1LPI+fIsbUMg+I80Y/mck=; b=Fpx3r8RHmSKRS+c0+rQgeU+g1FtaHOv0vrE3Fh1r9AwC7OZ7AB/EnPi5R4X8HgQQdV ipPYrzPien8J/a5v96wu52LiU/sF/eCsau3TpNEnzU5SY0KvCb4JvYTji3fcapAV5G4l Heti70TdX7Iuht3z0/UBSOV77OzLOSfYt7MsZbJWIsz3NF2Ut6ISK/FiS4zoXl6rTRJA o9iiK6xTgWR5LGRH+cuI3pLZ7YhuMSzo//ou4ooA2s03zPeNu757zneEH1JhYZWo4I4z jQPh8QoH5ZMBKhVJ4Y5r+geGizI+0rJFL+fYU7ioDvBz4Ik9lNiKUybg4h04+0RZW4wm GJ9Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sE3Sv2Pm; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e91e928c37si40878806d6.454.2025.03.11.13.03.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Mar 2025 13:03:21 -0700 (PDT) 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=sE3Sv2Pm; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ts5lR-0003fb-H5; Tue, 11 Mar 2025 15:59:45 -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 1ts5kE-00011k-Pi for qemu-devel@nongnu.org; Tue, 11 Mar 2025 15:58:37 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ts5kA-00008V-4f for qemu-devel@nongnu.org; Tue, 11 Mar 2025 15:58:28 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-223f4c06e9fso3135395ad.1 for ; Tue, 11 Mar 2025 12:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741723104; x=1742327904; darn=nongnu.org; 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=YZcwoIie6BtZ5Bqo8BYW0CKBTK95znA0iA8YHmiy7v4=; b=sE3Sv2PmuDHH2NJUPQHB+DnObIB0L7z5fqcP4ko5dAS+3AvSH/mHBm0gWKOOmHz5VW cHQlTLbQMpq2zSSQS1ZOiKerjFllkI7a0zncwAmdTnL57U689B8E679W7I6Yt0//Wbfl yMyWG6Je0tzMCFIVIFffPEvuoL/tjla0QGmn8/mR/IOldQlBKHjzMLONc0T6IPwjkt1V 0s8+ldtdA9kFpDIuJVWduBPrhcLbBN+5/WlTzwIc+dOHmcy3CNdce3mUp9ftkOFPNjXP EaNZjuizq+SQ59lqNU2dNP/Ej7rde5F12xIm8ApB02QUcqXDFiTONYNUJL48SW7jr5Id ja7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741723104; x=1742327904; 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=YZcwoIie6BtZ5Bqo8BYW0CKBTK95znA0iA8YHmiy7v4=; b=MMZdZr02QvAZ4wkITA1+/Iz2JKm8OUocvRAOSY6vAg7wA76YOEci6S/lLvcLdWuX+q /+REnBi6TBq4mC4F89P6acd7nVDkb7PNeWjpy1tod9Lpc33MGvDNIz7YSlBPgypqRuL+ JI5dNr9SCL1Cd5npZhvVn1KTGKy6Uyc9a8IbYZkAAcW89+VTAZCiyBMnh5fw8vlHnAge +RNWZ0woFlk2kaJI7aHUQeAWwK+KQ2zNknvr5Ewubsq6Z9UPMdD5HmMW/zGosG/6Ni0v kYPgXM/H/owHqbwrPeap4BYAn4UVtezaw8yGJIWLqexkPDeIwU8GkyCCquMORdQm37En P9Ig== X-Gm-Message-State: AOJu0Yydh5CgaLeBfTiVjew+vh9fRTnxyoq96TkNw7vVIB7ZKrNEJLO3 iQAjO9CCp9ryZ2Qe4SWSyjvAEt+wTYyiOEY+GEk2XhDHHnk6b9gMia0enIiqduVfhbnCGtC+nl8 tntI= X-Gm-Gg: ASbGncsOWLPydQ0aaR0s8/9ViwV8t3rzBoo/jtbJRu2xeG5/7F3sNYUIYkkPCHK/mkQ ZfXDibQtm2wS0prxGkvKyunwn5lEpZlqkX3L3ZpSlpHsYuygmjrvoYbBhdcwUX8HpS+RJyY5fAJ NK845Xn37cyFyCU4mvTdjLckLTX5enkzDrlgbFdXb914c87LrOFGsliZ4/T+GT1kvcIROWC8tfP wmRaP2znmXNspRx3fP1auY1GH1K0TfBKMehIzb5VA8rfZTHVy4mTP6kSBnz8wFq0JeO1qsKBOGf fkhCoHmnFtTUWDqlkPRKUf36P71VzYK05lhmxNILVC4H X-Received: by 2002:a17:902:eccd:b0:21f:5063:d3ca with SMTP id d9443c01a7336-22593dc5076mr68139055ad.16.1741723104414; Tue, 11 Mar 2025 12:58:24 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-736a6e5c13asm9646981b3a.157.2025.03.11.12.58.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 12:58:24 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: David Hildenbrand , Stefano Stabellini , "Edgar E. Iglesias" , Anthony PERARD , xen-devel@lists.xenproject.org, Nicholas Piggin , Richard Henderson , Weiwei Li , kvm@vger.kernel.org, Palmer Dabbelt , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paul Durrant , Liu Zhiwei , Daniel Henrique Barboza , manos.pitsidianakis@linaro.org, Peter Xu , Harsh Prateek Bora , Alistair Francis , alex.bennee@linaro.org, Yoshinori Sato , qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, Pierrick Bouvier Subject: [PATCH v3 12/17] hw/xen: add stubs for various functions Date: Tue, 11 Mar 2025 12:57:58 -0700 Message-Id: <20250311195803.4115788-13-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250311195803.4115788-1-pierrick.bouvier@linaro.org> References: <20250311195803.4115788-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x629.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=unavailable 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 Those functions are used by system/physmem.c, and are called only if xen is enabled (which happens only if CONFIG_XEN is not set). So we can crash in case those are called. Acked-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- hw/xen/xen_stubs.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ hw/xen/meson.build | 3 +++ 2 files changed, 59 insertions(+) create mode 100644 hw/xen/xen_stubs.c diff --git a/hw/xen/xen_stubs.c b/hw/xen/xen_stubs.c new file mode 100644 index 00000000000..19cee84bbb4 --- /dev/null +++ b/hw/xen/xen_stubs.c @@ -0,0 +1,56 @@ +/* + * Various stubs for xen functions + * + * Those functions are used only if xen_enabled(). This file is linked only if + * CONFIG_XEN is not set, so they should never be called. + * + * Copyright (c) 2025 Linaro, Ltd. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "system/xen.h" +#include "system/xen-mapcache.h" + +void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) +{ + g_assert_not_reached(); +} + +void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, + struct MemoryRegion *mr, Error **errp) +{ + g_assert_not_reached(); +} + +bool xen_mr_is_memory(MemoryRegion *mr) +{ + g_assert_not_reached(); +} + +void xen_invalidate_map_cache_entry(uint8_t *buffer) +{ + g_assert_not_reached(); +} + +void xen_invalidate_map_cache(void) +{ + g_assert_not_reached(); +} + +ram_addr_t xen_ram_addr_from_mapcache(void *ptr) +{ + g_assert_not_reached(); +} + +uint8_t *xen_map_cache(MemoryRegion *mr, + hwaddr phys_addr, + hwaddr size, + ram_addr_t ram_addr_offset, + uint8_t lock, + bool dma, + bool is_write) +{ + g_assert_not_reached(); +} diff --git a/hw/xen/meson.build b/hw/xen/meson.build index 4a486e36738..a1850e76988 100644 --- a/hw/xen/meson.build +++ b/hw/xen/meson.build @@ -9,6 +9,9 @@ system_ss.add(when: ['CONFIG_XEN_BUS'], if_true: files( system_ss.add(when: ['CONFIG_XEN', xen], if_true: files( 'xen-operations.c', +), +if_false: files( + 'xen_stubs.c', )) xen_specific_ss = ss.source_set()