From patchwork Tue Mar 11 04:08:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 14011099 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D38821421F for ; Tue, 11 Mar 2025 04:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741666152; cv=none; b=LVjGXrLJHqTbbDcDf9j/vRjszf4bBOUX55J5ayEn37fL3Hg4sUc4TS1Bj31eoSHHIEhTsP3uA+7iBzdMDCrp+ZOnnHH19rCfODpd+PsUrV2dzFCMBN86l63f2Ueu7mPZqBhDXPG+OUigj7EwqMc/RO3K5bpXimlMSmEy01R2T/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741666152; c=relaxed/simple; bh=2BGYv29y1gAuWbOxLdSmdLhzjdPFXu3kgq+kOyRsd60=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XE4e3GSjlN7C9EFPLC0HrqCMZ4i+opt8XSfSt37c7v6JBY1bmkLkXkrvPh7iCdZY7WGRzoTII2CePn0NYd2IgNoSjBo6KZEEk0XTGHHFqo10Rls5kbU6uEp+FBQIr8php5mvFq4Cgqr7lqTqGZvvMlTYVisrcbH2oUx5RFWK1sE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SEqJ0+E5; arc=none smtp.client-ip=209.85.216.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SEqJ0+E5" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2ff04f36fd2so8358062a91.1 for ; Mon, 10 Mar 2025 21:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741666150; x=1742270950; darn=vger.kernel.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=SEqJ0+E5RpUIDI+bhZuTyk5LnYpMTz+Tbig1ni/+F6RusMpIddhmIJ3POvbATCIIJR quIZd6TDcDj7dTk+fi66Sd263vez8TUPNrduiF3U3SBcjJjivmLqjXoTkKMwAney7Mpl jye9CaCCsjr64SLwf3SnKdF/PYEN+krzsBQu6cF7/168bA73CgcIu47Zc5W1qZoDjSPg AcJrSbg9ATRwDp346Ic3iJl+HIuYxQeRuHn3jWEMCPzbWSjeaxBN+lF6zGQmSFVKYEjh pwb+Nh+p5swzSRj1mHgabjotby6H6EOVFJchHl2Jxz/CTVVNeuJNRFklhqCGFNYjrbsW H3fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741666150; x=1742270950; 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=LYZk/9CJhDHmHKs4h2dC/1zaEY93gxAdnDNiOIRWxdijzaB9bfkOpc9wi9uSvJ+xqQ 8AXFlO4OHDAp/m8jTt/WKJavKdVKWAu8EA1wyAuJpIC52V2kn7FIy1o6GDj1vBejK0bg P2JQ/VD4JskIs0Ei7AfGA/o8lifQ53xshlz8zdK3JcV6CmAPW8ybfV4XeIuaEjG4Je0L fzwAYK+D+pdqhTBpK6YpkKYxBeN9caLU1nFDdKbYAi3iLbPt+WN8Ira7kmr1wO0NRtsp blypCkuh77PbgrEuEF1H9rgAPAeaZtV21I0pYa7sE4F7reRZyjlaxVj59tMPrts8F1w1 rRvQ== X-Forwarded-Encrypted: i=1; AJvYcCXgEaU804Eszh138p2cY7mukDUYe9ZIa1miwK5Jz2rq7ZVEafKVUx3Ki2qyyg82pdqNUVQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4asGFLpgQNOmt037Bjnm+63IeGFXXPAEp1sTFjp+5GeYLPTKY 5giTEnegb/BvUvKdLlS4tY9dq0/IhqHDmh48f1ZNcxXna4ML3e+fvwl3i155HsA= X-Gm-Gg: ASbGncvyVVK9ANPsLWqCMtXDKGa25/vKjURS9n3Ni8XE7RFO5EdagyN+IdA2+zyLELU g+SQCZwiF00C7VnZKkKl+Bj1uA3J5D+2J3K60LMc+Y6Jf1QNQlwegm+9IHlofkm3BuCdEggmlOr 6a6IpuUpMzkGiTlo8vDJIGFYSXT0PGVDlcDQkM32TTUBfHPScumZEDmXILdz/9eNotgfjzzbp7I AVSIzMpx67UEEo1RCzJqfGbLZnAhYFP7HRWiIFMGwdcIcInqT0gS1gn7UlbhOzMZXZ7PXjFtOPg bUdNhtMsKJj7FGkgsRyeCCS8Kc0+xZphg1bZTDXv3S1Z X-Google-Smtp-Source: AGHT+IHJmCe2dJrkKZuUg8Hp5UUMBrSHtlgnmpF6Gn789stb7ihIio5wxKC4BVHFee5F9pMJvA7mBw== X-Received: by 2002:a05:6a21:3941:b0:1f0:e42e:fb1d with SMTP id adf61e73a8af0-1f544c7fc7fmr33091101637.36.1741666150581; Mon, 10 Mar 2025 21:09:10 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af28c0339cesm7324454a12.46.2025.03.10.21.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Mar 2025 21:09:10 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Paul Durrant , Liu Zhiwei , David Hildenbrand , Weiwei Li , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , xen-devel@lists.xenproject.org, Paolo Bonzini , Richard Henderson , Peter Xu , Nicholas Piggin , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Alistair Francis , "Edgar E. Iglesias" , Stefano Stabellini , Harsh Prateek Bora , alex.bennee@linaro.org, qemu-riscv@nongnu.org, manos.pitsidianakis@linaro.org, Yoshinori Sato , Palmer Dabbelt , Daniel Henrique Barboza , Anthony PERARD , Pierrick Bouvier Subject: [PATCH v2 12/16] hw/xen: add stubs for various functions Date: Mon, 10 Mar 2025 21:08:34 -0700 Message-Id: <20250311040838.3937136-13-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250311040838.3937136-1-pierrick.bouvier@linaro.org> References: <20250311040838.3937136-1-pierrick.bouvier@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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()