From nobody Sat Nov 15 20:49:57 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1747825668; cv=none; d=zohomail.com; s=zohoarc; b=bZ89xmWLaSVdrfuj3UvP946ayiNKhuZGEJsStbNUEmH41irDZi5bPqYbspWsGlirZBhavIMSV2o8SytHWfUPv4+mp9stHAaNH4faRkZKRPcI2KYXtDYegq0kZC8MjnUkKo8W9ozPyChivy6Xlp+3n56Ytn/M6PO0arpgsRAS970= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747825668; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wt4bP6YuiInKj1X7/KxN1ZU7Shym+gMXpXzLwN+yDu4=; b=Euqtn61MWgiUVCTxO3Tgl/5dl9wkEu8bNFu26w6rgNjKzBCMAz9tsjr2aAOeL+z//wU3swrxj9vxfQGRyLw9oOsWhNylHjLuPTSuysutrQxHC0swhM9b3/g7U/Gr7wr0SSvluBMIfWzooOKMEEjTIJMvlYZHmurNbyvJ2fPrnwo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747825668303918.4856934701988; Wed, 21 May 2025 04:07:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uHhHl-0002PN-HR; Wed, 21 May 2025 07:06:58 -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 1uHhHj-0002Oi-Ff for qemu-devel@nongnu.org; Wed, 21 May 2025 07:06:55 -0400 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uHhHh-0004O6-77 for qemu-devel@nongnu.org; Wed, 21 May 2025 07:06:55 -0400 Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2025 04:06:49 -0700 Received: from spr-s2600bt.bj.intel.com ([10.240.192.127]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2025 04:06:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747825614; x=1779361614; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=++EC2gZa0kDxUUVtUM66Xho/ya2K8OS0SPlDwdld7Js=; b=auv3rqRfwxMqFJ5nxFCYlpRlUyXnOi5haEc2DRoYLuZeBfJwKWqtMB+C 97mU7BVXRXZ1nJGywcur1OPnX7b/blJlHZ+zU3bZHzXnr5eTv8BciB24N tdV9dQCD2iYPNqA8QNB1ES0ztwe67fkc77PAeFaz5cTXD9aJUBVAh4nNa 9wVW9GATGmFD6JTi/+IxhFWTK9YboY4TZhMKGPqvh+nbRzJ7CmM3fT356 O8IE9fafsUYTW7hyJ5ciB/voYjpBhAMsALHOUMECpe+sf1+j+BFJfStUT 7bBTGXfz+sta2ChB8c9XdmFcHJjxz9Nm61wv2j6nI7EeKDcIBxMDfDoSD Q==; X-CSE-ConnectionGUID: REt8nFK7QuK9/un7onsWUQ== X-CSE-MsgGUID: yF4sP4lbT7yWMlbAXWulXQ== X-IronPort-AV: E=McAfee;i="6700,10204,11439"; a="60032907" X-IronPort-AV: E=Sophos;i="6.15,303,1739865600"; d="scan'208";a="60032907" X-CSE-ConnectionGUID: PC0tt5giTOWpH9I38RqmbQ== X-CSE-MsgGUID: gLQEvYOAQgqa316jex7cvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,303,1739865600"; d="scan'208";a="171019909" From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com, clg@redhat.com, chao.p.peng@intel.com, Zhenzhong Duan Subject: [PATCH] vfio/iommufd: Add comment emphasizing no movement of hiod->realize() call Date: Wed, 21 May 2025 19:03:01 +0800 Message-Id: <20250521110301.3313877-1-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.11; envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.184, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1747825670556116600 The nested IOMMU support needs device and hwpt id which are generated only after attachment. Hiod encapsulates these information in realize() and passes to vIOMMU. Suggested-by: C=C3=A9dric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio/iommufd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index af1c7ab10a..6b2696793f 100644 --- a/hw/vfio/iommufd.c +++ b/hw/vfio/iommufd.c @@ -592,6 +592,10 @@ found_container: goto err_listener_register; } =20 + /* + * Do not move this code before attachment! The nested IOMMU support + * needs device and hwpt id which are generated only after attachment. + */ if (!vfio_device_hiod_create_and_realize(vbasedev, TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO, errp)) { goto err_listener_register; --=20 2.34.1