[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <391c735a-7daf-4256-8998-952652799dda@arm.com>
Date: Fri, 1 Nov 2024 17:23:06 +0000
From: Robin Murphy <robin.murphy@....com>
To: Frank Li <Frank.Li@....com>, Bjorn Helgaas <bhelgaas@...gle.com>,
Richard Zhu <hongxing.zhu@....com>, Lucas Stach <l.stach@...gutronix.de>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Rob Herring <robh@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>
Cc: linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, imx@...ts.linux.dev,
alyssa@...enzweig.io, bpf@...r.kernel.org, broonie@...nel.org, jgg@...pe.ca,
joro@...tes.org, lgirdwood@...il.com, maz@...nel.org,
p.zabel@...gutronix.de, will@...nel.org
Subject: Re: [PATCH v3 2/2] PCI: imx6: Add IOMMU and ITS MSI support for
i.MX95
On 2024-10-24 11:34 pm, Frank Li wrote:
[...]
> +static int imx_pcie_enable_device(struct pci_host_bridge *bridge, struct pci_dev *pdev)
> +{
> + u32 sid_i = 0, sid_m = 0, rid = pci_dev_id(pdev);
> + struct device_node *target;
> + struct imx_pcie *imx_pcie;
> + struct device *dev;
> + int err_i, err_m;
> +
> + imx_pcie = to_imx_pcie(to_dw_pcie_from_pp(bridge->sysdata));
> + dev = imx_pcie->pci->dev;
> +
> + target = NULL;
> + err_i = of_map_id(dev->of_node, rid, "iommu-map", "iommu-map-mask", &target, &sid_i);
No, you still need to actually check "target" at this point - if it is
now set, a mapping was found and "sid_i" is valid, otherwise if it still
NULL, no mapping exists even if "err_i" is 0 (i.e. an "iommu-map"
property was found, but did not contain any entries matching "rid" as
input). Note that the target node is returned with a reference held, so
needs an of_node_put() as well.
Thanks,
Robin.
> + target = NULL;
> + err_m = of_map_id(dev->of_node, rid, "msi-map", "msi-map-mask", &target, &sid_m);
Powered by blists - more mailing lists