From nobody Wed Nov 27 10:39:07 2024 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=1699888958; cv=none; d=zohomail.com; s=zohoarc; b=EbOtPeuY+c/8h26GR9X20kwPH6eSWxq8Qa9EJClSba8wLeCfZ4A2AeIfZbc+N4qe7FDpO9nz8t3vTccLi1s+YgqiGPfgeGzeprR/0GkN4736ngG7Lxb6g0fkKlLhsJ5HMkDZ3UcSfLE6knd5z90coRN8lanErhRPNH1OnVFXyNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699888958; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M4sm9DG4Z80HufhtnK5i8zUn8uDgyk6yGboQ8Gp5Uh8=; b=CCPYNxJKTQxi+vZjOoyMIPIdNGX5QOamJWOnaroVNq/RiFUkH9+Sa3F5H7r9Vy3wDQzDTf1oIxqtMZduAZ/CPV8BMPneSw8wjGqBQAUOqw91vn8g3m8EZiLXuhDP+zu84XjE4vfWpW3QW+6XhWaiBxnKHvmT6clhhZMWw8oWOLQ= 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 1699888958584896.6186363357292; Mon, 13 Nov 2023 07:22:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2YlX-0002Dz-1K; Mon, 13 Nov 2023 10:22:19 -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 1r2YlU-0002Bp-Q2 for qemu-devel@nongnu.org; Mon, 13 Nov 2023 10:22:17 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2YlS-0003LP-R5 for qemu-devel@nongnu.org; Mon, 13 Nov 2023 10:22:16 -0500 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9d10972e63eso671118466b.2 for ; Mon, 13 Nov 2023 07:22:14 -0800 (PST) Received: from m1x-phil.lan ([176.164.221.204]) by smtp.gmail.com with ESMTPSA id lu16-20020a170906fad000b0098884f86e41sm4167855ejb.123.2023.11.13.07.22.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Nov 2023 07:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699888933; x=1700493733; 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=M4sm9DG4Z80HufhtnK5i8zUn8uDgyk6yGboQ8Gp5Uh8=; b=a2qOrCocF+Ys/l8EWrSFo9qsiI80FxUak9Fr960d4YC+1w0jPxE6FK6BilcPlLDpZU eiBGJ9m2uOZTQur8k3MKncwzIJu42SPHV2tZi6m8WkdEFPlFptUflwCGiQVC/8DOdj2O kZME+QYINKoChleCQEr2PGgmrNGOVLc2jPUD1VHFwTABHq2357EoZZfdrCkHaLge3+I6 UDcH3AaAMezLJyGC6FIBAfQrZnWIBH1OPasEbb/TJaZTnoIVanlGRM8j1OrlR3jh4mnr Pbee64znqzd3JBjmwTRAGylABKYwKwxdORixaZgtr1FfqcINBljuiBs8LvvjgS8+sa4G wcpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699888933; x=1700493733; 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=M4sm9DG4Z80HufhtnK5i8zUn8uDgyk6yGboQ8Gp5Uh8=; b=O0VG4bt/mRNlwVnKNZeA1iqTr/Vz0Cj1fG5I633p+vxZLAEeRbQuFv735OnkH37NuB l9ySjSAijOwRYJTSKUi8VfFb/gP+dnVDZ1bnWKbchuKfCdXSezYZhNTG1pfVYKa5zCDx OhrGbkwQuJFTkDJa8CyBldJvSjpWRl3jsrQgM/GnkUfsVpGQ5KPisqRqBk+LU68acRuc bU3evW3k+pIjKO+NZrusS85viCtUlgTpx49QEC0AY1q4268Qtn7F2b1jtbw1HuCKMjeV Y+u/CL9Z+OC12P2doE9RnZmZkAHNSXKn2+5436oHpW855pQCL2+U8chODJ9k6f1LZa6Y 6+lQ== X-Gm-Message-State: AOJu0YzVC67cXCrCh7Kf5VA+7PpGXcUvtybwu9NbIhkR2juXGKKraVES uhMNFubK1fIsOZW2WbtfpH1btA== X-Google-Smtp-Source: AGHT+IHGfNKy17vE6nE5Sw7Yg/bCgxdoxzzgRWsVuH1JW/c7ZnqbwtyNJGeirXmng2B4mnP0CKSxhg== X-Received: by 2002:a17:906:b092:b0:9de:2b93:cab9 with SMTP id x18-20020a170906b09200b009de2b93cab9mr5146163ejy.8.1699888933620; Mon, 13 Nov 2023 07:22:13 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: David Woodhouse , qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Anthony Perard , xen-devel@lists.xenproject.org, Stefano Stabellini , qemu-block@nongnu.org, Thomas Huth , Paolo Bonzini , qemu-arm@nongnu.org, Paul Durrant , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PATCH-for-9.0 09/10] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h' Date: Mon, 13 Nov 2023 16:21:12 +0100 Message-ID: <20231113152114.47916-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231113152114.47916-1-philmd@linaro.org> References: <20231113152114.47916-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::62b; envelope-from=philmd@linaro.org; helo=mail-ej1-x62b.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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1699888959674100012 "hw/xen/xen_pt.h" requires "hw/xen/xen_native.h" which is target specific. It also declares IGD methods, which are not target specific. Target-agnostic code can use IGD methods. To allow that, extract these methos into a new "hw/xen/xen_igd.h" header. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Woodhouse --- What license for the new "hw/xen/xen_igd.h" header? --- hw/xen/xen_pt.h | 14 -------------- include/hw/xen/xen_igd.h | 23 +++++++++++++++++++++++ accel/xen/xen-all.c | 1 + hw/i386/pc_piix.c | 1 + hw/xen/xen_pt.c | 3 ++- hw/xen/xen_pt_config_init.c | 3 ++- hw/xen/xen_pt_graphics.c | 3 ++- hw/xen/xen_pt_stub.c | 2 +- 8 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 include/hw/xen/xen_igd.h diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h index 31bcfdf705..da5af67638 100644 --- a/hw/xen/xen_pt.h +++ b/hw/xen/xen_pt.h @@ -5,9 +5,6 @@ #include "xen-host-pci-device.h" #include "qom/object.h" =20 -bool xen_igd_gfx_pt_enabled(void); -void xen_igd_gfx_pt_set(bool value, Error **errp); - void xen_pt_log(const PCIDevice *d, const char *f, ...) G_GNUC_PRINTF(2, 3= ); =20 #define XEN_PT_ERR(d, _f, _a...) xen_pt_log(d, "%s: Error: "_f, __func__, = ##_a) @@ -52,12 +49,6 @@ typedef struct XenPTDeviceClass { XenPTQdevRealize pci_qdev_realize; } XenPTDeviceClass; =20 -uint32_t igd_read_opregion(XenPCIPassthroughState *s); -void xen_igd_reserve_slot(PCIBus *pci_bus); -void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val); -void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s, - XenHostPCIDevice *dev); - /* function type for config reg */ typedef int (*xen_pt_conf_reg_init) (XenPCIPassthroughState *, XenPTRegInfo *, uint32_t real_offset, @@ -343,11 +334,6 @@ static inline bool xen_pt_has_msix_mapping(XenPCIPasst= hroughState *s, int bar) void *pci_assign_dev_load_option_rom(PCIDevice *dev, int *size, unsigned int domain, unsigned int bus, unsigned int slot, unsigned int funct= ion); -static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev) -{ - return (xen_igd_gfx_pt_enabled() - && ((dev->class_code >> 0x8) =3D=3D PCI_CLASS_DISPLAY_VGA)); -} int xen_pt_register_vga_regions(XenHostPCIDevice *dev); int xen_pt_unregister_vga_regions(XenHostPCIDevice *dev); void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev, diff --git a/include/hw/xen/xen_igd.h b/include/hw/xen/xen_igd.h new file mode 100644 index 0000000000..52f1f8244c --- /dev/null +++ b/include/hw/xen/xen_igd.h @@ -0,0 +1,23 @@ +#ifndef XEN_IGD_H +#define XEN_IGD_H + +#include "hw/xen/xen-host-pci-device.h" + +typedef struct XenPCIPassthroughState XenPCIPassthroughState; + +bool xen_igd_gfx_pt_enabled(void); +void xen_igd_gfx_pt_set(bool value, Error **errp); + +uint32_t igd_read_opregion(XenPCIPassthroughState *s); +void xen_igd_reserve_slot(PCIBus *pci_bus); +void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val); +void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s, + XenHostPCIDevice *dev); + +static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev) +{ + return (xen_igd_gfx_pt_enabled() + && ((dev->class_code >> 0x8) =3D=3D PCI_CLASS_DISPLAY_VGA)); +} + +#endif diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 5ff0cb8bd9..0bdefce537 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -15,6 +15,7 @@ #include "hw/xen/xen_native.h" #include "hw/xen/xen-legacy-backend.h" #include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "chardev/char.h" #include "qemu/accel.h" #include "sysemu/cpus.h" diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index eace854335..a607dcb56c 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -56,6 +56,7 @@ #ifdef CONFIG_XEN #include #include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #endif #include "hw/xen/xen-x86.h" #include "hw/xen/xen.h" diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 36e6f93c37..a8edabdabc 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -59,7 +59,8 @@ #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" -#include "xen_pt.h" +#include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "hw/xen/xen.h" #include "hw/xen/xen-legacy-backend.h" #include "qemu/range.h" diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index 2b8680b112..ba4cd78238 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -15,7 +15,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/timer.h" -#include "xen_pt.h" +#include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "hw/xen/xen-legacy-backend.h" =20 #define XEN_PT_MERGE_VALUE(value, data, val_mask) \ diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c index 0aed3bb6fd..6c2e3f4840 100644 --- a/hw/xen/xen_pt_graphics.c +++ b/hw/xen/xen_pt_graphics.c @@ -3,7 +3,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "xen_pt.h" +#include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "xen-host-pci-device.h" =20 static unsigned long igd_guest_opregion; diff --git a/hw/xen/xen_pt_stub.c b/hw/xen/xen_pt_stub.c index 5c108446a8..72feebeb20 100644 --- a/hw/xen/xen_pt_stub.c +++ b/hw/xen/xen_pt_stub.c @@ -6,7 +6,7 @@ */ =20 #include "qemu/osdep.h" -#include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "qapi/error.h" =20 bool xen_igd_gfx_pt_enabled(void) --=20 2.41.0