Commit 0ac9d210 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/device: simplify subdev construction

Replaces the piece-by-piece (in response to NV_DEVICE ctor args) device
contruction with a once-off all-or-nothing approach, eliminating some
tricky refcounting issues.  The partial device init capability was only
required by some tools, and has been moved to probe time instead.

Temporarily removes a workaround for some boards where we need to fiddle
with AGP registers before executing the DEVINIT scripts.  A later commit
in this series reinstates it.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent c813d8e0
...@@ -126,29 +126,6 @@ struct nv_device_v0 { ...@@ -126,29 +126,6 @@ struct nv_device_v0 {
__u8 version; __u8 version;
__u8 pad01[7]; __u8 pad01[7];
__u64 device; /* device identifier, ~0 for client default */ __u64 device; /* device identifier, ~0 for client default */
#define NV_DEVICE_V0_DISABLE_IDENTIFY 0x0000000000000001ULL
#define NV_DEVICE_V0_DISABLE_MMIO 0x0000000000000002ULL
#define NV_DEVICE_V0_DISABLE_VBIOS 0x0000000000000004ULL
#define NV_DEVICE_V0_DISABLE_CORE 0x0000000000000008ULL
#define NV_DEVICE_V0_DISABLE_DISP 0x0000000000010000ULL
#define NV_DEVICE_V0_DISABLE_FIFO 0x0000000000020000ULL
#define NV_DEVICE_V0_DISABLE_GR 0x0000000100000000ULL
#define NV_DEVICE_V0_DISABLE_MPEG 0x0000000200000000ULL
#define NV_DEVICE_V0_DISABLE_ME 0x0000000400000000ULL
#define NV_DEVICE_V0_DISABLE_VP 0x0000000800000000ULL
#define NV_DEVICE_V0_DISABLE_CIPHER 0x0000001000000000ULL
#define NV_DEVICE_V0_DISABLE_BSP 0x0000002000000000ULL
#define NV_DEVICE_V0_DISABLE_MSPPP 0x0000004000000000ULL
#define NV_DEVICE_V0_DISABLE_CE0 0x0000008000000000ULL
#define NV_DEVICE_V0_DISABLE_CE1 0x0000010000000000ULL
#define NV_DEVICE_V0_DISABLE_VIC 0x0000020000000000ULL
#define NV_DEVICE_V0_DISABLE_MSENC 0x0000040000000000ULL
#define NV_DEVICE_V0_DISABLE_CE2 0x0000080000000000ULL
#define NV_DEVICE_V0_DISABLE_MSVLD 0x0000100000000000ULL
#define NV_DEVICE_V0_DISABLE_SEC 0x0000200000000000ULL
#define NV_DEVICE_V0_DISABLE_MSPDEC 0x0000400000000000ULL
__u64 disable; /* disable particular subsystems */
__u64 debug0; /* as above, but *internal* ids, and *NOT* ABI */
}; };
#define NV_DEVICE_V0_INFO 0x00 #define NV_DEVICE_V0_INFO 0x00
......
...@@ -212,6 +212,7 @@ enum nv_bus_type { ...@@ -212,6 +212,7 @@ enum nv_bus_type {
int nvkm_device_new(void *, enum nv_bus_type type, u64 name, int nvkm_device_new(void *, enum nv_bus_type type, u64 name,
const char *sname, const char *cfg, const char *dbg, const char *sname, const char *cfg, const char *dbg,
bool detect, bool mmio, u64 subdev_mask,
struct nvkm_device **); struct nvkm_device **);
void nvkm_device_del(struct nvkm_device **); void nvkm_device_del(struct nvkm_device **);
......
...@@ -327,7 +327,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev, ...@@ -327,7 +327,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
ret = nvkm_device_new(pdev, NVKM_BUS_PCI, nouveau_pci_name(pdev), ret = nvkm_device_new(pdev, NVKM_BUS_PCI, nouveau_pci_name(pdev),
pci_name(pdev), nouveau_config, nouveau_debug, pci_name(pdev), nouveau_config, nouveau_debug,
&device); true, true, ~0ULL, &device);
if (ret) if (ret)
return ret; return ret;
...@@ -375,7 +375,6 @@ nouveau_get_hdmi_dev(struct nouveau_drm *drm) ...@@ -375,7 +375,6 @@ nouveau_get_hdmi_dev(struct nouveau_drm *drm)
static int static int
nouveau_drm_load(struct drm_device *dev, unsigned long flags) nouveau_drm_load(struct drm_device *dev, unsigned long flags)
{ {
struct pci_dev *pdev = dev->pdev;
struct nouveau_drm *drm; struct nouveau_drm *drm;
int ret; int ret;
...@@ -393,36 +392,10 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -393,36 +392,10 @@ nouveau_drm_load(struct drm_device *dev, unsigned long flags)
nouveau_get_hdmi_dev(drm); nouveau_get_hdmi_dev(drm);
/* make sure AGP controller is in a consistent state before we
* (possibly) execute vbios init tables (see nouveau_agp.h)
*/
if (pdev && drm_pci_device_is_agp(dev) && dev->agp) {
const u64 enables = NV_DEVICE_V0_DISABLE_IDENTIFY |
NV_DEVICE_V0_DISABLE_MMIO;
/* dummy device object, doesn't init anything, but allows
* agp code access to registers
*/
ret = nvif_device_init(&drm->client.base.base, NULL,
NVDRM_DEVICE, NV_DEVICE,
&(struct nv_device_v0) {
.device = ~0,
.disable = ~enables,
.debug0 = ~0,
}, sizeof(struct nv_device_v0),
&drm->device);
if (ret)
goto fail_device;
nouveau_agp_reset(drm);
nvif_device_fini(&drm->device);
}
ret = nvif_device_init(&drm->client.base.base, NULL, NVDRM_DEVICE, ret = nvif_device_init(&drm->client.base.base, NULL, NVDRM_DEVICE,
NV_DEVICE, NV_DEVICE,
&(struct nv_device_v0) { &(struct nv_device_v0) {
.device = ~0, .device = ~0,
.disable = 0,
.debug0 = 0,
}, sizeof(struct nv_device_v0), }, sizeof(struct nv_device_v0),
&drm->device); &drm->device);
if (ret) if (ret)
...@@ -1065,7 +1038,8 @@ nouveau_platform_device_create(struct platform_device *pdev, ...@@ -1065,7 +1038,8 @@ nouveau_platform_device_create(struct platform_device *pdev,
err = nvkm_device_new(pdev, NVKM_BUS_PLATFORM, err = nvkm_device_new(pdev, NVKM_BUS_PLATFORM,
nouveau_platform_name(pdev), nouveau_platform_name(pdev),
dev_name(&pdev->dev), nouveau_config, dev_name(&pdev->dev), nouveau_config,
nouveau_debug, pdevice); nouveau_debug, true, true, ~0ULL,
pdevice);
if (err) if (err)
goto err_free; goto err_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment