From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350524; cv=none; d=zohomail.com; s=zohoarc; b=eby8WL/SrsJ419KOj8Y0LZSh48H/GGcn1j1gIGea4UJ742FH6DxzDSshQNx6ObUfUG1DQaMBhWSIdg8TWD8Toj1FwgpWYfsifH9nRsUwdK7JyUD48vc9IdVhONkC5VQM3ddun1Qs4Hlnb3gOrFpBgJziZauR/drllaOD4fNRxxs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350524; 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=NwS9dUrfaaukpRhxKvrCMrX7fQRdDv6LekxfiOwoIMQ=; b=Ti8L6URkZ57X0lmwnLpRg7MV2ocE/AtEbagJGZYtqhdDbWq3EkTneRqkp8xRh4ChfIsgzfj1zbmkbkT93hoGNtGpj8FZIiARLBd0sSsnssKOPetzM0JwS4o6ZmVN5EZ71TF8eMFdiyF7+4UQCKAKQ5aMphAvdURSiHdAX7Xfn6s= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175735052477638.983343625862744; Mon, 8 Sep 2025 09:55:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8f-0006fs-N1; Mon, 08 Sep 2025 12:54:47 -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 1uvf8J-0006VW-Nv for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf86-0001Ys-W6 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:23 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-G92JeEbUMEKZSNgSnLVx1w-1; Mon, 08 Sep 2025 12:54:05 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5254219560AD; Mon, 8 Sep 2025 16:54:04 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AA209300018D; Mon, 8 Sep 2025 16:54:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NwS9dUrfaaukpRhxKvrCMrX7fQRdDv6LekxfiOwoIMQ=; b=DYRPsuLbOv1KX13LfKJJIKhMx6105+UAlZLUrRjw4gsSyTMSxdqgfwaPGHEFOYS4VGcgMB CNByn4VZSsb5/LMcBjqFMnc0lpay97fa2NFrSBTKv6d1cMqkBaa7LLogtoU7CMsW+Hn+MU xVBJDwmKI5DY1W9KG1lZ90VDBPhqhoE= X-MC-Unique: G92JeEbUMEKZSNgSnLVx1w-1 X-Mimecast-MFC-AGG-ID: G92JeEbUMEKZSNgSnLVx1w_1757350444 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Glenn Miles , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 01/31] MAINTAINERS: Add myself as reviewer for PowerNV and XIVE Date: Mon, 8 Sep 2025 18:53:24 +0200 Message-ID: <20250908165354.1731444-2-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=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 @redhat.com) X-ZM-MESSAGEID: 1757350529017124100 From: Glenn Miles Adding myself as reviewer for PowerNV and XIVE areas. Signed-off-by: Glenn Miles Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/qemu-devel/20250805213646.3285026-1-milesg@li= nux.ibm.com Signed-off-by: C=C3=A9dric Le Goater --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 1ae28e880424f32fae1737660ec7caded667d8b3..fb045388b92c2e41af238d8fe8a= 4f1ce87db44b6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1575,6 +1575,7 @@ F: tests/functional/ppc64/test_tuxrun.py PowerNV (Non-Virtualized) M: Nicholas Piggin R: Aditya Gupta +R: Glenn Miles L: qemu-ppc@nongnu.org S: Odd Fixes F: docs/system/ppc/powernv.rst @@ -2781,6 +2782,7 @@ T: git https://github.com/philmd/qemu.git fw_cfg-next =20 XIVE R: Gautam Menghani +R: Glenn Miles L: qemu-ppc@nongnu.org S: Odd Fixes F: hw/*/*xive* --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350767; cv=none; d=zohomail.com; s=zohoarc; b=M/p5Ys97hpFE7ZkWhnm2Ls39R/4Jc+0Z6dP8OlD/lwdZG5R2QmmNpsW/sFFjXPxwuUlgOCaLc+rvgBKg0G6nOB77JDrGbYi+ARZyjeNARKyMo2Evw4pM/cjhrOBWtEw4+Vt1FBfTx12CCymkPdIQ2Zn727bPkIPAmqkogacnz7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350767; 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=WMWQE+lVSW0xd2rlDdzp5kGDyFgdfJPePxcUB3qr7U0=; b=E5MpXdgvBnRYesOpzeGPqSTBTHSz7L0odMnb53rJph8hD4YDK/soOu5l+RwAzmRxElAR+9EXUbJY/F+g3zMsB0YsGA516IXaGFkttkQFlRIv1LLskaiVPW6hktRmvTtyBGPRtPhTbDWYuWa69Dqp2s72P0+x49OLrDyFcB9etug= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350767502352.86426676004555; Mon, 8 Sep 2025 09:59:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8l-0006mc-47; Mon, 08 Sep 2025 12:54:51 -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 1uvf8I-0006V1-Py for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8D-0001ZK-8A for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:22 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-qP9et2AmOKCB9pes12hjxw-1; Mon, 08 Sep 2025 12:54:07 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6D262195419F; Mon, 8 Sep 2025 16:54:06 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CDC77300018D; Mon, 8 Sep 2025 16:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350452; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WMWQE+lVSW0xd2rlDdzp5kGDyFgdfJPePxcUB3qr7U0=; b=OWDt7cx0CLUclcd10F9lqK+d/QqaXA0n3Lzrxj52dnz5sjskdoAC4eSobE2Aq3t0wNzFF3 YH+z4cERnTOCM7o0XNdBqQ2DUY7eklrItjx73ZX5neraeAOh26OhoAqMY1hZ6R3EqVs00G oYR0BdsPFw9yy92aDTOoQ2//iGduZ3Y= X-MC-Unique: qP9et2AmOKCB9pes12hjxw-1 X-Mimecast-MFC-AGG-ID: qP9et2AmOKCB9pes12hjxw_1757350446 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Tomita Moeko , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 02/31] vfio/igd: Enable quirks when IGD is not the primary display Date: Mon, 8 Sep 2025 18:53:25 +0200 Message-ID: <20250908165354.1731444-3-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350769419116600 From: Tomita Moeko Since linux 6.15, commit 41112160ca87 ("vfio/pci: match IGD devices in display controller class"), IGD related regions are also exposed when IGD is not primary display (device class is Display controller). Allow IGD quirks to be enabled in this configuration so that guests can have display output on IGD when it is not the primary display. Signed-off-by: Tomita Moeko Reviewed-by: Alex Williamson Link: https://lore.kernel.org/qemu-devel/20250813160510.23553-1-tomitamoeko= @gmail.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/pci.h | 5 +++++ hw/vfio/igd.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 810a842f4a153d4bcc924a6984c6dae58e1e69dd..923cf9c2f79d078546239bf6719= 5d6ba8157265a 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -203,6 +203,11 @@ static inline bool vfio_is_vga(VFIOPCIDevice *vdev) return (vdev->class_code >> 8) =3D=3D PCI_CLASS_DISPLAY_VGA; } =20 +static inline bool vfio_is_base_display(VFIOPCIDevice *vdev) +{ + return (vdev->class_code >> 16) =3D=3D PCI_BASE_CLASS_DISPLAY; +} + /* MSI/MSI-X/INTx */ void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr); void vfio_pci_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector, diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index ee0767b0b89c085a5147369dd6fcbd3ff21f8927..f116c40ccd933c8e6e7fd99d599= c6372c26973e1 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -460,7 +460,7 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int= nr) int gen; =20 if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) || - !vfio_is_vga(vdev) || nr !=3D 0) { + !vfio_is_base_display(vdev) || nr !=3D 0) { return; } =20 @@ -518,7 +518,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vd= ev, Error **errp) Error *err =3D NULL; =20 if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) || - !vfio_is_vga(vdev)) { + !vfio_is_base_display(vdev)) { return true; } =20 @@ -534,12 +534,13 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *= vdev, Error **errp) /* * For backward compatibility, enable legacy mode when * - Device geneation is 6 to 9 (including both) - * - IGD claims VGA cycles on host + * - IGD exposes itself as VGA controller and claims VGA cycles on host * - Machine type is i440fx (pc_piix) * - IGD device is at guest BDF 00:02.0 * - Not manually disabled by x-igd-legacy-mode=3Doff */ if ((vdev->igd_legacy_mode !=3D ON_OFF_AUTO_OFF) && + vfio_is_vga(vdev) && (gen >=3D 6 && gen <=3D 9) && !(gmch & IGD_GMCH_VGA_DISABLE) && !strcmp(MACHINE_GET_CLASS(qdev_get_machine())->family, "pc_piix") = && --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757351013; cv=none; d=zohomail.com; s=zohoarc; b=KeK3LCXI2Ajd7CpTn0wJZ+S7X75g0xsMiNB0Tvj7Cx0HTO02a8KAnvhacXF8e8+PMMNcO1quOdgZQEd5thiZBscKyyFrXp9GQdTOob/UhNP7uBoli0CedPU8dAX4BUwqBkUAswBU9AFnJtji9g7+VzhpOfLzkpOhul4V4QzKpkU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757351013; 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=gDXfnAowvAfz5Qf9kaIplFbPI5r2VzBNS1IgEzB/wLw=; b=eAb4QkC31gzSxK+a24vIaZAwTV7qqBco1S9nTj9pfXpb+A0iTYX8hn1py84nm5j0KoveFteY2aFfDdwZ2KVNrxJwLSQxZAa3MuESvjQMty2qjm6JsH0kOWaceLycpUBjsuStCXPRf4Q6ITUAOPMP5/RA0Nwgya3t7sc/AtulQPo= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757351013957667.798170423035; Mon, 8 Sep 2025 10:03:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8a-0006eG-Md; Mon, 08 Sep 2025 12:54:41 -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 1uvf8I-0006Uk-C7 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8A-0001ZC-At for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:21 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-K4emFdOYOmahx2SQ903Qxg-1; Mon, 08 Sep 2025 12:54:10 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2471619560BC for ; Mon, 8 Sep 2025 16:54:09 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E8622300018D; Mon, 8 Sep 2025 16:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gDXfnAowvAfz5Qf9kaIplFbPI5r2VzBNS1IgEzB/wLw=; b=VRsi3Tsc+9gIpDtBYfAIpyA6swsz/7+Hz+fCz1CLruGyXujua6PqkZ3CfkrSyajT2R5R/B t+aAGDD65uUK7P+zAwN965i0QpGTNGuA78hmmipXouqDvIe8F5O5r88JM1tORxsZ7xKaMp Fi/tYU78BjBxugAt/ZMYihiACzJI7cQ= X-MC-Unique: K4emFdOYOmahx2SQ903Qxg-1 X-Mimecast-MFC-AGG-ID: K4emFdOYOmahx2SQ903Qxg_1757350449 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Auger Subject: [PULL 03/31] vfio: Remove 'vfio-amd-xgbe' device Date: Mon, 8 Sep 2025 18:53:26 +0200 Message-ID: <20250908165354.1731444-4-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757351016757124100 The VFIO_AMD_XGBE device type has been deprecated in the QEMU 10.0 timeframe. The AMD "Seattle" device is not supported anymore. Remove it. Reviewed-by: Eric Auger Reviewed-by: Alex Williamson Link: https://lore.kernel.org/qemu-devel/20250901064631.530723-6-clg@redhat= .com Signed-off-by: C=C3=A9dric Le Goater --- docs/about/deprecated.rst | 6 - docs/about/removed-features.rst | 9 + docs/devel/kconfig.rst | 1 - include/hw/vfio/vfio-amd-xgbe.h | 46 ----- hw/arm/virt.c | 2 - hw/core/sysbus-fdt.c | 316 -------------------------------- hw/vfio/amd-xgbe.c | 61 ------ hw/arm/Kconfig | 1 - hw/vfio/Kconfig | 5 - hw/vfio/meson.build | 1 - 10 files changed, 9 insertions(+), 439 deletions(-) delete mode 100644 include/hw/vfio/vfio-amd-xgbe.h delete mode 100644 hw/vfio/amd-xgbe.c diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index b2420732e1d7a9b84e4e0b02b975a7a2354c444b..eb424f96d26be2c7226f9feefdd= d91da31984709 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -498,12 +498,6 @@ The vfio-calxeda-xgmac device allows to assign a host = Calxeda Highbank string) to a guest. Calxeda HW has been ewasted now and there is no point keeping that device. =20 -``-device vfio-amd-xgbe`` (since 10.0) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The vfio-amd-xgbe device allows to assign a host AMD 10GbE controller -to a guest ("amd,xgbe-seattle-v1a" compatibility string). AMD "Seattle" -is not supported anymore and there is no point keeping that device. - ``-device vfio-platform`` (since 10.0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The vfio-platform device allows to assign a host platform device diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index fff781d6b7c3bfde20bb4c0b0a4983764ed8d27c..eb0e5128ba1489a81dc9a45e9b2= 0594513d98347 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -1280,6 +1280,15 @@ The corresponding upstream server project is no long= er maintained. Users are recommended to switch to an alternative distributed block device driver such as RBD. =20 +VFIO devices +------------ + +``-device vfio-amd-xgbe`` (since 10.2) +'''''''''''''''''''''''''''''''''''''' +The vfio-amd-xgbe device allows to assign a host AMD 10GbE controller +to a guest ("amd,xgbe-seattle-v1a" compatibility string). AMD "Seattle" +is not supported anymore and there is no point keeping that device. + Tools ----- =20 diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst index 493b76c4fbf70dc4f2943e23704d1246e324f4cb..9fdf5015298ea2d19b97857c212= ab38dca9ab85f 100644 --- a/docs/devel/kconfig.rst +++ b/docs/devel/kconfig.rst @@ -59,7 +59,6 @@ stanza like the following:: config ARM_VIRT bool imply PCI_DEVICES - imply VFIO_AMD_XGBE imply VFIO_XGMAC select A15MPCORE select ACPI diff --git a/include/hw/vfio/vfio-amd-xgbe.h b/include/hw/vfio/vfio-amd-xgb= e.h deleted file mode 100644 index a894546c02d140d2b689f09ace733c4d43019371..000000000000000000000000000= 0000000000000 --- a/include/hw/vfio/vfio-amd-xgbe.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * VFIO AMD XGBE device - * - * Copyright Linaro Limited, 2015 - * - * Authors: - * Eric Auger - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#ifndef HW_VFIO_VFIO_AMD_XGBE_H -#define HW_VFIO_VFIO_AMD_XGBE_H - -#include "hw/vfio/vfio-platform.h" -#include "qom/object.h" - -#define TYPE_VFIO_AMD_XGBE "vfio-amd-xgbe" - -/** - * This device exposes: - * - 5 MMIO regions: MAC, PCS, SerDes Rx/Tx regs, - SerDes Integration Registers 1/2 & 2/2 - * - 2 level sensitive IRQs and optional DMA channel IRQs - */ -struct VFIOAmdXgbeDevice { - VFIOPlatformDevice vdev; -}; - -typedef struct VFIOAmdXgbeDevice VFIOAmdXgbeDevice; - -struct VFIOAmdXgbeDeviceClass { - /*< private >*/ - VFIOPlatformDeviceClass parent_class; - /*< public >*/ - DeviceRealize parent_realize; -}; - -typedef struct VFIOAmdXgbeDeviceClass VFIOAmdXgbeDeviceClass; - -DECLARE_OBJ_CHECKERS(VFIOAmdXgbeDevice, VFIOAmdXgbeDeviceClass, - VFIO_AMD_XGBE_DEVICE, TYPE_VFIO_AMD_XGBE) - -#endif diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e5c4142e822d78261f32b986f86d40ee5562e592..75fb157f6cc676127781adfb206= 613528f975cc6 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -39,7 +39,6 @@ #include "hw/arm/virt.h" #include "hw/block/flash.h" #include "hw/vfio/vfio-calxeda-xgmac.h" -#include "hw/vfio/vfio-amd-xgbe.h" #include "hw/display/ramfb.h" #include "net/net.h" #include "system/device_tree.h" @@ -3219,7 +3218,6 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) */ mc->max_cpus =3D 512; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC); - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_AMD_XGBE); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS); diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c index c339a27875cbee8131b064674aa09adf4b9efa25..d3649d5367e7294cd7a269a7b08= e56d8cbd5021a 100644 --- a/hw/core/sysbus-fdt.c +++ b/hw/core/sysbus-fdt.c @@ -34,7 +34,6 @@ #include "hw/platform-bus.h" #include "hw/vfio/vfio-platform.h" #include "hw/vfio/vfio-calxeda-xgmac.h" -#include "hw/vfio/vfio-amd-xgbe.h" #include "hw/vfio/vfio-region.h" #include "hw/display/ramfb.h" #include "hw/uefi/var-service-api.h" @@ -68,142 +67,6 @@ typedef struct HostProperty { =20 #ifdef CONFIG_LINUX =20 -/** - * copy_properties_from_host - * - * copies properties listed in an array from host device tree to - * guest device tree. If a non optional property is not found, the - * function asserts. An optional property is ignored if not found - * in the host device tree. - * @props: array of HostProperty to copy - * @nb_props: number of properties in the array - * @host_dt: host device tree blob - * @guest_dt: guest device tree blob - * @node_path: host dt node path where the property is supposed to be - found - * @nodename: guest node name the properties should be added to - */ -static void copy_properties_from_host(HostProperty *props, int nb_props, - void *host_fdt, void *guest_fdt, - char *node_path, char *nodename) -{ - int i, prop_len; - const void *r; - Error *err =3D NULL; - - for (i =3D 0; i < nb_props; i++) { - r =3D qemu_fdt_getprop(host_fdt, node_path, - props[i].name, - &prop_len, - &err); - if (r) { - qemu_fdt_setprop(guest_fdt, nodename, - props[i].name, r, prop_len); - } else { - if (props[i].optional && prop_len =3D=3D -FDT_ERR_NOTFOUND) { - /* optional property does not exist */ - error_free(err); - } else { - error_report_err(err); - } - if (!props[i].optional) { - /* mandatory property not found: bail out */ - exit(1); - } - err =3D NULL; - } - } -} - -/* clock properties whose values are copied/pasted from host */ -static HostProperty clock_copied_properties[] =3D { - {"compatible", false}, - {"#clock-cells", false}, - {"clock-frequency", true}, - {"clock-output-names", true}, -}; - -/** - * fdt_build_clock_node - * - * Build a guest clock node, used as a dependency from a passthrough'ed - * device. Most information are retrieved from the host clock node. - * Also check the host clock is a fixed one. - * - * @host_fdt: host device tree blob from which info are retrieved - * @guest_fdt: guest device tree blob where the clock node is added - * @host_phandle: phandle of the clock in host device tree - * @guest_phandle: phandle to assign to the guest node - */ -static void fdt_build_clock_node(void *host_fdt, void *guest_fdt, - uint32_t host_phandle, - uint32_t guest_phandle) -{ - char *node_path =3D NULL; - char *nodename; - const void *r; - int ret, node_offset, prop_len, path_len =3D 16; - - node_offset =3D fdt_node_offset_by_phandle(host_fdt, host_phandle); - if (node_offset <=3D 0) { - error_report("not able to locate clock handle %d in host device tr= ee", - host_phandle); - exit(1); - } - node_path =3D g_malloc(path_len); - while ((ret =3D fdt_get_path(host_fdt, node_offset, node_path, path_le= n)) - =3D=3D -FDT_ERR_NOSPACE) { - path_len +=3D 16; - node_path =3D g_realloc(node_path, path_len); - } - if (ret < 0) { - error_report("not able to retrieve node path for clock handle %d", - host_phandle); - exit(1); - } - - r =3D qemu_fdt_getprop(host_fdt, node_path, "compatible", &prop_len, - &error_fatal); - if (strcmp(r, "fixed-clock")) { - error_report("clock handle %d is not a fixed clock", host_phandle); - exit(1); - } - - nodename =3D strrchr(node_path, '/'); - qemu_fdt_add_subnode(guest_fdt, nodename); - - copy_properties_from_host(clock_copied_properties, - ARRAY_SIZE(clock_copied_properties), - host_fdt, guest_fdt, - node_path, nodename); - - qemu_fdt_setprop_cell(guest_fdt, nodename, "phandle", guest_phandle); - - g_free(node_path); -} - -/** - * sysfs_to_dt_name: convert the name found in sysfs into the node name - * for instance e0900000.xgmac is converted into xgmac@e0900000 - * @sysfs_name: directory name in sysfs - * - * returns the device tree name upon success or NULL in case the sysfs name - * does not match the expected format - */ -static char *sysfs_to_dt_name(const char *sysfs_name) -{ - gchar **substrings =3D g_strsplit(sysfs_name, ".", 2); - char *dt_name =3D NULL; - - if (!substrings || !substrings[0] || !substrings[1]) { - goto out; - } - dt_name =3D g_strdup_printf("%s@%s", substrings[1], substrings[0]); -out: - g_strfreev(substrings); - return dt_name; -} - /* Device Specific Code */ =20 /** @@ -261,183 +124,6 @@ static int add_calxeda_midway_xgmac_fdt_node(SysBusDe= vice *sbdev, void *opaque) g_free(nodename); return 0; } - -/* AMD xgbe properties whose values are copied/pasted from host */ -static HostProperty amd_xgbe_copied_properties[] =3D { - {"compatible", false}, - {"dma-coherent", true}, - {"amd,per-channel-interrupt", true}, - {"phy-mode", false}, - {"mac-address", true}, - {"amd,speed-set", false}, - {"amd,serdes-blwc", true}, - {"amd,serdes-cdr-rate", true}, - {"amd,serdes-pq-skew", true}, - {"amd,serdes-tx-amp", true}, - {"amd,serdes-dfe-tap-config", true}, - {"amd,serdes-dfe-tap-enable", true}, - {"clock-names", false}, -}; - -/** - * add_amd_xgbe_fdt_node - * - * Generates the combined xgbe/phy node following kernel >=3D4.2 - * binding documentation: - * Documentation/devicetree/bindings/net/amd-xgbe.txt: - * Also 2 clock nodes are created (dma and ptp) - * - * Asserts in case of error - */ -static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque) -{ - PlatformBusFDTData *data =3D opaque; - PlatformBusDevice *pbus =3D data->pbus; - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(sbdev); - VFIODevice *vbasedev =3D &vdev->vbasedev; - VFIOINTp *intp; - const char *parent_node =3D data->pbus_node_name; - char **node_path, *nodename, *dt_name; - void *guest_fdt =3D data->fdt, *host_fdt; - const void *r; - int i, prop_len; - uint32_t *irq_attr, *reg_attr; - const uint32_t *host_clock_phandles; - uint64_t mmio_base, irq_number; - uint32_t guest_clock_phandles[2]; - - host_fdt =3D load_device_tree_from_sysfs(); - - dt_name =3D sysfs_to_dt_name(vbasedev->name); - if (!dt_name) { - error_report("%s incorrect sysfs device name %s", - __func__, vbasedev->name); - exit(1); - } - node_path =3D qemu_fdt_node_path(host_fdt, dt_name, vdev->compat, - &error_fatal); - if (!node_path || !node_path[0]) { - error_report("%s unable to retrieve node path for %s/%s", - __func__, dt_name, vdev->compat); - exit(1); - } - - if (node_path[1]) { - error_report("%s more than one node matching %s/%s!", - __func__, dt_name, vdev->compat); - exit(1); - } - - g_free(dt_name); - - if (vbasedev->num_regions !=3D 5) { - error_report("%s Does the host dt node combine XGBE/PHY?", __func_= _); - exit(1); - } - - /* generate nodes for DMA_CLK and PTP_CLK */ - r =3D qemu_fdt_getprop(host_fdt, node_path[0], "clocks", - &prop_len, &error_fatal); - if (prop_len !=3D 8) { - error_report("%s clocks property should contain 2 handles", __func= __); - exit(1); - } - host_clock_phandles =3D r; - guest_clock_phandles[0] =3D qemu_fdt_alloc_phandle(guest_fdt); - guest_clock_phandles[1] =3D qemu_fdt_alloc_phandle(guest_fdt); - - /** - * clock handles fetched from host dt are in be32 layout whereas - * rest of the code uses cpu layout. Also guest clock handles are - * in cpu layout. - */ - fdt_build_clock_node(host_fdt, guest_fdt, - be32_to_cpu(host_clock_phandles[0]), - guest_clock_phandles[0]); - - fdt_build_clock_node(host_fdt, guest_fdt, - be32_to_cpu(host_clock_phandles[1]), - guest_clock_phandles[1]); - - /* combined XGBE/PHY node */ - mmio_base =3D platform_bus_get_mmio_addr(pbus, sbdev, 0); - nodename =3D g_strdup_printf("%s/%s@%" PRIx64, parent_node, - vbasedev->name, mmio_base); - qemu_fdt_add_subnode(guest_fdt, nodename); - - copy_properties_from_host(amd_xgbe_copied_properties, - ARRAY_SIZE(amd_xgbe_copied_properties), - host_fdt, guest_fdt, - node_path[0], nodename); - - qemu_fdt_setprop_cells(guest_fdt, nodename, "clocks", - guest_clock_phandles[0], - guest_clock_phandles[1]); - - reg_attr =3D g_new(uint32_t, vbasedev->num_regions * 2); - for (i =3D 0; i < vbasedev->num_regions; i++) { - mmio_base =3D platform_bus_get_mmio_addr(pbus, sbdev, i); - reg_attr[2 * i] =3D cpu_to_be32(mmio_base); - reg_attr[2 * i + 1] =3D cpu_to_be32( - memory_region_size(vdev->regions[i]->mem)); - } - qemu_fdt_setprop(guest_fdt, nodename, "reg", reg_attr, - vbasedev->num_regions * 2 * sizeof(uint32_t)); - - irq_attr =3D g_new(uint32_t, vbasedev->num_irqs * 3); - for (i =3D 0; i < vbasedev->num_irqs; i++) { - irq_number =3D platform_bus_get_irqn(pbus, sbdev , i) - + data->irq_start; - irq_attr[3 * i] =3D cpu_to_be32(GIC_FDT_IRQ_TYPE_SPI); - irq_attr[3 * i + 1] =3D cpu_to_be32(irq_number); - /* - * General device interrupt and PCS auto-negotiation interrupts a= re - * level-sensitive while the 4 per-channel interrupts are edge - * sensitive - */ - QLIST_FOREACH(intp, &vdev->intp_list, next) { - if (intp->pin =3D=3D i) { - break; - } - } - if (intp->flags & VFIO_IRQ_INFO_AUTOMASKED) { - irq_attr[3 * i + 2] =3D cpu_to_be32(GIC_FDT_IRQ_FLAGS_LEVEL_HI= ); - } else { - irq_attr[3 * i + 2] =3D cpu_to_be32(GIC_FDT_IRQ_FLAGS_EDGE_LO_= HI); - } - } - qemu_fdt_setprop(guest_fdt, nodename, "interrupts", - irq_attr, vbasedev->num_irqs * 3 * sizeof(uint32_t)); - - g_free(host_fdt); - g_strfreev(node_path); - g_free(irq_attr); - g_free(reg_attr); - g_free(nodename); - return 0; -} - -/* DT compatible matching */ -static bool vfio_platform_match(SysBusDevice *sbdev, - const BindingEntry *entry) -{ - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(sbdev); - const char *compat; - unsigned int n; - - for (n =3D vdev->num_compat, compat =3D vdev->compat; n > 0; - n--, compat +=3D strlen(compat) + 1) { - if (!strcmp(entry->compat, compat)) { - return true; - } - } - - return false; -} - -#define VFIO_PLATFORM_BINDING(compat, add_fn) \ - {TYPE_VFIO_PLATFORM, (compat), (add_fn), vfio_platform_match} - #endif /* CONFIG_LINUX */ =20 #ifdef CONFIG_TPM @@ -512,8 +198,6 @@ static bool type_match(SysBusDevice *sbdev, const Bindi= ngEntry *entry) static const BindingEntry bindings[] =3D { #ifdef CONFIG_LINUX TYPE_BINDING(TYPE_VFIO_CALXEDA_XGMAC, add_calxeda_midway_xgmac_fdt_nod= e), - TYPE_BINDING(TYPE_VFIO_AMD_XGBE, add_amd_xgbe_fdt_node), - VFIO_PLATFORM_BINDING("amd,xgbe-seattle-v1a", add_amd_xgbe_fdt_node), #endif #ifdef CONFIG_TPM TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node), diff --git a/hw/vfio/amd-xgbe.c b/hw/vfio/amd-xgbe.c deleted file mode 100644 index 58f590e385b90ac39464f96b7b896e7f845e5271..000000000000000000000000000= 0000000000000 --- a/hw/vfio/amd-xgbe.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * AMD XGBE VFIO device - * - * Copyright Linaro Limited, 2015 - * - * Authors: - * Eric Auger - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#include "qemu/osdep.h" -#include "hw/vfio/vfio-amd-xgbe.h" -#include "migration/vmstate.h" -#include "qemu/module.h" -#include "qemu/error-report.h" - -static void amd_xgbe_realize(DeviceState *dev, Error **errp) -{ - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(dev); - VFIOAmdXgbeDeviceClass *k =3D VFIO_AMD_XGBE_DEVICE_GET_CLASS(dev); - - warn_report("-device vfio-amd-xgbe is deprecated"); - vdev->compat =3D g_strdup("amd,xgbe-seattle-v1a"); - vdev->num_compat =3D 1; - - k->parent_realize(dev, errp); -} - -static const VMStateDescription vfio_platform_amd_xgbe_vmstate =3D { - .name =3D "vfio-amd-xgbe", - .unmigratable =3D 1, -}; - -static void vfio_amd_xgbe_class_init(ObjectClass *klass, const void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VFIOAmdXgbeDeviceClass *vcxc =3D - VFIO_AMD_XGBE_DEVICE_CLASS(klass); - device_class_set_parent_realize(dc, amd_xgbe_realize, - &vcxc->parent_realize); - dc->desc =3D "VFIO AMD XGBE"; - dc->vmsd =3D &vfio_platform_amd_xgbe_vmstate; -} - -static const TypeInfo vfio_amd_xgbe_dev_info =3D { - .name =3D TYPE_VFIO_AMD_XGBE, - .parent =3D TYPE_VFIO_PLATFORM, - .instance_size =3D sizeof(VFIOAmdXgbeDevice), - .class_init =3D vfio_amd_xgbe_class_init, - .class_size =3D sizeof(VFIOAmdXgbeDeviceClass), -}; - -static void register_amd_xgbe_dev_type(void) -{ - type_register_static(&vfio_amd_xgbe_dev_info); -} - -type_init(register_amd_xgbe_dev_type) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 2aa4b5d77864ff01e69650711e7d914f351e9966..64b2ec87b59b12601e28023cd8a= 5ae925f101a77 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -5,7 +5,6 @@ config ARM_VIRT depends on TCG || KVM || HVF imply PCI_DEVICES imply TEST_DEVICES - imply VFIO_AMD_XGBE imply VFIO_PLATFORM imply VFIO_XGMAC imply TPM_TIS_SYSBUS diff --git a/hw/vfio/Kconfig b/hw/vfio/Kconfig index 91d9023b79b594975c6c5f65273011b89240691c..bc984f198639627043a88ecab95= da4e927355e5a 100644 --- a/hw/vfio/Kconfig +++ b/hw/vfio/Kconfig @@ -28,11 +28,6 @@ config VFIO_XGMAC default y depends on VFIO_PLATFORM =20 -config VFIO_AMD_XGBE - bool - default y - depends on VFIO_PLATFORM - config VFIO_AP bool default y diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build index bfaf6be805483d46190232bd6805a7a042380a0d..0edcaf5155c8853d165d03e4a3a= e514f77ca5e8c 100644 --- a/hw/vfio/meson.build +++ b/hw/vfio/meson.build @@ -20,7 +20,6 @@ vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.= c')) specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss) =20 system_ss.add(when: 'CONFIG_VFIO_XGMAC', if_true: files('calxeda-xgmac.c')) -system_ss.add(when: 'CONFIG_VFIO_AMD_XGBE', if_true: files('amd-xgbe.c')) system_ss.add(when: 'CONFIG_VFIO', if_true: files( 'cpr.c', 'cpr-legacy.c', --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350680; cv=none; d=zohomail.com; s=zohoarc; b=YyjabO3oV1CG+GJCJcoiuE7XIr6TuebR9BsdvW426A5oFtSu+x7zYW5UUnLTr0BCO7EmJci4nAMBQPKNl1ASrx7UCWIauW9TaR1aFYDR3yQEY7n+ddssR66cN+qPU0k2r9L+kkffMGlzEY5n23M876XiMUB8/OQyUvFeLr+IzZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350680; 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=XbBIB7xE8mZvpKPZLSICCkcz8xJxKQZE6ianLFZkd7A=; b=Egyri0suEVHu/A2JC1LrpmHRHT7AYBmuBaojFsTuxaAeFpaN11E++9NElCG73IHOctOFjsH5aIjOkThJYRg0bj8Q+ZK868+LGYzzwFXklJxIprD++E+iKBu5w7t0Cs7YnZpNo07cm57cVpg5V9NX0bG7XHt7w3+nAXbdAnazBTU= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350680979442.5403474231981; Mon, 8 Sep 2025 09:58:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8d-0006f2-60; Mon, 08 Sep 2025 12:54: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 1uvf8V-0006cO-Pe for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8K-0001Zz-Kh for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:35 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-y-4QiaThOg-TcvGgAnPq8g-1; Mon, 08 Sep 2025 12:54:17 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6B846180063D for ; Mon, 8 Sep 2025 16:54:13 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A46513002D2D; Mon, 8 Sep 2025 16:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XbBIB7xE8mZvpKPZLSICCkcz8xJxKQZE6ianLFZkd7A=; b=bgAXrAkAJd6UGs4EIQBQUDJvcqY50tSKEaPjPAcql6ZCrvJIK54hs0Y4fLBQCl4/zGPnEr iUq9jQmQApMnyFK0Xb235RjfbKBVAjb5iCNKaFm+9npJnEXDmFJRDHnSDQpSwI+U/wvd0g j5LWef6z2gFQgjD6yLgn57e8xLu9YYA= X-MC-Unique: y-4QiaThOg-TcvGgAnPq8g-1 X-Mimecast-MFC-AGG-ID: y-4QiaThOg-TcvGgAnPq8g_1757350456 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Auger Subject: [PULL 04/31] vfio: Remove 'vfio-calxeda-xgmac' device Date: Mon, 8 Sep 2025 18:53:27 +0200 Message-ID: <20250908165354.1731444-5-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350682916124100 The VFIO_XGMAC device type has been deprecated in the QEMU 10.0 timeframe. Remove it. Reviewed-by: Eric Auger Reviewed-by: Alex Williamson Link: https://lore.kernel.org/qemu-devel/20250901064631.530723-7-clg@redhat= .com Signed-off-by: C=C3=A9dric Le Goater --- docs/about/deprecated.rst | 7 --- docs/about/removed-features.rst | 7 +++ docs/devel/kconfig.rst | 1 - include/hw/vfio/vfio-calxeda-xgmac.h | 43 ------------------ hw/arm/virt.c | 3 +- hw/core/sysbus-fdt.c | 67 ---------------------------- hw/vfio/calxeda-xgmac.c | 61 ------------------------- hw/arm/Kconfig | 1 - hw/vfio/Kconfig | 5 --- hw/vfio/meson.build | 1 - 10 files changed, 8 insertions(+), 188 deletions(-) delete mode 100644 include/hw/vfio/vfio-calxeda-xgmac.h delete mode 100644 hw/vfio/calxeda-xgmac.c diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index eb424f96d26be2c7226f9feefddd91da31984709..d0fa8e5536b583f1ec32a8aad4e= c2649d1ee8097 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -491,13 +491,6 @@ which is not enough for all types of use cases, use ``= reconnect-ms`` instead. VFIO device options ''''''''''''''''''' =20 -``-device vfio-calxeda-xgmac`` (since 10.0) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The vfio-calxeda-xgmac device allows to assign a host Calxeda Highbank -10Gb XGMAC Ethernet controller device ("calxeda,hb-xgmac" compatibility -string) to a guest. Calxeda HW has been ewasted now and there is no point -keeping that device. - ``-device vfio-platform`` (since 10.0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The vfio-platform device allows to assign a host platform device diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index eb0e5128ba1489a81dc9a45e9b20594513d98347..db3f22941c25e19ea9ce8fbba58= 4819fc961c7e2 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -1283,6 +1283,13 @@ device driver such as RBD. VFIO devices ------------ =20 +``-device vfio-calxeda-xgmac`` (since 10.2) +''''''''''''''''''''''''''''''''''''''''''' +The vfio-calxeda-xgmac device allows to assign a host Calxeda Highbank +10Gb XGMAC Ethernet controller device ("calxeda,hb-xgmac" compatibility +string) to a guest. Calxeda HW has been ewasted now and there is no point +keeping that device. + ``-device vfio-amd-xgbe`` (since 10.2) '''''''''''''''''''''''''''''''''''''' The vfio-amd-xgbe device allows to assign a host AMD 10GbE controller diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst index 9fdf5015298ea2d19b97857c212ab38dca9ab85f..1d4a114a022af99a5a652da0803= 4f2c1f3617bb0 100644 --- a/docs/devel/kconfig.rst +++ b/docs/devel/kconfig.rst @@ -59,7 +59,6 @@ stanza like the following:: config ARM_VIRT bool imply PCI_DEVICES - imply VFIO_XGMAC select A15MPCORE select ACPI select ARM_SMMUV3 diff --git a/include/hw/vfio/vfio-calxeda-xgmac.h b/include/hw/vfio/vfio-ca= lxeda-xgmac.h deleted file mode 100644 index 8482f151dd5ab8ca5f7e8f4300e67314604a68e3..000000000000000000000000000= 0000000000000 --- a/include/hw/vfio/vfio-calxeda-xgmac.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * VFIO calxeda xgmac device - * - * Copyright Linaro Limited, 2014 - * - * Authors: - * Eric Auger - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#ifndef HW_VFIO_VFIO_CALXEDA_XGMAC_H -#define HW_VFIO_VFIO_CALXEDA_XGMAC_H - -#include "hw/vfio/vfio-platform.h" -#include "qom/object.h" - -#define TYPE_VFIO_CALXEDA_XGMAC "vfio-calxeda-xgmac" - -/** - * This device exposes: - * - a single MMIO region corresponding to its register space - * - 3 IRQS (main and 2 power related IRQs) - */ -struct VFIOCalxedaXgmacDevice { - VFIOPlatformDevice vdev; -}; -typedef struct VFIOCalxedaXgmacDevice VFIOCalxedaXgmacDevice; - -struct VFIOCalxedaXgmacDeviceClass { - /*< private >*/ - VFIOPlatformDeviceClass parent_class; - /*< public >*/ - DeviceRealize parent_realize; -}; -typedef struct VFIOCalxedaXgmacDeviceClass VFIOCalxedaXgmacDeviceClass; - -DECLARE_OBJ_CHECKERS(VFIOCalxedaXgmacDevice, VFIOCalxedaXgmacDeviceClass, - VFIO_CALXEDA_XGMAC_DEVICE, TYPE_VFIO_CALXEDA_XGMAC) - -#endif diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 75fb157f6cc676127781adfb206613528f975cc6..6a887228bbb8b65cf8e38f14d83= 9fe1e80b8abce 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -38,7 +38,7 @@ #include "hw/arm/primecell.h" #include "hw/arm/virt.h" #include "hw/block/flash.h" -#include "hw/vfio/vfio-calxeda-xgmac.h" +#include "hw/vfio/vfio-platform.h" #include "hw/display/ramfb.h" #include "net/net.h" #include "system/device_tree.h" @@ -3217,7 +3217,6 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) * configuration of the particular instance. */ mc->max_cpus =3D 512; - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_CALXEDA_XGMAC); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS); diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c index d3649d5367e7294cd7a269a7b08e56d8cbd5021a..07117363a6f27ec9128d8732a87= eaed3f054ef55 100644 --- a/hw/core/sysbus-fdt.c +++ b/hw/core/sysbus-fdt.c @@ -32,9 +32,6 @@ #include "system/device_tree.h" #include "system/tpm.h" #include "hw/platform-bus.h" -#include "hw/vfio/vfio-platform.h" -#include "hw/vfio/vfio-calxeda-xgmac.h" -#include "hw/vfio/vfio-region.h" #include "hw/display/ramfb.h" #include "hw/uefi/var-service-api.h" #include "hw/arm/fdt.h" @@ -65,67 +62,6 @@ typedef struct HostProperty { bool optional; } HostProperty; =20 -#ifdef CONFIG_LINUX - -/* Device Specific Code */ - -/** - * add_calxeda_midway_xgmac_fdt_node - * - * Generates a simple node with following properties: - * compatible string, regs, interrupts, dma-coherent - */ -static int add_calxeda_midway_xgmac_fdt_node(SysBusDevice *sbdev, void *op= aque) -{ - PlatformBusFDTData *data =3D opaque; - PlatformBusDevice *pbus =3D data->pbus; - void *fdt =3D data->fdt; - const char *parent_node =3D data->pbus_node_name; - int compat_str_len, i; - char *nodename; - uint32_t *irq_attr, *reg_attr; - uint64_t mmio_base, irq_number; - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(sbdev); - VFIODevice *vbasedev =3D &vdev->vbasedev; - - mmio_base =3D platform_bus_get_mmio_addr(pbus, sbdev, 0); - nodename =3D g_strdup_printf("%s/%s@%" PRIx64, parent_node, - vbasedev->name, mmio_base); - qemu_fdt_add_subnode(fdt, nodename); - - compat_str_len =3D strlen(vdev->compat) + 1; - qemu_fdt_setprop(fdt, nodename, "compatible", - vdev->compat, compat_str_len); - - qemu_fdt_setprop(fdt, nodename, "dma-coherent", "", 0); - - reg_attr =3D g_new(uint32_t, vbasedev->num_regions * 2); - for (i =3D 0; i < vbasedev->num_regions; i++) { - mmio_base =3D platform_bus_get_mmio_addr(pbus, sbdev, i); - reg_attr[2 * i] =3D cpu_to_be32(mmio_base); - reg_attr[2 * i + 1] =3D cpu_to_be32( - memory_region_size(vdev->regions[i]->mem)); - } - qemu_fdt_setprop(fdt, nodename, "reg", reg_attr, - vbasedev->num_regions * 2 * sizeof(uint32_t)); - - irq_attr =3D g_new(uint32_t, vbasedev->num_irqs * 3); - for (i =3D 0; i < vbasedev->num_irqs; i++) { - irq_number =3D platform_bus_get_irqn(pbus, sbdev , i) - + data->irq_start; - irq_attr[3 * i] =3D cpu_to_be32(GIC_FDT_IRQ_TYPE_SPI); - irq_attr[3 * i + 1] =3D cpu_to_be32(irq_number); - irq_attr[3 * i + 2] =3D cpu_to_be32(GIC_FDT_IRQ_FLAGS_LEVEL_HI); - } - qemu_fdt_setprop(fdt, nodename, "interrupts", - irq_attr, vbasedev->num_irqs * 3 * sizeof(uint32_t)); - g_free(irq_attr); - g_free(reg_attr); - g_free(nodename); - return 0; -} -#endif /* CONFIG_LINUX */ - #ifdef CONFIG_TPM /* * add_tpm_tis_fdt_node: Create a DT node for TPM TIS @@ -196,9 +132,6 @@ static bool type_match(SysBusDevice *sbdev, const Bindi= ngEntry *entry) =20 /* list of supported dynamic sysbus bindings */ static const BindingEntry bindings[] =3D { -#ifdef CONFIG_LINUX - TYPE_BINDING(TYPE_VFIO_CALXEDA_XGMAC, add_calxeda_midway_xgmac_fdt_nod= e), -#endif #ifdef CONFIG_TPM TYPE_BINDING(TYPE_TPM_TIS_SYSBUS, add_tpm_tis_fdt_node), #endif diff --git a/hw/vfio/calxeda-xgmac.c b/hw/vfio/calxeda-xgmac.c deleted file mode 100644 index 03f2ff57630b557dfbd5bde03544f5b6395c29c4..000000000000000000000000000= 0000000000000 --- a/hw/vfio/calxeda-xgmac.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * calxeda xgmac VFIO device - * - * Copyright Linaro Limited, 2014 - * - * Authors: - * Eric Auger - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#include "qemu/osdep.h" -#include "hw/vfio/vfio-calxeda-xgmac.h" -#include "migration/vmstate.h" -#include "qemu/module.h" -#include "qemu/error-report.h" - -static void calxeda_xgmac_realize(DeviceState *dev, Error **errp) -{ - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(dev); - VFIOCalxedaXgmacDeviceClass *k =3D VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS= (dev); - - warn_report("-device vfio-calxeda-xgmac is deprecated"); - vdev->compat =3D g_strdup("calxeda,hb-xgmac"); - vdev->num_compat =3D 1; - - k->parent_realize(dev, errp); -} - -static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate =3D { - .name =3D "vfio-calxeda-xgmac", - .unmigratable =3D 1, -}; - -static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, const void *= data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - VFIOCalxedaXgmacDeviceClass *vcxc =3D - VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass); - device_class_set_parent_realize(dc, calxeda_xgmac_realize, - &vcxc->parent_realize); - dc->desc =3D "VFIO Calxeda XGMAC"; - dc->vmsd =3D &vfio_platform_calxeda_xgmac_vmstate; -} - -static const TypeInfo vfio_calxeda_xgmac_dev_info =3D { - .name =3D TYPE_VFIO_CALXEDA_XGMAC, - .parent =3D TYPE_VFIO_PLATFORM, - .instance_size =3D sizeof(VFIOCalxedaXgmacDevice), - .class_init =3D vfio_calxeda_xgmac_class_init, - .class_size =3D sizeof(VFIOCalxedaXgmacDeviceClass), -}; - -static void register_calxeda_xgmac_dev_type(void) -{ - type_register_static(&vfio_calxeda_xgmac_dev_info); -} - -type_init(register_calxeda_xgmac_dev_type) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 64b2ec87b59b12601e28023cd8a5ae925f101a77..3fca48349ade97002597c866fa6= 457a784c3219d 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -6,7 +6,6 @@ config ARM_VIRT imply PCI_DEVICES imply TEST_DEVICES imply VFIO_PLATFORM - imply VFIO_XGMAC imply TPM_TIS_SYSBUS imply TPM_TIS_I2C imply NVDIMM diff --git a/hw/vfio/Kconfig b/hw/vfio/Kconfig index bc984f198639627043a88ecab95da4e927355e5a..9a1dbe29267ea61709c3e28e4f8= c25be01c3aa33 100644 --- a/hw/vfio/Kconfig +++ b/hw/vfio/Kconfig @@ -23,11 +23,6 @@ config VFIO_PLATFORM select VFIO depends on LINUX && PLATFORM_BUS =20 -config VFIO_XGMAC - bool - default y - depends on VFIO_PLATFORM - config VFIO_AP bool default y diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build index 0edcaf5155c8853d165d03e4a3ae514f77ca5e8c..06473a078990eab9ec5ce76a6d9= 897326280dc03 100644 --- a/hw/vfio/meson.build +++ b/hw/vfio/meson.build @@ -19,7 +19,6 @@ vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.= c')) =20 specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss) =20 -system_ss.add(when: 'CONFIG_VFIO_XGMAC', if_true: files('calxeda-xgmac.c')) system_ss.add(when: 'CONFIG_VFIO', if_true: files( 'cpr.c', 'cpr-legacy.c', --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350769; cv=none; d=zohomail.com; s=zohoarc; b=PJWoy9Ecc8meGCQQXODQCGRuQFTiPS3yFwd8vr2VWbiYQH49Tf/OEvlgo88AM6LKvKNSDelcDPL0PLjP1XRZ+6cKMzwySsghig/8TL3hjPoafzgxtP86X1W13p5P6pfo96J+31gDwEka3Uu0Wmnt/bwbzYH7ic0CzENlZqKuBb0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350769; 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=SQx/oECd+eMogBWUPUCkeZ9e+yCISQHntFXEeKE/cs4=; b=jx/6anRsD49PECgSKVpRldimRMTOYNL/8BPOgrGjiFHZFP7Vyb/FMbRgNRG5eW9w+z+Smx7H3piMtbZBCUrnJjtMs4MIODj4wIk3Jz5KnpIyTix6gs1P/ASZeRqcSFuf7o3oPjAq8WyHQ8A1pjD549dyeASIvb2hRdMY33M3cs8= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350769020222.92737912526115; Mon, 8 Sep 2025 09:59:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8o-0006xd-3y; Mon, 08 Sep 2025 12:54:54 -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 1uvf8a-0006ez-QL for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8N-0001aS-OT for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:39 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-183-QqoIIouXOVm1kbYaND0duw-1; Mon, 08 Sep 2025 12:54:19 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C7201800624 for ; Mon, 8 Sep 2025 16:54:16 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D4A0C3002D30; Mon, 8 Sep 2025 16:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SQx/oECd+eMogBWUPUCkeZ9e+yCISQHntFXEeKE/cs4=; b=FoCnFt04LZaVp6fcGRFZQ2LHxLK9OWRWzELd+6QVpkgrdTPjf8Jle22fS3Y2Dh+lfZr2Ez wJ9AFPjqZaKelpXWIKmjKNZBvzM95Vz3vbirz9pvkhNyKkeZKzi0o0MbcbGWJzqond84xe vXSgUMW/+1cnp42ar5Pb+BNHNk/3fJs= X-MC-Unique: QqoIIouXOVm1kbYaND0duw-1 X-Mimecast-MFC-AGG-ID: QqoIIouXOVm1kbYaND0duw_1757350458 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Auger Subject: [PULL 05/31] vfio: Remove 'vfio-platform' Date: Mon, 8 Sep 2025 18:53:28 +0200 Message-ID: <20250908165354.1731444-6-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350776686124100 The VFIO_PLATFORM device type has been deprecated in the QEMU 10.0 timeframe. All dependent devices have been removed. Now remove the core vfio platform framework. Rename VFIO_DEVICE_TYPE_PLATFORM enum to VFIO_DEVICE_TYPE_UNUSED to maintain the same index for the CCW and AP VFIO device types. Reviewed-by: Eric Auger Reviewed-by: Alex Williamson Link: https://lore.kernel.org/qemu-devel/20250901064631.530723-8-clg@redhat= .com Signed-off-by: C=C3=A9dric Le Goater --- docs/about/deprecated.rst | 12 - docs/about/removed-features.rst | 9 + include/hw/vfio/vfio-device.h | 2 +- include/hw/vfio/vfio-platform.h | 78 ---- hw/arm/virt.c | 2 - hw/vfio/platform.c | 716 -------------------------------- hw/arm/Kconfig | 1 - hw/vfio/Kconfig | 6 - hw/vfio/meson.build | 1 - hw/vfio/trace-events | 11 - 10 files changed, 10 insertions(+), 828 deletions(-) delete mode 100644 include/hw/vfio/vfio-platform.h delete mode 100644 hw/vfio/platform.c diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index d0fa8e5536b583f1ec32a8aad4ec2649d1ee8097..2fa2c47b6807c02d9acd5fe6f6b= a452de201a354 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -488,18 +488,6 @@ Stream ``reconnect`` (since 9.2) The ``reconnect`` option only allows specifying second granularity timeout= s, which is not enough for all types of use cases, use ``reconnect-ms`` inste= ad. =20 -VFIO device options -''''''''''''''''''' - -``-device vfio-platform`` (since 10.0) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The vfio-platform device allows to assign a host platform device -to a guest in a generic manner. Integrating a new device into -the vfio-platform infrastructure requires some adaptation at -both kernel and qemu level. No such attempt has been done for years -and the conclusion is that vfio-platform has not got any traction. -PCIe passthrough shall be the mainline solution. - CPU device properties ''''''''''''''''''''' =20 diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index db3f22941c25e19ea9ce8fbba584819fc961c7e2..2d3a684e53a4e3c607e1feb5391= 55e8ccb82b72f 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -1296,6 +1296,15 @@ The vfio-amd-xgbe device allows to assign a host AMD= 10GbE controller to a guest ("amd,xgbe-seattle-v1a" compatibility string). AMD "Seattle" is not supported anymore and there is no point keeping that device. =20 +``-device vfio-platform`` (since 10.2) +'''''''''''''''''''''''''''''''''''''' +The vfio-platform device allows to assign a host platform device +to a guest in a generic manner. Integrating a new device into +the vfio-platform infrastructure requires some adaptation at +both kernel and qemu level. No such attempt has been done for years +and the conclusion is that vfio-platform has not got any traction. +PCIe passthrough shall be the mainline solution. + Tools ----- =20 diff --git a/include/hw/vfio/vfio-device.h b/include/hw/vfio/vfio-device.h index 6e4d5ccdac6eaae32fb2d3a59b9c7c85e13e156a..e7e6243e2dd7cf1be37d95414d6= a511666f5cb39 100644 --- a/include/hw/vfio/vfio-device.h +++ b/include/hw/vfio/vfio-device.h @@ -36,7 +36,7 @@ =20 enum { VFIO_DEVICE_TYPE_PCI =3D 0, - VFIO_DEVICE_TYPE_PLATFORM =3D 1, + VFIO_DEVICE_TYPE_UNUSED =3D 1, VFIO_DEVICE_TYPE_CCW =3D 2, VFIO_DEVICE_TYPE_AP =3D 3, }; diff --git a/include/hw/vfio/vfio-platform.h b/include/hw/vfio/vfio-platfor= m.h deleted file mode 100644 index 256d8500b70a2e985e975b0895e3cfca435ed8ed..000000000000000000000000000= 0000000000000 --- a/include/hw/vfio/vfio-platform.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * vfio based device assignment support - platform devices - * - * Copyright Linaro Limited, 2014 - * - * Authors: - * Kim Phillips - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - * Based on vfio based PCI device assignment support: - * Copyright Red Hat, Inc. 2012 - */ - -#ifndef HW_VFIO_VFIO_PLATFORM_H -#define HW_VFIO_VFIO_PLATFORM_H - -#include "hw/sysbus.h" -#include "hw/vfio/vfio-device.h" -#include "qemu/event_notifier.h" -#include "qemu/queue.h" -#include "qom/object.h" - -#define TYPE_VFIO_PLATFORM "vfio-platform" - -enum { - VFIO_IRQ_INACTIVE =3D 0, - VFIO_IRQ_PENDING =3D 1, - VFIO_IRQ_ACTIVE =3D 2, - /* VFIO_IRQ_ACTIVE_AND_PENDING cannot happen with VFIO */ -}; - -typedef struct VFIOINTp { - QLIST_ENTRY(VFIOINTp) next; /* entry for IRQ list */ - QSIMPLEQ_ENTRY(VFIOINTp) pqnext; /* entry for pending IRQ queue */ - EventNotifier *interrupt; /* eventfd triggered on interrupt */ - EventNotifier *unmask; /* eventfd for unmask on QEMU bypass */ - qemu_irq qemuirq; - struct VFIOPlatformDevice *vdev; /* back pointer to device */ - int state; /* inactive, pending, active */ - uint8_t pin; /* index */ - uint32_t flags; /* IRQ info flags */ - bool kvm_accel; /* set when QEMU bypass through KVM enabled */ -} VFIOINTp; - -/* function type for user side eventfd handler */ -typedef void (*eventfd_user_side_handler_t)(VFIOINTp *intp); - -typedef struct VFIORegion VFIORegion; - -struct VFIOPlatformDevice { - SysBusDevice sbdev; - VFIODevice vbasedev; /* not a QOM object */ - VFIORegion **regions; - QLIST_HEAD(, VFIOINTp) intp_list; /* list of IRQs */ - /* queue of pending IRQs */ - QSIMPLEQ_HEAD(, VFIOINTp) pending_intp_queue; - char *compat; /* DT compatible values, separated by NUL */ - unsigned int num_compat; /* number of compatible values */ - uint32_t mmap_timeout; /* delay to re-enable mmaps after interrupt */ - QEMUTimer *mmap_timer; /* allows fast-path resume after IRQ hit */ - QemuMutex intp_mutex; /* protect the intp_list IRQ state */ - bool irqfd_allowed; /* debug option to force irqfd on/off */ -}; -typedef struct VFIOPlatformDevice VFIOPlatformDevice; - -struct VFIOPlatformDeviceClass { - /*< private >*/ - SysBusDeviceClass parent_class; - /*< public >*/ -}; -typedef struct VFIOPlatformDeviceClass VFIOPlatformDeviceClass; - -DECLARE_OBJ_CHECKERS(VFIOPlatformDevice, VFIOPlatformDeviceClass, - VFIO_PLATFORM_DEVICE, TYPE_VFIO_PLATFORM) - -#endif /* HW_VFIO_VFIO_PLATFORM_H */ diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 6a887228bbb8b65cf8e38f14d839fe1e80b8abce..6f01746e746066b6b9dd70d7899= a97e3af876b85 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -38,7 +38,6 @@ #include "hw/arm/primecell.h" #include "hw/arm/virt.h" #include "hw/block/flash.h" -#include "hw/vfio/vfio-platform.h" #include "hw/display/ramfb.h" #include "net/net.h" #include "system/device_tree.h" @@ -3218,7 +3217,6 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) */ mc->max_cpus =3D 512; machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE); - machine_class_allow_dynamic_sysbus_dev(mc, TYPE_VFIO_PLATFORM); machine_class_allow_dynamic_sysbus_dev(mc, TYPE_UEFI_VARS_SYSBUS); #ifdef CONFIG_TPM machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS); diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c deleted file mode 100644 index 5c1795a26fe79b98a9886e15f365fa7a921409a4..000000000000000000000000000= 0000000000000 --- a/hw/vfio/platform.c +++ /dev/null @@ -1,716 +0,0 @@ -/* - * vfio based device assignment support - platform devices - * - * Copyright Linaro Limited, 2014 - * - * Authors: - * Kim Phillips - * Eric Auger - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - * Based on vfio based PCI device assignment support: - * Copyright Red Hat, Inc. 2012 - */ - -#include "qemu/osdep.h" -#include CONFIG_DEVICES /* CONFIG_IOMMUFD */ -#include "qapi/error.h" -#include -#include - -#include "hw/vfio/vfio-platform.h" -#include "system/iommufd.h" -#include "migration/vmstate.h" -#include "qemu/error-report.h" -#include "qemu/lockable.h" -#include "qemu/main-loop.h" -#include "qemu/module.h" -#include "qemu/range.h" -#include "system/memory.h" -#include "system/address-spaces.h" -#include "qemu/queue.h" -#include "hw/sysbus.h" -#include "trace.h" -#include "hw/irq.h" -#include "hw/platform-bus.h" -#include "hw/qdev-properties.h" -#include "system/kvm.h" -#include "hw/vfio/vfio-region.h" - -/* - * Functions used whatever the injection method - */ - -static inline bool vfio_irq_is_automasked(VFIOINTp *intp) -{ - return intp->flags & VFIO_IRQ_INFO_AUTOMASKED; -} - -/** - * vfio_init_intp - allocate, initialize the IRQ struct pointer - * and add it into the list of IRQs - * @vbasedev: the VFIO device handle - * @info: irq info struct retrieved from VFIO driver - * @errp: error object - */ -static VFIOINTp *vfio_init_intp(VFIODevice *vbasedev, - struct vfio_irq_info info, Error **errp) -{ - int ret; - VFIOPlatformDevice *vdev =3D - container_of(vbasedev, VFIOPlatformDevice, vbasedev); - SysBusDevice *sbdev =3D SYS_BUS_DEVICE(vdev); - VFIOINTp *intp; - - intp =3D g_malloc0(sizeof(*intp)); - intp->vdev =3D vdev; - intp->pin =3D info.index; - intp->flags =3D info.flags; - intp->state =3D VFIO_IRQ_INACTIVE; - intp->kvm_accel =3D false; - - sysbus_init_irq(sbdev, &intp->qemuirq); - - /* Get an eventfd for trigger */ - intp->interrupt =3D g_new0(EventNotifier, 1); - ret =3D event_notifier_init(intp->interrupt, 0); - if (ret) { - g_free(intp->interrupt); - g_free(intp); - error_setg_errno(errp, -ret, - "failed to initialize trigger eventfd notifier"); - return NULL; - } - if (vfio_irq_is_automasked(intp)) { - /* Get an eventfd for resample/unmask */ - intp->unmask =3D g_new0(EventNotifier, 1); - ret =3D event_notifier_init(intp->unmask, 0); - if (ret) { - g_free(intp->interrupt); - g_free(intp->unmask); - g_free(intp); - error_setg_errno(errp, -ret, - "failed to initialize resample eventfd notifi= er"); - return NULL; - } - } - - QLIST_INSERT_HEAD(&vdev->intp_list, intp, next); - return intp; -} - -/** - * vfio_set_trigger_eventfd - set VFIO eventfd handling - * - * @intp: IRQ struct handle - * @handler: handler to be called on eventfd signaling - * - * Setup VFIO signaling and attach an optional user-side handler - * to the eventfd - */ -static int vfio_set_trigger_eventfd(VFIOINTp *intp, - eventfd_user_side_handler_t handler) -{ - VFIODevice *vbasedev =3D &intp->vdev->vbasedev; - int32_t fd =3D event_notifier_get_fd(intp->interrupt); - Error *err =3D NULL; - - qemu_set_fd_handler(fd, (IOHandler *)handler, NULL, intp); - - if (!vfio_device_irq_set_signaling(vbasedev, intp->pin, 0, - VFIO_IRQ_SET_ACTION_TRIGGER, fd, &e= rr)) { - error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name); - qemu_set_fd_handler(fd, NULL, NULL, NULL); - return -EINVAL; - } - - return 0; -} - -/* - * Functions only used when eventfds are handled on user-side - * ie. without irqfd - */ - -/** - * vfio_mmap_set_enabled - enable/disable the fast path mode - * @vdev: the VFIO platform device - * @enabled: the target mmap state - * - * enabled =3D true ~ fast path =3D MMIO region is mmaped (no KVM TRAP); - * enabled =3D false ~ slow path =3D MMIO region is trapped and region cal= lbacks - * are called; slow path enables to trap the device IRQ status register re= set -*/ - -static void vfio_mmap_set_enabled(VFIOPlatformDevice *vdev, bool enabled) -{ - int i; - - for (i =3D 0; i < vdev->vbasedev.num_regions; i++) { - vfio_region_mmaps_set_enabled(vdev->regions[i], enabled); - } -} - -/** - * vfio_intp_mmap_enable - timer function, restores the fast path - * if there is no more active IRQ - * @opaque: actually points to the VFIO platform device - * - * Called on mmap timer timeout, this function checks whether the - * IRQ is still active and if not, restores the fast path. - * by construction a single eventfd is handled at a time. - * if the IRQ is still active, the timer is re-programmed. - */ -static void vfio_intp_mmap_enable(void *opaque) -{ - VFIOINTp *tmp; - VFIOPlatformDevice *vdev =3D (VFIOPlatformDevice *)opaque; - - QEMU_LOCK_GUARD(&vdev->intp_mutex); - QLIST_FOREACH(tmp, &vdev->intp_list, next) { - if (tmp->state =3D=3D VFIO_IRQ_ACTIVE) { - trace_vfio_platform_intp_mmap_enable(tmp->pin); - /* re-program the timer to check active status later */ - timer_mod(vdev->mmap_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + - vdev->mmap_timeout); - return; - } - } - vfio_mmap_set_enabled(vdev, true); -} - -/** - * vfio_intp_inject_pending_lockheld - Injects a pending IRQ - * @opaque: opaque pointer, in practice the VFIOINTp handle - * - * The function is called on a previous IRQ completion, from - * vfio_platform_eoi, while the intp_mutex is locked. - * Also in such situation, the slow path already is set and - * the mmap timer was already programmed. - */ -static void vfio_intp_inject_pending_lockheld(VFIOINTp *intp) -{ - trace_vfio_platform_intp_inject_pending_lockheld(intp->pin, - event_notifier_get_fd(intp->interrupt)); - - intp->state =3D VFIO_IRQ_ACTIVE; - - /* trigger the virtual IRQ */ - qemu_set_irq(intp->qemuirq, 1); -} - -/** - * vfio_intp_interrupt - The user-side eventfd handler - * @opaque: opaque pointer which in practice is the VFIOINTp handle - * - * the function is entered in event handler context: - * the vIRQ is injected into the guest if there is no other active - * or pending IRQ. - */ -static void vfio_intp_interrupt(VFIOINTp *intp) -{ - int ret; - VFIOINTp *tmp; - VFIOPlatformDevice *vdev =3D intp->vdev; - bool delay_handling =3D false; - - QEMU_LOCK_GUARD(&vdev->intp_mutex); - if (intp->state =3D=3D VFIO_IRQ_INACTIVE) { - QLIST_FOREACH(tmp, &vdev->intp_list, next) { - if (tmp->state =3D=3D VFIO_IRQ_ACTIVE || - tmp->state =3D=3D VFIO_IRQ_PENDING) { - delay_handling =3D true; - break; - } - } - } - if (delay_handling) { - /* - * the new IRQ gets a pending status and is pushed in - * the pending queue - */ - intp->state =3D VFIO_IRQ_PENDING; - trace_vfio_intp_interrupt_set_pending(intp->pin); - QSIMPLEQ_INSERT_TAIL(&vdev->pending_intp_queue, - intp, pqnext); - event_notifier_test_and_clear(intp->interrupt); - return; - } - - trace_vfio_platform_intp_interrupt(intp->pin, - event_notifier_get_fd(intp->interrupt)); - - ret =3D event_notifier_test_and_clear(intp->interrupt); - if (!ret) { - error_report("Error when clearing fd=3D%d (ret =3D %d)", - event_notifier_get_fd(intp->interrupt), ret); - } - - intp->state =3D VFIO_IRQ_ACTIVE; - - /* sets slow path */ - vfio_mmap_set_enabled(vdev, false); - - /* trigger the virtual IRQ */ - qemu_set_irq(intp->qemuirq, 1); - - /* - * Schedule the mmap timer which will restore fastpath when no IRQ - * is active anymore - */ - if (vdev->mmap_timeout) { - timer_mod(vdev->mmap_timer, - qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + - vdev->mmap_timeout); - } -} - -/** - * vfio_platform_eoi - IRQ completion routine - * @vbasedev: the VFIO device handle - * - * De-asserts the active virtual IRQ and unmasks the physical IRQ - * (effective for level sensitive IRQ auto-masked by the VFIO driver). - * Then it handles next pending IRQ if any. - * eoi function is called on the first access to any MMIO region - * after an IRQ was triggered, trapped since slow path was set. - * It is assumed this access corresponds to the IRQ status - * register reset. With such a mechanism, a single IRQ can be - * handled at a time since there is no way to know which IRQ - * was completed by the guest (we would need additional details - * about the IRQ status register mask). - */ -static void vfio_platform_eoi(VFIODevice *vbasedev) -{ - VFIOINTp *intp; - VFIOPlatformDevice *vdev =3D - container_of(vbasedev, VFIOPlatformDevice, vbasedev); - - QEMU_LOCK_GUARD(&vdev->intp_mutex); - QLIST_FOREACH(intp, &vdev->intp_list, next) { - if (intp->state =3D=3D VFIO_IRQ_ACTIVE) { - trace_vfio_platform_eoi(intp->pin, - event_notifier_get_fd(intp->interrupt)); - intp->state =3D VFIO_IRQ_INACTIVE; - - /* deassert the virtual IRQ */ - qemu_set_irq(intp->qemuirq, 0); - - if (vfio_irq_is_automasked(intp)) { - /* unmasks the physical level-sensitive IRQ */ - vfio_device_irq_unmask(vbasedev, intp->pin); - } - - /* a single IRQ can be active at a time */ - break; - } - } - /* in case there are pending IRQs, handle the first one */ - if (!QSIMPLEQ_EMPTY(&vdev->pending_intp_queue)) { - intp =3D QSIMPLEQ_FIRST(&vdev->pending_intp_queue); - vfio_intp_inject_pending_lockheld(intp); - QSIMPLEQ_REMOVE_HEAD(&vdev->pending_intp_queue, pqnext); - } -} - -/** - * vfio_start_eventfd_injection - starts the virtual IRQ injection using - * user-side handled eventfds - * @sbdev: the sysbus device handle - * @irq: the qemu irq handle - */ - -static void vfio_start_eventfd_injection(SysBusDevice *sbdev, qemu_irq irq) -{ - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(sbdev); - VFIOINTp *intp; - - QLIST_FOREACH(intp, &vdev->intp_list, next) { - if (intp->qemuirq =3D=3D irq) { - break; - } - } - assert(intp); - - if (vfio_set_trigger_eventfd(intp, vfio_intp_interrupt)) { - abort(); - } -} - -/* - * Functions used for irqfd - */ - -/** - * vfio_set_resample_eventfd - sets the resamplefd for an IRQ - * @intp: the IRQ struct handle - * programs the VFIO driver to unmask this IRQ when the - * intp->unmask eventfd is triggered - */ -static int vfio_set_resample_eventfd(VFIOINTp *intp) -{ - int32_t fd =3D event_notifier_get_fd(intp->unmask); - VFIODevice *vbasedev =3D &intp->vdev->vbasedev; - Error *err =3D NULL; - - qemu_set_fd_handler(fd, NULL, NULL, NULL); - if (!vfio_device_irq_set_signaling(vbasedev, intp->pin, 0, - VFIO_IRQ_SET_ACTION_UNMASK, fd, &er= r)) { - error_reportf_err(err, VFIO_MSG_PREFIX, vbasedev->name); - return -EINVAL; - } - return 0; -} - -/** - * vfio_start_irqfd_injection - starts the virtual IRQ injection using - * irqfd - * - * @sbdev: the sysbus device handle - * @irq: the qemu irq handle - * - * In case the irqfd setup fails, we fallback to userspace handled eventfd - */ -static void vfio_start_irqfd_injection(SysBusDevice *sbdev, qemu_irq irq) -{ - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(sbdev); - VFIOINTp *intp; - - if (!kvm_irqfds_enabled() || !kvm_resamplefds_enabled() || - !vdev->irqfd_allowed) { - goto fail_irqfd; - } - - QLIST_FOREACH(intp, &vdev->intp_list, next) { - if (intp->qemuirq =3D=3D irq) { - break; - } - } - assert(intp); - - if (kvm_irqchip_add_irqfd_notifier(kvm_state, intp->interrupt, - intp->unmask, irq) < 0) { - goto fail_irqfd; - } - - if (vfio_set_trigger_eventfd(intp, NULL) < 0) { - goto fail_vfio; - } - if (vfio_irq_is_automasked(intp)) { - if (vfio_set_resample_eventfd(intp) < 0) { - goto fail_vfio; - } - trace_vfio_platform_start_level_irqfd_injection(intp->pin, - event_notifier_get_fd(intp->interrupt), - event_notifier_get_fd(intp->unmask)); - } else { - trace_vfio_platform_start_edge_irqfd_injection(intp->pin, - event_notifier_get_fd(intp->interrupt)= ); - } - - intp->kvm_accel =3D true; - - return; -fail_vfio: - kvm_irqchip_remove_irqfd_notifier(kvm_state, intp->interrupt, irq); - abort(); -fail_irqfd: - vfio_start_eventfd_injection(sbdev, irq); -} - -/* VFIO skeleton */ - -static void vfio_platform_compute_needs_reset(VFIODevice *vbasedev) -{ - vbasedev->needs_reset =3D true; -} - -/* not implemented yet */ -static int vfio_platform_hot_reset_multi(VFIODevice *vbasedev) -{ - return -1; -} - -/** - * vfio_populate_device - Allocate and populate MMIO region - * and IRQ structs according to driver returned information - * @vbasedev: the VFIO device handle - * @errp: error object - * - */ -static bool vfio_populate_device(VFIODevice *vbasedev, Error **errp) -{ - VFIOINTp *intp, *tmp; - int i, ret =3D -1; - VFIOPlatformDevice *vdev =3D - container_of(vbasedev, VFIOPlatformDevice, vbasedev); - - if (!(vbasedev->flags & VFIO_DEVICE_FLAGS_PLATFORM)) { - error_setg(errp, "this isn't a platform device"); - return false; - } - - vdev->regions =3D g_new0(VFIORegion *, vbasedev->num_regions); - - for (i =3D 0; i < vbasedev->num_regions; i++) { - char *name =3D g_strdup_printf("VFIO %s region %d\n", vbasedev->na= me, i); - - vdev->regions[i] =3D g_new0(VFIORegion, 1); - ret =3D vfio_region_setup(OBJECT(vdev), vbasedev, - vdev->regions[i], i, name); - g_free(name); - if (ret) { - error_setg_errno(errp, -ret, "failed to get region %d info", i= ); - goto reg_error; - } - } - - vdev->mmap_timer =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, - vfio_intp_mmap_enable, vdev); - - QSIMPLEQ_INIT(&vdev->pending_intp_queue); - - for (i =3D 0; i < vbasedev->num_irqs; i++) { - struct vfio_irq_info irq; - - ret =3D vfio_device_get_irq_info(vbasedev, i, &irq); - - if (ret) { - error_setg_errno(errp, -ret, "failed to get device irq info"); - goto irq_err; - } else { - trace_vfio_platform_populate_interrupts(irq.index, - irq.count, - irq.flags); - intp =3D vfio_init_intp(vbasedev, irq, errp); - if (!intp) { - goto irq_err; - } - } - } - return true; -irq_err: - timer_del(vdev->mmap_timer); - QLIST_FOREACH_SAFE(intp, &vdev->intp_list, next, tmp) { - QLIST_REMOVE(intp, next); - g_free(intp); - } -reg_error: - for (i =3D 0; i < vbasedev->num_regions; i++) { - if (vdev->regions[i]) { - vfio_region_finalize(vdev->regions[i]); - } - g_free(vdev->regions[i]); - } - g_free(vdev->regions); - return false; -} - -/* specialized functions for VFIO Platform devices */ -static VFIODeviceOps vfio_platform_ops =3D { - .vfio_compute_needs_reset =3D vfio_platform_compute_needs_reset, - .vfio_hot_reset_multi =3D vfio_platform_hot_reset_multi, - .vfio_eoi =3D vfio_platform_eoi, -}; - -/** - * vfio_base_device_init - perform preliminary VFIO setup - * @vbasedev: the VFIO device handle - * @errp: error object - * - * Implement the VFIO command sequence that allows to discover - * assigned device resources: group extraction, device - * fd retrieval, resource query. - * Precondition: the device name must be initialized - */ -static bool vfio_base_device_init(VFIODevice *vbasedev, Error **errp) -{ - /* @fd takes precedence over @sysfsdev which takes precedence over @ho= st */ - if (vbasedev->fd < 0 && vbasedev->sysfsdev) { - vfio_device_free_name(vbasedev); - vbasedev->name =3D g_path_get_basename(vbasedev->sysfsdev); - } else if (vbasedev->fd < 0) { - if (!vbasedev->name || strchr(vbasedev->name, '/')) { - error_setg(errp, "wrong host device name"); - return false; - } - - vbasedev->sysfsdev =3D g_strdup_printf("/sys/bus/platform/devices/= %s", - vbasedev->name); - } - - if (!vfio_device_get_name(vbasedev, errp)) { - return false; - } - - if (!vfio_device_attach(vbasedev->name, vbasedev, - &address_space_memory, errp)) { - return false; - } - - if (vfio_populate_device(vbasedev, errp)) { - return true; - } - - vfio_device_detach(vbasedev); - return false; -} - -/** - * vfio_platform_realize - the device realize function - * @dev: device state pointer - * @errp: error - * - * initialize the device, its memory regions and IRQ structures - * IRQ are started separately - */ -static void vfio_platform_realize(DeviceState *dev, Error **errp) -{ - ERRP_GUARD(); - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(dev); - SysBusDevice *sbdev =3D SYS_BUS_DEVICE(dev); - VFIODevice *vbasedev =3D &vdev->vbasedev; - int i; - - warn_report("-device vfio-platform is deprecated"); - qemu_mutex_init(&vdev->intp_mutex); - - trace_vfio_platform_realize(vbasedev->sysfsdev ? - vbasedev->sysfsdev : vbasedev->name, - vdev->compat); - - if (!vfio_base_device_init(vbasedev, errp)) { - goto init_err; - } - - if (!vdev->compat) { - GError *gerr =3D NULL; - gchar *contents; - gsize length; - char *path; - - path =3D g_strdup_printf("%s/of_node/compatible", vbasedev->sysfsd= ev); - if (!g_file_get_contents(path, &contents, &length, &gerr)) { - error_setg(errp, "%s", gerr->message); - g_error_free(gerr); - g_free(path); - return; - } - g_free(path); - vdev->compat =3D contents; - for (vdev->num_compat =3D 0; length; vdev->num_compat++) { - size_t skip =3D strlen(contents) + 1; - contents +=3D skip; - length -=3D skip; - } - } - - for (i =3D 0; i < vbasedev->num_regions; i++) { - if (vfio_region_mmap(vdev->regions[i])) { - warn_report("%s mmap unsupported, performance may be slow", - memory_region_name(vdev->regions[i]->mem)); - } - sysbus_init_mmio(sbdev, vdev->regions[i]->mem); - } - return; - -init_err: - if (vdev->vbasedev.name) { - error_prepend(errp, VFIO_MSG_PREFIX, vdev->vbasedev.name); - } else { - error_prepend(errp, "vfio error: "); - } -} - -static const VMStateDescription vfio_platform_vmstate =3D { - .name =3D "vfio-platform", - .unmigratable =3D 1, -}; - -static const Property vfio_platform_dev_properties[] =3D { - DEFINE_PROP_STRING("host", VFIOPlatformDevice, vbasedev.name), - DEFINE_PROP_STRING("sysfsdev", VFIOPlatformDevice, vbasedev.sysfsdev), - DEFINE_PROP_BOOL("x-no-mmap", VFIOPlatformDevice, vbasedev.no_mmap, fa= lse), - DEFINE_PROP_UINT32("mmap-timeout-ms", VFIOPlatformDevice, - mmap_timeout, 1100), - DEFINE_PROP_BOOL("x-irqfd", VFIOPlatformDevice, irqfd_allowed, true), -#ifdef CONFIG_IOMMUFD - DEFINE_PROP_LINK("iommufd", VFIOPlatformDevice, vbasedev.iommufd, - TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), -#endif -}; - -static void vfio_platform_instance_init(Object *obj) -{ - VFIOPlatformDevice *vdev =3D VFIO_PLATFORM_DEVICE(obj); - VFIODevice *vbasedev =3D &vdev->vbasedev; - - vfio_device_init(vbasedev, VFIO_DEVICE_TYPE_PLATFORM, &vfio_platform_o= ps, - DEVICE(vdev), false); -} - -#ifdef CONFIG_IOMMUFD -static void vfio_platform_set_fd(Object *obj, const char *str, Error **err= p) -{ - vfio_device_set_fd(&VFIO_PLATFORM_DEVICE(obj)->vbasedev, str, errp); -} -#endif - -static void vfio_platform_class_init(ObjectClass *klass, const void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - SysBusDeviceClass *sbc =3D SYS_BUS_DEVICE_CLASS(klass); - - dc->realize =3D vfio_platform_realize; - device_class_set_props(dc, vfio_platform_dev_properties); -#ifdef CONFIG_IOMMUFD - object_class_property_add_str(klass, "fd", NULL, vfio_platform_set_fd); -#endif - dc->vmsd =3D &vfio_platform_vmstate; - dc->desc =3D "VFIO-based platform device assignment"; - sbc->connect_irq_notifier =3D vfio_start_irqfd_injection; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - - object_class_property_set_description(klass, /* 2.4 */ - "host", - "Host device name of assigned de= vice"); - object_class_property_set_description(klass, /* 2.4 and 2.5 */ - "x-no-mmap", - "Disable MMAP for device. Allows= to trace MMIO " - "accesses (DEBUG)"); - object_class_property_set_description(klass, /* 2.4 */ - "mmap-timeout-ms", - "When EOI is not provided by KVM= /QEMU, wait time " - "(milliseconds) to re-enable dev= ice direct access " - "after level interrupt (DEBUG)"); - object_class_property_set_description(klass, /* 2.4 */ - "x-irqfd", - "Allow disabling irqfd support (= DEBUG)"); - object_class_property_set_description(klass, /* 2.6 */ - "sysfsdev", - "Host sysfs path of assigned dev= ice"); -#ifdef CONFIG_IOMMUFD - object_class_property_set_description(klass, /* 9.0 */ - "iommufd", - "Set host IOMMUFD backend device= "); -#endif -} - -static const TypeInfo vfio_platform_dev_info =3D { - .name =3D TYPE_VFIO_PLATFORM, - .parent =3D TYPE_DYNAMIC_SYS_BUS_DEVICE, - .instance_size =3D sizeof(VFIOPlatformDevice), - .instance_init =3D vfio_platform_instance_init, - .class_init =3D vfio_platform_class_init, - .class_size =3D sizeof(VFIOPlatformDeviceClass), -}; - -static void register_vfio_platform_dev_type(void) -{ - type_register_static(&vfio_platform_dev_info); -} - -type_init(register_vfio_platform_dev_type) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 3fca48349ade97002597c866fa6457a784c3219d..3baa6c6c74778683de25ea1349e= ccace1275cedd 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -5,7 +5,6 @@ config ARM_VIRT depends on TCG || KVM || HVF imply PCI_DEVICES imply TEST_DEVICES - imply VFIO_PLATFORM imply TPM_TIS_SYSBUS imply TPM_TIS_I2C imply NVDIMM diff --git a/hw/vfio/Kconfig b/hw/vfio/Kconfig index 9a1dbe29267ea61709c3e28e4f8c25be01c3aa33..27de24e4db1f080d94be8d666e5= 6812e1e904f1a 100644 --- a/hw/vfio/Kconfig +++ b/hw/vfio/Kconfig @@ -17,12 +17,6 @@ config VFIO_CCW select VFIO depends on LINUX && S390_CCW_VIRTIO =20 -config VFIO_PLATFORM - bool - default y - select VFIO - depends on LINUX && PLATFORM_BUS - config VFIO_AP bool default y diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build index 06473a078990eab9ec5ce76a6d9897326280dc03..d3ed3cb7ac19931f95f60057c3d= 9d290bc48c07c 100644 --- a/hw/vfio/meson.build +++ b/hw/vfio/meson.build @@ -13,7 +13,6 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files( 'pci.c', )) vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c')) -vfio_ss.add(when: 'CONFIG_VFIO_PLATFORM', if_true: files('platform.c')) vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c')) vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c')) =20 diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index fc6ed230d0c89d4b94e5878043bc23d94dcfe737..e3d571f8c845dad85de5738f8ca= 768bdfc336252 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -127,17 +127,6 @@ vfio_region_unmap(const char *name, unsigned long offs= et, unsigned long end) "Re vfio_region_sparse_mmap_header(const char *name, int index, int nr_areas) = "Device %s region %d: %d sparse mmap entries" vfio_region_sparse_mmap_entry(int i, unsigned long start, unsigned long en= d) "sparse entry %d [0x%lx - 0x%lx]" =20 -# platform.c -vfio_platform_realize(char *name, char *compat) "vfio device %s, compat = =3D %s" -vfio_platform_eoi(int pin, int fd) "EOI IRQ pin %d (fd=3D%d)" -vfio_platform_intp_mmap_enable(int pin) "IRQ #%d still active, stay in slo= w path" -vfio_platform_intp_interrupt(int pin, int fd) "Inject IRQ #%d (fd =3D %d)" -vfio_platform_intp_inject_pending_lockheld(int pin, int fd) "Inject pendin= g IRQ #%d (fd =3D %d)" -vfio_platform_populate_interrupts(int pin, int count, int flags) "- IRQ in= dex %d: count %d, flags=3D0x%x" -vfio_intp_interrupt_set_pending(int index) "irq %d is set PENDING" -vfio_platform_start_level_irqfd_injection(int index, int fd, int resamplef= d) "IRQ index=3D%d, fd =3D %d, resamplefd =3D %d" -vfio_platform_start_edge_irqfd_injection(int index, int fd) "IRQ index=3D%= d, fd =3D %d" - # spapr.c vfio_prereg_listener_region_add_skip(uint64_t start, uint64_t end) "0x%"PR= Ix64" - 0x%"PRIx64 vfio_prereg_listener_region_del_skip(uint64_t start, uint64_t end) "0x%"PR= Ix64" - 0x%"PRIx64 --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350876; cv=none; d=zohomail.com; s=zohoarc; b=ejfb2pwOiuX//HWtKht7jqJVMY5XlIlH7PIvKXJ0trf48Mj0J8ucwocR6QQXzI5RjKpGekB2vtvv2kekmUhssXa+nqNSPBuYls+XvQABddtVtjNjITJXkVptC+eNjRUR0PQDYxrRO/atv2uQJUWQYfT5MKERBYz+7wzgXwRYih8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350876; 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=LvIioNBdTNRhhD6SkTX0rdLzGmfP7U4ncZ62iuf8SNw=; b=MgbdHupbmBkN9B6rZz5fgOJ6Xaxt2btHZkH1bnP7FR3ooS/TA++I9MAeb1UioycfrRu5bEv7L5vSJj5+Nx9juz/zD5/7iYAorXoRPATnoELPoChwB/rkEQDp6qAuPDDr8ngF262LGWyIDG8X0qBNAp5wGZBKx5TjCMCiuJLkavI= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350876564295.4939794313076; Mon, 8 Sep 2025 10:01:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8j-0006kp-Bj; Mon, 08 Sep 2025 12:54:49 -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 1uvf8W-0006cy-HS for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8M-0001aH-PT for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:34 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-562-9_U9Ncf7OJW5RtRq2wg2eA-1; Mon, 08 Sep 2025 12:54:19 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ABFA219560B5 for ; Mon, 8 Sep 2025 16:54:18 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8B2D03000198; Mon, 8 Sep 2025 16:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LvIioNBdTNRhhD6SkTX0rdLzGmfP7U4ncZ62iuf8SNw=; b=R0KyaKGimOrEJI0x94iITfHlCaa7+quS5FMSA51t/dc1QQEaAEWLf0Leo36maJxSiPoto3 5C/k2CJWyuKabc4BZv1Xk8AmPu0bLhG5MyWaN1xIJUL9buA1wOnWzuLRQ4VCf0pifAKwGJ ZGvMuGYAoLJ6iIKz9AaMHOANPdGzPzM= X-MC-Unique: 9_U9Ncf7OJW5RtRq2wg2eA-1 X-Mimecast-MFC-AGG-ID: 9_U9Ncf7OJW5RtRq2wg2eA_1757350458 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Eric Auger Subject: [PULL 06/31] vfio: Move vfio-region.h under hw/vfio/ Date: Mon, 8 Sep 2025 18:53:29 +0200 Message-ID: <20250908165354.1731444-7-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=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 @redhat.com) X-ZM-MESSAGEID: 1757350879510124100 Since the removal of vfio-platform, header file vfio-region.h no longer needs to be a public VFIO interface. Move it under hw/vfio. Reviewed-by: Eric Auger Reviewed-by: Alex Williamson Link: https://lore.kernel.org/qemu-devel/20250901064631.530723-9-clg@redhat= .com Signed-off-by: C=C3=A9dric Le Goater --- {include/hw =3D> hw}/vfio/vfio-region.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {include/hw =3D> hw}/vfio/vfio-region.h (100%) diff --git a/include/hw/vfio/vfio-region.h b/hw/vfio/vfio-region.h similarity index 100% rename from include/hw/vfio/vfio-region.h rename to hw/vfio/vfio-region.h --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350681; cv=none; d=zohomail.com; s=zohoarc; b=bshRl3aJ10HeuW/8qMqAkrLS3rwtq6nnMx5P3l9faqE3XJ38xBv1bE+w0RP7XHBdDzx4K4ULc8vGreb4gPbQZI1yVmPkzr47UKKnw+VGxSL8yeikurGen7B4tRfD+LFcc+/MUUhKL6Dl8BHZVLAYYUtqP9CaYZtC95P+nNBEFv8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350681; 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=hixaJXCQu+5fLz7dX08ljEjkycAfNaEeAyVcstlHakE=; b=Yqe2yWvUIX02xite43Xy9idIRY3L3xMvnUTACihF9E4iqDgqeqx+WWxJlPdKrl89aTeiX7fBDSuVNsHMxl/fzaJlNybDn1t6t2QYL5EsxwjU27K1PHKasosN6hlyVjw5bYiSUFG4NfL+TI4IPPVANWCOnu1YPXQD7BpkDcC06yY= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350681685670.16160792715; Mon, 8 Sep 2025 09:58:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8y-00079V-NQ; Mon, 08 Sep 2025 12:55:06 -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 1uvf8Y-0006eM-4M for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8N-0001aX-NZ for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:37 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-602-E1v1SCR6P7C1dFhBWHteyg-1; Mon, 08 Sep 2025 12:54:22 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4F5D419541B0; Mon, 8 Sep 2025 16:54:21 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 35C653000198; Mon, 8 Sep 2025 16:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hixaJXCQu+5fLz7dX08ljEjkycAfNaEeAyVcstlHakE=; b=D7oWDEfKJZeK6Rxa7lxE0kVvDf/HSU3O7ik/YprVWp3g75dBlMN/Vbe+g+ez/EadFMqk4y wmOswmg1GdasDTOu9ZatzFYkczT0rNJH+DVnZwyJpkV3NHLb7Vf51JPrmW/LFPKcw8xyhG lYdrvjCO/l370Ws99HVJJmDrRt0mByU= X-MC-Unique: E1v1SCR6P7C1dFhBWHteyg-1 X-Mimecast-MFC-AGG-ID: E1v1SCR6P7C1dFhBWHteyg_1757350461 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Steve Sistare , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Zhenzhong Duan Subject: [PULL 07/31] vfio/container: set error on cpr failure Date: Mon, 8 Sep 2025 18:53:30 +0200 Message-ID: <20250908165354.1731444-8-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350682425116600 From: Steve Sistare Set an error message if vfio_cpr_ram_discard_register_listener fails so the fail label gets a valid error object. Reported-by: C=C3=A9dric Le Goater Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure") Signed-off-by: Steve Sistare Reviewed-by: Zhenzhong Duan Link: https://lore.kernel.org/qemu-devel/1755094667-281419-1-git-send-email= -steven.sistare@oracle.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/listener.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c index f498e23a93747cb1826726f7c4ca28f8128b4ced..5ebafaa07ea15070dfbe299d3f2= c0f265959fb7d 100644 --- a/hw/vfio/listener.c +++ b/hw/vfio/listener.c @@ -574,6 +574,9 @@ void vfio_container_region_add(VFIOContainerBase *bcont= ainer, vfio_ram_discard_register_listener(bcontainer, section); } else if (!vfio_cpr_ram_discard_register_listener(bcontainer, section)) { + error_setg(&err, + "vfio_cpr_ram_discard_register_listener for %s fail= ed", + memory_region_name(section->mr)); goto fail; } return; --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350637; cv=none; d=zohomail.com; s=zohoarc; b=ZlTC+cx3gQkuuVuSx8xxwOuhuUkfX7RmgZBYvqgYffMSX0RYxlRYl57oVcSQW25W/wlZUnE1gw3KsY7pNbxOdSmfgPEOfUKuLJkRAZcorBeMXPixDa5r3+SUbUFodecKDGcoU2RxzG1zd1pRqLA5uhYMSf98L80At/7U2taaYzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350637; 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=Yy0UHB5UY3SkW0YZ23dbCFp+M/mYAit6r4Hadl6Hdj8=; b=S69p2yUnD38NJxBYvKT55EFVlfQpNM3OdqrVfmaeOxhj1CG9gOnbQHWuKfyiJ8+4bgeBZLtKqor8OfZT3p6dshzeGsQjD0MZ1Z4s0fMO48FXrRGhQQNQRZ+g020UmHU/mdU+rt/pgpouMkV9sqRc11aVUzfy4xiA1IH1/TCneac= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350637573805.7509900464352; Mon, 8 Sep 2025 09:57:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8m-0006qp-AT; Mon, 08 Sep 2025 12:54:52 -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 1uvf8Y-0006e9-2A for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8N-0001ag-Q7 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:37 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-367-z690hmoZPVWCDC8iA0nOFQ-1; Mon, 08 Sep 2025 12:54:24 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6D9BD1800365; Mon, 8 Sep 2025 16:54:23 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CBC99300018D; Mon, 8 Sep 2025 16:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yy0UHB5UY3SkW0YZ23dbCFp+M/mYAit6r4Hadl6Hdj8=; b=KtWwaAmPqhwUzm5YWH/lL3fJrBjRvdEObq2GXyeSXupvrJNHd1+t1sNCOh3te1ptZW1reY hUwsGp39zEYnPIByairwAFguw/cBHaMVt8kZpPAff9KkBKgVSvEeBwmMFCnqvDC6Iyb/rz +STWuMMzzHkuL/I4ZV0h2zDyhkmhCzU= X-MC-Unique: z690hmoZPVWCDC8iA0nOFQ-1 X-Mimecast-MFC-AGG-ID: z690hmoZPVWCDC8iA0nOFQ_1757350463 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Yi Liu Subject: [PULL 08/31] vfio: Report an error when the 'dma_max_mappings' limit is reached Date: Mon, 8 Sep 2025 18:53:31 +0200 Message-ID: <20250908165354.1731444-9-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350640273124101 The VFIO IOMMU Type1 kernel driver enforces a default IOMMU mapping limit of 65535, which is configurable via the 'dma_max_mappings' module parameter. When this limit is reached, QEMU issues a warning and fails the mapping operation, but allows the VM to continue running, potentially causing issues later. This scenario occurs with SEV-SNP guests, which must update all IOMMU mappings during initialization. To address this, update vfio_ram_discard_register_listener() to accept an 'Error **' parameter and propagate the error to the caller. This change will halt the VM immediately, at init time, with the same error message. Additionally, the same behavior will be enforced at runtime. While this might be considered too brutal, the rarity of this case and the planned removal of the dma_max_mappings module parameter make it a reasonable approach. Cc: Alex Williamson Reviewed-by: Yi Liu Reviewed-by: Alex Williamson Link: https://lore.kernel.org/qemu-devel/20250814153419.1643897-1-clg@redha= t.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/listener.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c index 5ebafaa07ea15070dfbe299d3f2c0f265959fb7d..c244be5e218ae60e2b9c8a29d2d= 4b9dad86fc77a 100644 --- a/hw/vfio/listener.c +++ b/hw/vfio/listener.c @@ -250,8 +250,9 @@ static int vfio_ram_discard_notify_populate(RamDiscardL= istener *rdl, return 0; } =20 -static void vfio_ram_discard_register_listener(VFIOContainerBase *bcontain= er, - MemoryRegionSection *sectio= n) +static bool vfio_ram_discard_register_listener(VFIOContainerBase *bcontain= er, + MemoryRegionSection *sectio= n, + Error **errp) { RamDiscardManager *rdm =3D memory_region_get_ram_discard_manager(secti= on->mr); int target_page_size =3D qemu_target_page_size(); @@ -316,13 +317,15 @@ static void vfio_ram_discard_register_listener(VFIOCo= ntainerBase *bcontainer, =20 if (vrdl_mappings + max_memslots - vrdl_count > bcontainer->dma_max_mappings) { - warn_report("%s: possibly running out of DMA mappings. E.g., t= ry" + error_setg(errp, "%s: possibly running out of DMA mappings. E.= g., try" " increasing the 'block-size' of virtio-mem devies= ." " Maximum possible DMA mappings: %d, Maximum possi= ble" " memslots: %d", __func__, bcontainer->dma_max_map= pings, max_memslots); + return false; } } + return true; } =20 static void vfio_ram_discard_unregister_listener(VFIOContainerBase *bconta= iner, @@ -571,7 +574,9 @@ void vfio_container_region_add(VFIOContainerBase *bcont= ainer, */ if (memory_region_has_ram_discard_manager(section->mr)) { if (!cpr_remap) { - vfio_ram_discard_register_listener(bcontainer, section); + if (!vfio_ram_discard_register_listener(bcontainer, section, &= err)) { + goto fail; + } } else if (!vfio_cpr_ram_discard_register_listener(bcontainer, section)) { error_setg(&err, --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350756; cv=none; d=zohomail.com; s=zohoarc; b=Ezam4SiljSQ2RnVE+BrTgpEn9F4peFBvU97x27s6eWK/g+Vnh3uoJS8f79hfx923PxSQIGY+L35P4vrarH8HtxTR0Jf/V5TWfX9G+bwINHyIY9Tw5and1EbxbIGe5734tASnGgATxrhTFYCzw2UG76J/kbHoZ7cU1JmH+fQKcVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350756; 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=oGKdzj2YknubA7zlVYVjCrCakq6678WpmsVdgfmsKwU=; b=OyinqqiUOCtWYG1bxBT0136PgkGrAflsyVdW4uvKVSrFIHef7zmdGclftYq7J8gJvtIdVr/+Y6KSl/2uUPt+BMsrAWo38duzUStEDTqIJJ69tal8v8yRTMTYxwVS5r5ZxbMep0SUJWT5NU1Fb2dZCkl/CU2ceuiN5eMTBlrn9TA= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350756629463.8803271901455; Mon, 8 Sep 2025 09:59:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8l-0006ok-2x; Mon, 08 Sep 2025 12:54:51 -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 1uvf8Z-0006el-Vy for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8U-0001b2-G8 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:38 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-SxT8x68nMg-s9ZPIOBuNgg-1; Mon, 08 Sep 2025 12:54:27 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 888E6180057A; Mon, 8 Sep 2025 16:54:25 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E9A1D300018D; Mon, 8 Sep 2025 16:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oGKdzj2YknubA7zlVYVjCrCakq6678WpmsVdgfmsKwU=; b=CJ2f2OMfD69Yo/+GZz8/FAK0BOUutiGm9UoWQ/doKqlKK4r1MWsbakrXbb8YJqb2UXOrKm o3pcaRcRDDwUePuwyvksYL/MAUmqc8RPRZrxwtKj+Eq07G0iUMhTpH/tso1xdYziLRciVv lHo0wUh2xu4R6I48DYFLI3PH0ouRrM4= X-MC-Unique: SxT8x68nMg-s9ZPIOBuNgg-1 X-Mimecast-MFC-AGG-ID: SxT8x68nMg-s9ZPIOBuNgg_1757350465 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , John Levon , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 09/31] hw/vfio-user: add x-pci-class-code Date: Mon, 8 Sep 2025 18:53:32 +0200 Message-ID: <20250908165354.1731444-10-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350757192116600 From: John Levon This new option was not added to vfio_user_pci_dev_properties, which caused an incorrect class code for vfio-user devices. Fixes: a59d06305fff ("vfio/pci: Introduce x-pci-class-code option") Signed-off-by: John Levon Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/qemu-devel/20250827190810.1645340-1-john.levo= n@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio-user/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c index be71c777291f0c68b01b54029612c4dbc6aa86e2..dfaa89498dfd034dde73703acaa= b788c6f50afed 100644 --- a/hw/vfio-user/pci.c +++ b/hw/vfio-user/pci.c @@ -406,6 +406,8 @@ static const Property vfio_user_pci_dev_properties[] = =3D { sub_vendor_id, PCI_ANY_ID), DEFINE_PROP_UINT32("x-pci-sub-device-id", VFIOPCIDevice, sub_device_id, PCI_ANY_ID), + DEFINE_PROP_UINT32("x-pci-class-code", VFIOPCIDevice, + class_code, PCI_ANY_ID), DEFINE_PROP_BOOL("x-send-queued", VFIOUserPCIDevice, send_queued, fals= e), DEFINE_PROP_UINT32("x-msg-timeout", VFIOUserPCIDevice, wait_time, 5000= ), DEFINE_PROP_BOOL("x-no-posted-writes", VFIOUserPCIDevice, no_post, fal= se), --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757351052; cv=none; d=zohomail.com; s=zohoarc; b=iRVGsmOXmdREfa56OG8duS91IWa4B6wYXuaFk1HPt/Qj0SZ/urkq0Ta8TpO7DtCKMSfTnSVg0kBSZZtesSmKCxUsQXymwk6MlqjUsG2FKL7reKMdMKVrCs3Ru1ZPBjVXKXdIIWEKJNSArgS/8Ok3E3E/RK1B3pFnzocw4pAiTnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757351052; 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=xZbfSTP/JfACJayh18nuWhbeIHHE2nsgBhjOK4FY6p8=; b=cROYKFCt+qsHpKGwrrEBEK8KUqI4/mZn+n9AJtNS6Tu9K8ombh/2+jic2CAhfJtXH6qDeTBgCBY34eUikg+KTFMYozXVZYgN/HaElAgcO4LELmDyyRIKjjMjfRfn9HZrmX9E07CHqqX3h0gmHyMPwT4+kdn539pFXXBlt5DetuY= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757351052956339.39552102547293; Mon, 8 Sep 2025 10:04:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8u-00074e-Gr; Mon, 08 Sep 2025 12:55:01 -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 1uvf8b-0006fe-JK for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8T-0001ax-OT for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:41 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-690-l2WNfykDOmidbRKWdO0cTw-1; Mon, 08 Sep 2025 12:54:28 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A9CF819560A1; Mon, 8 Sep 2025 16:54:27 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1267A30001B5; Mon, 8 Sep 2025 16:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xZbfSTP/JfACJayh18nuWhbeIHHE2nsgBhjOK4FY6p8=; b=US3Kh+SDzR40BAQ6WgR5acmmYkcEXxOeNoHmMz4bLfaFvXbFF+Qxqdbgm8RxbFzlisAJe8 erRkQDMR0BIOf06YOJ27l/DuOMI0skGe9uX10dhC1VRbWpSjZNoFQXmV8uURHTnOaY54ER 1sHKBnfgSgrQhwd11K1eJjxWa0vlhqU= X-MC-Unique: l2WNfykDOmidbRKWdO0cTw-1 X-Mimecast-MFC-AGG-ID: l2WNfykDOmidbRKWdO0cTw_1757350467 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Zhenzhong Duan , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 10/31] vfio: Introduce helper vfio_pci_from_vfio_device() Date: Mon, 8 Sep 2025 18:53:33 +0200 Message-ID: <20250908165354.1731444-11-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=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 @redhat.com) X-ZM-MESSAGEID: 1757351054848124100 From: Zhenzhong Duan Introduce helper vfio_pci_from_vfio_device() to transform from VFIODevice to VFIOPCIDevice, also to hide low level VFIO_DEVICE_TYPE_PCI type check. Suggested-by: C=C3=A9dric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/qemu-devel/20250822064101.123526-5-zhenzhong.= duan@intel.com [ clg: Added documentation ] Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/pci.h | 12 ++++++++++++ hw/vfio/container.c | 4 ++-- hw/vfio/device.c | 2 +- hw/vfio/iommufd.c | 4 ++-- hw/vfio/listener.c | 4 ++-- hw/vfio/pci.c | 9 +++++++++ 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 923cf9c2f79d078546239bf67195d6ba8157265a..96144b6fdeb94dccf6c0beecf03= 9a12b9845c59b 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -226,6 +226,18 @@ void vfio_pci_write_config(PCIDevice *pdev, uint64_t vfio_vga_read(void *opaque, hwaddr addr, unsigned size); void vfio_vga_write(void *opaque, hwaddr addr, uint64_t data, unsigned siz= e); =20 +/** + * vfio_pci_from_vfio_device: Transform from VFIODevice to + * VFIOPCIDevice + * + * This function checks if the given @vbasedev is a VFIO PCI device. + * If it is, it returns the containing VFIOPCIDevice. + * + * @vbasedev: The VFIODevice to transform + * + * Return: The VFIOPCIDevice on success, NULL on failure. + */ +VFIOPCIDevice *vfio_pci_from_vfio_device(VFIODevice *vbasedev); void vfio_sub_page_bar_update_mappings(VFIOPCIDevice *vdev); bool vfio_opt_rom_in_denylist(VFIOPCIDevice *vdev); bool vfio_config_quirk_setup(VFIOPCIDevice *vdev, Error **errp); diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 3e13feaa74c30e8d7f5a0978e15824cecbf6d674..134ddccc52449cd7d4ac90d1707= 5e9fca5439674 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -1087,7 +1087,7 @@ static int vfio_legacy_pci_hot_reset(VFIODevice *vbas= edev, bool single) /* Prep dependent devices for reset and clear our marker. */ QLIST_FOREACH(vbasedev_iter, &group->device_list, next) { if (!vbasedev_iter->dev->realized || - vbasedev_iter->type !=3D VFIO_DEVICE_TYPE_PCI) { + !vfio_pci_from_vfio_device(vbasedev_iter)) { continue; } tmp =3D container_of(vbasedev_iter, VFIOPCIDevice, vbasedev); @@ -1172,7 +1172,7 @@ out: =20 QLIST_FOREACH(vbasedev_iter, &group->device_list, next) { if (!vbasedev_iter->dev->realized || - vbasedev_iter->type !=3D VFIO_DEVICE_TYPE_PCI) { + !vfio_pci_from_vfio_device(vbasedev_iter)) { continue; } tmp =3D container_of(vbasedev_iter, VFIOPCIDevice, vbasedev); diff --git a/hw/vfio/device.c b/hw/vfio/device.c index 52a1996dc4e122499a978cc8a5ce7e01620a9639..08f12ac31f44fdebc9fc1f23f71= 6c52f391ed53e 100644 --- a/hw/vfio/device.c +++ b/hw/vfio/device.c @@ -129,7 +129,7 @@ static inline const char *action_to_str(int action) =20 static const char *index_to_str(VFIODevice *vbasedev, int index) { - if (vbasedev->type !=3D VFIO_DEVICE_TYPE_PCI) { + if (!vfio_pci_from_vfio_device(vbasedev)) { return NULL; } =20 diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index 48c590b6a9467c8139131bef8b92864893a8f2e6..8c27222f754a22f47fda6b6a1a8= 6005341ec0d7f 100644 --- a/hw/vfio/iommufd.c +++ b/hw/vfio/iommufd.c @@ -737,8 +737,8 @@ iommufd_cdev_dep_get_realized_vpdev(struct vfio_pci_dep= endent_device *dep_dev, } =20 vbasedev_tmp =3D iommufd_cdev_pci_find_by_devid(dep_dev->devid); - if (!vbasedev_tmp || !vbasedev_tmp->dev->realized || - vbasedev_tmp->type !=3D VFIO_DEVICE_TYPE_PCI) { + if (!vfio_pci_from_vfio_device(vbasedev_tmp) || + !vbasedev_tmp->dev->realized) { return NULL; } =20 diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c index c244be5e218ae60e2b9c8a29d2d4b9dad86fc77a..e0938331659833bdca98e700ac4= 2651a90fb1571 100644 --- a/hw/vfio/listener.c +++ b/hw/vfio/listener.c @@ -453,7 +453,7 @@ static void vfio_device_error_append(VFIODevice *vbased= ev, Error **errp) * MMIO region mapping failures are not fatal but in this case PCI * peer-to-peer transactions are broken. */ - if (vbasedev && vbasedev->type =3D=3D VFIO_DEVICE_TYPE_PCI) { + if (vfio_pci_from_vfio_device(vbasedev)) { error_append_hint(errp, "%s: PCI peer-to-peer transactions " "on BARs are not supported.\n", vbasedev->name); } @@ -759,7 +759,7 @@ static bool vfio_section_is_vfio_pci(MemoryRegionSectio= n *section, owner =3D memory_region_owner(section->mr); =20 QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) { - if (vbasedev->type !=3D VFIO_DEVICE_TYPE_PCI) { + if (!vfio_pci_from_vfio_device(vbasedev)) { continue; } pcidev =3D container_of(vbasedev, VFIOPCIDevice, vbasedev); diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 07257d0fa049b09fc296ac2279a6fafbdf93d277..3fe5b03eb1160bb66fc4ae3942d= 14a2d71b4431a 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2833,6 +2833,15 @@ static int vfio_pci_load_config(VFIODevice *vbasedev= , QEMUFile *f) return ret; } =20 +/* Transform from VFIODevice to VFIOPCIDevice. Return NULL if fails. */ +VFIOPCIDevice *vfio_pci_from_vfio_device(VFIODevice *vbasedev) +{ + if (vbasedev && vbasedev->type =3D=3D VFIO_DEVICE_TYPE_PCI) { + return container_of(vbasedev, VFIOPCIDevice, vbasedev); + } + return NULL; +} + void vfio_sub_page_bar_update_mappings(VFIOPCIDevice *vdev) { PCIDevice *pdev =3D &vdev->pdev; --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350758; cv=none; d=zohomail.com; s=zohoarc; b=XSOBcySTQ9iiuaWHHi9oiMktwWd2lbgC3HMlQj0ChwTecfVJTLf4lzgfPG34YKpf7wSG0E+VmMKcIbCQH2au6/JeOeoQ1SUiMmDc7febA3Mf65lSOovtJ3JbMl0c83RvkSk8QBbzpGjHVPkTeJUv5m9Gp2BNi/+Ubh8ivJ+Pc9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350758; 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=S92+nlsO4FvoezEykD/GekIndRhl9sPOpetgVoPS+TU=; b=jVKqYHK6NPp3ZB31wL1ds97rTTL4B3nDLa+1QCpMH56wCCUoIY9PnGncqpT7tulvwt+NVvyKjH7d2fe3w2IqirNAFIZxNlHR+JGiZdDrmun6R3nLGbQhZB5NSBxi72/BFjU0Vmb2En/qcnKYtrvvhDbn8wJ/p7zle8Vv0CcIObs= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350758816932.1871368284409; Mon, 8 Sep 2025 09:59:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf97-0007FW-37; Mon, 08 Sep 2025 12:55:13 -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 1uvf8c-0006fl-3P for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8Y-0001bC-99 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:41 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-327-N2pPgd9_P6uTPU1mWjOaUg-1; Mon, 08 Sep 2025 12:54:30 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C5C99195609F; Mon, 8 Sep 2025 16:54:29 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 31AA130001B5; Mon, 8 Sep 2025 16:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S92+nlsO4FvoezEykD/GekIndRhl9sPOpetgVoPS+TU=; b=heSqrfyvAhSrRI5HM5fWEWWFHbdX0mh3W8G95Bb9FbEx16F5t86zO+ZiFVeUJVV6/kvlVJ GwhEPDARHJpDDUSLBnBXFUrletZe/6OqdlY++Eu4livDNvPAgNjYG7FcxFSnK52satN2Mw N0efy4Y1qYTcuo0HIlxwU6HdV1eQ+u8= X-MC-Unique: N2pPgd9_P6uTPU1mWjOaUg-1 X-Mimecast-MFC-AGG-ID: N2pPgd9_P6uTPU1mWjOaUg_1757350469 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 11/31] vfio/vfio-container-base.h: update VFIOContainerBase declaration Date: Mon, 8 Sep 2025 18:53:34 +0200 Message-ID: <20250908165354.1731444-12-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350759208116600 From: Mark Cave-Ayland Update the VFIOContainerBase declaration to match our current coding guidelines: remove the explicit typedef (this is already handled by the OBJECT_DECLARE_TYPE() macro), add a blank line after the parent object, rename parent to parent_obj, and move the macro declaration next to the VFIOContainerBase struct declaration. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-2-mark.cavea= yland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- include/hw/vfio/vfio-container-base.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-c= ontainer-base.h index bded6e993ffd34910f5583bf8e94c81c41f4885f..acbd48a18a3a35ba6c5484d6d0f= b12c23a983f77 100644 --- a/include/hw/vfio/vfio-container-base.h +++ b/include/hw/vfio/vfio-container-base.h @@ -33,8 +33,9 @@ typedef struct VFIOAddressSpace { /* * This is the base object for vfio container backends */ -typedef struct VFIOContainerBase { - Object parent; +struct VFIOContainerBase { + Object parent_obj; + VFIOAddressSpace *space; MemoryListener listener; Error *error; @@ -51,7 +52,10 @@ typedef struct VFIOContainerBase { QLIST_HEAD(, VFIODevice) device_list; GList *iova_ranges; NotifierWithReturn cpr_reboot_notifier; -} VFIOContainerBase; +}; + +#define TYPE_VFIO_IOMMU "vfio-iommu" +OBJECT_DECLARE_TYPE(VFIOContainerBase, VFIOIOMMUClass, VFIO_IOMMU) =20 typedef struct VFIOGuestIOMMU { VFIOContainerBase *bcontainer; @@ -105,14 +109,11 @@ vfio_container_get_page_size_mask(const VFIOContainer= Base *bcontainer) return bcontainer->pgsizes; } =20 -#define TYPE_VFIO_IOMMU "vfio-iommu" #define TYPE_VFIO_IOMMU_LEGACY TYPE_VFIO_IOMMU "-legacy" #define TYPE_VFIO_IOMMU_SPAPR TYPE_VFIO_IOMMU "-spapr" #define TYPE_VFIO_IOMMU_IOMMUFD TYPE_VFIO_IOMMU "-iommufd" #define TYPE_VFIO_IOMMU_USER TYPE_VFIO_IOMMU "-user" =20 -OBJECT_DECLARE_TYPE(VFIOContainerBase, VFIOIOMMUClass, VFIO_IOMMU) - struct VFIOIOMMUClass { ObjectClass parent_class; =20 --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757351036; cv=none; d=zohomail.com; s=zohoarc; b=AkrZcuKjxdzGizWCYTsfxJ/ZtJIvZ8Bj0BLWAXYQEFQoofR7QeA73Qnrr1mvs1Jhhy4R2tx54IN1H5N17WTMfIozvJYZqbpYHod5ixlRhmfD9pjf9Rqfzb56lt6Za3cwoDFpA4ILWvg6CU2PidLro+3oTztwzzO+CP4mOHu9i5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757351036; 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=w34wgmCcEJP5Yp1OgrjuV3z3G9GVzOJOwUSUWNBCj3g=; b=jVFYNKG2+4ntwdeWMwMvSWbndaLOfJBeu10UUyeCtIhlhq14mXBe7EoDrVgAlxryZwT6QjDdhv48r1SniMvZZ6/v/a85H64vmBn6mjHv6PhyVAC9dZzqRttnirzAAH4sF5mCX/nMyFcsJXB1oJ6X5iScaJ0pCKOXOiBGBzC+RyA= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757351036446896.0278284995807; Mon, 8 Sep 2025 10:03:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf98-0007Le-3N; Mon, 08 Sep 2025 12:55:14 -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 1uvf8h-0006ht-3m for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8Y-0001bV-GN for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:44 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-526-hUWAdE8JPfSrcfCMym71eQ-1; Mon, 08 Sep 2025 12:54:33 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 33E27195609F; Mon, 8 Sep 2025 16:54:32 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4D885300018D; Mon, 8 Sep 2025 16:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w34wgmCcEJP5Yp1OgrjuV3z3G9GVzOJOwUSUWNBCj3g=; b=eAHhbPed5yT5J8godJR4UjI6PRYlw5pbQbnZBu6AbUsE7Iyat3QHPWlA6bD7quJLp8vR+E BqdqZWhoIH4ToTj5EPxhSA+A+MuTRFN96+hLW0kCrFaRjNHKMbhYVcrMmDkKaVwaqTGTZ8 jEQkxj6De7E/ZwBna6/JbPmA6VCjBtg= X-MC-Unique: hUWAdE8JPfSrcfCMym71eQ-1 X-Mimecast-MFC-AGG-ID: hUWAdE8JPfSrcfCMym71eQ_1757350472 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 12/31] vfio/vfio-container.h: update VFIOContainer declaration Date: Mon, 8 Sep 2025 18:53:35 +0200 Message-ID: <20250908165354.1731444-13-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757351038554116600 From: Mark Cave-Ayland Update the VFIOContainer declaration so that it is closer to our coding guidelines: emove the explicit typedef (this is already handled by the OBJECT_DECLARE_TYPE() macro) and add a blank line after the parent object. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-3-mark.cavea= yland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- include/hw/vfio/vfio-container.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-contai= ner.h index 21e5807e48e1be69a67fa864a7deddb141cb0cf7..50c91788d5b95aac67f548aa05f= ce6f36911606a 100644 --- a/include/hw/vfio/vfio-container.h +++ b/include/hw/vfio/vfio-container.h @@ -25,13 +25,14 @@ typedef struct VFIOGroup { bool ram_block_discard_allowed; } VFIOGroup; =20 -typedef struct VFIOContainer { +struct VFIOContainer { VFIOContainerBase bcontainer; + int fd; /* /dev/vfio/vfio, empowered by the attached groups */ unsigned iommu_type; QLIST_HEAD(, VFIOGroup) group_list; VFIOContainerCPR cpr; -} VFIOContainer; +}; =20 OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY); =20 --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350528; cv=none; d=zohomail.com; s=zohoarc; b=Q9gj2N5LLprHgajucHEtLhZYbncaFbGAvWyApuHtVpEmTRx1GcVAl7S6pA+U4ZAgfYxhcHSUQsQq115qBeQkXFv4nGtI3S5UGm5NX33mix56KPuuK/lS/8U3o+wqKfruENK6wK/8PZI6rfpF5iZYu86kSZO8EOtbGkNciJVLXM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350528; 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=8HV3S2WsxXDMXfyZlW1cb2Az/K8L2YoJTRcc6ZcbtKQ=; b=grZGBlnPCNSknIqzkG97ReZZrLZc2U7kVfT6AZnobXChYmggFapSSgdnK6hzsgz7LiOu11OKJ1AoIK/fXH+R3x5ZT9d9ElOOq8aHNNgoytTegt0BBbUGpNGdZCnWXV8YTURM0V74iu4G8RNpTBPUH24rSGpVF8m2AgoRgiPjVFc= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350528300944.5990321839402; Mon, 8 Sep 2025 09:55:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8q-00073N-AK; Mon, 08 Sep 2025 12:54:56 -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 1uvf8h-0006hw-EU for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8e-0001cc-Tl for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:47 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-B1jLQRY3Ot2J-BDaNPtFEQ-1; Mon, 08 Sep 2025 12:54:39 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 11AFB18004D4; Mon, 8 Sep 2025 16:54:35 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AF469300018D; Mon, 8 Sep 2025 16:54:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8HV3S2WsxXDMXfyZlW1cb2Az/K8L2YoJTRcc6ZcbtKQ=; b=VxNq73uDJhOJiHlqhZPNtcPgRpXCQ+m2Ap1ulJJiOxUAZ+ci09OipdC2N+SCLehpWC1AIu pwOhcwIhrTQzU9DbZwq/ivbOV5e8cE5pKsimYzWBtQDnE9E0JCYR34OEv55SsULUn9Xt6D 13U/DmlOXhPD7Ww2DzBVYIcO+YCOjZw= X-MC-Unique: B1jLQRY3Ot2J-BDaNPtFEQ-1 X-Mimecast-MFC-AGG-ID: B1jLQRY3Ot2J-BDaNPtFEQ_1757350475 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Steve Sistare Subject: [PULL 13/31] hw/vfio/cpr-legacy.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:36 +0200 Message-ID: <20250908165354.1731444-14-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350528990124100 From: Mark Cave-Ayland Use QOM casts to convert between VFIOContainer and VFIOContainerBase instead of accessing bcontainer directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Steve Sistare Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-4-mark.cavea= yland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/cpr-legacy.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/vfio/cpr-legacy.c b/hw/vfio/cpr-legacy.c index 553b203e9b60b3a08159e2224a887b4d76162428..8f437194fae035b37de3f7c3f88= e332c4ef88302 100644 --- a/hw/vfio/cpr-legacy.c +++ b/hw/vfio/cpr-legacy.c @@ -41,8 +41,8 @@ static int vfio_legacy_cpr_dma_map(const VFIOContainerBas= e *bcontainer, hwaddr iova, ram_addr_t size, void *vad= dr, bool readonly, MemoryRegion *mr) { - const VFIOContainer *container =3D container_of(bcontainer, VFIOContai= ner, - bcontainer); + const VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); + struct vfio_iommu_type1_dma_map map =3D { .argsz =3D sizeof(map), .flags =3D VFIO_DMA_MAP_FLAG_VADDR, @@ -65,7 +65,7 @@ static void vfio_region_remap(MemoryListener *listener, { VFIOContainer *container =3D container_of(listener, VFIOContainer, cpr.remap_listener); - vfio_container_region_add(&container->bcontainer, section, true); + vfio_container_region_add(VFIO_IOMMU(container), section, true); } =20 static bool vfio_cpr_supported(VFIOContainer *container, Error **errp) @@ -98,7 +98,7 @@ static int vfio_container_pre_save(void *opaque) static int vfio_container_post_load(void *opaque, int version_id) { VFIOContainer *container =3D opaque; - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); VFIOIOMMUClass *vioc =3D VFIO_IOMMU_GET_CLASS(bcontainer); dma_map_fn saved_dma_map =3D vioc->dma_map; Error *local_err =3D NULL; @@ -135,7 +135,7 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *n= otifier, { VFIOContainer *container =3D container_of(notifier, VFIOContainer, cpr.transfer_notifier); - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); =20 if (e->type !=3D MIG_EVENT_PRECOPY_FAILED) { return 0; @@ -167,7 +167,7 @@ static int vfio_cpr_fail_notifier(NotifierWithReturn *n= otifier, =20 bool vfio_legacy_cpr_register_container(VFIOContainer *container, Error **= errp) { - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); Error **cpr_blocker =3D &container->cpr.blocker; =20 migration_add_notifier_mode(&bcontainer->cpr_reboot_notifier, @@ -191,7 +191,7 @@ bool vfio_legacy_cpr_register_container(VFIOContainer *= container, Error **errp) =20 void vfio_legacy_cpr_unregister_container(VFIOContainer *container) { - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); =20 migration_remove_notifier(&bcontainer->cpr_reboot_notifier); migrate_del_blocker(&container->cpr.blocker); --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350706; cv=none; d=zohomail.com; s=zohoarc; b=NkE1AvcSs77V6jC2Jw3aG1K7+PZaimvjExtv2eGL+iwuzwt9J1bolHIbl5fMuvN/D5YBd/mwnpGeeSQx4aLQs3eR04nm190U+O+sL4lmzg748u4+oSae1bxXf8H1xWoF8gNMuiRZjN1O6dQU8povdaintEZk/NQM7NAqDIsjHhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350706; 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=fHdFZnrjCMDOGkyais0homueeFu9kysDP0ORzt9+fdw=; b=YR/etVBTYnfCWDLrazUZq3SleVYsTdcr4BQL0iydcO3kliwdJJi3RCTA3oP+Z4Um9STwaC6RXGih2hu/0tLDstf0vgvFpki+dUihRfy/o0afBNg33vIwKzXMteb7G8xEFZbPThFVlzK1SXdFaUF5SAHHtCZ3myAW+s9A48mRjJ0= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350706534649.7789631299827; Mon, 8 Sep 2025 09:58:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8q-00073K-AA; Mon, 08 Sep 2025 12:54:56 -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 1uvf8h-0006hv-Bu for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8e-0001cF-PO for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:47 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-63-Q6AbwY-nOQiWogJ_EuAQhA-1; Mon, 08 Sep 2025 12:54:38 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2D5C319560AD; Mon, 8 Sep 2025 16:54:37 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8E6ED300018D; Mon, 8 Sep 2025 16:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350480; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fHdFZnrjCMDOGkyais0homueeFu9kysDP0ORzt9+fdw=; b=AssaJSO2VUAFKqibqDWOABc0Dn/grwxAoZWXDpelhUWGKtDca7/unghh4+jzEgSG5U4x5k 0GBrS/JXE/zdSRbPo7dDILxDwd7wm7ZJQK9JRegNhrRfa/zqYzwI2VFEWMWza/bjQizErD PGbOpE4F/WpR5t/1oVXTzfvSa359E6s= X-MC-Unique: Q6AbwY-nOQiWogJ_EuAQhA-1 X-Mimecast-MFC-AGG-ID: Q6AbwY-nOQiWogJ_EuAQhA_1757350477 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 14/31] hw/vfio/container.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:37 +0200 Message-ID: <20250908165354.1731444-15-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350707309124100 From: Mark Cave-Ayland Use QOM casts to convert between VFIOContainer and VFIOContainerBase instead of accessing bcontainer directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-5-mark.cavea= yland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/container.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 134ddccc52449cd7d4ac90d17075e9fca5439674..030c6d3f89cf57dc06e9bb2222f= 02e7803482c56 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -71,7 +71,7 @@ static int vfio_dma_unmap_bitmap(const VFIOContainer *con= tainer, hwaddr iova, ram_addr_t size, IOMMUTLBEntry *iotlb) { - const VFIOContainerBase *bcontainer =3D &container->bcontainer; + const VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); struct vfio_iommu_type1_dma_unmap *unmap; struct vfio_bitmap *bitmap; VFIOBitmap vbmap; @@ -124,8 +124,7 @@ static int vfio_legacy_dma_unmap_one(const VFIOContaine= rBase *bcontainer, hwaddr iova, ram_addr_t size, IOMMUTLBEntry *iotlb) { - const VFIOContainer *container =3D container_of(bcontainer, VFIOContai= ner, - bcontainer); + const VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); struct vfio_iommu_type1_dma_unmap unmap =3D { .argsz =3D sizeof(unmap), .flags =3D 0, @@ -213,8 +212,7 @@ static int vfio_legacy_dma_map(const VFIOContainerBase = *bcontainer, hwaddr iova, ram_addr_t size, void *vaddr, bool readonly, MemoryRegion *mr) { - const VFIOContainer *container =3D container_of(bcontainer, VFIOContai= ner, - bcontainer); + const VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); struct vfio_iommu_type1_dma_map map =3D { .argsz =3D sizeof(map), .flags =3D VFIO_DMA_MAP_FLAG_READ, @@ -246,8 +244,7 @@ static int vfio_legacy_set_dirty_page_tracking(const VFIOContainerBase *bcontainer, bool start, Error **errp) { - const VFIOContainer *container =3D container_of(bcontainer, VFIOContai= ner, - bcontainer); + const VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); int ret; struct vfio_iommu_type1_dirty_bitmap dirty =3D { .argsz =3D sizeof(dirty), @@ -272,8 +269,7 @@ vfio_legacy_set_dirty_page_tracking(const VFIOContainer= Base *bcontainer, static int vfio_legacy_query_dirty_bitmap(const VFIOContainerBase *bcontai= ner, VFIOBitmap *vbmap, hwaddr iova, hwaddr size, Error *= *errp) { - const VFIOContainer *container =3D container_of(bcontainer, VFIOContai= ner, - bcontainer); + const VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); struct vfio_iommu_type1_dirty_bitmap *dbitmap; struct vfio_iommu_type1_dirty_bitmap_get *range; int ret; @@ -495,7 +491,7 @@ static void vfio_get_iommu_info_migration(VFIOContainer= *container, { struct vfio_info_cap_header *hdr; struct vfio_iommu_type1_info_cap_migration *cap_mig; - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); =20 hdr =3D vfio_get_iommu_info_cap(info, VFIO_IOMMU_TYPE1_INFO_CAP_MIGRAT= ION); if (!hdr) { @@ -518,8 +514,7 @@ static void vfio_get_iommu_info_migration(VFIOContainer= *container, =20 static bool vfio_legacy_setup(VFIOContainerBase *bcontainer, Error **errp) { - VFIOContainer *container =3D container_of(bcontainer, VFIOContainer, - bcontainer); + VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); g_autofree struct vfio_iommu_type1_info *info =3D NULL; int ret; =20 @@ -634,7 +629,7 @@ static bool vfio_container_connect(VFIOGroup *group, Ad= dressSpace *as, =20 if (!cpr_is_incoming()) { QLIST_FOREACH(bcontainer, &space->containers, next) { - container =3D container_of(bcontainer, VFIOContainer, bcontain= er); + container =3D VFIO_IOMMU_LEGACY(bcontainer); if (!ioctl(group->fd, VFIO_GROUP_SET_CONTAINER, &container->fd= )) { return vfio_container_group_add(container, group, errp); } @@ -652,7 +647,7 @@ static bool vfio_container_connect(VFIOGroup *group, Ad= dressSpace *as, * create the container struct and group list. */ QLIST_FOREACH(bcontainer, &space->containers, next) { - container =3D container_of(bcontainer, VFIOContainer, bcontain= er); + container =3D VFIO_IOMMU_LEGACY(bcontainer); =20 if (vfio_cpr_container_match(container, group, fd)) { return vfio_container_group_add(container, group, errp); @@ -672,7 +667,7 @@ static bool vfio_container_connect(VFIOGroup *group, Ad= dressSpace *as, goto fail; } new_container =3D true; - bcontainer =3D &container->bcontainer; + bcontainer =3D VFIO_IOMMU(container); =20 if (!vfio_legacy_cpr_register_container(container, errp)) { goto fail; @@ -735,7 +730,7 @@ fail: static void vfio_container_disconnect(VFIOGroup *group) { VFIOContainer *container =3D group->container; - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); VFIOIOMMUClass *vioc =3D VFIO_IOMMU_GET_CLASS(bcontainer); =20 QLIST_REMOVE(group, container_next); @@ -781,7 +776,7 @@ static VFIOGroup *vfio_group_get(int groupid, AddressSp= ace *as, Error **errp) QLIST_FOREACH(group, &vfio_group_list, next) { if (group->groupid =3D=3D groupid) { /* Found it. Now is it already in the right context? */ - if (group->container->bcontainer.space->as =3D=3D as) { + if (VFIO_IOMMU(group->container)->space->as =3D=3D as) { return group; } else { error_setg(errp, "group %d used in multiple address spaces= ", @@ -895,7 +890,7 @@ static bool vfio_device_get(VFIOGroup *group, const cha= r *name, } } =20 - vfio_device_prepare(vbasedev, &group->container->bcontainer, info); + vfio_device_prepare(vbasedev, VFIO_IOMMU(group->container), info); =20 vbasedev->fd =3D fd; vbasedev->group =3D group; --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350580; cv=none; d=zohomail.com; s=zohoarc; b=a/xxpWVZXMc3MpixrUR/XIEfrihW8k/vuJS09zv/RSXPVhDrdSirDhu0nEnDJY2uBeMi8M6MB0alMFxB5iYRNMiUIFMOE1dGhkSL4Iw/28f1JtSxYMmqvQNJkehG3sfDUkdFfmQyXUiYgRIDWJA69QshsT2kI5DTpotFveU5V+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350580; 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=XMPGRVEc5CSIdCtsnXAhGWCEP5HWyh1TBA2vviOexWM=; b=bIkx2VfoLu7pRnNFkKGi9MonV51aNMkd8OfA6ehIQqx16MYbwcivjmW/yQrU7bf0gtaYvC/lX1hVaKTl5y7K74MIQtZ4YWFmObCvwE0lMc/YsrOZqb5aXWaMOYZ4OBdIhpdbgTIY/GnYFK6lqOM3KcHwORc/kdAMEbngM9JEq7s= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350580481553.4870779683368; Mon, 8 Sep 2025 09:56:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf99-0007Nb-5J; Mon, 08 Sep 2025 12:55:15 -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 1uvf8n-0006yu-T7 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8h-0001cj-B0 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:53 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-FqPftlZrPb6eZ9JFytDkrQ-1; Mon, 08 Sep 2025 12:54:40 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 94C671800366; Mon, 8 Sep 2025 16:54:39 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A87AF3000198; Mon, 8 Sep 2025 16:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XMPGRVEc5CSIdCtsnXAhGWCEP5HWyh1TBA2vviOexWM=; b=bKi3KRY0qDlVTS5Mn/JbKO24SmnuxOntQUSius4AS0XfOpzWYMjyofZBVfEoIlyawPjBpy 0kKnRI1P+MW5Qw4/V97KmDACYxMFy01sWID9orhAIt/cSvYgvFwIz6zHlJFdkBQNbfX9gj MBV0kfw0YCUlIFC5x9RLTjkBA/ZCtyk= X-MC-Unique: FqPftlZrPb6eZ9JFytDkrQ-1 X-Mimecast-MFC-AGG-ID: FqPftlZrPb6eZ9JFytDkrQ_1757350479 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Harsh Prateek Bora Subject: [PULL 15/31] ppc/spapr_pci_vfio.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:38 +0200 Message-ID: <20250908165354.1731444-16-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=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 @redhat.com) X-ZM-MESSAGEID: 1757350581586124100 From: Mark Cave-Ayland Use a QOM cast to convert to VFIOContainer instead of accessing bcontainer directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Harsh Prateek Bora Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-6-mark.cavea= yland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/spapr_pci_vfio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c index e318d0d912f3e90d1289e4bc2195bf68418e5206..7e1c71ef59d5c4d4449769b726c= 8c0053e607097 100644 --- a/hw/ppc/spapr_pci_vfio.c +++ b/hw/ppc/spapr_pci_vfio.c @@ -106,7 +106,7 @@ static VFIOContainer *vfio_eeh_as_container(AddressSpac= e *as) =20 out: vfio_address_space_put(space); - return container_of(bcontainer, VFIOContainer, bcontainer); + return VFIO_IOMMU_LEGACY(bcontainer); } =20 static bool vfio_eeh_as_ok(AddressSpace *as) --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350649; cv=none; d=zohomail.com; s=zohoarc; b=eMUN+ujNpjCeU1qYlKLR8RiI5peXukfBJtvv7hmRUoSZNBtTYOABmbM5vesKIq3pOxOHCk+zEnHlCp5WHcXJm6iwcPMab7W6gDnlPAyqZxUrFYNCpcGR7G/pGlByTjyt3dQcfggTEl6oqJb5N8BdBn5adnq6Euk4jLX2Uu41PPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350649; 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=tBAHUg/1deAc9H+jWQlEafaj8TcIBlfqvPlCYJuG8ok=; b=OnMzwPZvPp/1nJpf2qw7ESYJ2inbBfaS3qiGJcB+EhBSLYIjWDJNEr4f7OSHFV0fXXZs9pOm+Yn8EZmidM5/swb3DLKLmp0dGOLxAEXcGfZ4e6C72G2FCtFKuvNJlhZYP+lU+GcwrkclpfEbJZxMO+FICxJ8tYLZ6mf65ef7Pog= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350649672788.9957817379695; Mon, 8 Sep 2025 09:57:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf95-0007FU-Mu; Mon, 08 Sep 2025 12:55:12 -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 1uvf8s-00077v-9B for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8i-0001d2-NF for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:57 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-486-In6bElq2MiSwkOBc4ah4zA-1; Mon, 08 Sep 2025 12:54:42 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F091A1800366; Mon, 8 Sep 2025 16:54:41 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1B905300018D; Mon, 8 Sep 2025 16:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tBAHUg/1deAc9H+jWQlEafaj8TcIBlfqvPlCYJuG8ok=; b=Fotjs8g8H6SLZWRg+7nnJGQVXrOHMqTkipcSs+cItfe4QUfRqVtgvizEDPhAkaLsIezuG+ ioz8jun/WuQgI6Y0EIHvYbaHkQM2tVjjg8NQFTiRT4jIa8Ve4uxTZsl2iVVdCMBZ41Ul6w 7XkX9B/DnSPiEHr940nIv/cPeUyoFKY= X-MC-Unique: In6bElq2MiSwkOBc4ah4zA-1 X-Mimecast-MFC-AGG-ID: In6bElq2MiSwkOBc4ah4zA_1757350482 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Harsh Prateek Bora Subject: [PULL 16/31] vfio/spapr.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:39 +0200 Message-ID: <20250908165354.1731444-17-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=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 @redhat.com) X-ZM-MESSAGEID: 1757350652475124100 From: Mark Cave-Ayland Use QOM casts to convert between VFIOContainer and VFIOContainerBase instead of accessing bcontainer directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Harsh Prateek Bora Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-7-mark.cavea= yland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/spapr.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c index 564b70ef97fb8465af6160ec08fdd203d35cb7ab..c41e4588d6f2f0532f80720c1a3= 2079d1ccfdef4 100644 --- a/hw/vfio/spapr.c +++ b/hw/vfio/spapr.c @@ -62,7 +62,7 @@ static void vfio_prereg_listener_region_add(MemoryListene= r *listener, VFIOSpaprContainer *scontainer =3D container_of(listener, VFIOSpaprCon= tainer, prereg_listener); VFIOContainer *container =3D &scontainer->container; - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); const hwaddr gpa =3D section->offset_within_address_space; hwaddr end; int ret; @@ -244,7 +244,7 @@ static bool vfio_spapr_create_window(VFIOContainer *con= tainer, hwaddr *pgsize, Error **errp) { int ret =3D 0; - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); VFIOSpaprContainer *scontainer =3D container_of(container, VFIOSpaprCo= ntainer, container); IOMMUMemoryRegion *iommu_mr =3D IOMMU_MEMORY_REGION(section->mr); @@ -352,8 +352,7 @@ vfio_spapr_container_add_section_window(VFIOContainerBa= se *bcontainer, MemoryRegionSection *section, Error **errp) { - VFIOContainer *container =3D container_of(bcontainer, VFIOContainer, - bcontainer); + VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); VFIOSpaprContainer *scontainer =3D container_of(container, VFIOSpaprCo= ntainer, container); VFIOHostDMAWindow *hostwin; @@ -443,8 +442,7 @@ static void vfio_spapr_container_del_section_window(VFIOContainerBase *bcontainer, MemoryRegionSection *section) { - VFIOContainer *container =3D container_of(bcontainer, VFIOContainer, - bcontainer); + VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); VFIOSpaprContainer *scontainer =3D container_of(container, VFIOSpaprCo= ntainer, container); =20 @@ -465,8 +463,7 @@ vfio_spapr_container_del_section_window(VFIOContainerBa= se *bcontainer, =20 static void vfio_spapr_container_release(VFIOContainerBase *bcontainer) { - VFIOContainer *container =3D container_of(bcontainer, VFIOContainer, - bcontainer); + VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); VFIOSpaprContainer *scontainer =3D container_of(container, VFIOSpaprCo= ntainer, container); VFIOHostDMAWindow *hostwin, *next; @@ -484,8 +481,7 @@ static void vfio_spapr_container_release(VFIOContainerB= ase *bcontainer) static bool vfio_spapr_container_setup(VFIOContainerBase *bcontainer, Error **errp) { - VFIOContainer *container =3D container_of(bcontainer, VFIOContainer, - bcontainer); + VFIOContainer *container =3D VFIO_IOMMU_LEGACY(bcontainer); VFIOSpaprContainer *scontainer =3D container_of(container, VFIOSpaprCo= ntainer, container); struct vfio_iommu_spapr_tce_info info; --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350980; cv=none; d=zohomail.com; s=zohoarc; b=Wy042NgtLnxwx41a8eJ1fBoLA96Gty334fAiia2aYSFaVszxOiPNWgkAliV5Mwd0MgF8kvFt0fvF/GjNR5XiOJNaSw6PRs7tv6cm+6RxxjhNSD7N76w6uMmppTURmUwsthITkiO7p50boc13m2lydQEhJWAfymmss+FoOmTY/7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350980; 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=UjuFtMr7yL5FTIa5iqSKzZkeQpNrbMdTzhCUo5HK32c=; b=b5g08Zgo6a/O0Y3gzZmxu4ydrb9/INIhdFgSLVLiUXi8pdf9PFJ06OLW7qBL2eYzaIcU4J3PxhDuw5lObM2uNBGMKoFHOQaRiG/MuV7ssB1nFQDqkMLKMKSyNR7vytH+tyLPQtOmvmew+i6wmWHDfFTXqAy32XdDK2wj/T+4J4Y= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350980585373.0042601549012; Mon, 8 Sep 2025 10:03:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf8u-00078C-G8; Mon, 08 Sep 2025 12:55:01 -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 1uvf8q-00074Y-D8 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8i-0001dE-NQ for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:54:55 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-57-ULR_fCpyPE2xaJ7jsfT_Eg-1; Mon, 08 Sep 2025 12:54:45 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6844E19560B7; Mon, 8 Sep 2025 16:54:44 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 78A54300018D; Mon, 8 Sep 2025 16:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UjuFtMr7yL5FTIa5iqSKzZkeQpNrbMdTzhCUo5HK32c=; b=KOZQ8lWsFcJY+O3u1n+I5Y01EgIHQmjqwuQunOYHc1FO/fAUCMDBovWV730b211mD6/mUK ux/V77E3nORPoSVp++fvEPreAKV31Y2rfnvCwCWdOjiYYVhdzEGy5tmRHZbflReMoZta/J 5oIYXCZoRddkgc6NHqgSTyrZQGEP/UI= X-MC-Unique: ULR_fCpyPE2xaJ7jsfT_Eg-1 X-Mimecast-MFC-AGG-ID: ULR_fCpyPE2xaJ7jsfT_Eg_1757350484 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 17/31] vfio/vfio-container.h: rename VFIOContainer bcontainer field to parent_obj Date: Mon, 8 Sep 2025 18:53:40 +0200 Message-ID: <20250908165354.1731444-18-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350981783116600 From: Mark Cave-Ayland Now that nothing accesses the bcontainer field directly, rename bcontainer = to parent_obj as per our current coding guidelines. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-8-mark.cavea= yland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- include/hw/vfio/vfio-container.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/vfio/vfio-container.h b/include/hw/vfio/vfio-contai= ner.h index 50c91788d5b95aac67f548aa05fce6f36911606a..240f56699336fb6fb3a925fe7a4= d83a218a26eb2 100644 --- a/include/hw/vfio/vfio-container.h +++ b/include/hw/vfio/vfio-container.h @@ -26,7 +26,7 @@ typedef struct VFIOGroup { } VFIOGroup; =20 struct VFIOContainer { - VFIOContainerBase bcontainer; + VFIOContainerBase parent_obj; =20 int fd; /* /dev/vfio/vfio, empowered by the attached groups */ unsigned iommu_type; --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350806; cv=none; d=zohomail.com; s=zohoarc; b=BkADVttWqUzaWzzlXIYhQgIKYgSzLVZYaCcBmf/shRrofVMvA6iY/1RTmEQXz6JO5ZO/gtqmgIYqZMe8PStdtY5nydLJumL1a4U1rgc6utmMxMzg6zCHedZVFOvgvc3B426bhYHDK5ylcMDqyGEOjpXpUK09suTwzTAHoaR6qvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350806; 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=fsu+oMiwd+/z8WuQ/D4yWcEU4hO/Tb/8LklLZbxcTYE=; b=WJk1nZBipzDyIPEJwWHNDC5ukT6Lhij+TWK5oYF9B2oVztIjdYalVnElEwt8lL87KxOeGo5Ozb15v4v+HG8jRnS4mQZEaB3EFVVUTdDc3osB7bigQQ2ZVI0u5sLkn9njpNoCf0x+6FlCr0yDlXSHOeMiFPE+ywOsxxdEYwLnB0I= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350806970788.9875920666589; Mon, 8 Sep 2025 10:00:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf97-0007LB-Vn; Mon, 08 Sep 2025 12:55:14 -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 1uvf8z-0007Ao-18 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8q-0001du-BR for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:02 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-221-9mve0AOPMxOrbDvek0N7Ow-1; Mon, 08 Sep 2025 12:54:48 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 10212180035C; Mon, 8 Sep 2025 16:54:47 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E3DFF300018D; Mon, 8 Sep 2025 16:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fsu+oMiwd+/z8WuQ/D4yWcEU4hO/Tb/8LklLZbxcTYE=; b=hIILVH8RcwmND9t541z9e3Pk9QcSG+C92F2eYI8GyFG50ZntkiNa4YAxBqibP9zFJAL85y tW0Cos6FxK91dtxCbYx059ijL4A6N/WsQjZ2IYcv3yI1BmYJZ15Q9AnF/6kd+cRlUUTKHf /iakx4xuSIJolab6vYAVXJjIHJNv0Dk= X-MC-Unique: 9mve0AOPMxOrbDvek0N7Ow-1 X-Mimecast-MFC-AGG-ID: 9mve0AOPMxOrbDvek0N7Ow_1757350487 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Levon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 18/31] vfio-user/container.h: update VFIOUserContainer declaration Date: Mon, 8 Sep 2025 18:53:41 +0200 Message-ID: <20250908165354.1731444-19-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350808259124100 From: Mark Cave-Ayland Update the VFIOUserContainer declaration so that it is closer to our coding guidelines: remove the explicit typedef (this is already handled by the OBJECT_DECLARE_TYPE() macro) and add a blank line after the parent object. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: John Levon Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-9-mark.cavea= yland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio-user/container.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/vfio-user/container.h b/hw/vfio-user/container.h index 2bb1fa13431c280f595f52cd6510ccd141f1ffdb..d5d2275af732977461c504d7335= e49464dbe4684 100644 --- a/hw/vfio-user/container.h +++ b/hw/vfio-user/container.h @@ -13,10 +13,11 @@ #include "hw/vfio-user/proxy.h" =20 /* MMU container sub-class for vfio-user. */ -typedef struct VFIOUserContainer { +struct VFIOUserContainer { VFIOContainerBase bcontainer; + VFIOUserProxy *proxy; -} VFIOUserContainer; +}; =20 OBJECT_DECLARE_SIMPLE_TYPE(VFIOUserContainer, VFIO_IOMMU_USER); =20 --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757351034; cv=none; d=zohomail.com; s=zohoarc; b=ZMmE3Ar7aAiTbOqdA6GyyjpnFYp9H2BOCY77zImVsxYO+xPuEo9imlsCOaEuGrSyyl3KxxB9Ta8ucuZg8HkSZS6nIi6qy8KD0wXkMKyhyP0ZQB52gF6M5u+4EkZNgQFxZa0+KevihfeIKbSR2Wz+bks6nO+J1s94RHfzKGm06Xc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757351034; 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=LxL649bZ9kgLbkNAweSzp4umnC2umcgzjheXrcb5Kvc=; b=enSnFAIKdrGFLE3T8oO0B1fiNcWDbjGq+YKzmNZdK8Qoo8VnmtPnJjng/ar7Hc+jTWrf63rwtT7bIHe2gxonAPaRFDC0WwbSMlxVgOccAFv0liXOO56xN8VBMJdh+14Ej87YW1zEx3czr0SU8yw0RrNkuYeq9sSTC4x6k6v3tAE= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17573510345611023.2911036967951; Mon, 8 Sep 2025 10:03:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9A-0007Or-4s; Mon, 08 Sep 2025 12:55:16 -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 1uvf8v-00079k-BC for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8s-0001dx-27 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:00 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-UfzzD-4jP0-E-iV9DNHPgw-1; Mon, 08 Sep 2025 12:54:50 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6BC1C1800447; Mon, 8 Sep 2025 16:54:49 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8AD28300018D; Mon, 8 Sep 2025 16:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LxL649bZ9kgLbkNAweSzp4umnC2umcgzjheXrcb5Kvc=; b=EgYl/zM9fjIC6POllRgLfplXotXwsF5FCg+/X9VmCYOgn97MbifrQhqWUXjv8PuBhDGd++ jHC/Wl2huYvamzccwvFpuKc/ElWUxpK6UETvPvwgzOzcTiPkqXvDNfyu9qmlzJbGk6aXoD vChS5VxI/Mo1p+1C76Sp8BCBUGVGOKs= X-MC-Unique: UfzzD-4jP0-E-iV9DNHPgw-1 X-Mimecast-MFC-AGG-ID: UfzzD-4jP0-E-iV9DNHPgw_1757350489 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Levon Subject: [PULL 19/31] vfio/container.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:42 +0200 Message-ID: <20250908165354.1731444-20-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757351036549116600 From: Mark Cave-Ayland Use QOM casts to convert between VFIOUserContainer and VFIOContainerBase in= stead of accessing bcontainer directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: John Levon Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-10-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio-user/container.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/hw/vfio-user/container.c b/hw/vfio-user/container.c index d589dd90f501bbb3442c7fdc263529501086510d..3cdbd44c1aac2153dd099139a39= 56a3a0bb9b48e 100644 --- a/hw/vfio-user/container.c +++ b/hw/vfio-user/container.c @@ -24,16 +24,14 @@ */ static void vfio_user_listener_begin(VFIOContainerBase *bcontainer) { - VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, - bcontainer); + VFIOUserContainer *container =3D VFIO_IOMMU_USER(bcontainer); =20 container->proxy->async_ops =3D true; } =20 static void vfio_user_listener_commit(VFIOContainerBase *bcontainer) { - VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, - bcontainer); + VFIOUserContainer *container =3D VFIO_IOMMU_USER(bcontainer); =20 /* wait here for any async requests sent during the transaction */ container->proxy->async_ops =3D false; @@ -44,8 +42,8 @@ static int vfio_user_dma_unmap(const VFIOContainerBase *b= container, hwaddr iova, ram_addr_t size, IOMMUTLBEntry *iotlb, bool unmap_all) { - VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, - bcontainer); + VFIOUserContainer *container =3D VFIO_IOMMU_USER(bcontainer); + Error *local_err =3D NULL; int ret =3D 0; =20 @@ -86,8 +84,8 @@ static int vfio_user_dma_map(const VFIOContainerBase *bco= ntainer, hwaddr iova, ram_addr_t size, void *vaddr, bool readonly, MemoryRegion *mrp) { - VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, - bcontainer); + VFIOUserContainer *container =3D VFIO_IOMMU_USER(bcontainer); + int fd =3D memory_region_get_fd(mrp); Error *local_err =3D NULL; int ret =3D 0; @@ -173,8 +171,7 @@ static int vfio_user_query_dirty_bitmap(const VFIOConta= inerBase *bcontainer, =20 static bool vfio_user_setup(VFIOContainerBase *bcontainer, Error **errp) { - VFIOUserContainer *container =3D container_of(bcontainer, VFIOUserCont= ainer, - bcontainer); + VFIOUserContainer *container =3D VFIO_IOMMU_USER(bcontainer); =20 assert(container->proxy->dma_pgsizes !=3D 0); bcontainer->pgsizes =3D container->proxy->dma_pgsizes; @@ -218,7 +215,7 @@ vfio_user_container_connect(AddressSpace *as, VFIODevic= e *vbasedev, goto put_space_exit; } =20 - bcontainer =3D &container->bcontainer; + bcontainer =3D VFIO_IOMMU(container); =20 ret =3D ram_block_uncoordinated_discard_disable(true); if (ret) { @@ -263,7 +260,7 @@ put_space_exit: =20 static void vfio_user_container_disconnect(VFIOUserContainer *container) { - VFIOContainerBase *bcontainer =3D &container->bcontainer; + VFIOContainerBase *bcontainer =3D VFIO_IOMMU(container); VFIOIOMMUClass *vioc =3D VFIO_IOMMU_GET_CLASS(bcontainer); VFIOAddressSpace *space =3D bcontainer->space; =20 @@ -291,7 +288,7 @@ static bool vfio_user_device_get(VFIOUserContainer *con= tainer, =20 vbasedev->fd =3D -1; =20 - vfio_device_prepare(vbasedev, &container->bcontainer, &info); + vfio_device_prepare(vbasedev, VFIO_IOMMU(container), &info); =20 return true; } @@ -315,8 +312,7 @@ static bool vfio_user_device_attach(const char *name, V= FIODevice *vbasedev, =20 static void vfio_user_device_detach(VFIODevice *vbasedev) { - VFIOUserContainer *container =3D container_of(vbasedev->bcontainer, - VFIOUserContainer, bcontai= ner); + VFIOUserContainer *container =3D VFIO_IOMMU_USER(vbasedev->bcontainer); =20 vfio_device_unprepare(vbasedev); =20 --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757351009; cv=none; d=zohomail.com; s=zohoarc; b=Pif7dk+uL5cX8ctqZvZtsUNXOijkV5eD/REkr0oc9MAcWNaY4WQux0ysOueoX0IBZ1hLAoa5SoMoUuN9UkHl3kXPZELZpte+WBNfgkRN0qnh21MXFj+Cbbfk1wkrKEEJc+I2KuKw4kd+dm33bBqTwBVMYK7Bq1is+Jg5B7ANWQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757351009; 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=TWUHP1NqsBYyZedpM+2tOs/tXXsWvVAoe4AGr7+MEW0=; b=GITEYkNXXN9whmJzWGkKagLigz8MM/w9ffNQg1e/5UQ4ZPLwXjBTRsd+zQdBBKNYgCL6vSQjoFOpxQrP93P1vBuUsOp8JJV0JpsZiIyP2zvZstRDQ5UVocVpuPj4DaqDssGoNHRc9GKuxbfcs1atZUq1elbPdtzVUB9EU1vUoNs= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757351009629111.75988713753952; Mon, 8 Sep 2025 10:03:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9A-0007Ou-7i; Mon, 08 Sep 2025 12:55:16 -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 1uvf8x-0007A7-25 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf8s-0001eI-Nz for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:02 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-546-QjO4hTy-P8acWPBlgO1P0A-1; Mon, 08 Sep 2025 12:54:53 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8CACE19560B5; Mon, 8 Sep 2025 16:54:52 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E73CF300018D; Mon, 8 Sep 2025 16:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350496; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TWUHP1NqsBYyZedpM+2tOs/tXXsWvVAoe4AGr7+MEW0=; b=BVwhd9JMtNJi/u1yh3HESXF4eEVEWFidTQgXrtuWn0NWRObfVdaPoTq8OnRKSr6rAznGPu 90hrwR6eJY9mXrkGISRKYBpGTdtjIeuieg0wsgOz1pHoHZJiQy8xhUpka5FIY9okye79Xr G7DNZoZA3W843Nv2HY0c1iepJ/X2lkQ= X-MC-Unique: QjO4hTy-P8acWPBlgO1P0A-1 X-Mimecast-MFC-AGG-ID: QjO4hTy-P8acWPBlgO1P0A_1757350492 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Levon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 20/31] vfio-user/container.h: rename VFIOUserContainer bcontainer field to parent_obj Date: Mon, 8 Sep 2025 18:53:43 +0200 Message-ID: <20250908165354.1731444-21-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757351010561124100 From: Mark Cave-Ayland Now that nothing accesses the bcontainer field directly, rename bcontainer = to parent_obj as per our current coding guidelines. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: John Levon Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-11-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio-user/container.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio-user/container.h b/hw/vfio-user/container.h index d5d2275af732977461c504d7335e49464dbe4684..96aa6785d9b394137f91b274a0d= 6a8a9e9aab672 100644 --- a/hw/vfio-user/container.h +++ b/hw/vfio-user/container.h @@ -14,7 +14,7 @@ =20 /* MMU container sub-class for vfio-user. */ struct VFIOUserContainer { - VFIOContainerBase bcontainer; + VFIOContainerBase parent_obj; =20 VFIOUserProxy *proxy; }; --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350819; cv=none; d=zohomail.com; s=zohoarc; b=G2O10thXs4eChvsognUce6Z/eg8u/Skp0MK+ruKKsF8GN7AC5O9y+XNA1NWxwa/QfJf9f6wHivcSZkz9DgalzduiHxrBvqnxLLQh7KP0VEBSwaQy4XX5tdLlifSKc2BNTP8dNk41yYTeF+/YTRlIMSqN1DHm6aEcZGBFHoW6xOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350819; 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=7Qz8UmxjaGZRGFIy+sOgYJ5XRF2Jf2PxiX5C7M0SeBQ=; b=M43eRUP9phPC1snxMHnoxmnddRKTSvKwphRiuCW6cL+zOScJbNrdhXGDahMN1XL+0S7qeEe9bsFnGuMxazxrdKLcEbfCObqnsTv4l9E6rCflhKeGT5Rr35hp/JLS5lLLFtT6/KeceZG57DdqZqce2kGi+kpOhTE07nJ80O5HD4A= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350819931585.775417026771; Mon, 8 Sep 2025 10:00:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9C-0007VC-99; Mon, 08 Sep 2025 12:55:18 -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 1uvf99-0007Ol-Sv for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf90-0001f6-OF for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:15 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-227-cc43yLrNMhuVI147Jgj2Aw-1; Mon, 08 Sep 2025 12:54:56 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3E42A180028C; Mon, 8 Sep 2025 16:54:55 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1439D300018D; Mon, 8 Sep 2025 16:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7Qz8UmxjaGZRGFIy+sOgYJ5XRF2Jf2PxiX5C7M0SeBQ=; b=LdAjmVzi5HiiAlqcVmAW//kELLlDLqHHjGXoF631YNNbD+iO0lpKdU8L4QJHlyP3sTS+X+ L50oUENF5EDvSaqP7q1YGyFwIE4cCJG/txM8jupptbxuFNytFCBbW0uHfotAvzMJNc/kIP cuW/h276C8YPBrcGD5A/ZV4w5jcxPtw= X-MC-Unique: cc43yLrNMhuVI147Jgj2Aw-1 X-Mimecast-MFC-AGG-ID: cc43yLrNMhuVI147Jgj2Aw_1757350495 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Levon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 21/31] vfio-user/pci.c: update VFIOUserPCIDevice declaration Date: Mon, 8 Sep 2025 18:53:44 +0200 Message-ID: <20250908165354.1731444-22-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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 @redhat.com) X-ZM-MESSAGEID: 1757350822004116600 From: Mark Cave-Ayland Update the VFIOUserPCIDevice declaration so that it is closer to our coding guidelines: add a blank line after the parent object. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: John Levon Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-12-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio-user/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c index dfaa89498dfd034dde73703acaab788c6f50afed..29cb592e9cf4d9a5923366dba2e= ce8d3266fe515 100644 --- a/hw/vfio-user/pci.c +++ b/hw/vfio-user/pci.c @@ -21,6 +21,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VFIOUserPCIDevice, VFIO_USER_P= CI) =20 struct VFIOUserPCIDevice { VFIOPCIDevice device; + SocketAddress *socket; bool send_queued; /* all sends are queued */ uint32_t wait_time; /* timeout for message replies */ --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350589; cv=none; d=zohomail.com; s=zohoarc; b=TqLrYGb9S0Y1w7aBUbtkufN4aU08UFquG8UjCUhodjm614EJohXI+VQSE9rrEdR+vZPJ4/IX+P7WyyEOEEDarexUCPKdqcXhXPExNuPiWQwHqhuoc2L+3vtusgWu7SrSYKBGoDkWBcJbMrts+G3SCmRVcOrCM2CCPxNGMBvXZ64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350589; 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=HTf9EWa3cQi5k7E0A65swuWdTLKr3lHlsuS/MO2SbXI=; b=Fwe/ZhWUXeysdorS+xQoi1w/yg+RFghl/5jh32bxb7TbLTiiWichCji64or7W8yGryUjoISJcFSCURF2k88nnq+3e0jOoLvzt5umd2GBlc0aZjqercszlY9kCDgigcfIq64WYcJEl8nwyUGNwwME1C7Q+xI0azD6wVvUyxhWuH4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350589271950.7301848729288; Mon, 8 Sep 2025 09:56:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9H-0007hl-Bq; Mon, 08 Sep 2025 12:55:23 -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 1uvf9F-0007at-1H for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf94-0001fI-SK for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:20 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-_xufGYiYNQ-mtm6-t9ld0Q-1; Mon, 08 Sep 2025 12:54:59 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 99CAD18002E9; Mon, 8 Sep 2025 16:54:57 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BA80D30001A4; Mon, 8 Sep 2025 16:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350501; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HTf9EWa3cQi5k7E0A65swuWdTLKr3lHlsuS/MO2SbXI=; b=bognFE0rrIINW43b7oLxi9+XTUkwOek3POgw2MQNMH2eX3qJAoTJAmZEU/zowrVS+XB0lw siTA/rxJG1tGN2oRORHYxiUZTA9DD7tiDzr5p5eXZ0HReG2wtyxkMzYOJzvki97+qEnW77 WEVloJH1JsYrb+Q4XaVfQ4rkDufiowg= X-MC-Unique: _xufGYiYNQ-mtm6-t9ld0Q-1 X-Mimecast-MFC-AGG-ID: _xufGYiYNQ-mtm6-t9ld0Q_1757350497 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , John Levon , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 22/31] vfio-user/pci.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:45 +0200 Message-ID: <20250908165354.1731444-23-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350591762124101 From: Mark Cave-Ayland Use QOM casts to convert between VFIOUserPCIDevice and VFIOPCIDevice instead of accessing device directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: John Levon Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-13-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio-user/pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c index 29cb592e9cf4d9a5923366dba2ece8d3266fe515..7b6a6514f6c22c64ea52d4e8e99= b263ed44de522 100644 --- a/hw/vfio-user/pci.c +++ b/hw/vfio-user/pci.c @@ -214,8 +214,9 @@ static void vfio_user_compute_needs_reset(VFIODevice *v= basedev) =20 static Object *vfio_user_pci_get_object(VFIODevice *vbasedev) { - VFIOUserPCIDevice *vdev =3D container_of(vbasedev, VFIOUserPCIDevice, - device.vbasedev); + VFIOUserPCIDevice *vdev =3D VFIO_USER_PCI(container_of(vbasedev, + VFIOPCIDevice, + vbasedev)); =20 return OBJECT(vdev); } @@ -420,7 +421,7 @@ static void vfio_user_pci_set_socket(Object *obj, Visit= or *v, const char *name, VFIOUserPCIDevice *udev =3D VFIO_USER_PCI(obj); bool success; =20 - if (udev->device.vbasedev.proxy) { + if (VFIO_PCI_BASE(udev)->vbasedev.proxy) { error_setg(errp, "Proxy is connected"); return; } --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350733; cv=none; d=zohomail.com; s=zohoarc; b=V9j5O+ar5kgH6eJMC5vA28QIEQ5/WBaDrGPzGZtJycxZU/tE/rN9voJMLisn8l33NHQOtSbYL5xJHArRXy+PTi3BFfwZQKdWFj0zdoub1moU0FrV772BxJ+K69TooZ58itMgtauBK08khvrxkbr/FKhv/zA/KNmEKhE9LeTSxm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350733; 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=6uTUGkT6l2VFj2s62kA2cob0zVa39/BxqJ9b2QjmEaY=; b=efMFPkbNd0WTazWYazocQX9E63luPDrvinqpT5WQBhDR/U0qwKuY/+AbcTauUcRpYQPy5nTGQA6RuQpOl/4/s+FMQFmXveJF5hLtCKzlrCgoh/lvybi76JKZcKtq9zXemwzhxMWIzuiAcFpxTtL5iAnWV1hz4V5acnyR3+fyutw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350733616346.1200639824599; Mon, 8 Sep 2025 09:58:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9F-0007bh-PM; Mon, 08 Sep 2025 12:55:21 -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 1uvf9B-0007R1-NC for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf94-0001qU-JJ for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:17 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-244-DWifPo0KMlGeX7YEYqs4Bw-1; Mon, 08 Sep 2025 12:55:02 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4CFFF19540F1; Mon, 8 Sep 2025 16:55:00 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 220A53000198; Mon, 8 Sep 2025 16:54:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6uTUGkT6l2VFj2s62kA2cob0zVa39/BxqJ9b2QjmEaY=; b=ev+gxFBPA7Macruw5VYl/MwsDGN5liqzBdj3xw88Be31VGHfypIZUdmfD14hPbydTY8gUa aD0rWXSM3TqmcBcJCWzwiuDNNjir02bZajLejF0xIUw48YuCpi3Zqsi31nKE09UYMU6dQS bgdW4jTeiCpyb3e2SgXrHpdO/d0eX+c= X-MC-Unique: DWifPo0KMlGeX7YEYqs4Bw-1 X-Mimecast-MFC-AGG-ID: DWifPo0KMlGeX7YEYqs4Bw_1757350501 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , John Levon , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 23/31] vfio-user/pci.c: rename VFIOUserPCIDevice device field to parent_obj Date: Mon, 8 Sep 2025 18:53:46 +0200 Message-ID: <20250908165354.1731444-24-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350735370124100 From: Mark Cave-Ayland Now that nothing accesses the device field directly, rename device to parent_obj as per our current coding guidelines. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: John Levon Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-14-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio-user/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c index 7b6a6514f6c22c64ea52d4e8e99b263ed44de522..c3947a8f2ec9c0309b4484b95a4= bd5439fa1d17f 100644 --- a/hw/vfio-user/pci.c +++ b/hw/vfio-user/pci.c @@ -20,7 +20,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VFIOUserPCIDevice, VFIO_USER_PCI) =20 struct VFIOUserPCIDevice { - VFIOPCIDevice device; + VFIOPCIDevice parent_obj; =20 SocketAddress *socket; bool send_queued; /* all sends are queued */ --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350681; cv=none; d=zohomail.com; s=zohoarc; b=R98rkVzb1O+36TgIM8vR/8SfndQXNLkaTu0xV0gQIJ70DBWGu0A9wfqERlDgTjFXLoVnRomb6Ha20pO7VHjxR9vF1hnq9El7Tv1ULxG1Aidx9J3ck5yo0IFOBnoILuDH76lK/eXUvfbKfpQiYwuPWmCu6FjrfP6I9NtUdtq3+p0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350681; 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=gPEUCaZYygqJQz764hQRVW735UON+2BLl3xNtcGzDWM=; b=TOgzCMMi4JKK6LLoWhp4l6EzPZ6P3OxZ1RmtvHHfxnyYBz8Dq1hyztHTcYRSSZHYoF3CVTeNmSJbxtBI7cl5dku625JotxFtQXzZaKNAqo7XYw20Y4nu9QSTMOqDOq0oetAJMB2HPAoiBadpNNN4aqsehJwI1jyYC4ZhkOgTbh4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350681547337.0722834675498; Mon, 8 Sep 2025 09:58:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9D-0007WR-AQ; Mon, 08 Sep 2025 12:55:19 -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 1uvf9A-0007QD-Mi for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf93-0001qa-Q5 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:16 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-k0Cu7P1WOnKhQ_EM-2lf-A-1; Mon, 08 Sep 2025 12:55:03 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B22871800452; Mon, 8 Sep 2025 16:55:02 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C89B6300018D; Mon, 8 Sep 2025 16:55:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gPEUCaZYygqJQz764hQRVW735UON+2BLl3xNtcGzDWM=; b=DYBBmGVWvUZ4VrZFeMFr/QcsJlfwJLpsuuzwLHCxoX5a2jWZyyBoC5Xk3bQXU1M3c+uRwh ZEydAqrvZ5rP1c3LzOOHDG4VZoJiXGSX7pd7FD2lgXovEQDui5TsxbOvk8XOGApTGfMEkG uOUVrEcAz+zttXzNPU5jRme9kMp1i3Q= X-MC-Unique: k0Cu7P1WOnKhQ_EM-2lf-A-1 X-Mimecast-MFC-AGG-ID: k0Cu7P1WOnKhQ_EM-2lf-A_1757350502 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 24/31] vfio/pci.h: update VFIOPCIDevice declaration Date: Mon, 8 Sep 2025 18:53:47 +0200 Message-ID: <20250908165354.1731444-25-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350684760124100 From: Mark Cave-Ayland Update the VFIOPCIDevice declaration so that it is closer to our coding guidelines: add a blank line after the parent object. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-15-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/pci.h | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 96144b6fdeb94dccf6c0beecf039a12b9845c59b..2db76b6f4fb58679d65b651f050= 7c474e5c05857 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -124,6 +124,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(VFIOPCIDevice, VFIO_PCI_BASE) =20 struct VFIOPCIDevice { PCIDevice pdev; + VFIODevice vbasedev; VFIOINTx intx; unsigned int config_size; --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350598; cv=none; d=zohomail.com; s=zohoarc; b=Jnz2X9EIOx8Q1h/ZF9bQUMex6nca6/BK18PsKhg+TEMhDzfR1iD4/oAQdOFTXR7TZExV/mF7ui/xrAEh9MEas79mFo7xfgjnaRik6GjmMSwQHhktOXdh63U2LG/B58WN7nVdOqrwTlqE7vMEj8Ukzm9DrlHCEqb57++pGCw57K4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350598; 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=Unov/+9wCa1CgQRxZUAu5LOV2dzyHa5fZ7go7/hv/VU=; b=UccqcQG1d7a+GNyqUwik72ApG8ewDkkNSMBMFC4WvWKWHJjqq+F2Y3iaVd6AVdBmpMYtMqZDluYX0arIlwccS806H5wFRvtcv8f6YRu4E7k1YGxyk7NMAko4O1eb8lVVXVy4L/+ztn4aVe2Nv4yZOlftJes2EfPvFe9WZki6bhw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350598819456.8941902811936; Mon, 8 Sep 2025 09:56:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9J-0007lI-Px; Mon, 08 Sep 2025 12:55:25 -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 1uvf9H-0007hZ-8q for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf96-0001r3-NJ for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:22 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-1Ds6UxzrN-CxxnD8aBDBuw-1; Mon, 08 Sep 2025 12:55:06 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CFC4018002C3; Mon, 8 Sep 2025 16:55:04 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3B6DB3000198; Mon, 8 Sep 2025 16:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Unov/+9wCa1CgQRxZUAu5LOV2dzyHa5fZ7go7/hv/VU=; b=WR01faMEVBY+izLoQnXFJwCuzhacQ2WtVmCQYVBm52ApiMBX5BFvygmv1/LwXcVh5YQvJZ kq5AKqRcGcw4oTaD+HJK4KtM0PslnpOz1+fmWmdzgH+v89VO/vZpS1RBLilrffROGd3U9w QMC76c3n5nysyU58/xqnb7FoXK+GCm4= X-MC-Unique: 1Ds6UxzrN-CxxnD8aBDBuw-1 X-Mimecast-MFC-AGG-ID: 1Ds6UxzrN-CxxnD8aBDBuw_1757350504 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 25/31] vfio/pci.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:48 +0200 Message-ID: <20250908165354.1731444-26-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350599529116600 From: Mark Cave-Ayland Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of accessing pdev directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-17-mark.cave= ayland@nutanix.com [ clg: Updated vfio_sub_page_bar_update_mappings() ] Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/pci.c | 204 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 121 insertions(+), 83 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 3fe5b03eb1160bb66fc4ae3942d14a2d71b4431a..052591d2c970a1668db390f31ea= 06cd90e6a420f 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -117,6 +117,7 @@ static void vfio_intx_mmap_enable(void *opaque) static void vfio_intx_interrupt(void *opaque) { VFIOPCIDevice *vdev =3D opaque; + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 if (!event_notifier_test_and_clear(&vdev->intx.interrupt)) { return; @@ -125,7 +126,7 @@ static void vfio_intx_interrupt(void *opaque) trace_vfio_intx_interrupt(vdev->vbasedev.name, 'A' + vdev->intx.pin); =20 vdev->intx.pending =3D true; - pci_irq_assert(&vdev->pdev); + pci_irq_assert(pdev); vfio_mmap_set_enabled(vdev, false); if (vdev->intx.mmap_timeout) { timer_mod(vdev->intx.mmap_timer, @@ -136,6 +137,7 @@ static void vfio_intx_interrupt(void *opaque) void vfio_pci_intx_eoi(VFIODevice *vbasedev) { VFIOPCIDevice *vdev =3D container_of(vbasedev, VFIOPCIDevice, vbasedev= ); + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 if (!vdev->intx.pending) { return; @@ -144,13 +146,14 @@ void vfio_pci_intx_eoi(VFIODevice *vbasedev) trace_vfio_pci_intx_eoi(vbasedev->name); =20 vdev->intx.pending =3D false; - pci_irq_deassert(&vdev->pdev); + pci_irq_deassert(pdev); vfio_device_irq_unmask(vbasedev, VFIO_PCI_INTX_IRQ_INDEX); } =20 static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp) { #ifdef CONFIG_KVM + PCIDevice *pdev =3D PCI_DEVICE(vdev); int irq_fd =3D event_notifier_get_fd(&vdev->intx.interrupt); =20 if (vdev->no_kvm_intx || !kvm_irqfds_enabled() || @@ -163,7 +166,7 @@ static bool vfio_intx_enable_kvm(VFIOPCIDevice *vdev, E= rror **errp) qemu_set_fd_handler(irq_fd, NULL, NULL, vdev); vfio_device_irq_mask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vdev->intx.pending =3D false; - pci_irq_deassert(&vdev->pdev); + pci_irq_deassert(pdev); =20 /* Get an eventfd for resample/unmask */ if (!vfio_notifier_init(vdev, &vdev->intx.unmask, "intx-unmask", 0, er= rp)) { @@ -241,6 +244,8 @@ static bool vfio_cpr_intx_enable_kvm(VFIOPCIDevice *vde= v, Error **errp) static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev) { #ifdef CONFIG_KVM + PCIDevice *pdev =3D PCI_DEVICE(vdev); + if (!vdev->intx.kvm_accel) { return; } @@ -251,7 +256,7 @@ static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev) */ vfio_device_irq_mask(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vdev->intx.pending =3D false; - pci_irq_deassert(&vdev->pdev); + pci_irq_deassert(pdev); =20 /* Tell KVM to stop listening for an INTx irqfd */ if (kvm_irqchip_remove_irqfd_notifier_gsi(kvm_state, &vdev->intx.inter= rupt, @@ -307,7 +312,7 @@ static void vfio_intx_routing_notifier(PCIDevice *pdev) return; } =20 - route =3D pci_device_route_intx_to_irq(&vdev->pdev, vdev->intx.pin); + route =3D pci_device_route_intx_to_irq(pdev, vdev->intx.pin); =20 if (pci_intx_route_changed(&vdev->intx.route, &route)) { vfio_intx_update(vdev, &route); @@ -324,7 +329,8 @@ static void vfio_irqchip_change(Notifier *notify, void = *data) =20 static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp) { - uint8_t pin =3D vfio_pci_read_config(&vdev->pdev, PCI_INTERRUPT_PIN, 1= ); + PCIDevice *pdev =3D PCI_DEVICE(vdev); + uint8_t pin =3D vfio_pci_read_config(pdev, PCI_INTERRUPT_PIN, 1); Error *err =3D NULL; int32_t fd; =20 @@ -342,7 +348,7 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error= **errp) } =20 vdev->intx.pin =3D pin - 1; /* Pin A (1) -> irq[0] */ - pci_config_set_interrupt_pin(vdev->pdev.config, pin); + pci_config_set_interrupt_pin(pdev->config, pin); =20 #ifdef CONFIG_KVM /* @@ -350,7 +356,7 @@ static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error= **errp) * where we won't actually use the result anyway. */ if (kvm_irqfds_enabled() && kvm_resamplefds_enabled()) { - vdev->intx.route =3D pci_device_route_intx_to_irq(&vdev->pdev, + vdev->intx.route =3D pci_device_route_intx_to_irq(pdev, vdev->intx.pin); } #endif @@ -390,13 +396,14 @@ skip_signaling: =20 static void vfio_intx_disable(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); int fd; =20 timer_del(vdev->intx.mmap_timer); vfio_intx_disable_kvm(vdev); vfio_device_irq_disable(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX); vdev->intx.pending =3D false; - pci_irq_deassert(&vdev->pdev); + pci_irq_deassert(pdev); vfio_mmap_set_enabled(vdev, true); =20 fd =3D event_notifier_get_fd(&vdev->intx.interrupt); @@ -428,6 +435,7 @@ static void vfio_msi_interrupt(void *opaque) { VFIOMSIVector *vector =3D opaque; VFIOPCIDevice *vdev =3D vector->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); MSIMessage (*get_msg)(PCIDevice *dev, unsigned vector); void (*notify)(PCIDevice *dev, unsigned vector); MSIMessage msg; @@ -442,9 +450,9 @@ static void vfio_msi_interrupt(void *opaque) notify =3D msix_notify; =20 /* A masked vector firing needs to use the PBA, enable it */ - if (msix_is_masked(&vdev->pdev, nr)) { + if (msix_is_masked(pdev, nr)) { set_bit(nr, vdev->msix->pending); - memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, true); + memory_region_set_enabled(&pdev->msix_pba_mmio, true); trace_vfio_msix_pba_enable(vdev->vbasedev.name); } } else if (vdev->interrupt =3D=3D VFIO_INT_MSI) { @@ -454,9 +462,9 @@ static void vfio_msi_interrupt(void *opaque) abort(); } =20 - msg =3D get_msg(&vdev->pdev, nr); + msg =3D get_msg(pdev, nr); trace_vfio_msi_interrupt(vdev->vbasedev.name, nr, msg.address, msg.dat= a); - notify(&vdev->pdev, nr); + notify(pdev, nr); } =20 void vfio_pci_msi_set_handler(VFIOPCIDevice *vdev, int nr, bool enable) @@ -495,6 +503,7 @@ static int vfio_enable_msix_no_vec(VFIOPCIDevice *vdev) =20 static int vfio_enable_vectors(VFIOPCIDevice *vdev, bool msix) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); struct vfio_irq_set *irq_set; int ret =3D 0, i, argsz; int32_t *fds; @@ -537,7 +546,7 @@ static int vfio_enable_vectors(VFIOPCIDevice *vdev, boo= l msix) */ if (vdev->msi_vectors[i].use) { if (vdev->msi_vectors[i].virq < 0 || - (msix && msix_is_masked(&vdev->pdev, i))) { + (msix && msix_is_masked(pdev, i))) { fd =3D event_notifier_get_fd(&vdev->msi_vectors[i].interru= pt); } else { fd =3D event_notifier_get_fd(&vdev->msi_vectors[i].kvm_int= errupt); @@ -557,12 +566,14 @@ static int vfio_enable_vectors(VFIOPCIDevice *vdev, b= ool msix) void vfio_pci_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector, int vector_n, bool msix) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); + if ((msix && vdev->no_kvm_msix) || (!msix && vdev->no_kvm_msi)) { return; } =20 vector->virq =3D kvm_irqchip_add_msi_route(&vfio_route_change, - vector_n, &vdev->pdev); + vector_n, pdev); } =20 static void vfio_connect_kvm_msi_virq(VFIOMSIVector *vector, int nr) @@ -631,7 +642,7 @@ static void set_irq_signalling(VFIODevice *vbasedev, VF= IOMSIVector *vector, void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr) { VFIOMSIVector *vector =3D &vdev->msi_vectors[nr]; - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); Error *local_err =3D NULL; =20 vector->vdev =3D vdev; @@ -720,7 +731,7 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, uns= igned int nr, clear_bit(nr, vdev->msix->pending); if (find_first_bit(vdev->msix->pending, vdev->nr_vectors) =3D=3D vdev->nr_vectors) { - memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, false); + memory_region_set_enabled(&pdev->msix_pba_mmio, false); trace_vfio_msix_pba_disable(vdev->vbasedev.name); } =20 @@ -771,7 +782,9 @@ static void vfio_msix_vector_release(PCIDevice *pdev, u= nsigned int nr) =20 void vfio_pci_msix_set_notifiers(VFIOPCIDevice *vdev) { - msix_set_vector_notifiers(&vdev->pdev, vfio_msix_vector_use, + PCIDevice *pdev =3D PCI_DEVICE(vdev); + + msix_set_vector_notifiers(pdev, vfio_msix_vector_use, vfio_msix_vector_release, NULL); } =20 @@ -798,6 +811,7 @@ void vfio_pci_commit_kvm_msi_virq_batch(VFIOPCIDevice *= vdev) =20 static void vfio_msix_enable(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); int ret; =20 vfio_disable_interrupts(vdev); @@ -814,7 +828,7 @@ static void vfio_msix_enable(VFIOPCIDevice *vdev) */ vfio_pci_prepare_kvm_msi_virq_batch(vdev); =20 - if (msix_set_vector_notifiers(&vdev->pdev, vfio_msix_vector_use, + if (msix_set_vector_notifiers(pdev, vfio_msix_vector_use, vfio_msix_vector_release, NULL)) { error_report("vfio: msix_set_vector_notifiers failed"); } @@ -852,11 +866,12 @@ static void vfio_msix_enable(VFIOPCIDevice *vdev) =20 static void vfio_msi_enable(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); int ret, i; =20 vfio_disable_interrupts(vdev); =20 - vdev->nr_vectors =3D msi_nr_vectors_allocated(&vdev->pdev); + vdev->nr_vectors =3D msi_nr_vectors_allocated(pdev); retry: /* * Setting vector notifiers needs to enable route for each vector. @@ -949,10 +964,11 @@ static void vfio_msi_disable_common(VFIOPCIDevice *vd= ev) =20 static void vfio_msix_disable(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); Error *err =3D NULL; int i; =20 - msix_unset_vector_notifiers(&vdev->pdev); + msix_unset_vector_notifiers(pdev); =20 /* * MSI-X will only release vectors if MSI-X is still enabled on the @@ -960,8 +976,8 @@ static void vfio_msix_disable(VFIOPCIDevice *vdev) */ for (i =3D 0; i < vdev->nr_vectors; i++) { if (vdev->msi_vectors[i].use) { - vfio_msix_vector_release(&vdev->pdev, i); - msix_vector_unuse(&vdev->pdev, i); + vfio_msix_vector_release(pdev, i); + msix_vector_unuse(pdev, i); } } =20 @@ -998,6 +1014,7 @@ static void vfio_msi_disable(VFIOPCIDevice *vdev) =20 static void vfio_update_msi(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); int i; =20 for (i =3D 0; i < vdev->nr_vectors; i++) { @@ -1008,8 +1025,8 @@ static void vfio_update_msi(VFIOPCIDevice *vdev) continue; } =20 - msg =3D msi_get_message(&vdev->pdev, i); - vfio_update_kvm_msi_virq(vector, msg, &vdev->pdev); + msg =3D msi_get_message(pdev, i); + vfio_update_kvm_msi_virq(vector, msg, pdev); } } =20 @@ -1171,13 +1188,14 @@ static const MemoryRegionOps vfio_rom_ops =3D { =20 static void vfio_pci_size_rom(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); VFIODevice *vbasedev =3D &vdev->vbasedev; uint32_t orig, size =3D cpu_to_le32((uint32_t)PCI_ROM_ADDRESS_MASK); char *name; =20 - if (vdev->pdev.romfile || !vdev->pdev.rom_bar) { + if (pdev->romfile || !pdev->rom_bar) { /* Since pci handles romfile, just print a message and return */ - if (vfio_opt_rom_in_denylist(vdev) && vdev->pdev.romfile) { + if (vfio_opt_rom_in_denylist(vdev) && pdev->romfile) { warn_report("Device at %s is known to cause system instability" " issues during option rom execution", vdev->vbasedev.name); @@ -1206,7 +1224,7 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev) } =20 if (vfio_opt_rom_in_denylist(vdev)) { - if (vdev->pdev.rom_bar > 0) { + if (pdev->rom_bar > 0) { warn_report("Device at %s is known to cause system instability" " issues during option rom execution", vdev->vbasedev.name); @@ -1225,12 +1243,12 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev) =20 name =3D g_strdup_printf("vfio[%s].rom", vdev->vbasedev.name); =20 - memory_region_init_io(&vdev->pdev.rom, OBJECT(vdev), + memory_region_init_io(&pdev->rom, OBJECT(vdev), &vfio_rom_ops, vdev, name, size); g_free(name); =20 - pci_register_bar(&vdev->pdev, PCI_ROM_SLOT, - PCI_BASE_ADDRESS_SPACE_MEMORY, &vdev->pdev.rom); + pci_register_bar(pdev, PCI_ROM_SLOT, + PCI_BASE_ADDRESS_SPACE_MEMORY, &pdev->rom); =20 vdev->rom_read_failed =3D false; } @@ -1503,6 +1521,7 @@ static void vfio_disable_interrupts(VFIOPCIDevice *vd= ev) =20 static bool vfio_msi_setup(VFIOPCIDevice *vdev, int pos, Error **errp) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint16_t ctrl; bool msi_64bit, msi_maskbit; int ret, entries; @@ -1523,7 +1542,7 @@ static bool vfio_msi_setup(VFIOPCIDevice *vdev, int p= os, Error **errp) =20 trace_vfio_msi_setup(vdev->vbasedev.name, pos); =20 - ret =3D msi_init(&vdev->pdev, pos, entries, msi_64bit, msi_maskbit, &e= rr); + ret =3D msi_init(pdev, pos, entries, msi_64bit, msi_maskbit, &err); if (ret < 0) { if (ret =3D=3D -ENOTSUP) { return true; @@ -1716,6 +1735,7 @@ static bool vfio_pci_relocate_msix(VFIOPCIDevice *vde= v, Error **errp) */ static bool vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint8_t pos; uint16_t ctrl; uint32_t table, pba; @@ -1723,7 +1743,7 @@ static bool vfio_msix_early_setup(VFIOPCIDevice *vdev= , Error **errp) VFIOMSIXInfo *msix; int ret; =20 - pos =3D pci_find_capability(&vdev->pdev, PCI_CAP_ID_MSIX); + pos =3D pci_find_capability(pdev, PCI_CAP_ID_MSIX); if (!pos) { return true; } @@ -1815,12 +1835,13 @@ static bool vfio_msix_early_setup(VFIOPCIDevice *vd= ev, Error **errp) =20 static bool vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); int ret; Error *err =3D NULL; =20 vdev->msix->pending =3D g_new0(unsigned long, BITS_TO_LONGS(vdev->msix->entries)); - ret =3D msix_init(&vdev->pdev, vdev->msix->entries, + ret =3D msix_init(pdev, vdev->msix->entries, vdev->bars[vdev->msix->table_bar].mr, vdev->msix->table_bar, vdev->msix->table_offset, vdev->bars[vdev->msix->pba_bar].mr, @@ -1852,7 +1873,7 @@ static bool vfio_msix_setup(VFIOPCIDevice *vdev, int = pos, Error **errp) * vector-use notifier is called, which occurs on unmask, we test whet= her * PBA emulation is needed and again disable if not. */ - memory_region_set_enabled(&vdev->pdev.msix_pba_mmio, false); + memory_region_set_enabled(&pdev->msix_pba_mmio, false); =20 /* * The emulated machine may provide a paravirt interface for MSIX setup @@ -1864,7 +1885,7 @@ static bool vfio_msix_setup(VFIOPCIDevice *vdev, int = pos, Error **errp) */ if (object_property_get_bool(OBJECT(qdev_get_machine()), "vfio-no-msix-emulation", NULL)) { - memory_region_set_enabled(&vdev->pdev.msix_table_mmio, false); + memory_region_set_enabled(&pdev->msix_table_mmio, false); } =20 return true; @@ -1872,10 +1893,12 @@ static bool vfio_msix_setup(VFIOPCIDevice *vdev, in= t pos, Error **errp) =20 void vfio_pci_teardown_msi(VFIOPCIDevice *vdev) { - msi_uninit(&vdev->pdev); + PCIDevice *pdev =3D PCI_DEVICE(vdev); + + msi_uninit(pdev); =20 if (vdev->msix) { - msix_uninit(&vdev->pdev, + msix_uninit(pdev, vdev->bars[vdev->msix->table_bar].mr, vdev->bars[vdev->msix->pba_bar].mr); g_free(vdev->msix->pending); @@ -1936,6 +1959,7 @@ static void vfio_bars_prepare(VFIOPCIDevice *vdev) =20 static void vfio_bar_register(VFIOPCIDevice *vdev, int nr) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); VFIOBAR *bar =3D &vdev->bars[nr]; char *name; =20 @@ -1957,7 +1981,7 @@ static void vfio_bar_register(VFIOPCIDevice *vdev, in= t nr) } } =20 - pci_register_bar(&vdev->pdev, nr, bar->type, bar->mr); + pci_register_bar(pdev, nr, bar->type, bar->mr); } =20 static void vfio_bars_register(VFIOPCIDevice *vdev) @@ -1971,6 +1995,7 @@ static void vfio_bars_register(VFIOPCIDevice *vdev) =20 void vfio_pci_bars_exit(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); int i; =20 for (i =3D 0; i < PCI_ROM_SLOT; i++) { @@ -1984,7 +2009,7 @@ void vfio_pci_bars_exit(VFIOPCIDevice *vdev) } =20 if (vdev->vga) { - pci_unregister_vga(&vdev->pdev); + pci_unregister_vga(pdev); vfio_vga_quirk_exit(vdev); } } @@ -2056,8 +2081,10 @@ static void vfio_set_word_bits(uint8_t *buf, uint16_= t val, uint16_t mask) static void vfio_add_emulated_word(VFIOPCIDevice *vdev, int pos, uint16_t val, uint16_t mask) { - vfio_set_word_bits(vdev->pdev.config + pos, val, mask); - vfio_set_word_bits(vdev->pdev.wmask + pos, ~mask, mask); + PCIDevice *pdev =3D PCI_DEVICE(vdev); + + vfio_set_word_bits(pdev->config + pos, val, mask); + vfio_set_word_bits(pdev->wmask + pos, ~mask, mask); vfio_set_word_bits(vdev->emulated_config_bits + pos, mask, mask); } =20 @@ -2069,8 +2096,10 @@ static void vfio_set_long_bits(uint8_t *buf, uint32_= t val, uint32_t mask) static void vfio_add_emulated_long(VFIOPCIDevice *vdev, int pos, uint32_t val, uint32_t mask) { - vfio_set_long_bits(vdev->pdev.config + pos, val, mask); - vfio_set_long_bits(vdev->pdev.wmask + pos, ~mask, mask); + PCIDevice *pdev =3D PCI_DEVICE(vdev); + + vfio_set_long_bits(pdev->config + pos, val, mask); + vfio_set_long_bits(pdev->wmask + pos, ~mask, mask); vfio_set_long_bits(vdev->emulated_config_bits + pos, mask, mask); } =20 @@ -2078,7 +2107,8 @@ static void vfio_pci_enable_rp_atomics(VFIOPCIDevice = *vdev) { struct vfio_device_info_cap_pci_atomic_comp *cap; g_autofree struct vfio_device_info *info =3D NULL; - PCIBus *bus =3D pci_get_bus(&vdev->pdev); + PCIDevice *pdev =3D PCI_DEVICE(vdev); + PCIBus *bus =3D pci_get_bus(pdev); PCIDevice *parent =3D bus->parent_dev; struct vfio_info_cap_header *hdr; uint32_t mask =3D 0; @@ -2094,8 +2124,8 @@ static void vfio_pci_enable_rp_atomics(VFIOPCIDevice = *vdev) if (pci_bus_is_root(bus) || !parent || !parent->exp.exp_cap || pcie_cap_get_type(parent) !=3D PCI_EXP_TYPE_ROOT_PORT || pcie_cap_get_version(parent) !=3D PCI_EXP_FLAGS_VER2 || - vdev->pdev.devfn || - vdev->pdev.cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { + pdev->devfn || + pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { return; } =20 @@ -2139,8 +2169,10 @@ static void vfio_pci_enable_rp_atomics(VFIOPCIDevice= *vdev) =20 static void vfio_pci_disable_rp_atomics(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); + if (vdev->clear_parent_atomics_on_exit) { - PCIDevice *parent =3D pci_get_bus(&vdev->pdev)->parent_dev; + PCIDevice *parent =3D pci_get_bus(pdev)->parent_dev; uint8_t *pos =3D parent->config + parent->exp.exp_cap + PCI_EXP_DE= VCAP2; =20 pci_long_test_and_clear_mask(pos, PCI_EXP_DEVCAP2_ATOMIC_COMP32 | @@ -2152,10 +2184,11 @@ static void vfio_pci_disable_rp_atomics(VFIOPCIDevi= ce *vdev) static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size, Error **errp) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint16_t flags; uint8_t type; =20 - flags =3D pci_get_word(vdev->pdev.config + pos + PCI_CAP_FLAGS); + flags =3D pci_get_word(pdev->config + pos + PCI_CAP_FLAGS); type =3D (flags & PCI_EXP_FLAGS_TYPE) >> 4; =20 if (type !=3D PCI_EXP_TYPE_ENDPOINT && @@ -2167,8 +2200,8 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, = int pos, uint8_t size, return false; } =20 - if (!pci_bus_is_express(pci_get_bus(&vdev->pdev))) { - PCIBus *bus =3D pci_get_bus(&vdev->pdev); + if (!pci_bus_is_express(pci_get_bus(pdev))) { + PCIBus *bus =3D pci_get_bus(pdev); PCIDevice *bridge; =20 /* @@ -2200,7 +2233,7 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev, = int pos, uint8_t size, return true; } =20 - } else if (pci_bus_is_root(pci_get_bus(&vdev->pdev))) { + } else if (pci_bus_is_root(pci_get_bus(pdev))) { /* * On a Root Complex bus Endpoints become Root Complex Integrated * Endpoints, which changes the type and clears the LNK & LNK2 fie= lds. @@ -2268,20 +2301,20 @@ static bool vfio_setup_pcie_cap(VFIOPCIDevice *vdev= , int pos, uint8_t size, 1, PCI_EXP_FLAGS_VERS); } =20 - pos =3D pci_add_capability(&vdev->pdev, PCI_CAP_ID_EXP, pos, size, - errp); + pos =3D pci_add_capability(pdev, PCI_CAP_ID_EXP, pos, size, errp); if (pos < 0) { return false; } =20 - vdev->pdev.exp.exp_cap =3D pos; + pdev->exp.exp_cap =3D pos; =20 return true; } =20 static void vfio_check_pcie_flr(VFIOPCIDevice *vdev, uint8_t pos) { - uint32_t cap =3D pci_get_long(vdev->pdev.config + pos + PCI_EXP_DEVCAP= ); + PCIDevice *pdev =3D PCI_DEVICE(vdev); + uint32_t cap =3D pci_get_long(pdev->config + pos + PCI_EXP_DEVCAP); =20 if (cap & PCI_EXP_DEVCAP_FLR) { trace_vfio_check_pcie_flr(vdev->vbasedev.name); @@ -2291,7 +2324,8 @@ static void vfio_check_pcie_flr(VFIOPCIDevice *vdev, = uint8_t pos) =20 static void vfio_check_pm_reset(VFIOPCIDevice *vdev, uint8_t pos) { - uint16_t csr =3D pci_get_word(vdev->pdev.config + pos + PCI_PM_CTRL); + PCIDevice *pdev =3D PCI_DEVICE(vdev); + uint16_t csr =3D pci_get_word(pdev->config + pos + PCI_PM_CTRL); =20 if (!(csr & PCI_PM_CTRL_NO_SOFT_RESET)) { trace_vfio_check_pm_reset(vdev->vbasedev.name); @@ -2301,7 +2335,8 @@ static void vfio_check_pm_reset(VFIOPCIDevice *vdev, = uint8_t pos) =20 static void vfio_check_af_flr(VFIOPCIDevice *vdev, uint8_t pos) { - uint8_t cap =3D pci_get_byte(vdev->pdev.config + pos + PCI_AF_CAP); + PCIDevice *pdev =3D PCI_DEVICE(vdev); + uint8_t cap =3D pci_get_byte(pdev->config + pos + PCI_AF_CAP); =20 if ((cap & PCI_AF_CAP_TP) && (cap & PCI_AF_CAP_FLR)) { trace_vfio_check_af_flr(vdev->vbasedev.name); @@ -2312,7 +2347,7 @@ static void vfio_check_af_flr(VFIOPCIDevice *vdev, ui= nt8_t pos) static bool vfio_add_vendor_specific_cap(VFIOPCIDevice *vdev, int pos, uint8_t size, Error **errp) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 pos =3D pci_add_capability(pdev, PCI_CAP_ID_VNDR, pos, size, errp); if (pos < 0) { @@ -2334,7 +2369,7 @@ static bool vfio_add_vendor_specific_cap(VFIOPCIDevic= e *vdev, int pos, static bool vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **err= p) { ERRP_GUARD(); - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint8_t cap_id, next, size; bool ret; =20 @@ -2420,17 +2455,18 @@ static bool vfio_add_std_cap(VFIOPCIDevice *vdev, u= int8_t pos, Error **errp) =20 static int vfio_setup_rebar_ecap(VFIOPCIDevice *vdev, uint16_t pos) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint32_t ctrl; int i, nbar; =20 - ctrl =3D pci_get_long(vdev->pdev.config + pos + PCI_REBAR_CTRL); + ctrl =3D pci_get_long(pdev->config + pos + PCI_REBAR_CTRL); nbar =3D (ctrl & PCI_REBAR_CTRL_NBAR_MASK) >> PCI_REBAR_CTRL_NBAR_SHIF= T; =20 for (i =3D 0; i < nbar; i++) { uint32_t cap; int size; =20 - ctrl =3D pci_get_long(vdev->pdev.config + pos + PCI_REBAR_CTRL + (= i * 8)); + ctrl =3D pci_get_long(pdev->config + pos + PCI_REBAR_CTRL + (i * 8= )); size =3D (ctrl & PCI_REBAR_CTRL_BAR_SIZE) >> PCI_REBAR_CTRL_BAR_SH= IFT; =20 /* The cap register reports sizes 1MB to 128TB, with 4 reserved bi= ts */ @@ -2468,7 +2504,7 @@ static int vfio_setup_rebar_ecap(VFIOPCIDevice *vdev,= uint16_t pos) =20 static void vfio_add_ext_cap(VFIOPCIDevice *vdev) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint32_t header; uint16_t cap_id, next, size; uint8_t cap_ver; @@ -2562,7 +2598,7 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev) =20 bool vfio_pci_add_capabilities(VFIOPCIDevice *vdev, Error **errp) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 if (!(pdev->config[PCI_STATUS] & PCI_STATUS_CAP_LIST) || !pdev->config[PCI_CAPABILITY_LIST]) { @@ -2579,7 +2615,7 @@ bool vfio_pci_add_capabilities(VFIOPCIDevice *vdev, E= rror **errp) =20 void vfio_pci_pre_reset(VFIOPCIDevice *vdev) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint16_t cmd; =20 vfio_disable_interrupts(vdev); @@ -2796,7 +2832,7 @@ static int vfio_pci_save_config(VFIODevice *vbasedev,= QEMUFile *f, Error **errp) static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f) { VFIOPCIDevice *vdev =3D container_of(vbasedev, VFIOPCIDevice, vbasedev= ); - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); pcibus_t old_addr[PCI_NUM_REGIONS - 1]; int bar, ret; =20 @@ -2844,7 +2880,7 @@ VFIOPCIDevice *vfio_pci_from_vfio_device(VFIODevice *= vbasedev) =20 void vfio_sub_page_bar_update_mappings(VFIOPCIDevice *vdev) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); int page_size =3D qemu_real_host_page_size(); int bar; =20 @@ -2928,6 +2964,7 @@ bool vfio_populate_vga(VFIOPCIDevice *vdev, Error **e= rrp) =20 bool vfio_pci_populate_device(VFIOPCIDevice *vdev, Error **errp) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); VFIODevice *vbasedev =3D &vdev->vbasedev; struct vfio_region_info *reg_info =3D NULL; struct vfio_irq_info irq_info; @@ -2979,7 +3016,7 @@ bool vfio_pci_populate_device(VFIOPCIDevice *vdev, Er= ror **errp) =20 vdev->config_size =3D reg_info->size; if (vdev->config_size =3D=3D PCI_CONFIG_SPACE_SIZE) { - vdev->pdev.cap_present &=3D ~QEMU_PCI_CAP_EXPRESS; + pdev->cap_present &=3D ~QEMU_PCI_CAP_EXPRESS; } vdev->config_offset =3D reg_info->offset; =20 @@ -3183,25 +3220,26 @@ static void vfio_unregister_req_notifier(VFIOPCIDev= ice *vdev) =20 void vfio_pci_config_register_vga(VFIOPCIDevice *vdev) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); assert(vdev->vga !=3D NULL); =20 - pci_register_vga(&vdev->pdev, &vdev->vga->region[QEMU_PCI_VGA_MEM].mem, + pci_register_vga(pdev, &vdev->vga->region[QEMU_PCI_VGA_MEM].mem, &vdev->vga->region[QEMU_PCI_VGA_IO_LO].mem, &vdev->vga->region[QEMU_PCI_VGA_IO_HI].mem); } =20 bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error **errp) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); VFIODevice *vbasedev =3D &vdev->vbasedev; uint32_t config_space_size; int ret; =20 - config_space_size =3D MIN(pci_config_size(&vdev->pdev), vdev->config_s= ize); + config_space_size =3D MIN(pci_config_size(pdev), vdev->config_size); =20 /* Get a copy of config space */ ret =3D vfio_pci_config_space_read(vdev, 0, config_space_size, - vdev->pdev.config); + pdev->config); if (ret < (int)config_space_size) { ret =3D ret < 0 ? -ret : EFAULT; error_setg_errno(errp, ret, "failed to read device config space"); @@ -3286,10 +3324,10 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Err= or **errp) PCI_HEADER_TYPE_MULTI_FUNCTI= ON; =20 /* Restore or clear multifunction, this is always controlled by QEMU */ - if (vdev->pdev.cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { - vdev->pdev.config[PCI_HEADER_TYPE] |=3D PCI_HEADER_TYPE_MULTI_FUNC= TION; + if (pdev->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { + pdev->config[PCI_HEADER_TYPE] |=3D PCI_HEADER_TYPE_MULTI_FUNCTION; } else { - vdev->pdev.config[PCI_HEADER_TYPE] &=3D ~PCI_HEADER_TYPE_MULTI_FUN= CTION; + pdev->config[PCI_HEADER_TYPE] &=3D ~PCI_HEADER_TYPE_MULTI_FUNCTION; } =20 /* @@ -3297,8 +3335,8 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error= **errp) * BAR, such as might be the case with the option ROM, we can get * confusing, unwritable, residual addresses from the host here. */ - memset(&vdev->pdev.config[PCI_BASE_ADDRESS_0], 0, 24); - memset(&vdev->pdev.config[PCI_ROM_ADDRESS], 0, 4); + memset(&pdev->config[PCI_BASE_ADDRESS_0], 0, 24); + memset(&pdev->config[PCI_ROM_ADDRESS], 0, 4); =20 vfio_pci_size_rom(vdev); =20 @@ -3319,7 +3357,7 @@ bool vfio_pci_config_setup(VFIOPCIDevice *vdev, Error= **errp) =20 bool vfio_pci_interrupt_setup(VFIOPCIDevice *vdev, Error **errp) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 /* QEMU emulates all of MSI & MSIX */ if (pdev->cap_present & QEMU_PCI_CAP_MSIX) { @@ -3332,10 +3370,10 @@ bool vfio_pci_interrupt_setup(VFIOPCIDevice *vdev, = Error **errp) vdev->msi_cap_size); } =20 - if (vfio_pci_read_config(&vdev->pdev, PCI_INTERRUPT_PIN, 1)) { + if (vfio_pci_read_config(pdev, PCI_INTERRUPT_PIN, 1)) { vdev->intx.mmap_timer =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, vfio_intx_mmap_enable, vdev); - pci_device_set_intx_routing_notifier(&vdev->pdev, + pci_device_set_intx_routing_notifier(pdev, vfio_intx_routing_notifier); vdev->irqchip_change_notifier.notify =3D vfio_irqchip_change; kvm_irqchip_add_change_notifier(&vdev->irqchip_change_notifier); @@ -3347,7 +3385,7 @@ bool vfio_pci_interrupt_setup(VFIOPCIDevice *vdev, Er= ror **errp) */ if (!cpr_is_incoming() && !vfio_intx_enable(vdev, errp)) { timer_free(vdev->intx.mmap_timer); - pci_device_set_intx_routing_notifier(&vdev->pdev, NULL); + pci_device_set_intx_routing_notifier(pdev, NULL); kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notif= ier); return false; } @@ -3498,7 +3536,7 @@ out_deregister: if (vdev->interrupt =3D=3D VFIO_INT_INTx) { vfio_intx_disable(vdev); } - pci_device_set_intx_routing_notifier(&vdev->pdev, NULL); + pci_device_set_intx_routing_notifier(pdev, NULL); if (vdev->irqchip_change_notifier.notify) { kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier); } @@ -3530,7 +3568,7 @@ static void vfio_exitfn(PCIDevice *pdev) =20 vfio_unregister_req_notifier(vdev); vfio_unregister_err_notifier(vdev); - pci_device_set_intx_routing_notifier(&vdev->pdev, NULL); + pci_device_set_intx_routing_notifier(pdev, NULL); if (vdev->irqchip_change_notifier.notify) { kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier); } --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350582; cv=none; d=zohomail.com; s=zohoarc; b=PR6bLqe9D+ugoZu+3ryWvruJM1svSDK++DPQP0nwsobk4dQMgWyFpAl2rlw2eVSyRmVOL1YzCGckOJQcHWxZ3nj7YB/4P9EdOAlTmObDipsv9Xs1xNbL7gIO82y7+QVcZ/tvUGrLk6ZkR0Njx5FvHWwPgEGpPd9UtbD2Tv4UEMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350582; 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=5AUWhOBpLxOP0IIjacLsrZ3xebJZ3z7XCAI19qfRF2k=; b=gCZ6LgqbAHRcFowF5vMGmaYgzTEfLogSp+FUVE2b3cDOOpIRy3fqPVoFApUz904eYGhjXBH5zYEvHKHcsaQQ+ovQGnRwBpxBKCyl6gkn7IP4J+OKK/B87o6XIy5x1elUmk3DcYIwpMHclFqvwkszTitvNFFNB47TWjrxSjpk8Ck= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350582432130.12651989277242; Mon, 8 Sep 2025 09:56:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9L-0007pu-O2; Mon, 08 Sep 2025 12:55:28 -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 1uvf9I-0007kb-OX for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf96-0001rI-PN for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:24 -0400 Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-202-W6IGJ274MUaWbJz82vUqLA-1; Mon, 08 Sep 2025 12:55:08 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EB7E819560B0; Mon, 8 Sep 2025 16:55:06 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 57F8530001A4; Mon, 8 Sep 2025 16:55:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5AUWhOBpLxOP0IIjacLsrZ3xebJZ3z7XCAI19qfRF2k=; b=GKW+lffbbVCtfP/wdNao/AXA7MBLtPI0Ep6uICbH+8LXaJHunnrZ5xWqmDJGEY0RS+ACtX aiYyeyHtLTm9PJ9242wh4b9b3oqfboD4VJPjpiKbp5/mEwI99v1A3zM55bymajkZGAGxrd NcDocEx4xEGhx6TMru/Px5DJrGcprew= X-MC-Unique: W6IGJ274MUaWbJz82vUqLA-1 X-Mimecast-MFC-AGG-ID: W6IGJ274MUaWbJz82vUqLA_1757350507 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 26/31] vfio/pci-quirks.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:49 +0200 Message-ID: <20250908165354.1731444-27-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350583634124100 From: Mark Cave-Ayland Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of accessing pdev directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-18-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/pci-quirks.c | 48 ++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 3f002252acfb7ac809107c99bdbdbaf66d56a50d..c97606dbf194d48c80b93acdd7a= 75bbbb475b8f2 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -113,6 +113,7 @@ static uint64_t vfio_generic_window_quirk_data_read(voi= d *opaque, { VFIOConfigWindowQuirk *window =3D opaque; VFIOPCIDevice *vdev =3D window->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint64_t data; =20 /* Always read data reg, discard if window enabled */ @@ -120,7 +121,7 @@ static uint64_t vfio_generic_window_quirk_data_read(voi= d *opaque, addr + window->data_offset, size); =20 if (window->window_enabled) { - data =3D vfio_pci_read_config(&vdev->pdev, window->address_val, si= ze); + data =3D vfio_pci_read_config(pdev, window->address_val, size); trace_vfio_quirk_generic_window_data_read(vdev->vbasedev.name, memory_region_name(window->data_mem), = data); } @@ -133,9 +134,10 @@ static void vfio_generic_window_quirk_data_write(void = *opaque, hwaddr addr, { VFIOConfigWindowQuirk *window =3D opaque; VFIOPCIDevice *vdev =3D window->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 if (window->window_enabled) { - vfio_pci_write_config(&vdev->pdev, window->address_val, data, size= ); + vfio_pci_write_config(pdev, window->address_val, data, size); trace_vfio_quirk_generic_window_data_write(vdev->vbasedev.name, memory_region_name(window->data_mem), = data); return; @@ -156,6 +158,7 @@ static uint64_t vfio_generic_quirk_mirror_read(void *op= aque, { VFIOConfigMirrorQuirk *mirror =3D opaque; VFIOPCIDevice *vdev =3D mirror->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint64_t data; =20 /* Read and discard in case the hardware cares */ @@ -163,7 +166,7 @@ static uint64_t vfio_generic_quirk_mirror_read(void *op= aque, addr + mirror->offset, size); =20 addr +=3D mirror->config_offset; - data =3D vfio_pci_read_config(&vdev->pdev, addr, size); + data =3D vfio_pci_read_config(pdev, addr, size); trace_vfio_quirk_generic_mirror_read(vdev->vbasedev.name, memory_region_name(mirror->mem), addr, data); @@ -175,9 +178,10 @@ static void vfio_generic_quirk_mirror_write(void *opaq= ue, hwaddr addr, { VFIOConfigMirrorQuirk *mirror =3D opaque; VFIOPCIDevice *vdev =3D mirror->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 addr +=3D mirror->config_offset; - vfio_pci_write_config(&vdev->pdev, addr, data, size); + vfio_pci_write_config(pdev, addr, data, size); trace_vfio_quirk_generic_mirror_write(vdev->vbasedev.name, memory_region_name(mirror->mem), addr, data); @@ -211,7 +215,8 @@ static uint64_t vfio_ati_3c3_quirk_read(void *opaque, hwaddr addr, unsigned size) { VFIOPCIDevice *vdev =3D opaque; - uint64_t data =3D vfio_pci_read_config(&vdev->pdev, + PCIDevice *pdev =3D PCI_DEVICE(vdev); + uint64_t data =3D vfio_pci_read_config(pdev, PCI_BASE_ADDRESS_4 + 1, size); =20 trace_vfio_quirk_ati_3c3_read(vdev->vbasedev.name, data); @@ -563,6 +568,7 @@ static uint64_t vfio_nvidia_3d0_quirk_read(void *opaque, { VFIONvidia3d0Quirk *quirk =3D opaque; VFIOPCIDevice *vdev =3D quirk->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); VFIONvidia3d0State old_state =3D quirk->state; uint64_t data =3D vfio_vga_read(&vdev->vga->region[QEMU_PCI_VGA_IO_HI], addr + 0x10, size); @@ -573,7 +579,7 @@ static uint64_t vfio_nvidia_3d0_quirk_read(void *opaque, (quirk->offset & ~(PCI_CONFIG_SPACE_SIZE - 1)) =3D=3D 0x1800) { uint8_t offset =3D quirk->offset & (PCI_CONFIG_SPACE_SIZE - 1); =20 - data =3D vfio_pci_read_config(&vdev->pdev, offset, size); + data =3D vfio_pci_read_config(pdev, offset, size); trace_vfio_quirk_nvidia_3d0_read(vdev->vbasedev.name, offset, size, data); } @@ -586,6 +592,7 @@ static void vfio_nvidia_3d0_quirk_write(void *opaque, h= waddr addr, { VFIONvidia3d0Quirk *quirk =3D opaque; VFIOPCIDevice *vdev =3D quirk->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); VFIONvidia3d0State old_state =3D quirk->state; =20 quirk->state =3D NONE; @@ -599,7 +606,7 @@ static void vfio_nvidia_3d0_quirk_write(void *opaque, h= waddr addr, if ((quirk->offset & ~(PCI_CONFIG_SPACE_SIZE - 1)) =3D=3D 0x1800) { uint8_t offset =3D quirk->offset & (PCI_CONFIG_SPACE_SIZE - 1); =20 - vfio_pci_write_config(&vdev->pdev, offset, data, size); + vfio_pci_write_config(pdev, offset, data, size); trace_vfio_quirk_nvidia_3d0_write(vdev->vbasedev.name, offset, data, size); return; @@ -815,7 +822,7 @@ static void vfio_nvidia_quirk_mirror_write(void *opaque= , hwaddr addr, { VFIOConfigMirrorQuirk *mirror =3D opaque; VFIOPCIDevice *vdev =3D mirror->vdev; - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); LastDataSet *last =3D (LastDataSet *)&mirror->data; =20 vfio_generic_quirk_mirror_write(opaque, addr, data, size); @@ -1005,6 +1012,7 @@ static void vfio_rtl8168_quirk_address_write(void *op= aque, hwaddr addr, { VFIOrtl8168Quirk *rtl =3D opaque; VFIOPCIDevice *vdev =3D rtl->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 rtl->enabled =3D false; =20 @@ -1013,7 +1021,7 @@ static void vfio_rtl8168_quirk_address_write(void *op= aque, hwaddr addr, rtl->addr =3D (uint32_t)data; =20 if (data & 0x80000000U) { /* Do write */ - if (vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX) { + if (pdev->cap_present & QEMU_PCI_CAP_MSIX) { hwaddr offset =3D data & 0xfff; uint64_t val =3D rtl->data; =20 @@ -1021,7 +1029,7 @@ static void vfio_rtl8168_quirk_address_write(void *op= aque, hwaddr addr, (uint16_t)offset, val); =20 /* Write to the proper guest MSI-X table instead */ - memory_region_dispatch_write(&vdev->pdev.msix_table_mmio, + memory_region_dispatch_write(&pdev->msix_table_mmio, offset, val, size_memop(size) | MO_LE, MEMTXATTRS_UNSPECIFIED); @@ -1049,11 +1057,12 @@ static uint64_t vfio_rtl8168_quirk_data_read(void *= opaque, { VFIOrtl8168Quirk *rtl =3D opaque; VFIOPCIDevice *vdev =3D rtl->vdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint64_t data =3D vfio_region_read(&vdev->bars[2].region, addr + 0x70,= size); =20 - if (rtl->enabled && (vdev->pdev.cap_present & QEMU_PCI_CAP_MSIX)) { + if (rtl->enabled && (pdev->cap_present & QEMU_PCI_CAP_MSIX)) { hwaddr offset =3D rtl->addr & 0xfff; - memory_region_dispatch_read(&vdev->pdev.msix_table_mmio, offset, + memory_region_dispatch_read(&pdev->msix_table_mmio, offset, &data, size_memop(size) | MO_LE, MEMTXATTRS_UNSPECIFIED); trace_vfio_quirk_rtl8168_msix_read(vdev->vbasedev.name, offset, da= ta); @@ -1297,7 +1306,7 @@ static void vfio_radeon_set_gfx_only_reset(VFIOPCIDev= ice *vdev) =20 static int vfio_radeon_reset(VFIOPCIDevice *vdev) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); int i, ret =3D 0; uint32_t data; =20 @@ -1454,7 +1463,7 @@ static bool is_valid_std_cap_offset(uint8_t pos) static bool vfio_add_nv_gpudirect_cap(VFIOPCIDevice *vdev, Error **errp) { ERRP_GUARD(); - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); int ret, pos; bool c8_conflict =3D false, d4_conflict =3D false; uint8_t tmp; @@ -1547,6 +1556,7 @@ static bool vfio_add_nv_gpudirect_cap(VFIOPCIDevice *= vdev, Error **errp) static bool vfio_add_vmd_shadow_cap(VFIOPCIDevice *vdev, Error **errp) { ERRP_GUARD(); + PCIDevice *pdev =3D PCI_DEVICE(vdev); uint8_t membar_phys[16]; int ret, pos =3D 0xE8; =20 @@ -1565,7 +1575,7 @@ static bool vfio_add_vmd_shadow_cap(VFIOPCIDevice *vd= ev, Error **errp) return false; } =20 - ret =3D pci_add_capability(&vdev->pdev, PCI_CAP_ID_VNDR, pos, + ret =3D pci_add_capability(pdev, PCI_CAP_ID_VNDR, pos, VMD_SHADOW_CAP_LEN, errp); if (ret < 0) { error_prepend(errp, "Failed to add VMD MEMBAR Shadow cap: "); @@ -1574,10 +1584,10 @@ static bool vfio_add_vmd_shadow_cap(VFIOPCIDevice *= vdev, Error **errp) =20 memset(vdev->emulated_config_bits + pos, 0xFF, VMD_SHADOW_CAP_LEN); pos +=3D PCI_CAP_FLAGS; - pci_set_byte(vdev->pdev.config + pos++, VMD_SHADOW_CAP_LEN); - pci_set_byte(vdev->pdev.config + pos++, VMD_SHADOW_CAP_VER); - pci_set_long(vdev->pdev.config + pos, 0x53484457); /* SHDW */ - memcpy(vdev->pdev.config + pos + 4, membar_phys, 16); + pci_set_byte(pdev->config + pos++, VMD_SHADOW_CAP_LEN); + pci_set_byte(pdev->config + pos++, VMD_SHADOW_CAP_VER); + pci_set_long(pdev->config + pos, 0x53484457); /* SHDW */ + memcpy(pdev->config + pos + 4, membar_phys, 16); =20 return true; } --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350705; cv=none; d=zohomail.com; s=zohoarc; b=RRIS35gUPWo2VcjpWI9z2sgqmokZC33vUKzB8EIU4BTqLBaDKlxIqs5e40mLHzKnl5Fw2e+vVjJGXpOmuQn+LPXeTgDw2CdjGRC5lFjWZwSraXOV0r/SfuZyc8AgPORDXBssZCQGnMrDukpfRTd8uEvq9+Sa2KPtZufUXTcV208= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350705; 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=FlZzZrjzCpbN3RMK+uCMvYdvJ6K/gsub/1q6bJe+ud4=; b=FVp77HsI2hJAQRhLt+Algkl+9RDo9E1jC7phkK8EOYR7BiWLx1IKaNywyVSgxtg81kk21J2TdVAamu/CvtHXoBGGuOSR8osd/1VMyWCZqga3y8+X9DMomn80tPbjoyygEJmWadU9y+589dA04Osu721nxB1aZfcKZ037gkPbah4= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350705880514.2202567633036; Mon, 8 Sep 2025 09:58:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9P-0007wI-4x; Mon, 08 Sep 2025 12:55:31 -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 1uvf9L-0007q3-LE for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf99-0001sF-Ud for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:27 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-440-2-MimYYCNbW44J2e4LtXEg-1; Mon, 08 Sep 2025 12:55:10 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CF6C5180057E; Mon, 8 Sep 2025 16:55:09 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7342B3000198; Mon, 8 Sep 2025 16:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FlZzZrjzCpbN3RMK+uCMvYdvJ6K/gsub/1q6bJe+ud4=; b=OzX0Jn5POqvAdux8qkgqBeGCloYl6T9RiZcGnbXyyBb3xp+2B18EnDrv4dlyb5vVFZA+o7 99uyoAbo/sN51ZNUrGMpDHNYHP8UQLPu9Wqk5S4YHEYKlAQY6Nf2r4khgf3CsH01JFZ/b0 PRSFabRjFZAslziCEvkE/WMbt4YldY8= X-MC-Unique: 2-MimYYCNbW44J2e4LtXEg-1 X-Mimecast-MFC-AGG-ID: 2-MimYYCNbW44J2e4LtXEg_1757350510 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , Steve Sistare , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 27/31] vfio/cpr.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:50 +0200 Message-ID: <20250908165354.1731444-28-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=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 @redhat.com) X-ZM-MESSAGEID: 1757350706901116600 From: Mark Cave-Ayland Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of accessing pdev directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Steve Sistare Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-19-mark.cave= ayland@nutanix.com [ clg: Updated vfio_cpr_set_msi_virq() ] Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/cpr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c index a831243e0207112a9357d7d718bd915a26411e06..f911988adddfdc1c8e8f87d66d1= 647c81f633570 100644 --- a/hw/vfio/cpr.c +++ b/hw/vfio/cpr.c @@ -56,7 +56,7 @@ static void vfio_cpr_claim_vectors(VFIOPCIDevice *vdev, i= nt nr_vectors, { int i, fd; bool pending =3D false; - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); =20 vdev->nr_vectors =3D nr_vectors; vdev->msi_vectors =3D g_new0(VFIOMSIVector, nr_vectors); @@ -99,7 +99,7 @@ static void vfio_cpr_claim_vectors(VFIOPCIDevice *vdev, i= nt nr_vectors, static int vfio_cpr_pci_pre_load(void *opaque) { VFIOPCIDevice *vdev =3D opaque; - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); int size =3D MIN(pci_config_size(pdev), vdev->config_size); int i; =20 @@ -113,7 +113,7 @@ static int vfio_cpr_pci_pre_load(void *opaque) static int vfio_cpr_pci_post_load(void *opaque, int version_id) { VFIOPCIDevice *vdev =3D opaque; - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); int nr_vectors; =20 vfio_sub_page_bar_update_mappings(vdev); @@ -214,7 +214,7 @@ static int set_irqfd_notifier_gsi(KVMState *s, EventNot= ifier *n, static int vfio_cpr_set_msi_virq(VFIOPCIDevice *vdev, Error **errp, bool e= nable) { const char *op =3D (enable ? "enable" : "disable"); - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); int i, nr_vectors, ret =3D 0; =20 if (msix_enabled(pdev)) { --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350926; cv=none; d=zohomail.com; s=zohoarc; b=XPLYJbAbkX8UEYQ3o/2SPqFko22bO7E+YIidD+WeBE/6/NcFB5yaSd4nYw0PErp4XyG6Jhd8yvxcWNa0j2r8RCN3J+oBEV/7tkUHJT7bekVvM9gCSzw+9dqyYGwtybRurln3zVvz2Fb00ZUWiNvsdrZN4nsZTEmJM3KAavJoFh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350926; 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=Zg/jfyUQaksIu0iHJ/vbO+gVCj0KWB4I+W4rrQbdjW0=; b=ik94SsRpFb/5KDzebtYEjHJOyLpkg9I57+tqoAHYdqhUF0JWJ8P39PmAtWfDAqh7ieVFpC9iLvjhlPXnosKHT6OeqllCilJgqWm4MWQ822NDfFDBAsZU1XAI6WzshFLwoOtrL2a/eLFngr78VRN+Rxlnybz5wFzTyC2wtXbFT8s= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175735092659072.02866083246704; Mon, 8 Sep 2025 10:02:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9X-0008HV-4O; Mon, 08 Sep 2025 12:55:39 -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 1uvf9R-00080T-Dn for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf9E-0001sx-FZ for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:31 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-251-xIrKqsX2MtOkMTkX8XkDgg-1; Mon, 08 Sep 2025 12:55:14 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 00EEB18002C7; Mon, 8 Sep 2025 16:55:13 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 56B1C300018D; Mon, 8 Sep 2025 16:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350517; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zg/jfyUQaksIu0iHJ/vbO+gVCj0KWB4I+W4rrQbdjW0=; b=axGcjA47KPyKqcSAKW7TUdGJS62nVIdQIxRx2I8mH3Ygx9sD0i7qb1qyl2IHvIXZg4YUYb z5lfPs3a64LE+O9dIMJFDV+LefkZYEKjVrSZ7ClBEasjjRsHevbrIG3WJaLtunPKy0ZX7b pOG/k7JoQg1nRYZeRRvE4g2YCy99i6U= X-MC-Unique: xIrKqsX2MtOkMTkX8XkDgg-1 X-Mimecast-MFC-AGG-ID: xIrKqsX2MtOkMTkX8XkDgg_1757350513 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , Tomita Moeko , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 28/31] vfio/igd.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:51 +0200 Message-ID: <20250908165354.1731444-29-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350927371116600 From: Mark Cave-Ayland Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of accessing pdev directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Tomita Moeko Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-20-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/igd.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index f116c40ccd933c8e6e7fd99d599c6372c26973e1..4bfa2e0fcd22a811c9dcf2b1c23= 57ad34c9e4a68 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -200,7 +200,7 @@ static bool vfio_pci_igd_opregion_detect(VFIOPCIDevice = *vdev, } =20 /* Hotplugging is not supported for opregion access */ - if (vdev->pdev.qdev.hotplugged) { + if (DEVICE(vdev)->hotplugged) { warn_report("IGD device detected, but OpRegion is not supported " "on hotplugged device."); return false; @@ -260,11 +260,12 @@ static int vfio_pci_igd_copy(VFIOPCIDevice *vdev, PCI= Device *pdev, static int vfio_pci_igd_host_init(VFIOPCIDevice *vdev, struct vfio_region_info *info) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); PCIBus *bus; PCIDevice *host_bridge; int ret; =20 - bus =3D pci_device_root_bus(&vdev->pdev); + bus =3D pci_device_root_bus(pdev); host_bridge =3D pci_find_device(bus, 0, PCI_DEVFN(0, 0)); =20 if (!host_bridge) { @@ -327,13 +328,14 @@ type_init(vfio_pci_igd_register_types) static int vfio_pci_igd_lpc_init(VFIOPCIDevice *vdev, struct vfio_region_info *info) { + PCIDevice *pdev =3D PCI_DEVICE(vdev); PCIDevice *lpc_bridge; int ret; =20 - lpc_bridge =3D pci_find_device(pci_device_root_bus(&vdev->pdev), + lpc_bridge =3D pci_find_device(pci_device_root_bus(pdev), 0, PCI_DEVFN(0x1f, 0)); if (!lpc_bridge) { - lpc_bridge =3D pci_create_simple(pci_device_root_bus(&vdev->pdev), + lpc_bridge =3D pci_create_simple(pci_device_root_bus(pdev), PCI_DEVFN(0x1f, 0), "vfio-pci-igd-lpc-bri= dge"); } =20 @@ -350,13 +352,14 @@ static bool vfio_pci_igd_setup_lpc_bridge(VFIOPCIDevi= ce *vdev, Error **errp) { struct vfio_region_info *host =3D NULL; struct vfio_region_info *lpc =3D NULL; + PCIDevice *pdev =3D PCI_DEVICE(vdev); PCIDevice *lpc_bridge; int ret; =20 /* * Copying IDs or creating new devices are not supported on hotplug */ - if (vdev->pdev.qdev.hotplugged) { + if (DEVICE(vdev)->hotplugged) { error_setg(errp, "IGD LPC is not supported on hotplugged device"); return false; } @@ -366,7 +369,7 @@ static bool vfio_pci_igd_setup_lpc_bridge(VFIOPCIDevice= *vdev, Error **errp) * can stuff host values into, so if there's already one there and it'= s not * one we can hack on, this quirk is no-go. Sorry Q35. */ - lpc_bridge =3D pci_find_device(pci_device_root_bus(&vdev->pdev), + lpc_bridge =3D pci_find_device(pci_device_root_bus(pdev), 0, PCI_DEVFN(0x1f, 0)); if (lpc_bridge && !object_dynamic_cast(OBJECT(lpc_bridge), "vfio-pci-igd-lpc-bridge")) { @@ -510,6 +513,7 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int= nr) static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp) { struct vfio_region_info *opregion =3D NULL; + PCIDevice *pdev =3D PCI_DEVICE(vdev); int ret, gen; uint64_t gms_size =3D 0; uint64_t *bdsm_size; @@ -529,7 +533,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vd= ev, Error **errp) info_report("OpRegion detected on Intel display %x.", vdev->device_id); =20 gen =3D igd_gen(vdev); - gmch =3D vfio_pci_read_config(&vdev->pdev, IGD_GMCH, 4); + gmch =3D vfio_pci_read_config(pdev, IGD_GMCH, 4); =20 /* * For backward compatibility, enable legacy mode when @@ -544,7 +548,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vd= ev, Error **errp) (gen >=3D 6 && gen <=3D 9) && !(gmch & IGD_GMCH_VGA_DISABLE) && !strcmp(MACHINE_GET_CLASS(qdev_get_machine())->family, "pc_piix") = && - (&vdev->pdev =3D=3D pci_find_device(pci_device_root_bus(&vdev->pde= v), + (pdev =3D=3D pci_find_device(pci_device_root_bus(pdev), 0, PCI_DEVFN(0x2, 0)))) { /* * IGD legacy mode requires: @@ -566,7 +570,7 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vd= ev, Error **errp) */ ret =3D vfio_device_get_region_info(&vdev->vbasedev, VFIO_PCI_ROM_REGION_INDEX, &rom); - if ((ret || !rom->size) && !vdev->pdev.romfile) { + if ((ret || !rom->size) && !pdev->romfile) { error_setg(&err, "Device has no ROM"); goto error; } @@ -611,8 +615,8 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vd= ev, Error **errp) * ASLS (OpRegion address) is read-only, emulated * It contains HPA, guest firmware need to reprogram it with GPA. */ - pci_set_long(vdev->pdev.config + IGD_ASLS, 0); - pci_set_long(vdev->pdev.wmask + IGD_ASLS, ~0); + pci_set_long(pdev->config + IGD_ASLS, 0); + pci_set_long(pdev->wmask + IGD_ASLS, ~0); pci_set_long(vdev->emulated_config_bits + IGD_ASLS, ~0); =20 /* @@ -626,8 +630,8 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *vd= ev, Error **errp) } =20 /* GMCH is read-only, emulated */ - pci_set_long(vdev->pdev.config + IGD_GMCH, gmch); - pci_set_long(vdev->pdev.wmask + IGD_GMCH, 0); + pci_set_long(pdev->config + IGD_GMCH, gmch); + pci_set_long(pdev->wmask + IGD_GMCH, 0); pci_set_long(vdev->emulated_config_bits + IGD_GMCH, ~0); } =20 @@ -636,12 +640,12 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice *= vdev, Error **errp) =20 /* BDSM is read-write, emulated. BIOS needs to be able to write it= */ if (gen < 11) { - pci_set_long(vdev->pdev.config + IGD_BDSM, 0); - pci_set_long(vdev->pdev.wmask + IGD_BDSM, ~0); + pci_set_long(pdev->config + IGD_BDSM, 0); + pci_set_long(pdev->wmask + IGD_BDSM, ~0); pci_set_long(vdev->emulated_config_bits + IGD_BDSM, ~0); } else { - pci_set_quad(vdev->pdev.config + IGD_BDSM_GEN11, 0); - pci_set_quad(vdev->pdev.wmask + IGD_BDSM_GEN11, ~0); + pci_set_quad(pdev->config + IGD_BDSM_GEN11, 0); + pci_set_quad(pdev->wmask + IGD_BDSM_GEN11, ~0); pci_set_quad(vdev->emulated_config_bits + IGD_BDSM_GEN11, ~0); } } --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350942; cv=none; d=zohomail.com; s=zohoarc; b=OWZnzvcR9pTqh/OLtlWdlDXR+zf999ZQvC4QngE5UYa3WzxEw6gwMcJCMsLgJTQYpxZkitxUq5Alvs5mRYv3NfaKXZqgJtxdU9YSBCdk6uHIu1FU9EVQ50fVjWUN2cVtSTc0rnxSYSqhNqVajyugCC6RYNjsZSFf+2BxPDxfLVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350942; 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=ypOxM9dc7y4eaNDSraygXyRP+ty+I+WP3T62HkaR0aM=; b=Wpvq5Id5dP/Zlpml7L+beeCj5bKJzVcaj462PifMV0uxqzbwu4X7n8abT3AAsJsRdrcJICynF1CJYWJjPnvgxqvhMlNhXCxe6p26PRBMPIEsvJOzGfldt604sxR1WT2mU8sWkCWUw68ZMN7lD7xXwuOKbaT6+m+EMMZE6BSLXKc= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350942629522.9510308309694; Mon, 8 Sep 2025 10:02:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9N-0007v3-Ku; Mon, 08 Sep 2025 12:55:29 -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 1uvf9L-0007pQ-6J for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf9G-0001tN-Jy for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:26 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-36-MVOrqmCmPfig852YIDyiqA-1; Mon, 08 Sep 2025 12:55:16 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D144180057A; Mon, 8 Sep 2025 16:55:15 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5D915300018D; Mon, 8 Sep 2025 16:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350518; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ypOxM9dc7y4eaNDSraygXyRP+ty+I+WP3T62HkaR0aM=; b=dHdgycEzug2BdmKxEOBR5OFShfEK+gnfS/9miCz/nETyq95Y9bnNcKwrJlNu+u012GF1at U99V6XTHkaus6lSDQRe3HIHHMcFM+1R5TA2nDBPgXHCWYIkwAHFKoU+U+FXovkb+3XhYQ1 fJTlWdEwhEoxLdYXpReTs745sJzc2wA= X-MC-Unique: MVOrqmCmPfig852YIDyiqA-1 X-Mimecast-MFC-AGG-ID: MVOrqmCmPfig852YIDyiqA_1757350515 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , John Levon , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 29/31] vfio-user/pci.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:52 +0200 Message-ID: <20250908165354.1731444-30-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350945706124100 From: Mark Cave-Ayland Use QOM casts to convert between VFIOPCIDevice and PCIDevice instead of accessing pdev directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: John Levon Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-21-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio-user/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c index c3947a8f2ec9c0309b4484b95a4bd5439fa1d17f..e2c309784fec5feca635eb0f314= f02eabb2dbf1f 100644 --- a/hw/vfio-user/pci.c +++ b/hw/vfio-user/pci.c @@ -65,7 +65,7 @@ static void vfio_user_msix_setup(VFIOPCIDevice *vdev) vdev->msix->pba_region =3D pba_reg; =20 vfio_reg =3D vdev->bars[vdev->msix->pba_bar].mr; - msix_reg =3D &vdev->pdev.msix_pba_mmio; + msix_reg =3D &PCI_DEVICE(vdev)->msix_pba_mmio; memory_region_init_io(pba_reg, OBJECT(vdev), &vfio_user_pba_ops, vdev, "VFIO MSIX PBA", int128_get64(msix_reg->size)); memory_region_add_subregion_overlap(vfio_reg, vdev->msix->pba_offset, @@ -86,7 +86,7 @@ static void vfio_user_msix_teardown(VFIOPCIDevice *vdev) =20 static void vfio_user_dma_read(VFIOPCIDevice *vdev, VFIOUserDMARW *msg) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); VFIOUserProxy *proxy =3D vdev->vbasedev.proxy; VFIOUserDMARW *res; MemTxResult r; @@ -134,7 +134,7 @@ static void vfio_user_dma_read(VFIOPCIDevice *vdev, VFI= OUserDMARW *msg) =20 static void vfio_user_dma_write(VFIOPCIDevice *vdev, VFIOUserDMARW *msg) { - PCIDevice *pdev =3D &vdev->pdev; + PCIDevice *pdev =3D PCI_DEVICE(vdev); VFIOUserProxy *proxy =3D vdev->vbasedev.proxy; MemTxResult r; =20 --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350940; cv=none; d=zohomail.com; s=zohoarc; b=X/xJJH+w1fRd1BnH0aCqEkjoce/q7ajuocR/W7z0SBmT05o1sku2gr2Xb+PdHS4+31xLJZ4M9V32uYI6rWhzbxurlx0MnoWhTahdlqbXWH6CEOtLwksyRwWjIhW+T0lrt3btXajreDBf3vVMcKvF4BDK6v9uFpzVgkiMzZRXpHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350940; 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=Tk/z8tBX1EhZyT86hd2bvnQ/UP6G4WHHkayDdzWaLoE=; b=NZPD3GJcx/SifPhPbxiCTzmlLIK72o+4f1iuUGp3EjJI1k1T7iUU3obB+kRyhJj5X/xtSiLPy/odQNzZje8QmOWrFRsMamZFz2Hb4fWeHsmHGIlS/FXCjBbPuc/2OZEc7s09cH/FsnhsGIzAmyr1btJH3pBRT18kB1S5ojqivPk= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350940907980.9454837173952; Mon, 8 Sep 2025 10:02:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9T-00083w-H5; Mon, 08 Sep 2025 12:55:36 -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 1uvf9Q-00080U-E9 for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf9M-0001uJ-NB for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:31 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-utz4Pf6QP4mCzYWIQeyO9A-1; Mon, 08 Sep 2025 12:55:18 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D90F118002CE; Mon, 8 Sep 2025 16:55:17 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B8780300018D; Mon, 8 Sep 2025 16:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tk/z8tBX1EhZyT86hd2bvnQ/UP6G4WHHkayDdzWaLoE=; b=ES+Pul0BVoyz3X0LP8JXU01PIB+84cBDxvhBsG7ba5BDDbwpB9qJtkoSKzf39A1AmsMC0W MO4nUWIEjB7jEB21R759WZWk9wIZFH27VTXQ+jdHcIiIHtL0J8wLU3xCA7lpZIqD1sJ/wg 3CTtgqvuMa1UD1dteG4yjoIs1ZQcoJ0= X-MC-Unique: utz4Pf6QP4mCzYWIQeyO9A-1 X-Mimecast-MFC-AGG-ID: utz4Pf6QP4mCzYWIQeyO9A_1757350518 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , Matthew Rosato , Eric Farman , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 30/31] s390x/s390-pci-vfio.c: use QOM casts where appropriate Date: Mon, 8 Sep 2025 18:53:53 +0200 Message-ID: <20250908165354.1731444-31-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350941504116600 From: Mark Cave-Ayland Use QOM casts to cast to VFIOPCIDevice instead of using container_of(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Matthew Rosato Reviewed-by: Eric Farman Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-22-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/s390x/s390-pci-vfio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c index aaf91319b4e3cfacf3ca3a91e71d9d6d2fbda13f..938a5511713dade46740dca79a8= c4c738799a1ce 100644 --- a/hw/s390x/s390-pci-vfio.c +++ b/hw/s390x/s390-pci-vfio.c @@ -62,7 +62,7 @@ S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s, { S390PCIDMACount *cnt; uint32_t avail; - VFIOPCIDevice *vpdev =3D container_of(pbdev->pdev, VFIOPCIDevice, pdev= ); + VFIOPCIDevice *vpdev =3D VFIO_PCI_BASE(pbdev->pdev); int id; =20 assert(vpdev); @@ -108,7 +108,7 @@ static void s390_pci_read_base(S390PCIBusDevice *pbdev, { struct vfio_info_cap_header *hdr; struct vfio_device_info_cap_zpci_base *cap; - VFIOPCIDevice *vpci =3D container_of(pbdev->pdev, VFIOPCIDevice, pdev= ); + VFIOPCIDevice *vpci =3D VFIO_PCI_BASE(pbdev->pdev); uint64_t vfio_size; =20 hdr =3D vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_BASE); @@ -162,7 +162,7 @@ static bool get_host_fh(S390PCIBusDevice *pbdev, struct= vfio_device_info *info, { struct vfio_info_cap_header *hdr; struct vfio_device_info_cap_zpci_base *cap; - VFIOPCIDevice *vpci =3D container_of(pbdev->pdev, VFIOPCIDevice, pdev); + VFIOPCIDevice *vpci =3D VFIO_PCI_BASE(pbdev->pdev); =20 hdr =3D vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_BASE); =20 @@ -185,7 +185,7 @@ static void s390_pci_read_group(S390PCIBusDevice *pbdev, struct vfio_device_info_cap_zpci_group *cap; S390pciState *s =3D s390_get_phb(); ClpRspQueryPciGrp *resgrp; - VFIOPCIDevice *vpci =3D container_of(pbdev->pdev, VFIOPCIDevice, pdev= ); + VFIOPCIDevice *vpci =3D VFIO_PCI_BASE(pbdev->pdev); uint8_t start_gid =3D pbdev->zpci_fn.pfgid; =20 hdr =3D vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_GROUP= ); @@ -264,7 +264,7 @@ static void s390_pci_read_util(S390PCIBusDevice *pbdev, { struct vfio_info_cap_header *hdr; struct vfio_device_info_cap_zpci_util *cap; - VFIOPCIDevice *vpci =3D container_of(pbdev->pdev, VFIOPCIDevice, pdev= ); + VFIOPCIDevice *vpci =3D VFIO_PCI_BASE(pbdev->pdev); =20 hdr =3D vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_UTIL); =20 @@ -291,7 +291,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev, { struct vfio_info_cap_header *hdr; struct vfio_device_info_cap_zpci_pfip *cap; - VFIOPCIDevice *vpci =3D container_of(pbdev->pdev, VFIOPCIDevice, pdev= ); + VFIOPCIDevice *vpci =3D VFIO_PCI_BASE(pbdev->pdev); =20 hdr =3D vfio_get_device_info_cap(info, VFIO_DEVICE_INFO_CAP_ZPCI_PFIP); =20 @@ -314,7 +314,7 @@ static void s390_pci_read_pfip(S390PCIBusDevice *pbdev, =20 static struct vfio_device_info *get_device_info(S390PCIBusDevice *pbdev) { - VFIOPCIDevice *vfio_pci =3D container_of(pbdev->pdev, VFIOPCIDevice, p= dev); + VFIOPCIDevice *vfio_pci =3D VFIO_PCI_BASE(pbdev->pdev); =20 return vfio_get_device_info(vfio_pci->vbasedev.fd); } --=20 2.51.0 From nobody Wed Sep 10 01:54:44 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1757350583; cv=none; d=zohomail.com; s=zohoarc; b=Kb7NaiwfM3NLo5jp3wAaayQZPT/NnYLkRI/KdmZOKlVeUzrImbEEinBmC8Ht8330W2Xda/PMNAn5oCYbCfGNhOSdl1u9flpmkqrO4WorcXSO3eUBvSimj/UHRqD+9AWOMCWyLjVYl3/oMu2J4f2jEOp98Y0v4FGyP7zvXwu9NCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1757350583; 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=VzDQeLZJ1xnmfmw5TdfMdMrhfUNwDAO/ZuNdnSYO7uQ=; b=hRIUcIrnQZSqxCM9OuXQTUhD4phwRX1d8quevelGcyWmyYQVkyCAYh+hzwV5AOezlPalvAuUmuAB9jY65HDbbzPpn5Nvkhu67HraAnlc7apZkXS+pfe1dxTucL0dWipC1ZGEvrp4FphhuhhO6Dg9NO9FY9Mzeg8ZYcSdRRnXzlk= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1757350583368403.6217550340666; Mon, 8 Sep 2025 09:56:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uvf9W-0008F3-W8; Mon, 08 Sep 2025 12:55:39 -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 1uvf9U-00088K-8Q for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uvf9N-0001uB-4n for qemu-devel@nongnu.org; Mon, 08 Sep 2025 12:55:35 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-587-oR2Vfg0COL-5-jAmJ4K48Q-1; Mon, 08 Sep 2025 12:55:21 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 810DC1800291; Mon, 8 Sep 2025 16:55:20 +0000 (UTC) Received: from corto.redhat.com (unknown [10.44.32.50]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 612EA30001A4; Mon, 8 Sep 2025 16:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757350524; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VzDQeLZJ1xnmfmw5TdfMdMrhfUNwDAO/ZuNdnSYO7uQ=; b=b8TTBMqnLG3eVSW4w1sqxkq/wrrtUtpBjWLL91PPlNJ8iOFOz+BRGQ5eODlocell+T2OJc B4Tg3R1hv0fFcJMn0UXOza9/Wc4i0ZHtnXyPShjwKgcIjOLpp75lN9eldXXEiXbCIU+URN gcr+uHANZUPJla+4b6aIFZ77JHR4Zfs= X-MC-Unique: oR2Vfg0COL-5-jAmJ4K48Q-1 X-Mimecast-MFC-AGG-ID: oR2Vfg0COL-5-jAmJ4K48Q_1757350520 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-devel@nongnu.org Cc: Alex Williamson , Mark Cave-Ayland , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Steve Sistare , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 31/31] vfio/pci.h: rename VFIOPCIDevice pdev field to parent_obj Date: Mon, 8 Sep 2025 18:53:54 +0200 Message-ID: <20250908165354.1731444-32-clg@redhat.com> In-Reply-To: <20250908165354.1731444-1-clg@redhat.com> References: <20250908165354.1731444-1-clg@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=170.10.129.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @redhat.com) X-ZM-MESSAGEID: 1757350585471116600 From: Mark Cave-Ayland Now that nothing accesses the pdev field directly, rename pdev to parent_obj as per our current coding guidelines. Signed-off-by: Mark Cave-Ayland Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Steve Sistare Reviewed-by: Philippe Mathieu-Daud=C3=A9 Link: https://lore.kernel.org/qemu-devel/20250715093110.107317-23-mark.cave= ayland@nutanix.com Signed-off-by: C=C3=A9dric Le Goater --- hw/vfio/pci.h | 2 +- hw/vfio/cpr.c | 4 ++-- hw/vfio/pci.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 2db76b6f4fb58679d65b651f0507c474e5c05857..e0aef82a8931c78a5504411a912= acddda1fd6549 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -123,7 +123,7 @@ typedef struct VFIOMSIXInfo { OBJECT_DECLARE_SIMPLE_TYPE(VFIOPCIDevice, VFIO_PCI_BASE) =20 struct VFIOPCIDevice { - PCIDevice pdev; + PCIDevice parent_obj; =20 VFIODevice vbasedev; VFIOINTx intx; diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c index f911988adddfdc1c8e8f87d66d1647c81f633570..2c71fc1e8ef7b0765d015b0f423= cb6a30f273f0f 100644 --- a/hw/vfio/cpr.c +++ b/hw/vfio/cpr.c @@ -173,8 +173,8 @@ const VMStateDescription vfio_cpr_pci_vmstate =3D { .post_load =3D vfio_cpr_pci_post_load, .needed =3D cpr_incoming_needed, .fields =3D (VMStateField[]) { - VMSTATE_PCI_DEVICE(pdev, VFIOPCIDevice), - VMSTATE_MSIX_TEST(pdev, VFIOPCIDevice, pci_msix_present), + VMSTATE_PCI_DEVICE(parent_obj, VFIOPCIDevice), + VMSTATE_MSIX_TEST(parent_obj, VFIOPCIDevice, pci_msix_present), VMSTATE_VFIO_INTX(intx, VFIOPCIDevice), VMSTATE_END_OF_LIST() } diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 052591d2c970a1668db390f31ea06cd90e6a420f..d14e96b2f82d78746d361fc86cc= bf14f6275a8de 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2811,8 +2811,8 @@ static const VMStateDescription vmstate_vfio_pci_conf= ig =3D { .version_id =3D 1, .minimum_version_id =3D 1, .fields =3D (const VMStateField[]) { - VMSTATE_PCI_DEVICE(pdev, VFIOPCIDevice), - VMSTATE_MSIX_TEST(pdev, VFIOPCIDevice, vfio_msix_present), + VMSTATE_PCI_DEVICE(parent_obj, VFIOPCIDevice), + VMSTATE_MSIX_TEST(parent_obj, VFIOPCIDevice, vfio_msix_present), VMSTATE_END_OF_LIST() }, .subsections =3D (const VMStateDescription * const []) { --=20 2.51.0