OSDN Git Service

PCI: apple: Configure RID to SID mapper on device addition
authorMarc Zyngier <maz@kernel.org>
Wed, 29 Sep 2021 16:38:42 +0000 (17:38 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 4 Nov 2021 21:29:31 +0000 (16:29 -0500)
commit468c8d52c33271d21aac070ebef9283f302094cc
tree8618ec7eb0157d4a74fba4227f5b205697c37cef
parent946d619fa25f55483206befb035fed6a99fbe7b5
PCI: apple: Configure RID to SID mapper on device addition

The Apple PCIe controller doesn't directly feed the endpoint's Requester ID
to the IOMMU (DART), but instead maps RIDs onto Stream IDs (SIDs). The DART
and the PCIe controller must thus agree on the SIDs that are used for
translation (by using the 'iommu-map' property).

For this purpose, parse the 'iommu-map' property each time a device gets
added, and use the resulting translation to configure the PCIe RID-to-SID
mapper. Similarly, remove the translation if/when the device gets removed.

This is all driven from a bus notifier which gets registered at probe time.
Hopefully this is the only PCI controller driver in the whole system.

[bhelgaas: squash indentation from Zhaoyu Liu <zackary.liu.pro@gmail.com>:
https://lore.kernel.org/r/20211031135544.GA1616@pc]
Link: https://lore.kernel.org/r/20210929163847.2807812-10-maz@kernel.org
Tested-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Sven Peter <sven@svenpeter.dev>
drivers/pci/controller/pcie-apple.c