From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16AC3331A5B for ; Mon, 28 Sep 2026 01:49:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790560184; cv=none; b=nxxVEMoFQfcpOaqWF72irgAwViSXDrRVI+S7xFn6aQwpNbGYehKfm5pBnhi8pyrQmkMyMXYlmhcIuKYFTVfWQhYZhvpiRgjZdq6fqn6HCr/S9d0jp/EgCue83mxChHfnu6WySDykX//6GVx6aMVZ0nK6PPcSCmv/2COJJxJvMwo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790560184; c=relaxed/simple; bh=AqUmf7Q4iWaz3G+9zZxSgy3N38hsPbIZJu8sLq5Tlqg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gHmpyO0FR5EQzPWaf1DNkHFQKF898qsemhe+J8TCZqk81kB22p2ZwuptkNKkgrZMkEIM74kb5c+bK+hWXGR1y7uT++3puIHvvSzmDkObpOpVcoYS7oi+XiL+Nx+AthhLowKC+Fi1QoXhYtZeZsQEEd/3JFKotfkFM4DueKRD2Gs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=lD+NA9Iu; arc=none smtp.client-ip=115.124.30.98 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="lD+NA9Iu" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1790560171; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=SmJKx9IQeBrvMCfRacx1gV/ovk2JnZooxnnvNmOHKGA=; b=lD+NA9IuC/8n9ETSltczL7fc2cy7pLro+5VYtk8B+ZratfwbOY9UbL9x8j9/SUUZKoCkCysrpC0UFzTeLCkXRhpc3WA6K0gpcjtdfFlQc89UYg771l/rJeNXezgfCDizNto8EmeGDSTcunPsM2QFxP1CvNt5iJjlrTINojsM+D4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037033178;MF=fuwenxin@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0XBgzThC_1790560157; Received: from t50b09067.sqa.eu95.tbsite.net(mailfrom:fuwenxin@linux.alibaba.com fp:SMTPD_---0XBgzThC_1790560157 cluster:ay36) by smtp.aliyun-inc.com; Mon, 28 Sep 2026 09:49:30 +0800 From: fuwenxin To: Suravee Suthikulpanit , linux-iommu@lists.linux.dev, linux-kernel@vger.kernel.org, joro@8bytes.org, jgg@nvidia.com Cc: fuwenxin , vasant.hegde@amd.com, jon.grimm@amd.com, yi.l.liu@intel.com, kevin.tian@intel.com, nicolinc@nvidia.com, wnliu@google.com, Guanghui Feng , Guixin Liu , Vasant , ming.shu@amd.com Subject: Re: [PATCH v5 19/24] iommu/amd: Add per-segment translate device ID pool Date: Mon, 28 Sep 2026 09:49:13 +0800 Message-ID: <20260928014916.199019-1-fuwenxin@linux.alibaba.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260914184750.222939-20-suravee.suthikulpanit@amd.com> References: <20260914184750.222939-1-suravee.suthikulpanit@amd.com> <20260914184750.222939-20-suravee.suthikulpanit@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Suravee, > A translate device ID (TransDevID) is a host device-table index used > by hardware vIOMMU. VFCTRL guest-misc names the slot; that DTE holds > the nest-parent v1 table for GPA->SPA walks of guest IOMMU traffic. > Reserve PCI requestor IDs in a per-segment pool so they are not > used as vIOMMU translation DTEs. The device table is per-segment, > so the pool is too. > > Add trans_devid.c with pci_seg init/fini and > amd_iommu_trans_devid_reserve() from probe_device(). Keep > reservations for the pci_seg lifetime, including after > amd_iommu_release_device(). Reservation only happens on the probe path, but some DTE-slot holders never probe, so their devids stay unreserved while trans_devid_find_free_locked() [patch 22] treats any xa_load()==NULL slot as free. One such holder is the IOMMU's own function: init.c deliberately does rlookup_table[iommu->devid] = NULL , so it never reaches probe_device() -- yet patch 13 programs the self DTE at exactly iommu->devid. Thanks, fuwenxin