]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
PCI: rockchip: Fix window mapping and address translation for endpoint
authorRick Wertenbroek <rick.wertenbroek@gmail.com>
Tue, 18 Apr 2023 07:46:55 +0000 (09:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Aug 2023 08:22:28 +0000 (10:22 +0200)
commitcbd1494e51fd11d6f5d87e2764d3e9ebfb411a1b
tree9dbdd39409d02a2cb67bebfeeb6e63222f157db6
parenteb39c4c051dc2c0e5311b349a5f08e155e51e9d9
PCI: rockchip: Fix window mapping and address translation for endpoint

[ Upstream commit dc73ed0f1b8bddd7f2bf70d123e68ffc99ad71ce ]

The RK3399 PCI endpoint core has 33 windows for PCIe space, now in the
driver up to 32 fixed size (1M) windows are used and pages are allocated
and mapped accordingly. The driver first used a single window and allocated
space inside which caused translation issues (between CPU space and PCI
space) because a window can only have a single translation at a given
time, which if multiple pages are allocated inside will cause conflicts.
Now each window is a single region of 1M which will always guarantee that
the translation is not in conflict.

Set the translation register addresses for physical function. As documented
in the technical reference manual (TRM) section 17.5.5 "PCIe Address
Translation" and section 17.6.8 "Address Translation Registers Description"

Link: https://lore.kernel.org/r/20230418074700.1083505-9-rick.wertenbroek@gmail.com
Fixes: cf590b078391 ("PCI: rockchip: Add EP driver for Rockchip PCIe controller")
Tested-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/controller/pcie-rockchip-ep.c
drivers/pci/controller/pcie-rockchip.h