gpu: nvgpu: allocate from coherent pool

Maps memory coherently on devices that are connected to a coherent bus.

(1) Add code to be able to get the platform device node.
(2) Create a new flag to mark if the device is connected to a coherent bus
(3) Map memory coherently on coherent devices.

bug 2040331

Change-Id: Ide83a9261acdbbc6e9fef4fc5f38d6f9d0e5ab5b
Signed-off-by: David Nieto <dmartineznie@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1633985
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
David Nieto
2018-01-04 11:09:57 -08:00
committed by mobile promotions
parent 82f253b7c1
commit 6dde9e67d9
7 changed files with 38 additions and 4 deletions

View File

@@ -24,6 +24,8 @@
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/platform/tegra/common.h>
#include <linux/pci.h>
#include <uapi/linux/nvgpu.h>
#include <dt-bindings/soc/gm20b-fuse.h>
#include <dt-bindings/soc/gp10b-fuse.h>
@@ -70,6 +72,23 @@
#define CREATE_TRACE_POINTS
#include <trace/events/gk20a.h>
struct device_node *nvgpu_get_node(struct gk20a *g)
{
struct device *dev = dev_from_gk20a(g);
if (dev_is_pci(dev)) {
struct pci_bus *bus = to_pci_dev(dev)->bus;
while (!pci_is_root_bus(bus))
bus = bus->parent;
return bus->bridge->parent->of_node;
}
return dev->of_node;
}
void gk20a_busy_noresume(struct gk20a *g)
{
pm_runtime_get_noresume(dev_from_gk20a(g));
@@ -1042,7 +1061,7 @@ static inline void set_gk20a(struct platform_device *pdev, struct gk20a *gk20a)
static int nvgpu_read_fuse_overrides(struct gk20a *g)
{
struct device_node *np = dev_from_gk20a(g)->of_node;
struct device_node *np = nvgpu_get_node(g);
u32 *fuses;
int count, i;