From eca2cf043e3f52734e2fbba68631a2ef70dad76d Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 11 Sep 2018 14:35:09 +0300 Subject: gpu: nvgpu: store bus addr of gpu regs Usermode submit needs to access the usermode region of registers from userspace. Store the start address of register resource in struct nvgpu_os_linux to be used in remap to userspace. Bug 200145225 Bug 200541476 Change-Id: I3796b6bf67942af0cc16c86accb82a013032bfc8 Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1811838 Reviewed-by: mobile promotions Signed-off-by: Debarshi Dutta (cherry picked from commit 38c11db264f776fa495a3ba74caadf4262062b78 in dev-main) Reviewed-on: https://git-master.nvidia.com/r/2169921 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Tested-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/pci.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers/gpu/nvgpu/os/linux/pci.c') diff --git a/drivers/gpu/nvgpu/os/linux/pci.c b/drivers/gpu/nvgpu/os/linux/pci.c index 2e456abc..61e412f2 100644 --- a/drivers/gpu/nvgpu/os/linux/pci.c +++ b/drivers/gpu/nvgpu/os/linux/pci.c @@ -536,6 +536,13 @@ static int nvgpu_pci_init_support(struct pci_dev *pdev) goto fail; } + l->regs_bus_addr = pci_resource_start(pdev, 0); + if (!l->regs_bus_addr) { + nvgpu_err(g, "failed to read register bus offset"); + err = -ENODEV; + goto fail; + } + l->bar1 = nvgpu_devm_ioremap(dev, pci_resource_start(pdev, 1), pci_resource_len(pdev, 1)); if (IS_ERR(l->bar1)) { -- cgit v1.2.2