]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pci_user: call bus_translate_resource before BAR mmap
authorMarcin Wojtas <mw@FreeBSD.org>
Tue, 6 Apr 2021 15:10:04 +0000 (17:10 +0200)
committerMarcin Wojtas <mw@FreeBSD.org>
Tue, 6 Apr 2021 15:15:04 +0000 (17:15 +0200)
commitf2f1ab39c04088ce53287528549e652cf68cee09
tree3844a479a23233b226774fc9c715e97eb2b49d0b
parent1c1ead9b94a1a731646327ec3b09e8f3acd577b8
pci_user: call bus_translate_resource before BAR mmap

On some armv8 machines it is possible that the mapping between CPU
and PCI bus BAR base addresses is not 1:1. In case a BAR is allocated
in kernel using bus_alloc_resource_any this translation is handled in
ofw_pci_activate_resource.

Do the same in pci_user.c by calling bus_translate_resource devmethod.
This fixes mmaping BARs to userspace on Marvell SoCs (Armada 7k8k/CN913x)
and possibly many other platforms.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Marvell
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29604
sys/dev/pci/pci_user.c