From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jayachandran C Subject: Re: [PATCH] iommu/arm-smmu-v3: Cope with duplicated Stream IDs Date: Tue, 2 Jan 2018 10:42:19 -0800 Message-ID: <20180102184218.GA7161@jc-sabre> References: <13744c7ba2af61bc39b68e9ab05ab8482f928334.1514896042.git.robin.murphy@arm.com> <20180102130036.GB6613@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20180102130036.GB6613-5wv7dgnIgG8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Will Deacon Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Tomasz.Nowicki-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Tue, Jan 02, 2018 at 01:00:36PM +0000, Will Deacon wrote: > On Tue, Jan 02, 2018 at 12:33:14PM +0000, Robin Murphy wrote: > > For PCI devices behind an aliasing PCIe-to-PCI/X bridge, the bridge > > alias to DevFn 0.0 on the subordinate bus may match the original RID of > > the device, resulting in the same SID being present in the device's > > fwspec twice. This causes trouble later in arm_smmu_write_strtab_ent() > > when we wind up visiting the STE a second time and find it already live. > > > > Avoid the issue by giving arm_smmu_install_ste_for_dev() the cleverness > > to skip over duplicates. It seems mildly counterintuitive compared to > > preventing the duplicates from existing in the first place, but since > > the DT and ACPI probe paths build their fwspecs differently, this is > > actually the cleanest and most self-contained way to deal with it. > > > > Fixes: 8f78515425da ("iommu/arm-smmu: Implement of_xlate() for SMMUv3") > > Reported-by: Tomasz Nowicki > > Tested-by: Tomasz Nowicki > > Tested-by: Jayachandran C. > > Signed-off-by: Robin Murphy > > --- > > drivers/iommu/arm-smmu-v3.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > Cheers, Robin. I'll pick this up and send to Alex later this week along with > a couple of other fixes I have kicking around. Thanks. Even though the Fixes: tag points to an older commit, we really need the fix in 4.14 where another commit (10631d724def drm/pci: Deprecate drm_pci_init/exit completely) exposed the issue. It it is not already planned, can you please cc stable? JC. From mboxrd@z Thu Jan 1 00:00:00 1970 From: jnair@caviumnetworks.com (Jayachandran C) Date: Tue, 2 Jan 2018 10:42:19 -0800 Subject: [PATCH] iommu/arm-smmu-v3: Cope with duplicated Stream IDs In-Reply-To: <20180102130036.GB6613@arm.com> References: <13744c7ba2af61bc39b68e9ab05ab8482f928334.1514896042.git.robin.murphy@arm.com> <20180102130036.GB6613@arm.com> Message-ID: <20180102184218.GA7161@jc-sabre> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Jan 02, 2018 at 01:00:36PM +0000, Will Deacon wrote: > On Tue, Jan 02, 2018 at 12:33:14PM +0000, Robin Murphy wrote: > > For PCI devices behind an aliasing PCIe-to-PCI/X bridge, the bridge > > alias to DevFn 0.0 on the subordinate bus may match the original RID of > > the device, resulting in the same SID being present in the device's > > fwspec twice. This causes trouble later in arm_smmu_write_strtab_ent() > > when we wind up visiting the STE a second time and find it already live. > > > > Avoid the issue by giving arm_smmu_install_ste_for_dev() the cleverness > > to skip over duplicates. It seems mildly counterintuitive compared to > > preventing the duplicates from existing in the first place, but since > > the DT and ACPI probe paths build their fwspecs differently, this is > > actually the cleanest and most self-contained way to deal with it. > > > > Fixes: 8f78515425da ("iommu/arm-smmu: Implement of_xlate() for SMMUv3") > > Reported-by: Tomasz Nowicki > > Tested-by: Tomasz Nowicki > > Tested-by: Jayachandran C. > > Signed-off-by: Robin Murphy > > --- > > drivers/iommu/arm-smmu-v3.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > Cheers, Robin. I'll pick this up and send to Alex later this week along with > a couple of other fixes I have kicking around. Thanks. Even though the Fixes: tag points to an older commit, we really need the fix in 4.14 where another commit (10631d724def drm/pci: Deprecate drm_pci_init/exit completely) exposed the issue. It it is not already planned, can you please cc stable? JC.