From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) (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 9A0A339D for ; Mon, 14 Aug 2023 01:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691976029; x=1723512029; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=oe335Nlu8sc5VS5G7ofG+VOn5WK1MFpLS3mlAGuCpFo=; b=AmYB/mjLC5wgRSySM/rffrDcf5e+ITBfHXj28s9lrfuvIj0z52aZKMaA Ps5zEFr+Dx4o58D1CYXui18MRMfkVHSRYBasyEQueWuAffbZfMmFWW3VB RCf6nmC1zRu2lppk3DaB0TpkASusexmkSBwQ5EavBnJPQcbyQ+IbRKU6E qffxK+006HeR1aNTD8alhBGZwvKiWSZ8SPK6jOj2pIeRdsCVoUCMqrDUl RO+cq/UhXACCMp4FqzTm4nLwimq5Iv0af/P7xKqo7/IP/epNNJt8GAHbG CPDMfRdXeslE6ijCXti9hRQeaFfHXwOYhWiND77DISroTIt5mgp5Cc528 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="375645292" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="375645292" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 18:20:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="726842289" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="726842289" Received: from allen-box.sh.intel.com ([10.239.159.127]) by orsmga007.jf.intel.com with ESMTP; 13 Aug 2023 18:20:25 -0700 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Jean-Philippe Brucker , Nicolin Chen Cc: Yi Liu , Jacob Pan , iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v2 0/3] iommu: Make pasid array per device Date: Mon, 14 Aug 2023 09:17:56 +0800 Message-Id: <20230814011759.102089-1-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The PCI PASID enabling interface guarantees that the address space used by each PASID is unique. This is achieved by checking that the PCI ACS path is enabled for the device. If the path is not enabled, then the PASID feature cannot be used. if (!pci_acs_path_enabled(pdev, NULL, PCI_ACS_RR | PCI_ACS_UF)) return -EINVAL; The PASID array is not an attribute of the IOMMU group. It is more natural to store the PASID array in the per-device IOMMU data. This makes the code clearer and easier to understand. Please help review and suggest. Change log: v2: - Add an explict check for single-device group in the domain attaching device pasid interface. (Jason) - Make assert_pasid_dma_ownership() returns true or false. Refactor the code in a way that does not change its exsiting behavior. (Kevin) v1: https://lore.kernel.org/linux-iommu/20230801063125.34995-1-baolu.lu@linux.intel.com/ Lu Baolu (3): iommu: Make single-device group for PASID explicit iommu: Consolidate pasid dma ownership check iommu: Move pasid array from group to device include/linux/iommu.h | 2 + drivers/iommu/iommu.c | 102 +++++++++++++++++++----------------------- 2 files changed, 49 insertions(+), 55 deletions(-) -- 2.34.1