Skip to content

Commit

Permalink
drm/nouveau/pci: merge agp handling from nouveau drm
Browse files Browse the repository at this point in the history
This commit reinstates the pre-DEVINIT AGP fiddling that was broken in
an earlier commit.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Aug 28, 2015
1 parent 26c9e8e commit 340b0e7
Show file tree
Hide file tree
Showing 18 changed files with 271 additions and 239 deletions.
1 change: 0 additions & 1 deletion drivers/gpu/drm/nouveau/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ nouveau-y += $(nvkm-y)
ifdef CONFIG_X86
nouveau-$(CONFIG_ACPI) += nouveau_acpi.o
endif
nouveau-y += nouveau_agp.o
nouveau-$(CONFIG_DEBUG_FS) += nouveau_debugfs.o
nouveau-y += nouveau_drm.o
nouveau-y += nouveau_hwmon.o
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/include/nvif/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ u64 nvif_device_time(struct nvif_device *);
#include <subdev/i2c.h>
#include <subdev/timer.h>
#include <subdev/therm.h>
#include <subdev/pci.h>

#define nvxx_device(a) ({ \
struct nvif_device *_device = (a); \
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/include/nvif/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/power_supply.h>
#include <linux/clk.h>
#include <linux/regulator/consumer.h>
#include <linux/agp_backend.h>

#include <asm/unaligned.h>

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/nouveau/include/nvkm/core/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

const char *nvkm_stropt(const char *optstr, const char *opt, int *len);
bool nvkm_boolopt(const char *optstr, const char *opt, bool value);
long nvkm_longopt(const char *optstr, const char *opt, long value);
int nvkm_dbgopt(const char *optstr, const char *sub);

/* compares unterminated string 'str' with zero-terminated string 'cmp' */
Expand Down
11 changes: 11 additions & 0 deletions drivers/gpu/drm/nouveau/include/nvkm/subdev/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ struct nvkm_pci {
struct nvkm_subdev subdev;
struct pci_dev *pdev;
int irq;

struct {
struct agp_bridge_data *bridge;
u32 mode;
u64 base;
u64 size;
int mtrr;
bool cma;
bool acquired;
} agp;

bool msi;
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/nouveau_abi16.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
args.start += chan->ntfy_vma.offset;
args.limit += chan->ntfy_vma.offset;
} else
if (drm->agp.stat == ENABLED) {
if (drm->agp.bridge) {
args.target = NV_DMA_V0_TARGET_AGP;
args.access = NV_DMA_V0_ACCESS_RDWR;
args.start += drm->agp.base + chan->ntfy->bo.offset;
Expand Down
198 changes: 0 additions & 198 deletions drivers/gpu/drm/nouveau/nouveau_agp.c

This file was deleted.

10 changes: 0 additions & 10 deletions drivers/gpu/drm/nouveau/nouveau_agp.h

This file was deleted.

17 changes: 8 additions & 9 deletions drivers/gpu/drm/nouveau/nouveau_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,9 @@ nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size,
{
#if __OS_HAS_AGP
struct nouveau_drm *drm = nouveau_bdev(bdev);
struct drm_device *dev = drm->dev;

if (drm->agp.stat == ENABLED) {
return ttm_agp_tt_create(bdev, dev->agp->bridge, size,
if (drm->agp.bridge) {
return ttm_agp_tt_create(bdev, drm->agp.bridge, size,
page_flags, dummy_read);
}
#endif
Expand Down Expand Up @@ -631,12 +630,12 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
if (drm->device.info.family >= NV_DEVICE_INFO_V0_TESLA)
man->func = &nouveau_gart_manager;
else
if (drm->agp.stat != ENABLED)
if (!drm->agp.bridge)
man->func = &nv04_gart_manager;
else
man->func = &ttm_bo_manager_func;

if (drm->agp.stat == ENABLED) {
if (drm->agp.bridge) {
man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
man->available_caching = TTM_PL_FLAG_UNCACHED |
TTM_PL_FLAG_WC;
Expand Down Expand Up @@ -1368,10 +1367,10 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
return 0;
case TTM_PL_TT:
#if __OS_HAS_AGP
if (drm->agp.stat == ENABLED) {
if (drm->agp.bridge) {
mem->bus.offset = mem->start << PAGE_SHIFT;
mem->bus.base = drm->agp.base;
mem->bus.is_iomem = !drm->dev->agp->cant_use_aperture;
mem->bus.is_iomem = !drm->agp.cma;
}
#endif
if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA || !node->memtype)
Expand Down Expand Up @@ -1498,7 +1497,7 @@ nouveau_ttm_tt_populate(struct ttm_tt *ttm)
return ttm_dma_populate(ttm_dma, dev->dev);

#if __OS_HAS_AGP
if (drm->agp.stat == ENABLED) {
if (drm->agp.bridge) {
return ttm_agp_tt_populate(ttm);
}
#endif
Expand Down Expand Up @@ -1565,7 +1564,7 @@ nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
}

#if __OS_HAS_AGP
if (drm->agp.stat == ENABLED) {
if (drm->agp.bridge) {
ttm_agp_tt_unpopulate(ttm);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/nouveau/nouveau_chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
args.limit = device->info.ram_user - 1;
}
} else {
if (chan->drm->agp.stat == ENABLED) {
if (chan->drm->agp.bridge) {
args.target = NV_DMA_V0_TARGET_AGP;
args.access = NV_DMA_V0_ACCESS_RDWR;
args.start = chan->drm->agp.base;
Expand Down Expand Up @@ -328,7 +328,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart)
args.start = 0;
args.limit = cli->vm->mmu->limit - 1;
} else
if (chan->drm->agp.stat == ENABLED) {
if (chan->drm->agp.bridge) {
args.target = NV_DMA_V0_TARGET_AGP;
args.access = NV_DMA_V0_ACCESS_RDWR;
args.start = chan->drm->agp.base;
Expand Down
Loading

0 comments on commit 340b0e7

Please sign in to comment.