From nobody Thu Apr 3 10:24:53 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741286770; cv=none; d=zohomail.com; s=zohoarc; b=Bqnc8FG/tkyGbpavU/+dITpVcZg9DoXnhJbLhOmhZpOcCKzL4Vx38zJQADsX+PEfX6D6umjVvtKzibVS4t+pHiF+5WzYHmjOGeWlFKHcR8jyjkZPtozuqedv3K8rMFEGEmK/t+Ya0wXEWQQ9SqV7gpqcxPZ/SrE0BWoAZdQxIBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741286770; h=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=eYYJxJdIvSF4Ky9p+9rse8TFiw0pjojl4vD1VD595uU=; b=SakqSel9FXeZKT7Jd04RUQeb4O/obFxuOplFzfSYE0NAzQXXsV0XEghqkkcrmbr+sfnXigwK2TNoA1jbGMfjD/7r2obXcZsn+J8cUoaPNWwbm08xGGIIcjOVPnnE827qt24ffBQ0rQ9DFOnh2OOpl7yhtQYyIASWhiZvoNrgTvw= 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 1741286770691249.9812670405853; Thu, 6 Mar 2025 10:46:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tqFXy-00039D-5i; Thu, 06 Mar 2025 13:02:14 -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 1tqFXk-000351-SV for qemu-devel@nongnu.org; Thu, 06 Mar 2025 13:02:00 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tqFXh-00009k-3f for qemu-devel@nongnu.org; Thu, 06 Mar 2025 13:01:59 -0500 Received: by mail-pl1-x643.google.com with SMTP id d9443c01a7336-2234e5347e2so19112005ad.1 for ; Thu, 06 Mar 2025 10:01:56 -0800 (PST) Received: from localhost.localdomain ([58.37.175.138]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af28126db9bsm1338498a12.58.2025.03.06.10.01.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Mar 2025 10:01:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741284115; x=1741888915; 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=eYYJxJdIvSF4Ky9p+9rse8TFiw0pjojl4vD1VD595uU=; b=f7YZ9ox3iMuams7tvI8vToqiRPHzlr7WkWFzjLsd/QUZG6zLXb75E1qy2xyZ8gn4DC Pf1YTxzds+wVk9DY4VmqyoeW0WYvxNkPrx3u9i5O2r4oMmug/25QBUaBdrgoip9cOSP1 ld88s1+DmbJIJZ8imengsXrsghdH/JimjVTBhc319TWJOg/jrqc6ErYP2XkKlf+ZdLZm BB/JxihRdZeItELdBseW3GnNmibKbgAswRAOpXODSZLl+1tLRw9Yt4whwp04XTzKL9II 78RajEcWWdpc6ggG6U4R+ZxZ34l9luAEG6HgHbtnIs/928FOE0lBBB0pNCk/MhwnfmAZ Y5Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741284115; x=1741888915; 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=eYYJxJdIvSF4Ky9p+9rse8TFiw0pjojl4vD1VD595uU=; b=NVCrqaLx3Aq0KwcMk0LDPw0PcF//4m+oziLOkNjufSqRzzYeSaz9Zh6NpPP2AsFIJS cDD2aJ2jzIpMEZfPVvZuzNjBetYbNB5AmfIQaFOeUCyDHUrsNXMXy3q4eOG3MXf3/NGY vUX7SOIa0U2kvWwib0q4xMKH4SOZenKeThWnrTgtCHKTBuXleGFUimgjFgC629rny02v bHJTnP6WKLBuSH18H3+vbWCmJ3m/b1uLI66eJn5vsDES09DNCrTy03H4YYnQvPRuWCTx 4XvInfki40CEaSTN15/MLNqQxJPW6yERc/hebzR+T0F7reA58HLKKDXexfH8RRn28n+D AaXw== X-Gm-Message-State: AOJu0Yz2pUKx9K9Wnv4eWlzeUo4xh5Jo04j2c38YY26DRmcLXG2tN5X+ 2+p0nUHC4W2KBtH1THr4SVmqpU/Yg0ck2f0FCm190OrKbdy93fp7J/fjpAPq3Q== X-Gm-Gg: ASbGncvRSlLKly1+ViJ4jFo0vW3/j0+2CFzkjw1nq6MXTgcHDbMant2MCz7+gBtl4KG x9jq5FisfsgbPaWbCnWDABYjf3oovE1ZxDf86QIudneDaKl7z1KNE0lWcw6N1x9hi/GvEeZs0vB TpS340nem9A/Y1lpcus+831zqZxDPHFVAhY9UKuFyZcC8WzBSUcD7PGyWkoeBhjVOUcdHzGKVni eMgYuAD2Oj8eDdlIaSJGufuc7OQ5s58dslMI7V0odsL5oxj/cYVRAdESYdbu3mIOGiMWAiz9P+7 Y3TjQ6GbswYcNyZ1GuIsMnbFyDT2e6qmexI0BkSE/CNfzxMghh0pQL/4Eg== X-Google-Smtp-Source: AGHT+IE5vjZRx0YZHmWBZwEbjSAcMKl8mF/L61t494cETcOszhDUKoHE4uGo13GBYBYV3SAE5VbCVQ== X-Received: by 2002:a05:6a21:a49:b0:1f3:3e91:fad2 with SMTP id adf61e73a8af0-1f544af8695mr734006637.13.1741284115137; Thu, 06 Mar 2025 10:01:55 -0800 (PST) From: Tomita Moeko To: Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Cc: qemu-devel@nongnu.org, =?UTF-8?q?Corvin=20K=C3=B6hne?= , Tomita Moeko Subject: [PATCH v3 08/10] vfio/igd: Handle x-igd-opregion option in config quirk Date: Fri, 7 Mar 2025 02:01:28 +0800 Message-ID: <20250306180131.32970-9-tomitamoeko@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250306180131.32970-1-tomitamoeko@gmail.com> References: <20250306180131.32970-1-tomitamoeko@gmail.com> MIME-Version: 1.0 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=2607:f8b0:4864:20::643; envelope-from=tomitamoeko@gmail.com; helo=mail-pl1-x643.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, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1741286772231019000 Content-Type: text/plain; charset="utf-8" Both enable OpRegion option (x-igd-opregion) and legacy mode require setting up OpRegion copy for IGD devices. As the config quirk no longer depends on legacy mode, we can now handle x-igd-opregion option there instead of in vfio_realize. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 14 +++++++++----- hw/vfio/pci.c | 9 --------- hw/vfio/pci.h | 2 -- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index ac096e2eb5..4c3862b61e 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -189,7 +189,7 @@ static bool vfio_pci_igd_opregion_init(VFIOPCIDevice *v= dev, return true; } =20 -bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp) +static bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp) { g_autofree struct vfio_region_info *opregion =3D NULL; int ret; @@ -560,10 +560,8 @@ bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, = Error **errp) goto error; } =20 - /* Setup OpRegion access */ - if (!vfio_pci_igd_setup_opregion(vdev, &err)) { - goto error; - } + /* Enable OpRegion quirk */ + vdev->features |=3D VFIO_FEATURE_ENABLE_IGD_OPREGION; =20 /* Setup LPC bridge / Host bridge PCI IDs */ if (!vfio_pci_igd_setup_lpc_bridge(vdev, &err)) { @@ -575,6 +573,12 @@ bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, = Error **errp) goto error; } =20 + /* Setup OpRegion access */ + if ((vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION) && + !vfio_pci_igd_setup_opregion(vdev, errp)) { + goto error; + } + /* * Allow user to override dsm size using x-igd-gms option, in multiple= s of * 32MiB. This option should only be used when the desired size cannot= be diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index d5ff8c1ea8..c9a484fa68 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3136,15 +3136,6 @@ static void vfio_realize(PCIDevice *pdev, Error **er= rp) vfio_bar_quirk_setup(vdev, i); } =20 -#ifdef CONFIG_VFIO_IGD - if (!vdev->igd_opregion && - vdev->features & VFIO_FEATURE_ENABLE_IGD_OPREGION) { - if (!vfio_pci_igd_setup_opregion(vdev, errp)) { - goto out_unset_idev; - } - } -#endif - /* QEMU emulates all of MSI & MSIX */ if (pdev->cap_present & QEMU_PCI_CAP_MSIX) { memset(vdev->emulated_config_bits + pdev->msix_cap, 0xff, diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index aa67ceb346..0d0a18136a 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -230,8 +230,6 @@ int vfio_pci_get_pci_hot_reset_info(VFIOPCIDevice *vdev, =20 bool vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp); =20 -bool vfio_pci_igd_setup_opregion(VFIOPCIDevice *vdev, Error **errp); - void vfio_display_reset(VFIOPCIDevice *vdev); bool vfio_display_probe(VFIOPCIDevice *vdev, Error **errp); void vfio_display_finalize(VFIOPCIDevice *vdev); --=20 2.47.2