mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 07:30:06 -04:00
drm/nouveau/pci: add PRI address of config space mirror to nvkm_pci_func
These registers have moved on GH100/GBxxx, and the GSP-RM init code uses hardcoded values from earlier GPUs to fill GspSystemInfo. Replace the per-GPU accessors in nvkm_pci_func with region info, and use it when initialising GspSystemInfo. Signed-off-by: Ben Skeggs <bskeggs@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Timur Tabi <ttabi@nvidia.com> Tested-by: Timur Tabi <ttabi@nvidia.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "priv.h"
|
||||
|
||||
#include <core/pci.h>
|
||||
#include <subdev/pci/priv.h>
|
||||
#include <subdev/timer.h>
|
||||
#include <subdev/vfn.h>
|
||||
#include <engine/fifo/chan.h>
|
||||
@@ -905,8 +906,8 @@ r535_gsp_set_system_info(struct nvkm_gsp *gsp)
|
||||
info->gpuPhysInstAddr = device->func->resource_addr(device, 3);
|
||||
info->nvDomainBusDeviceFunc = pci_dev_id(pdev->pdev);
|
||||
info->maxUserVa = TASK_SIZE;
|
||||
info->pciConfigMirrorBase = 0x088000;
|
||||
info->pciConfigMirrorSize = 0x001000;
|
||||
info->pciConfigMirrorBase = device->pci->func->cfg.addr;
|
||||
info->pciConfigMirrorSize = device->pci->func->cfg.size;
|
||||
r535_gsp_acpi_info(gsp, &info->acpiMethodData);
|
||||
|
||||
return nvkm_gsp_rpc_wr(gsp, info, NVKM_GSP_RPC_REPLY_NOWAIT);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "nvrm/msgfn.h"
|
||||
|
||||
#include <core/pci.h>
|
||||
#include <subdev/pci/priv.h>
|
||||
|
||||
static u32
|
||||
r570_gsp_sr_data_size(struct nvkm_gsp *gsp)
|
||||
@@ -157,8 +158,8 @@ r570_gsp_set_system_info(struct nvkm_gsp *gsp)
|
||||
info->gpuPhysInstAddr = device->func->resource_addr(device, 3);
|
||||
info->nvDomainBusDeviceFunc = pci_dev_id(pdev);
|
||||
info->maxUserVa = TASK_SIZE;
|
||||
info->pciConfigMirrorBase = 0x088000;
|
||||
info->pciConfigMirrorSize = 0x001000;
|
||||
info->pciConfigMirrorBase = device->pci->func->cfg.addr;
|
||||
info->pciConfigMirrorSize = device->pci->func->cfg.size;
|
||||
info->PCIDeviceID = (pdev->device << 16) | pdev->vendor;
|
||||
info->PCISubDeviceID = (pdev->subsystem_device << 16) | pdev->subsystem_vendor;
|
||||
info->PCIRevisionID = pdev->revision;
|
||||
|
||||
@@ -39,26 +39,26 @@ nvkm_pci_msi_rearm(struct nvkm_device *device)
|
||||
u32
|
||||
nvkm_pci_rd32(struct nvkm_pci *pci, u16 addr)
|
||||
{
|
||||
return pci->func->rd32(pci, addr);
|
||||
return nvkm_rd32(pci->subdev.device, pci->func->cfg.addr + addr);
|
||||
}
|
||||
|
||||
void
|
||||
nvkm_pci_wr08(struct nvkm_pci *pci, u16 addr, u8 data)
|
||||
{
|
||||
pci->func->wr08(pci, addr, data);
|
||||
nvkm_wr08(pci->subdev.device, pci->func->cfg.addr + addr, data);
|
||||
}
|
||||
|
||||
void
|
||||
nvkm_pci_wr32(struct nvkm_pci *pci, u16 addr, u32 data)
|
||||
{
|
||||
pci->func->wr32(pci, addr, data);
|
||||
nvkm_wr32(pci->subdev.device, pci->func->cfg.addr + addr, data);
|
||||
}
|
||||
|
||||
u32
|
||||
nvkm_pci_mask(struct nvkm_pci *pci, u16 addr, u32 mask, u32 value)
|
||||
{
|
||||
u32 data = pci->func->rd32(pci, addr);
|
||||
pci->func->wr32(pci, addr, (data & ~mask) | value);
|
||||
u32 data = nvkm_pci_rd32(pci, addr);
|
||||
nvkm_pci_wr32(pci, addr, (data & ~mask) | value);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,10 +132,9 @@ g84_pcie_init(struct nvkm_pci *pci)
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
g84_pci_func = {
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
|
||||
.init = g84_pci_init,
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.msi_rearm = nv46_pci_msi_rearm,
|
||||
|
||||
.pcie.init = g84_pcie_init,
|
||||
|
||||
@@ -33,10 +33,9 @@ g92_pcie_version_supported(struct nvkm_pci *pci)
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
g92_pci_func = {
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
|
||||
.init = g84_pci_init,
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.msi_rearm = nv46_pci_msi_rearm,
|
||||
|
||||
.pcie.init = g84_pcie_init,
|
||||
|
||||
@@ -25,10 +25,9 @@
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
g94_pci_func = {
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
|
||||
.init = g84_pci_init,
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.msi_rearm = nv40_pci_msi_rearm,
|
||||
|
||||
.pcie.init = g84_pcie_init,
|
||||
|
||||
@@ -78,10 +78,9 @@ gf100_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width)
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
gf100_pci_func = {
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
|
||||
.init = g84_pci_init,
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.msi_rearm = gf100_pci_msi_rearm,
|
||||
|
||||
.pcie.init = gf100_pcie_init,
|
||||
|
||||
@@ -25,10 +25,9 @@
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
gf106_pci_func = {
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
|
||||
.init = g84_pci_init,
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.msi_rearm = nv40_pci_msi_rearm,
|
||||
|
||||
.pcie.init = gf100_pcie_init,
|
||||
|
||||
@@ -204,10 +204,9 @@ gk104_pcie_set_link(struct nvkm_pci *pci, enum nvkm_pcie_speed speed, u8 width)
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
gk104_pci_func = {
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
|
||||
.init = g84_pci_init,
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.msi_rearm = nv40_pci_msi_rearm,
|
||||
|
||||
.pcie.init = gk104_pcie_init,
|
||||
|
||||
@@ -31,9 +31,7 @@ gp100_pci_msi_rearm(struct nvkm_pci *pci)
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
gp100_pci_func = {
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
.msi_rearm = gp100_pci_msi_rearm,
|
||||
};
|
||||
|
||||
|
||||
@@ -23,32 +23,9 @@
|
||||
*/
|
||||
#include "priv.h"
|
||||
|
||||
static u32
|
||||
nv04_pci_rd32(struct nvkm_pci *pci, u16 addr)
|
||||
{
|
||||
struct nvkm_device *device = pci->subdev.device;
|
||||
return nvkm_rd32(device, 0x001800 + addr);
|
||||
}
|
||||
|
||||
static void
|
||||
nv04_pci_wr08(struct nvkm_pci *pci, u16 addr, u8 data)
|
||||
{
|
||||
struct nvkm_device *device = pci->subdev.device;
|
||||
nvkm_wr08(device, 0x001800 + addr, data);
|
||||
}
|
||||
|
||||
static void
|
||||
nv04_pci_wr32(struct nvkm_pci *pci, u16 addr, u32 data)
|
||||
{
|
||||
struct nvkm_device *device = pci->subdev.device;
|
||||
nvkm_wr32(device, 0x001800 + addr, data);
|
||||
}
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
nv04_pci_func = {
|
||||
.rd32 = nv04_pci_rd32,
|
||||
.wr08 = nv04_pci_wr08,
|
||||
.wr32 = nv04_pci_wr32,
|
||||
.cfg = { .addr = 0x001800, .size = 0x1000 },
|
||||
};
|
||||
|
||||
int
|
||||
|
||||
@@ -23,27 +23,6 @@
|
||||
*/
|
||||
#include "priv.h"
|
||||
|
||||
u32
|
||||
nv40_pci_rd32(struct nvkm_pci *pci, u16 addr)
|
||||
{
|
||||
struct nvkm_device *device = pci->subdev.device;
|
||||
return nvkm_rd32(device, 0x088000 + addr);
|
||||
}
|
||||
|
||||
void
|
||||
nv40_pci_wr08(struct nvkm_pci *pci, u16 addr, u8 data)
|
||||
{
|
||||
struct nvkm_device *device = pci->subdev.device;
|
||||
nvkm_wr08(device, 0x088000 + addr, data);
|
||||
}
|
||||
|
||||
void
|
||||
nv40_pci_wr32(struct nvkm_pci *pci, u16 addr, u32 data)
|
||||
{
|
||||
struct nvkm_device *device = pci->subdev.device;
|
||||
nvkm_wr32(device, 0x088000 + addr, data);
|
||||
}
|
||||
|
||||
void
|
||||
nv40_pci_msi_rearm(struct nvkm_pci *pci)
|
||||
{
|
||||
@@ -52,9 +31,7 @@ nv40_pci_msi_rearm(struct nvkm_pci *pci)
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
nv40_pci_func = {
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
.msi_rearm = nv40_pci_msi_rearm,
|
||||
};
|
||||
|
||||
|
||||
@@ -38,9 +38,7 @@ nv46_pci_msi_rearm(struct nvkm_pci *pci)
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
nv46_pci_func = {
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
.msi_rearm = nv46_pci_msi_rearm,
|
||||
};
|
||||
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
|
||||
static const struct nvkm_pci_func
|
||||
nv4c_pci_func = {
|
||||
.rd32 = nv40_pci_rd32,
|
||||
.wr08 = nv40_pci_wr08,
|
||||
.wr32 = nv40_pci_wr32,
|
||||
.cfg = { .addr = 0x088000, .size = 0x1000 },
|
||||
};
|
||||
|
||||
int
|
||||
|
||||
@@ -8,10 +8,12 @@ int nvkm_pci_new_(const struct nvkm_pci_func *, struct nvkm_device *, enum nvkm_
|
||||
struct nvkm_pci **);
|
||||
|
||||
struct nvkm_pci_func {
|
||||
struct {
|
||||
u32 addr;
|
||||
u16 size;
|
||||
} cfg;
|
||||
|
||||
void (*init)(struct nvkm_pci *);
|
||||
u32 (*rd32)(struct nvkm_pci *, u16 addr);
|
||||
void (*wr08)(struct nvkm_pci *, u16 addr, u8 data);
|
||||
void (*wr32)(struct nvkm_pci *, u16 addr, u32 data);
|
||||
void (*msi_rearm)(struct nvkm_pci *);
|
||||
|
||||
struct {
|
||||
@@ -27,9 +29,6 @@ struct nvkm_pci_func {
|
||||
} pcie;
|
||||
};
|
||||
|
||||
u32 nv40_pci_rd32(struct nvkm_pci *, u16);
|
||||
void nv40_pci_wr08(struct nvkm_pci *, u16, u8);
|
||||
void nv40_pci_wr32(struct nvkm_pci *, u16, u32);
|
||||
void nv40_pci_msi_rearm(struct nvkm_pci *);
|
||||
|
||||
void nv46_pci_msi_rearm(struct nvkm_pci *);
|
||||
|
||||
Reference in New Issue
Block a user