[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241209192549.107226-3-mjrosato@linux.ibm.com>
Date: Mon, 9 Dec 2024 14:25:44 -0500
From: Matthew Rosato <mjrosato@...ux.ibm.com>
To: joro@...tes.org, will@...nel.org, robin.murphy@....com,
gerald.schaefer@...ux.ibm.com, schnelle@...ux.ibm.com
Cc: hca@...ux.ibm.com, gor@...ux.ibm.com, agordeev@...ux.ibm.com,
svens@...ux.ibm.com, borntraeger@...ux.ibm.com, clegoate@...hat.com,
iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-s390@...r.kernel.org
Subject: [PATCH 2/7] s390/pci: set appropriate IOTA region type
When registering the I/O Translation Anchor, use the current table type
stored in the zdev to set the apporpriate region type indication.
Signed-off-by: Matthew Rosato <mjrosato@...ux.ibm.com>
---
arch/s390/pci/pci.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 88f72745fa59..9f7adf913729 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -116,6 +116,21 @@ int pci_proc_domain(struct pci_bus *bus)
}
EXPORT_SYMBOL_GPL(pci_proc_domain);
+static u64 zpci_get_iota_region_flag(struct zpci_dev *zdev)
+{
+ switch (zdev->origin_type) {
+ case ZPCI_TABLE_TYPE_RTX:
+ return ZPCI_IOTA_RTTO_FLAG;
+ case ZPCI_TABLE_TYPE_RSX:
+ return ZPCI_IOTA_RSTO_FLAG;
+ case ZPCI_TABLE_TYPE_RFX:
+ return ZPCI_IOTA_RFTO_FLAG;
+ default:
+ WARN_ONCE(1, "Invalid IOMMU table (%x)\n", zdev->origin_type);
+ return 0;
+ }
+}
+
/* Modify PCI: Register I/O address translation parameters */
int zpci_register_ioat(struct zpci_dev *zdev, u8 dmaas,
u64 base, u64 limit, u64 iota, u8 *status)
@@ -131,7 +146,7 @@ int zpci_register_ioat(struct zpci_dev *zdev, u8 dmaas,
fib.pal = limit + (1 << 12);
else
fib.pal = limit;
- fib.iota = iota | ZPCI_IOTA_RTTO_FLAG;
+ fib.iota = iota | zpci_get_iota_region_flag(zdev);
fib.gd = zdev->gisa;
cc = zpci_mod_fc(req, &fib, status);
if (cc)
--
2.47.0
Powered by blists - more mailing lists