From d8b94793f305b359ce3caac36a3d99c22ddec1e6 Mon Sep 17 00:00:00 2001 From: Mikko Perttunen Date: Wed, 19 Jun 2019 10:08:54 +0300 Subject: [PATCH 1/2] video: tegra: host: Set DMA masks Set DMA masks for host1x, engines, and context devices as per the following to support over 32 bits of address space: - T210: 34 bits - T186: 40 bits - T194: 40 bits Bug 200527850 Change-Id: I1e7495bbf90a2928c17c06c2728640a036f843d7 Signed-off-by: Mikko Perttunen Signed-off-by: Puneet Saxena Reviewed-on: https://git-master.nvidia.com/r/2139215 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/video/tegra/host/host1x/host1x.c | 3 +++ drivers/video/tegra/host/host1x/host1x.h | 3 +++ drivers/video/tegra/host/iommu_context_dev.c | 2 ++ drivers/video/tegra/host/nvhost_acm.c | 6 ++++++ drivers/video/tegra/host/t186/t186.c | 4 ++++ drivers/video/tegra/host/t194/t194.c | 1 + drivers/video/tegra/host/t210/t210.c | 1 + include/linux/nvhost.h | 3 +++ 8 files changed, 23 insertions(+) diff --git a/drivers/video/tegra/host/host1x/host1x.c b/drivers/video/tegra/host/host1x/host1x.c index a98a47ce3..66c8167d9 100644 --- a/drivers/video/tegra/host/host1x/host1x.c +++ b/drivers/video/tegra/host/host1x/host1x.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "dev.h" #include @@ -1169,6 +1170,8 @@ static int nvhost_probe(struct platform_device *dev) pdata->pdev = dev; + dma_set_mask_and_coherent(&dev->dev, host->info.dma_mask); + /* set common host1x device data */ platform_set_drvdata(dev, pdata); diff --git a/drivers/video/tegra/host/host1x/host1x.h b/drivers/video/tegra/host/host1x/host1x.h index edb47ca8a..a06d307c9 100644 --- a/drivers/video/tegra/host/host1x/host1x.h +++ b/drivers/video/tegra/host/host1x/host1x.h @@ -89,6 +89,9 @@ struct host1x_device_info { /* cmdfifo only accessible from hypervisor? */ bool secure_cmdfifo; + + /* dma mask for host1x and clients */ + u64 dma_mask; }; struct nvhost_vm_firmware_area { diff --git a/drivers/video/tegra/host/iommu_context_dev.c b/drivers/video/tegra/host/iommu_context_dev.c index b600fadb3..0b4a7889e 100644 --- a/drivers/video/tegra/host/iommu_context_dev.c +++ b/drivers/video/tegra/host/iommu_context_dev.c @@ -227,6 +227,8 @@ static int iommu_context_dev_probe(struct platform_device *pdev) return -ENOSYS; } + dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)); + ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) { dev_err(&pdev->dev, diff --git a/drivers/video/tegra/host/nvhost_acm.c b/drivers/video/tegra/host/nvhost_acm.c index ff0eaedff..b78355c56 100644 --- a/drivers/video/tegra/host/nvhost_acm.c +++ b/drivers/video/tegra/host/nvhost_acm.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #if defined(CONFIG_TEGRA_BWMGR) @@ -636,6 +637,11 @@ int nvhost_module_init(struct platform_device *dev) int i = 0, err = 0; struct kobj_attribute *attr = NULL; struct nvhost_device_data *pdata = platform_get_drvdata(dev); + struct nvhost_master *master = nvhost_get_host(dev); + + if (!pdata->no_platform_dma_mask) { + dma_set_mask_and_coherent(&dev->dev, master->info.dma_mask); + } /* initialize clocks to known state (=enabled) */ pdata->num_clks = 0; diff --git a/drivers/video/tegra/host/t186/t186.c b/drivers/video/tegra/host/t186/t186.c index 20ecb07e0..f56f21e2a 100644 --- a/drivers/video/tegra/host/t186/t186.c +++ b/drivers/video/tegra/host/t186/t186.c @@ -124,6 +124,7 @@ static struct host1x_device_info host1x04_info = { .channel_policy = MAP_CHANNEL_ON_SUBMIT, .firmware_area_size = SZ_1M, .nb_actmons = 1, + .dma_mask = DMA_BIT_MASK(40), }; struct nvhost_device_data t18_host1x_info = { @@ -164,6 +165,7 @@ static struct host1x_device_info host1xb04_info = { .syncpt_policy = SYNCPT_PER_CHANNEL_INSTANCE, .channel_policy = MAP_CHANNEL_ON_SUBMIT, .firmware_area_size = SZ_1M, + .dma_mask = DMA_BIT_MASK(40), }; struct nvhost_device_data t18_host1xb_info = { @@ -239,6 +241,7 @@ struct nvhost_device_data t18_vi_info = { {0x30000 * 4, true} }, .num_ppc = 8, .aggregate_constraints = nvhost_vi4_aggregate_constraints, + .no_platform_dma_mask = true, }; #endif @@ -471,6 +474,7 @@ struct nvhost_device_data t18_nvcsi_info = { .keepalive = true, .serialize = 1, .push_work_done = 1, + .no_platform_dma_mask = true, }; #endif diff --git a/drivers/video/tegra/host/t194/t194.c b/drivers/video/tegra/host/t194/t194.c index d62f64f5c..9170abcc1 100644 --- a/drivers/video/tegra/host/t194/t194.c +++ b/drivers/video/tegra/host/t194/t194.c @@ -174,6 +174,7 @@ static struct host1x_device_info host1x04_info = { }, .nb_resources = 4, .secure_cmdfifo = true, + .dma_mask = DMA_BIT_MASK(40), }; struct nvhost_device_data t19_host1x_info = { diff --git a/drivers/video/tegra/host/t210/t210.c b/drivers/video/tegra/host/t210/t210.c index df0d771e6..a013bf6b7 100644 --- a/drivers/video/tegra/host/t210/t210.c +++ b/drivers/video/tegra/host/t210/t210.c @@ -70,6 +70,7 @@ static struct host1x_device_info host1x04_info = { .pts_limit = NV_HOST1X_SYNCPT_NB_PTS, .syncpt_policy = SYNCPT_PER_CHANNEL, .nb_actmons = 1, + .dma_mask = DMA_BIT_MASK(34), /* firmware_area_size=0 as no isolate_contexts=y */ }; diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h index 2c01ffdcc..d6170f7dc 100644 --- a/include/linux/nvhost.h +++ b/include/linux/nvhost.h @@ -382,6 +382,9 @@ struct nvhost_device_data { /* deliver task timestamps for falcon */ void (*enable_timestamps)(struct platform_device *pdev, struct nvhost_cdma *cdma, dma_addr_t timestamp_addr); + + /* don't apply platform dma mask */ + bool no_platform_dma_mask; }; -- 2.17.1