lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 20 Sep 2021 12:11:33 +0530
From:   Kishon Vijay Abraham I <kishon@...com>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Marc Zyngier <maz@...nel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>
CC:     <linux-kernel@...r.kernel.org>, <linux-pci@...r.kernel.org>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Kishon Vijay Abraham I <kishon@...com>,
        <lokeshvutla@...com>
Subject: [PATCH 3/3] irqchip/gic-v3-its: Include "msi-map-mask" for calculating nvecs

Using "msi-map-mask" in device tree lets multiple PCIe requestor ID to
use the same GIC ITS device ID. So while creating the Interrupt
Translation Table (ITT) for a specific GIC ITS device ID, the total number
of interrupts required by all the PCIe requestor ID that maps to the
same GIC ITS device ID should be calculated

Add support for gic-v3-its to include "msi-map-mask" property in device
tree for calculating the total number of MSI interrupts in
its_pci_msi_prepare().

Signed-off-by: Kishon Vijay Abraham I <kishon@...com>
---
 drivers/irqchip/irq-gic-v3-its-pci-msi.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its-pci-msi.c b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
index ad2810c017ed..c79bca1a5787 100644
--- a/drivers/irqchip/irq-gic-v3-its-pci-msi.c
+++ b/drivers/irqchip/irq-gic-v3-its-pci-msi.c
@@ -54,9 +54,13 @@ static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data)
 static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
 			       int nvec, msi_alloc_info_t *info)
 {
+	int alias_count = 0, map_count = 0, minnvec = 1, ret;
 	struct pci_dev *pdev, *alias_dev;
 	struct msi_domain_info *msi_info;
-	int alias_count = 0, minnvec = 1;
+	struct device *parent_dev;
+	struct pci_bus *root_bus;
+	struct device_node *np;
+	u32 map_mask, rid;
 
 	if (!dev_is_pci(dev))
 		return -EINVAL;
@@ -78,6 +82,21 @@ static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
 		info->flags |= MSI_ALLOC_FLAGS_PROXY_DEVICE;
 	}
 
+	for (parent_dev = dev; parent_dev; parent_dev = parent_dev->parent) {
+		np = parent_dev->of_node;
+		if (!np)
+			continue;
+
+		ret = of_property_read_u32(np, "msi-map-mask", &map_mask);
+		if (!ret && map_mask != 0xffff) {
+			rid = pci_dev_id(pdev) & map_mask;
+			root_bus = find_pci_root_bus(pdev->bus);
+			__pci_walk_bus(root_bus, its_pci_msi_vec_count, &map_count, rid, map_mask);
+			break;
+		}
+	}
+	alias_count = max(map_count, alias_count);
+
 	/* ITS specific DeviceID, as the core ITS ignores dev. */
 	info->scratchpad[0].ul = pci_msi_domain_get_msi_rid(domain, pdev);
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ