Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'linux-4.7' of git://github.com/skeggsb/linux into drm-next

Nothing too exciting here, there's a larger chunk of work that still
needs more testing but not likely to get that done today - so - here's
the rest of it. Assuming nothing else goes horribly wrong, I should be
able to send the rest Monday if it isn't too late....

Changes:
- Improvements to power sensor support
- Initial attempt at GM108 support
- Minor fixes to GR init + ucode
- Make use of topology information (provided by the GPU) in various
places, should at least fix some fault recovery issues and
engine/runlist mapping confusion on newer GPUs.

* 'linux-4.7' of git://github.com/skeggsb/linux: (51 commits)
drm/nouveau/gr/gf100-: fix race condition in fecs/gpccs ucode
drm/nouveau/core: recognise GM108 chipsets
drm/nouveau/gr/gm107-: fix touching non-existent ppcs in attrib cb setup
drm/nouveau/gr/gk104-: share implementation of ppc exception init
drm/nouveau/gr/gk104-: move rop_active_fbps init to nonctx
drm/nouveau/bios/pll: check BIT table version before trying to parse it
drm/nouveau/bios/pll: prevent oops when limits table can't be parsed
drm/nouveau/volt/gk104: round up in gk104_volt_set
drm/nouveau/fb/gm200: setup mmu debug buffer registers at init()
drm/nouveau/fb/gk20a,gm20b: setup mmu debug buffer registers at init()
drm/nouveau/fb/gf100-: allocate mmu debug buffers
drm/nouveau/fb: allow chipset-specific actions for oneinit()
drm/nouveau/gr/gm200-: fix bad hardcoding of a max-tpcs-per-gpc value
drm/nouveau/gr/gm200-: rop count == ltc count
drm/nouveau/gr/gm200: modify the mask when copying mmu settings from fb
drm/nouveau/gr/gm200: move some code into init_gpc_mmu() hook
drm/nouveau/gr/gm200: make generate_main() static
drm/nouveau/gr/gf100-: abstract fetching rop count
drm/nouveau/gr/gf100-: rename magic_not_rop_nr to screen_tile_row_offset
drm/nouveau/gr/gf100-: remove hardcoded idle_timeout values
...

+1860 -850
+1 -1
drivers/gpu/drm/nouveau/dispnv04/arb.c
··· 23 23 24 24 #include <drm/drmP.h> 25 25 26 - #include "nouveau_drm.h" 26 + #include "nouveau_drv.h" 27 27 #include "nouveau_reg.h" 28 28 #include "hw.h" 29 29
+2 -1
drivers/gpu/drm/nouveau/dispnv04/crtc.c
··· 28 28 #include <drm/drm_crtc_helper.h> 29 29 #include <drm/drm_plane_helper.h> 30 30 31 - #include "nouveau_drm.h" 31 + #include "nouveau_drv.h" 32 32 #include "nouveau_reg.h" 33 + #include "nouveau_ttm.h" 33 34 #include "nouveau_bo.h" 34 35 #include "nouveau_gem.h" 35 36 #include "nouveau_encoder.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/cursor.c
··· 1 1 #include <drm/drmP.h> 2 2 #include <drm/drm_mode.h> 3 - #include "nouveau_drm.h" 3 + #include "nouveau_drv.h" 4 4 #include "nouveau_reg.h" 5 5 #include "nouveau_crtc.h" 6 6 #include "hw.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/dac.c
··· 27 27 #include <drm/drmP.h> 28 28 #include <drm/drm_crtc_helper.h> 29 29 30 - #include "nouveau_drm.h" 30 + #include "nouveau_drv.h" 31 31 #include "nouveau_encoder.h" 32 32 #include "nouveau_connector.h" 33 33 #include "nouveau_crtc.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/dfp.c
··· 27 27 #include <drm/drmP.h> 28 28 #include <drm/drm_crtc_helper.h> 29 29 30 - #include "nouveau_drm.h" 30 + #include "nouveau_drv.h" 31 31 #include "nouveau_reg.h" 32 32 #include "nouveau_encoder.h" 33 33 #include "nouveau_connector.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/disp.c
··· 25 25 #include <drm/drmP.h> 26 26 #include <drm/drm_crtc_helper.h> 27 27 28 - #include "nouveau_drm.h" 28 + #include "nouveau_drv.h" 29 29 #include "nouveau_reg.h" 30 30 #include "hw.h" 31 31 #include "nouveau_encoder.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/disp.h
··· 1 1 #ifndef __NV04_DISPLAY_H__ 2 2 #define __NV04_DISPLAY_H__ 3 - 3 + #include <subdev/bios.h> 4 4 #include <subdev/bios/pll.h> 5 5 6 6 #include "nouveau_display.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/hw.c
··· 23 23 */ 24 24 25 25 #include <drm/drmP.h> 26 - #include "nouveau_drm.h" 26 + #include "nouveau_drv.h" 27 27 #include "hw.h" 28 28 29 29 #include <subdev/bios/pll.h>
+1 -1
drivers/gpu/drm/nouveau/dispnv04/overlay.c
··· 27 27 #include <drm/drm_crtc.h> 28 28 #include <drm/drm_fourcc.h> 29 29 30 - #include "nouveau_drm.h" 30 + #include "nouveau_drv.h" 31 31 32 32 #include "nouveau_bo.h" 33 33 #include "nouveau_connector.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/tvmodesnv17.c
··· 26 26 27 27 #include <drm/drmP.h> 28 28 #include <drm/drm_crtc_helper.h> 29 - #include "nouveau_drm.h" 29 + #include "nouveau_drv.h" 30 30 #include "nouveau_encoder.h" 31 31 #include "nouveau_crtc.h" 32 32 #include "hw.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/tvnv04.c
··· 25 25 */ 26 26 27 27 #include <drm/drmP.h> 28 - #include "nouveau_drm.h" 28 + #include "nouveau_drv.h" 29 29 #include "nouveau_reg.h" 30 30 #include "nouveau_encoder.h" 31 31 #include "nouveau_connector.h"
+1 -1
drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
··· 26 26 27 27 #include <drm/drmP.h> 28 28 #include <drm/drm_crtc_helper.h> 29 - #include "nouveau_drm.h" 29 + #include "nouveau_drv.h" 30 30 #include "nouveau_reg.h" 31 31 #include "nouveau_encoder.h" 32 32 #include "nouveau_connector.h"
+3
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
··· 7 7 NVKM_SUBDEV_PCI, 8 8 NVKM_SUBDEV_VBIOS, 9 9 NVKM_SUBDEV_DEVINIT, 10 + NVKM_SUBDEV_TOP, 10 11 NVKM_SUBDEV_IBUS, 11 12 NVKM_SUBDEV_GPIO, 12 13 NVKM_SUBDEV_I2C, ··· 132 131 struct nvkm_secboot *secboot; 133 132 struct nvkm_therm *therm; 134 133 struct nvkm_timer *timer; 134 + struct nvkm_top *top; 135 135 struct nvkm_volt *volt; 136 136 137 137 struct nvkm_engine *bsp; ··· 202 200 int (*secboot )(struct nvkm_device *, int idx, struct nvkm_secboot **); 203 201 int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **); 204 202 int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **); 203 + int (*top )(struct nvkm_device *, int idx, struct nvkm_top **); 205 204 int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **); 206 205 207 206 int (*bsp )(struct nvkm_device *, int idx, struct nvkm_engine **);
+2 -4
drivers/gpu/drm/nouveau/include/nvkm/core/engine.h
··· 38 38 }; 39 39 40 40 int nvkm_engine_ctor(const struct nvkm_engine_func *, struct nvkm_device *, 41 - int index, u32 pmc_enable, bool enable, 42 - struct nvkm_engine *); 41 + int index, bool enable, struct nvkm_engine *); 43 42 int nvkm_engine_new_(const struct nvkm_engine_func *, struct nvkm_device *, 44 - int index, u32 pmc_enable, bool enable, 45 - struct nvkm_engine **); 43 + int index, bool enable, struct nvkm_engine **); 46 44 struct nvkm_engine *nvkm_engine_ref(struct nvkm_engine *); 47 45 void nvkm_engine_unref(struct nvkm_engine **); 48 46 void nvkm_engine_tile(struct nvkm_engine *, int region);
+1 -2
drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h
··· 6 6 const struct nvkm_subdev_func *func; 7 7 struct nvkm_device *device; 8 8 enum nvkm_devidx index; 9 - u32 pmc_enable; 10 9 struct mutex mutex; 11 10 u32 debug; 12 11 ··· 23 24 24 25 extern const char *nvkm_subdev_name[NVKM_SUBDEV_NR]; 25 26 void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *, 26 - int index, u32 pmc_enable, struct nvkm_subdev *); 27 + int index, struct nvkm_subdev *); 27 28 void nvkm_subdev_del(struct nvkm_subdev **); 28 29 int nvkm_subdev_preinit(struct nvkm_subdev *); 29 30 int nvkm_subdev_init(struct nvkm_subdev *);
-1
drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h
··· 40 40 u32 *data; 41 41 u32 size; 42 42 } data; 43 - u32 pmc_enable; 44 43 void (*init)(struct nvkm_falcon *); 45 44 void (*intr)(struct nvkm_falcon *, struct nvkm_fifo_chan *); 46 45 struct nvkm_sclass sclass[];
-1
drivers/gpu/drm/nouveau/include/nvkm/engine/xtensa.h
··· 15 15 int index, bool enable, u32 addr, struct nvkm_engine **); 16 16 17 17 struct nvkm_xtensa_func { 18 - u32 pmc_enable; 19 18 u32 fifo_val; 20 19 u32 unkd28; 21 20 struct nvkm_sclass sclass[];
+1
drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h
··· 7 7 const struct nvkm_devinit_func *func; 8 8 struct nvkm_subdev subdev; 9 9 bool post; 10 + bool force_post; 10 11 }; 11 12 12 13 u32 nvkm_devinit_mmio(struct nvkm_devinit *, u32 addr);
+4
drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h
··· 55 55 struct nvkm_fb_tile region[16]; 56 56 int regions; 57 57 } tile; 58 + 59 + struct nvkm_memory *mmu_rd; 60 + struct nvkm_memory *mmu_wr; 58 61 }; 59 62 60 63 bool nvkm_fb_memtype_valid(struct nvkm_fb *, u32 memtype); ··· 90 87 int gk104_fb_new(struct nvkm_device *, int, struct nvkm_fb **); 91 88 int gk20a_fb_new(struct nvkm_device *, int, struct nvkm_fb **); 92 89 int gm107_fb_new(struct nvkm_device *, int, struct nvkm_fb **); 90 + int gm200_fb_new(struct nvkm_device *, int, struct nvkm_fb **); 93 91 94 92 #include <subdev/bios.h> 95 93 #include <subdev/bios/ramcfg.h>
+2 -4
drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h
··· 3 3 4 4 #include <core/subdev.h> 5 5 6 - struct nkvm_iccsense_rail; 7 6 struct nvkm_iccsense { 8 7 struct nvkm_subdev subdev; 9 - u8 rail_count; 10 8 bool data_valid; 11 - struct nvkm_iccsense_rail *rails; 9 + struct list_head sensors; 10 + struct list_head rails; 12 11 }; 13 12 14 13 int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **); 15 - int nvkm_iccsense_read(struct nvkm_iccsense *iccsense, u8 idx); 16 14 int nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense); 17 15 #endif
+6
drivers/gpu/drm/nouveau/include/nvkm/subdev/mc.h
··· 10 10 void nvkm_mc_intr(struct nvkm_mc *, bool *handled); 11 11 void nvkm_mc_intr_unarm(struct nvkm_mc *); 12 12 void nvkm_mc_intr_rearm(struct nvkm_mc *); 13 + void nvkm_mc_reset(struct nvkm_mc *, enum nvkm_devidx); 13 14 void nvkm_mc_unk260(struct nvkm_mc *, u32 data); 14 15 15 16 int nv04_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 17 + int nv11_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 18 + int nv17_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 16 19 int nv44_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 17 20 int nv50_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 21 + int g84_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 18 22 int g98_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 23 + int gt215_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 19 24 int gf100_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 25 + int gk104_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 20 26 int gk20a_mc_new(struct nvkm_device *, int, struct nvkm_mc **); 21 27 #endif
+17
drivers/gpu/drm/nouveau/include/nvkm/subdev/top.h
··· 1 + #ifndef __NVKM_TOP_H__ 2 + #define __NVKM_TOP_H__ 3 + #include <core/subdev.h> 4 + 5 + struct nvkm_top { 6 + const struct nvkm_top_func *func; 7 + struct nvkm_subdev subdev; 8 + struct list_head device; 9 + }; 10 + 11 + u32 nvkm_top_reset(struct nvkm_top *, enum nvkm_devidx); 12 + u32 nvkm_top_intr(struct nvkm_top *, u32 intr, u64 *subdevs); 13 + enum nvkm_devidx nvkm_top_fault(struct nvkm_top *, int fault); 14 + enum nvkm_devidx nvkm_top_engine(struct nvkm_top *, int, int *runl, int *engn); 15 + 16 + int gk104_top_new(struct nvkm_device *, int, struct nvkm_top **); 17 + #endif
+1 -1
drivers/gpu/drm/nouveau/nouveau_abi16.c
··· 29 29 #include <nvif/cla06f.h> 30 30 #include <nvif/unpack.h> 31 31 32 - #include "nouveau_drm.h" 32 + #include "nouveau_drv.h" 33 33 #include "nouveau_dma.h" 34 34 #include "nouveau_gem.h" 35 35 #include "nouveau_chan.h"
+1 -1
drivers/gpu/drm/nouveau/nouveau_acpi.c
··· 6 6 #include <drm/drm_edid.h> 7 7 #include <acpi/video.h> 8 8 9 - #include "nouveau_drm.h" 9 + #include "nouveau_drv.h" 10 10 #include "nouveau_acpi.h" 11 11 12 12 #define NOUVEAU_DSM_LED 0x02
+1 -1
drivers/gpu/drm/nouveau/nouveau_backlight.c
··· 32 32 33 33 #include <linux/backlight.h> 34 34 35 - #include "nouveau_drm.h" 35 + #include "nouveau_drv.h" 36 36 #include "nouveau_reg.h" 37 37 #include "nouveau_encoder.h" 38 38
+1 -1
drivers/gpu/drm/nouveau/nouveau_bios.c
··· 24 24 25 25 #include <drm/drmP.h> 26 26 27 - #include "nouveau_drm.h" 27 + #include "nouveau_drv.h" 28 28 #include "nouveau_reg.h" 29 29 #include "dispnv04/hw.h" 30 30 #include "nouveau_encoder.h"
+1 -1
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 30 30 #include <linux/dma-mapping.h> 31 31 #include <linux/swiotlb.h> 32 32 33 - #include "nouveau_drm.h" 33 + #include "nouveau_drv.h" 34 34 #include "nouveau_dma.h" 35 35 #include "nouveau_fence.h" 36 36
+1 -1
drivers/gpu/drm/nouveau/nouveau_chan.c
··· 34 34 /*XXX*/ 35 35 #include <core/client.h> 36 36 37 - #include "nouveau_drm.h" 37 + #include "nouveau_drv.h" 38 38 #include "nouveau_dma.h" 39 39 #include "nouveau_bo.h" 40 40 #include "nouveau_chan.h"
+1 -1
drivers/gpu/drm/nouveau/nouveau_connector.c
··· 34 34 #include <drm/drm_crtc_helper.h> 35 35 36 36 #include "nouveau_reg.h" 37 - #include "nouveau_drm.h" 37 + #include "nouveau_drv.h" 38 38 #include "dispnv04/hw.h" 39 39 #include "nouveau_acpi.h" 40 40
+1 -1
drivers/gpu/drm/nouveau/nouveau_debugfs.c
··· 32 32 #include <nvif/class.h> 33 33 #include <nvif/if0001.h> 34 34 #include "nouveau_debugfs.h" 35 - #include "nouveau_drm.h" 35 + #include "nouveau_drv.h" 36 36 37 37 static int 38 38 nouveau_debugfs_vbios_image(struct seq_file *m, void *data)
+1 -1
drivers/gpu/drm/nouveau/nouveau_debugfs.h
··· 5 5 6 6 #if defined(CONFIG_DEBUG_FS) 7 7 8 - #include "nouveau_drm.h" 8 + #include "nouveau_drv.h" 9 9 10 10 struct nouveau_debugfs { 11 11 struct nvif_object ctrl;
+1 -1
drivers/gpu/drm/nouveau/nouveau_display.h
··· 3 3 4 4 #include <subdev/mmu.h> 5 5 6 - #include "nouveau_drm.h" 6 + #include "nouveau_drv.h" 7 7 8 8 struct nouveau_framebuffer { 9 9 struct drm_framebuffer base;
+1 -1
drivers/gpu/drm/nouveau/nouveau_dma.c
··· 24 24 * 25 25 */ 26 26 27 - #include "nouveau_drm.h" 27 + #include "nouveau_drv.h" 28 28 #include "nouveau_dma.h" 29 29 30 30 void
+1 -1
drivers/gpu/drm/nouveau/nouveau_dp.c
··· 25 25 #include <drm/drmP.h> 26 26 #include <drm/drm_dp_helper.h> 27 27 28 - #include "nouveau_drm.h" 28 + #include "nouveau_drv.h" 29 29 #include "nouveau_connector.h" 30 30 #include "nouveau_encoder.h" 31 31 #include "nouveau_crtc.h"
+1 -1
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 44 44 #include <nvif/cla06f.h> 45 45 #include <nvif/if0004.h> 46 46 47 - #include "nouveau_drm.h" 47 + #include "nouveau_drv.h" 48 48 #include "nouveau_dma.h" 49 49 #include "nouveau_ttm.h" 50 50 #include "nouveau_gem.h"
+2 -2
drivers/gpu/drm/nouveau/nouveau_drm.h drivers/gpu/drm/nouveau/nouveau_drv.h
··· 1 - #ifndef __NOUVEAU_DRMCLI_H__ 2 - #define __NOUVEAU_DRMCLI_H__ 1 + #ifndef __NOUVEAU_DRV_H__ 2 + #define __NOUVEAU_DRV_H__ 3 3 4 4 #define DRIVER_AUTHOR "Nouveau Project" 5 5 #define DRIVER_EMAIL "nouveau@lists.freedesktop.org"
+1 -1
drivers/gpu/drm/nouveau/nouveau_fbcon.c
··· 43 43 #include <drm/drm_crtc_helper.h> 44 44 #include <drm/drm_fb_helper.h> 45 45 46 - #include "nouveau_drm.h" 46 + #include "nouveau_drv.h" 47 47 #include "nouveau_gem.h" 48 48 #include "nouveau_bo.h" 49 49 #include "nouveau_fbcon.h"
+1 -1
drivers/gpu/drm/nouveau/nouveau_fence.c
··· 34 34 #include <nvif/notify.h> 35 35 #include <nvif/event.h> 36 36 37 - #include "nouveau_drm.h" 37 + #include "nouveau_drv.h" 38 38 #include "nouveau_dma.h" 39 39 #include "nouveau_fence.h" 40 40
+1 -1
drivers/gpu/drm/nouveau/nouveau_gem.c
··· 24 24 * 25 25 */ 26 26 27 - #include "nouveau_drm.h" 27 + #include "nouveau_drv.h" 28 28 #include "nouveau_dma.h" 29 29 #include "nouveau_fence.h" 30 30 #include "nouveau_abi16.h"
+1 -1
drivers/gpu/drm/nouveau/nouveau_gem.h
··· 3 3 4 4 #include <drm/drmP.h> 5 5 6 - #include "nouveau_drm.h" 6 + #include "nouveau_drv.h" 7 7 #include "nouveau_bo.h" 8 8 9 9 #define nouveau_bo_tile_layout(nvbo) \
+2 -2
drivers/gpu/drm/nouveau/nouveau_hwmon.c
··· 31 31 32 32 #include <drm/drmP.h> 33 33 34 - #include "nouveau_drm.h" 34 + #include "nouveau_drv.h" 35 35 #include "nouveau_hwmon.h" 36 36 37 37 #include <nvkm/subdev/iccsense.h> ··· 689 689 goto error; 690 690 } 691 691 692 - if (iccsense && iccsense->data_valid && iccsense->rail_count) { 692 + if (iccsense && iccsense->data_valid && !list_empty(&iccsense->rails)) { 693 693 ret = sysfs_create_group(&hwmon_dev->kobj, 694 694 &hwmon_power_attrgroup); 695 695 if (ret)
+1 -1
drivers/gpu/drm/nouveau/nouveau_nvif.c
··· 36 36 #include <nvif/event.h> 37 37 #include <nvif/ioctl.h> 38 38 39 - #include "nouveau_drm.h" 39 + #include "nouveau_drv.h" 40 40 #include "nouveau_usif.h" 41 41 42 42 static void
+1 -1
drivers/gpu/drm/nouveau/nouveau_platform.h
··· 21 21 */ 22 22 #ifndef __NOUVEAU_PLATFORM_H__ 23 23 #define __NOUVEAU_PLATFORM_H__ 24 - #include "nouveau_drm.h" 24 + #include "nouveau_drv.h" 25 25 26 26 extern struct platform_driver nouveau_platform_driver; 27 27 #endif
+1 -1
drivers/gpu/drm/nouveau/nouveau_prime.c
··· 25 25 #include <drm/drmP.h> 26 26 #include <linux/dma-buf.h> 27 27 28 - #include "nouveau_drm.h" 28 + #include "nouveau_drv.h" 29 29 #include "nouveau_gem.h" 30 30 31 31 struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *obj)
+1 -1
drivers/gpu/drm/nouveau/nouveau_sgdma.c
··· 1 1 #include <linux/pagemap.h> 2 2 #include <linux/slab.h> 3 3 4 - #include "nouveau_drm.h" 4 + #include "nouveau_drv.h" 5 5 #include "nouveau_ttm.h" 6 6 7 7 struct nouveau_sgdma_be {
+1 -1
drivers/gpu/drm/nouveau/nouveau_ttm.c
··· 24 24 * USE OR OTHER DEALINGS IN THE SOFTWARE. 25 25 */ 26 26 27 - #include "nouveau_drm.h" 27 + #include "nouveau_drv.h" 28 28 #include "nouveau_ttm.h" 29 29 #include "nouveau_gem.h" 30 30
+1 -1
drivers/gpu/drm/nouveau/nouveau_usif.c
··· 22 22 * Authors: Ben Skeggs <bskeggs@redhat.com> 23 23 */ 24 24 25 - #include "nouveau_drm.h" 25 + #include "nouveau_drv.h" 26 26 #include "nouveau_usif.h" 27 27 #include "nouveau_abi16.h" 28 28
+1 -1
drivers/gpu/drm/nouveau/nouveau_vga.c
··· 4 4 #include <drm/drmP.h> 5 5 #include <drm/drm_crtc_helper.h> 6 6 7 - #include "nouveau_drm.h" 7 + #include "nouveau_drv.h" 8 8 #include "nouveau_acpi.h" 9 9 #include "nouveau_fbcon.h" 10 10 #include "nouveau_vga.h"
+1 -1
drivers/gpu/drm/nouveau/nv04_fbcon.c
··· 22 22 * DEALINGS IN THE SOFTWARE. 23 23 */ 24 24 25 - #include "nouveau_drm.h" 25 + #include "nouveau_drv.h" 26 26 #include "nouveau_dma.h" 27 27 #include "nouveau_fbcon.h" 28 28
+1 -1
drivers/gpu/drm/nouveau/nv04_fence.c
··· 22 22 * Authors: Ben Skeggs 23 23 */ 24 24 25 - #include "nouveau_drm.h" 25 + #include "nouveau_drv.h" 26 26 #include "nouveau_dma.h" 27 27 #include "nouveau_fence.h" 28 28
+1 -1
drivers/gpu/drm/nouveau/nv10_fence.c
··· 22 22 * Authors: Ben Skeggs <bskeggs@redhat.com> 23 23 */ 24 24 25 - #include "nouveau_drm.h" 25 + #include "nouveau_drv.h" 26 26 #include "nouveau_dma.h" 27 27 #include "nv10_fence.h" 28 28
+1 -1
drivers/gpu/drm/nouveau/nv17_fence.c
··· 26 26 #include <nvif/class.h> 27 27 #include <nvif/cl0002.h> 28 28 29 - #include "nouveau_drm.h" 29 + #include "nouveau_drv.h" 30 30 #include "nouveau_dma.h" 31 31 #include "nv10_fence.h" 32 32
+1 -1
drivers/gpu/drm/nouveau/nv50_display.c
··· 39 39 #include <nvif/cl507d.h> 40 40 #include <nvif/cl507e.h> 41 41 42 - #include "nouveau_drm.h" 42 + #include "nouveau_drv.h" 43 43 #include "nouveau_dma.h" 44 44 #include "nouveau_gem.h" 45 45 #include "nouveau_connector.h"
+1 -1
drivers/gpu/drm/nouveau/nv50_fbcon.c
··· 22 22 * Authors: Ben Skeggs 23 23 */ 24 24 25 - #include "nouveau_drm.h" 25 + #include "nouveau_drv.h" 26 26 #include "nouveau_dma.h" 27 27 #include "nouveau_fbcon.h" 28 28
+1 -1
drivers/gpu/drm/nouveau/nv50_fence.c
··· 26 26 #include <nvif/class.h> 27 27 #include <nvif/cl0002.h> 28 28 29 - #include "nouveau_drm.h" 29 + #include "nouveau_drv.h" 30 30 #include "nouveau_dma.h" 31 31 #include "nv10_fence.h" 32 32
+1 -1
drivers/gpu/drm/nouveau/nv84_fence.c
··· 22 22 * Authors: Ben Skeggs 23 23 */ 24 24 25 - #include "nouveau_drm.h" 25 + #include "nouveau_drv.h" 26 26 #include "nouveau_dma.h" 27 27 #include "nouveau_fence.h" 28 28
+1 -1
drivers/gpu/drm/nouveau/nvc0_fbcon.c
··· 22 22 * Authors: Ben Skeggs 23 23 */ 24 24 25 - #include "nouveau_drm.h" 25 + #include "nouveau_drv.h" 26 26 #include "nouveau_dma.h" 27 27 #include "nouveau_fbcon.h" 28 28
+1 -1
drivers/gpu/drm/nouveau/nvc0_fence.c
··· 22 22 * Authors: Ben Skeggs 23 23 */ 24 24 25 - #include "nouveau_drm.h" 25 + #include "nouveau_drv.h" 26 26 #include "nouveau_dma.h" 27 27 #include "nouveau_fence.h" 28 28
+6 -8
drivers/gpu/drm/nouveau/nvkm/core/engine.c
··· 137 137 138 138 int 139 139 nvkm_engine_ctor(const struct nvkm_engine_func *func, 140 - struct nvkm_device *device, int index, u32 pmc_enable, 141 - bool enable, struct nvkm_engine *engine) 140 + struct nvkm_device *device, int index, bool enable, 141 + struct nvkm_engine *engine) 142 142 { 143 - nvkm_subdev_ctor(&nvkm_engine_func, device, index, 144 - pmc_enable, &engine->subdev); 143 + nvkm_subdev_ctor(&nvkm_engine_func, device, index, &engine->subdev); 145 144 engine->func = func; 146 145 147 146 if (!nvkm_boolopt(device->cfgopt, nvkm_subdev_name[index], enable)) { ··· 154 155 155 156 int 156 157 nvkm_engine_new_(const struct nvkm_engine_func *func, 157 - struct nvkm_device *device, int index, u32 pmc_enable, 158 - bool enable, struct nvkm_engine **pengine) 158 + struct nvkm_device *device, int index, bool enable, 159 + struct nvkm_engine **pengine) 159 160 { 160 161 if (!(*pengine = kzalloc(sizeof(**pengine), GFP_KERNEL))) 161 162 return -ENOMEM; 162 - return nvkm_engine_ctor(func, device, index, pmc_enable, 163 - enable, *pengine); 163 + return nvkm_engine_ctor(func, device, index, enable, *pengine); 164 164 }
+4 -8
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
··· 24 24 #include <core/subdev.h> 25 25 #include <core/device.h> 26 26 #include <core/option.h> 27 + #include <subdev/mc.h> 27 28 28 29 static struct lock_class_key nvkm_subdev_lock_class[NVKM_SUBDEV_NR]; 29 30 ··· 51 50 [NVKM_SUBDEV_SECBOOT ] = "secboot", 52 51 [NVKM_SUBDEV_THERM ] = "therm", 53 52 [NVKM_SUBDEV_TIMER ] = "tmr", 53 + [NVKM_SUBDEV_TOP ] = "top", 54 54 [NVKM_SUBDEV_VOLT ] = "volt", 55 55 [NVKM_ENGINE_BSP ] = "bsp", 56 56 [NVKM_ENGINE_CE0 ] = "ce0", ··· 91 89 { 92 90 struct nvkm_device *device = subdev->device; 93 91 const char *action = suspend ? "suspend" : "fini"; 94 - u32 pmc_enable = subdev->pmc_enable; 95 92 s64 time; 96 93 97 94 nvkm_trace(subdev, "%s running...\n", action); ··· 105 104 } 106 105 } 107 106 108 - if (pmc_enable) { 109 - nvkm_mask(device, 0x000200, pmc_enable, 0x00000000); 110 - nvkm_mask(device, 0x000200, pmc_enable, pmc_enable); 111 - nvkm_rd32(device, 0x000200); 112 - } 107 + nvkm_mc_reset(device->mc, subdev->index); 113 108 114 109 time = ktime_to_us(ktime_get()) - time; 115 110 nvkm_trace(subdev, "%s completed in %lldus\n", action, time); ··· 190 193 191 194 void 192 195 nvkm_subdev_ctor(const struct nvkm_subdev_func *func, 193 - struct nvkm_device *device, int index, u32 pmc_enable, 196 + struct nvkm_device *device, int index, 194 197 struct nvkm_subdev *subdev) 195 198 { 196 199 const char *name = nvkm_subdev_name[index]; 197 200 subdev->func = func; 198 201 subdev->device = device; 199 202 subdev->index = index; 200 - subdev->pmc_enable = pmc_enable; 201 203 202 204 __mutex_init(&subdev->mutex, name, &nvkm_subdev_lock_class[index]); 203 205 subdev->debug = nvkm_dbgopt(device->dbgopt, name);
-1
drivers/gpu/drm/nouveau/nvkm/engine/bsp/g84.c
··· 27 27 28 28 static const struct nvkm_xtensa_func 29 29 g84_bsp = { 30 - .pmc_enable = 0x04008000, 31 30 .fifo_val = 0x1111, 32 31 .unkd28 = 0x90044, 33 32 .sclass = {
-2
drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c
··· 40 40 .code.size = sizeof(gf100_ce_code), 41 41 .data.data = gf100_ce_data, 42 42 .data.size = sizeof(gf100_ce_data), 43 - .pmc_enable = 0x00000040, 44 43 .init = gf100_ce_init, 45 44 .intr = gt215_ce_intr, 46 45 .sclass = { ··· 54 55 .code.size = sizeof(gf100_ce_code), 55 56 .data.data = gf100_ce_data, 56 57 .data.size = sizeof(gf100_ce_data), 57 - .pmc_enable = 0x00000080, 58 58 .init = gf100_ce_init, 59 59 .intr = gt215_ce_intr, 60 60 .sclass = {
+1 -13
drivers/gpu/drm/nouveau/nvkm/engine/ce/gk104.c
··· 97 97 gk104_ce_new(struct nvkm_device *device, int index, 98 98 struct nvkm_engine **pengine) 99 99 { 100 - if (index == NVKM_ENGINE_CE0) { 101 - return nvkm_engine_new_(&gk104_ce, device, index, 102 - 0x00000040, true, pengine); 103 - } else 104 - if (index == NVKM_ENGINE_CE1) { 105 - return nvkm_engine_new_(&gk104_ce, device, index, 106 - 0x00000080, true, pengine); 107 - } else 108 - if (index == NVKM_ENGINE_CE2) { 109 - return nvkm_engine_new_(&gk104_ce, device, index, 110 - 0x00200000, true, pengine); 111 - } 112 - return -ENODEV; 100 + return nvkm_engine_new_(&gk104_ce, device, index, true, pengine); 113 101 }
+1 -13
drivers/gpu/drm/nouveau/nvkm/engine/ce/gm107.c
··· 39 39 gm107_ce_new(struct nvkm_device *device, int index, 40 40 struct nvkm_engine **pengine) 41 41 { 42 - if (index == NVKM_ENGINE_CE0) { 43 - return nvkm_engine_new_(&gm107_ce, device, index, 44 - 0x00000040, true, pengine); 45 - } else 46 - if (index == NVKM_ENGINE_CE1) { 47 - return nvkm_engine_new_(&gm107_ce, device, index, 48 - 0x00000080, true, pengine); 49 - } else 50 - if (index == NVKM_ENGINE_CE2) { 51 - return nvkm_engine_new_(&gm107_ce, device, index, 52 - 0x00200000, true, pengine); 53 - } 54 - return -ENODEV; 42 + return nvkm_engine_new_(&gm107_ce, device, index, true, pengine); 55 43 }
+1 -13
drivers/gpu/drm/nouveau/nvkm/engine/ce/gm200.c
··· 38 38 gm200_ce_new(struct nvkm_device *device, int index, 39 39 struct nvkm_engine **pengine) 40 40 { 41 - if (index == NVKM_ENGINE_CE0) { 42 - return nvkm_engine_new_(&gm200_ce, device, index, 43 - 0x00000040, true, pengine); 44 - } else 45 - if (index == NVKM_ENGINE_CE1) { 46 - return nvkm_engine_new_(&gm200_ce, device, index, 47 - 0x00000080, true, pengine); 48 - } else 49 - if (index == NVKM_ENGINE_CE2) { 50 - return nvkm_engine_new_(&gm200_ce, device, index, 51 - 0x00200000, true, pengine); 52 - } 53 - return -ENODEV; 41 + return nvkm_engine_new_(&gm200_ce, device, index, true, pengine); 54 42 }
-1
drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c
··· 67 67 .code.size = sizeof(gt215_ce_code), 68 68 .data.data = gt215_ce_data, 69 69 .data.size = sizeof(gt215_ce_data), 70 - .pmc_enable = 0x00802000, 71 70 .intr = gt215_ce_intr, 72 71 .sclass = { 73 72 { -1, -1, GT212_DMA },
+1 -2
drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c
··· 130 130 g84_cipher_new(struct nvkm_device *device, int index, 131 131 struct nvkm_engine **pengine) 132 132 { 133 - return nvkm_engine_new_(&g84_cipher, device, index, 134 - 0x00004000, true, pengine); 133 + return nvkm_engine_new_(&g84_cipher, device, index, true, pengine); 135 134 }
+89 -39
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
··· 146 146 .gpio = nv10_gpio_new, 147 147 .i2c = nv04_i2c_new, 148 148 .imem = nv04_instmem_new, 149 - .mc = nv04_mc_new, 149 + .mc = nv11_mc_new, 150 150 .mmu = nv04_mmu_new, 151 151 .pci = nv04_pci_new, 152 152 .timer = nv04_timer_new, ··· 190 190 .gpio = nv10_gpio_new, 191 191 .i2c = nv04_i2c_new, 192 192 .imem = nv04_instmem_new, 193 - .mc = nv04_mc_new, 193 + .mc = nv17_mc_new, 194 194 .mmu = nv04_mmu_new, 195 195 .pci = nv04_pci_new, 196 196 .timer = nv04_timer_new, ··· 212 212 .gpio = nv10_gpio_new, 213 213 .i2c = nv04_i2c_new, 214 214 .imem = nv04_instmem_new, 215 - .mc = nv04_mc_new, 215 + .mc = nv17_mc_new, 216 216 .mmu = nv04_mmu_new, 217 217 .pci = nv04_pci_new, 218 218 .timer = nv04_timer_new, ··· 256 256 .gpio = nv10_gpio_new, 257 257 .i2c = nv04_i2c_new, 258 258 .imem = nv04_instmem_new, 259 - .mc = nv04_mc_new, 259 + .mc = nv17_mc_new, 260 260 .mmu = nv04_mmu_new, 261 261 .pci = nv04_pci_new, 262 262 .timer = nv04_timer_new, ··· 278 278 .gpio = nv10_gpio_new, 279 279 .i2c = nv04_i2c_new, 280 280 .imem = nv04_instmem_new, 281 - .mc = nv04_mc_new, 281 + .mc = nv17_mc_new, 282 282 .mmu = nv04_mmu_new, 283 283 .pci = nv04_pci_new, 284 284 .timer = nv04_timer_new, ··· 300 300 .gpio = nv10_gpio_new, 301 301 .i2c = nv04_i2c_new, 302 302 .imem = nv04_instmem_new, 303 - .mc = nv04_mc_new, 303 + .mc = nv17_mc_new, 304 304 .mmu = nv04_mmu_new, 305 305 .pci = nv04_pci_new, 306 306 .timer = nv04_timer_new, ··· 322 322 .gpio = nv10_gpio_new, 323 323 .i2c = nv04_i2c_new, 324 324 .imem = nv04_instmem_new, 325 - .mc = nv04_mc_new, 325 + .mc = nv17_mc_new, 326 326 .mmu = nv04_mmu_new, 327 327 .pci = nv04_pci_new, 328 328 .timer = nv04_timer_new, ··· 344 344 .gpio = nv10_gpio_new, 345 345 .i2c = nv04_i2c_new, 346 346 .imem = nv04_instmem_new, 347 - .mc = nv04_mc_new, 347 + .mc = nv17_mc_new, 348 348 .mmu = nv04_mmu_new, 349 349 .pci = nv04_pci_new, 350 350 .timer = nv04_timer_new, ··· 366 366 .gpio = nv10_gpio_new, 367 367 .i2c = nv04_i2c_new, 368 368 .imem = nv04_instmem_new, 369 - .mc = nv04_mc_new, 369 + .mc = nv17_mc_new, 370 370 .mmu = nv04_mmu_new, 371 371 .pci = nv04_pci_new, 372 372 .timer = nv04_timer_new, ··· 388 388 .gpio = nv10_gpio_new, 389 389 .i2c = nv04_i2c_new, 390 390 .imem = nv04_instmem_new, 391 - .mc = nv04_mc_new, 391 + .mc = nv17_mc_new, 392 392 .mmu = nv04_mmu_new, 393 393 .pci = nv04_pci_new, 394 394 .timer = nv04_timer_new, ··· 411 411 .gpio = nv10_gpio_new, 412 412 .i2c = nv04_i2c_new, 413 413 .imem = nv04_instmem_new, 414 - .mc = nv04_mc_new, 414 + .mc = nv17_mc_new, 415 415 .mmu = nv04_mmu_new, 416 416 .pci = nv04_pci_new, 417 417 .timer = nv04_timer_new, ··· 434 434 .gpio = nv10_gpio_new, 435 435 .i2c = nv04_i2c_new, 436 436 .imem = nv04_instmem_new, 437 - .mc = nv04_mc_new, 437 + .mc = nv17_mc_new, 438 438 .mmu = nv04_mmu_new, 439 439 .pci = nv04_pci_new, 440 440 .timer = nv04_timer_new, ··· 456 456 .gpio = nv10_gpio_new, 457 457 .i2c = nv04_i2c_new, 458 458 .imem = nv04_instmem_new, 459 - .mc = nv04_mc_new, 459 + .mc = nv17_mc_new, 460 460 .mmu = nv04_mmu_new, 461 461 .pci = nv04_pci_new, 462 462 .timer = nv04_timer_new, ··· 479 479 .gpio = nv10_gpio_new, 480 480 .i2c = nv04_i2c_new, 481 481 .imem = nv40_instmem_new, 482 - .mc = nv04_mc_new, 482 + .mc = nv17_mc_new, 483 483 .mmu = nv04_mmu_new, 484 484 .pci = nv40_pci_new, 485 485 .therm = nv40_therm_new, ··· 505 505 .gpio = nv10_gpio_new, 506 506 .i2c = nv04_i2c_new, 507 507 .imem = nv40_instmem_new, 508 - .mc = nv04_mc_new, 508 + .mc = nv17_mc_new, 509 509 .mmu = nv41_mmu_new, 510 510 .pci = nv40_pci_new, 511 511 .therm = nv40_therm_new, ··· 531 531 .gpio = nv10_gpio_new, 532 532 .i2c = nv04_i2c_new, 533 533 .imem = nv40_instmem_new, 534 - .mc = nv04_mc_new, 534 + .mc = nv17_mc_new, 535 535 .mmu = nv41_mmu_new, 536 536 .pci = nv40_pci_new, 537 537 .therm = nv40_therm_new, ··· 557 557 .gpio = nv10_gpio_new, 558 558 .i2c = nv04_i2c_new, 559 559 .imem = nv40_instmem_new, 560 - .mc = nv04_mc_new, 560 + .mc = nv17_mc_new, 561 561 .mmu = nv41_mmu_new, 562 562 .pci = nv40_pci_new, 563 563 .therm = nv40_therm_new, ··· 609 609 .gpio = nv10_gpio_new, 610 610 .i2c = nv04_i2c_new, 611 611 .imem = nv40_instmem_new, 612 - .mc = nv04_mc_new, 612 + .mc = nv17_mc_new, 613 613 .mmu = nv04_mmu_new, 614 614 .pci = nv40_pci_new, 615 615 .therm = nv40_therm_new, ··· 661 661 .gpio = nv10_gpio_new, 662 662 .i2c = nv04_i2c_new, 663 663 .imem = nv40_instmem_new, 664 - .mc = nv04_mc_new, 664 + .mc = nv17_mc_new, 665 665 .mmu = nv41_mmu_new, 666 666 .pci = nv40_pci_new, 667 667 .therm = nv40_therm_new, ··· 687 687 .gpio = nv10_gpio_new, 688 688 .i2c = nv04_i2c_new, 689 689 .imem = nv40_instmem_new, 690 - .mc = nv04_mc_new, 690 + .mc = nv17_mc_new, 691 691 .mmu = nv41_mmu_new, 692 692 .pci = nv40_pci_new, 693 693 .therm = nv40_therm_new, ··· 739 739 .gpio = nv10_gpio_new, 740 740 .i2c = nv04_i2c_new, 741 741 .imem = nv40_instmem_new, 742 - .mc = nv04_mc_new, 742 + .mc = nv17_mc_new, 743 743 .mmu = nv41_mmu_new, 744 744 .pci = nv40_pci_new, 745 745 .therm = nv40_therm_new, ··· 926 926 .gpio = nv50_gpio_new, 927 927 .i2c = nv50_i2c_new, 928 928 .imem = nv50_instmem_new, 929 - .mc = nv50_mc_new, 929 + .mc = g84_mc_new, 930 930 .mmu = nv50_mmu_new, 931 931 .mxm = nv50_mxm_new, 932 932 .pci = g84_pci_new, ··· 958 958 .gpio = nv50_gpio_new, 959 959 .i2c = nv50_i2c_new, 960 960 .imem = nv50_instmem_new, 961 - .mc = nv50_mc_new, 961 + .mc = g84_mc_new, 962 962 .mmu = nv50_mmu_new, 963 963 .mxm = nv50_mxm_new, 964 964 .pci = g84_pci_new, ··· 990 990 .gpio = nv50_gpio_new, 991 991 .i2c = nv50_i2c_new, 992 992 .imem = nv50_instmem_new, 993 - .mc = nv50_mc_new, 993 + .mc = g84_mc_new, 994 994 .mmu = nv50_mmu_new, 995 995 .mxm = nv50_mxm_new, 996 996 .pci = g84_pci_new, ··· 1022 1022 .gpio = g94_gpio_new, 1023 1023 .i2c = g94_i2c_new, 1024 1024 .imem = nv50_instmem_new, 1025 - .mc = nv50_mc_new, 1025 + .mc = g84_mc_new, 1026 1026 .mmu = nv50_mmu_new, 1027 1027 .mxm = nv50_mxm_new, 1028 1028 .pci = g94_pci_new, ··· 1054 1054 .gpio = g94_gpio_new, 1055 1055 .i2c = g94_i2c_new, 1056 1056 .imem = nv50_instmem_new, 1057 - .mc = nv50_mc_new, 1057 + .mc = g84_mc_new, 1058 1058 .mmu = nv50_mmu_new, 1059 1059 .mxm = nv50_mxm_new, 1060 1060 .pci = g94_pci_new, ··· 1118 1118 .gpio = g94_gpio_new, 1119 1119 .i2c = nv50_i2c_new, 1120 1120 .imem = nv50_instmem_new, 1121 - .mc = g98_mc_new, 1121 + .mc = g84_mc_new, 1122 1122 .mmu = nv50_mmu_new, 1123 1123 .mxm = nv50_mxm_new, 1124 1124 .pci = g94_pci_new, ··· 1150 1150 .gpio = g94_gpio_new, 1151 1151 .i2c = g94_i2c_new, 1152 1152 .imem = nv50_instmem_new, 1153 - .mc = g98_mc_new, 1153 + .mc = gt215_mc_new, 1154 1154 .mmu = nv50_mmu_new, 1155 1155 .mxm = nv50_mxm_new, 1156 1156 .pci = g94_pci_new, ··· 1184 1184 .gpio = g94_gpio_new, 1185 1185 .i2c = g94_i2c_new, 1186 1186 .imem = nv50_instmem_new, 1187 - .mc = g98_mc_new, 1187 + .mc = gt215_mc_new, 1188 1188 .mmu = nv50_mmu_new, 1189 1189 .mxm = nv50_mxm_new, 1190 1190 .pci = g94_pci_new, ··· 1217 1217 .gpio = g94_gpio_new, 1218 1218 .i2c = g94_i2c_new, 1219 1219 .imem = nv50_instmem_new, 1220 - .mc = g98_mc_new, 1220 + .mc = gt215_mc_new, 1221 1221 .mmu = nv50_mmu_new, 1222 1222 .mxm = nv50_mxm_new, 1223 1223 .pci = g94_pci_new, ··· 1314 1314 .gpio = g94_gpio_new, 1315 1315 .i2c = g94_i2c_new, 1316 1316 .imem = nv50_instmem_new, 1317 - .mc = g98_mc_new, 1317 + .mc = gt215_mc_new, 1318 1318 .mmu = nv50_mmu_new, 1319 1319 .mxm = nv50_mxm_new, 1320 1320 .pci = g94_pci_new, ··· 1676 1676 .iccsense = gf100_iccsense_new, 1677 1677 .imem = nv50_instmem_new, 1678 1678 .ltc = gk104_ltc_new, 1679 - .mc = gf100_mc_new, 1679 + .mc = gk104_mc_new, 1680 1680 .mmu = gf100_mmu_new, 1681 1681 .mxm = nv50_mxm_new, 1682 1682 .pci = gk104_pci_new, 1683 1683 .pmu = gk104_pmu_new, 1684 1684 .therm = gf119_therm_new, 1685 1685 .timer = nv41_timer_new, 1686 + .top = gk104_top_new, 1686 1687 .volt = gk104_volt_new, 1687 1688 .ce[0] = gk104_ce_new, 1688 1689 .ce[1] = gk104_ce_new, ··· 1715 1714 .iccsense = gf100_iccsense_new, 1716 1715 .imem = nv50_instmem_new, 1717 1716 .ltc = gk104_ltc_new, 1718 - .mc = gf100_mc_new, 1717 + .mc = gk104_mc_new, 1719 1718 .mmu = gf100_mmu_new, 1720 1719 .mxm = nv50_mxm_new, 1721 1720 .pci = gk104_pci_new, 1722 1721 .pmu = gk104_pmu_new, 1723 1722 .therm = gf119_therm_new, 1724 1723 .timer = nv41_timer_new, 1724 + .top = gk104_top_new, 1725 1725 .volt = gk104_volt_new, 1726 1726 .ce[0] = gk104_ce_new, 1727 1727 .ce[1] = gk104_ce_new, ··· 1754 1752 .iccsense = gf100_iccsense_new, 1755 1753 .imem = nv50_instmem_new, 1756 1754 .ltc = gk104_ltc_new, 1757 - .mc = gf100_mc_new, 1755 + .mc = gk104_mc_new, 1758 1756 .mmu = gf100_mmu_new, 1759 1757 .mxm = nv50_mxm_new, 1760 1758 .pci = gk104_pci_new, 1761 1759 .pmu = gk104_pmu_new, 1762 1760 .therm = gf119_therm_new, 1763 1761 .timer = nv41_timer_new, 1762 + .top = gk104_top_new, 1764 1763 .volt = gk104_volt_new, 1765 1764 .ce[0] = gk104_ce_new, 1766 1765 .ce[1] = gk104_ce_new, ··· 1792 1789 .mmu = gf100_mmu_new, 1793 1790 .pmu = gk20a_pmu_new, 1794 1791 .timer = gk20a_timer_new, 1792 + .top = gk104_top_new, 1795 1793 .volt = gk20a_volt_new, 1796 1794 .ce[2] = gk104_ce_new, 1797 1795 .dma = gf119_dma_new, ··· 1818 1814 .iccsense = gf100_iccsense_new, 1819 1815 .imem = nv50_instmem_new, 1820 1816 .ltc = gk104_ltc_new, 1821 - .mc = gf100_mc_new, 1817 + .mc = gk104_mc_new, 1822 1818 .mmu = gf100_mmu_new, 1823 1819 .mxm = nv50_mxm_new, 1824 1820 .pci = gk104_pci_new, 1825 1821 .pmu = gk110_pmu_new, 1826 1822 .therm = gf119_therm_new, 1827 1823 .timer = nv41_timer_new, 1824 + .top = gk104_top_new, 1828 1825 .volt = gk104_volt_new, 1829 1826 .ce[0] = gk104_ce_new, 1830 1827 .ce[1] = gk104_ce_new, ··· 1856 1851 .iccsense = gf100_iccsense_new, 1857 1852 .imem = nv50_instmem_new, 1858 1853 .ltc = gk104_ltc_new, 1859 - .mc = gf100_mc_new, 1854 + .mc = gk104_mc_new, 1860 1855 .mmu = gf100_mmu_new, 1861 1856 .mxm = nv50_mxm_new, 1862 1857 .pci = gk104_pci_new, 1863 1858 .pmu = gk110_pmu_new, 1864 1859 .therm = gf119_therm_new, 1865 1860 .timer = nv41_timer_new, 1861 + .top = gk104_top_new, 1866 1862 .volt = gk104_volt_new, 1867 1863 .ce[0] = gk104_ce_new, 1868 1864 .ce[1] = gk104_ce_new, ··· 1901 1895 .pmu = gk208_pmu_new, 1902 1896 .therm = gf119_therm_new, 1903 1897 .timer = nv41_timer_new, 1898 + .top = gk104_top_new, 1904 1899 .volt = gk104_volt_new, 1905 1900 .ce[0] = gk104_ce_new, 1906 1901 .ce[1] = gk104_ce_new, ··· 1939 1932 .pmu = gk208_pmu_new, 1940 1933 .therm = gf119_therm_new, 1941 1934 .timer = nv41_timer_new, 1935 + .top = gk104_top_new, 1942 1936 .volt = gk104_volt_new, 1943 1937 .ce[0] = gk104_ce_new, 1944 1938 .ce[1] = gk104_ce_new, ··· 1977 1969 .pmu = gm107_pmu_new, 1978 1970 .therm = gm107_therm_new, 1979 1971 .timer = gk20a_timer_new, 1972 + .top = gk104_top_new, 1973 + .volt = gk104_volt_new, 1974 + .ce[0] = gm107_ce_new, 1975 + .ce[2] = gm107_ce_new, 1976 + .disp = gm107_disp_new, 1977 + .dma = gf119_dma_new, 1978 + .fifo = gm107_fifo_new, 1979 + .gr = gm107_gr_new, 1980 + .sw = gf100_sw_new, 1981 + }; 1982 + 1983 + static const struct nvkm_device_chip 1984 + nv118_chipset = { 1985 + .name = "GM108", 1986 + .bar = gf100_bar_new, 1987 + .bios = nvkm_bios_new, 1988 + .bus = gf100_bus_new, 1989 + .clk = gk104_clk_new, 1990 + .devinit = gm107_devinit_new, 1991 + .fb = gm107_fb_new, 1992 + .fuse = gm107_fuse_new, 1993 + .gpio = gk104_gpio_new, 1994 + .i2c = gf119_i2c_new, 1995 + .ibus = gk104_ibus_new, 1996 + .iccsense = gf100_iccsense_new, 1997 + .imem = nv50_instmem_new, 1998 + .ltc = gm107_ltc_new, 1999 + .mc = gk20a_mc_new, 2000 + .mmu = gf100_mmu_new, 2001 + .mxm = nv50_mxm_new, 2002 + .pci = gk104_pci_new, 2003 + .pmu = gm107_pmu_new, 2004 + .therm = gm107_therm_new, 2005 + .timer = gk20a_timer_new, 2006 + .top = gk104_top_new, 1980 2007 .volt = gk104_volt_new, 1981 2008 .ce[0] = gm107_ce_new, 1982 2009 .ce[2] = gm107_ce_new, ··· 2029 1986 .bios = nvkm_bios_new, 2030 1987 .bus = gf100_bus_new, 2031 1988 .devinit = gm200_devinit_new, 2032 - .fb = gm107_fb_new, 1989 + .fb = gm200_fb_new, 2033 1990 .fuse = gm107_fuse_new, 2034 1991 .gpio = gk104_gpio_new, 2035 1992 .i2c = gm200_i2c_new, ··· 2044 2001 .pmu = gm107_pmu_new, 2045 2002 .secboot = gm200_secboot_new, 2046 2003 .timer = gk20a_timer_new, 2004 + .top = gk104_top_new, 2047 2005 .volt = gk104_volt_new, 2048 2006 .ce[0] = gm200_ce_new, 2049 2007 .ce[1] = gm200_ce_new, ··· 2063 2019 .bios = nvkm_bios_new, 2064 2020 .bus = gf100_bus_new, 2065 2021 .devinit = gm200_devinit_new, 2066 - .fb = gm107_fb_new, 2022 + .fb = gm200_fb_new, 2067 2023 .fuse = gm107_fuse_new, 2068 2024 .gpio = gk104_gpio_new, 2069 2025 .i2c = gm200_i2c_new, ··· 2078 2034 .pmu = gm107_pmu_new, 2079 2035 .secboot = gm200_secboot_new, 2080 2036 .timer = gk20a_timer_new, 2037 + .top = gk104_top_new, 2081 2038 .volt = gk104_volt_new, 2082 2039 .ce[0] = gm200_ce_new, 2083 2040 .ce[1] = gm200_ce_new, ··· 2097 2052 .bios = nvkm_bios_new, 2098 2053 .bus = gf100_bus_new, 2099 2054 .devinit = gm200_devinit_new, 2100 - .fb = gm107_fb_new, 2055 + .fb = gm200_fb_new, 2101 2056 .fuse = gm107_fuse_new, 2102 2057 .gpio = gk104_gpio_new, 2103 2058 .i2c = gm200_i2c_new, ··· 2112 2067 .pmu = gm107_pmu_new, 2113 2068 .secboot = gm200_secboot_new, 2114 2069 .timer = gk20a_timer_new, 2070 + .top = gk104_top_new, 2115 2071 .volt = gk104_volt_new, 2116 2072 .ce[0] = gm200_ce_new, 2117 2073 .ce[1] = gm200_ce_new, ··· 2139 2093 .mmu = gf100_mmu_new, 2140 2094 .secboot = gm20b_secboot_new, 2141 2095 .timer = gk20a_timer_new, 2096 + .top = gk104_top_new, 2142 2097 .ce[2] = gm200_ce_new, 2143 2098 .volt = gm20b_volt_new, 2144 2099 .dma = gf119_dma_new, ··· 2197 2150 _(SECBOOT , device->secboot , &device->secboot->subdev); 2198 2151 _(THERM , device->therm , &device->therm->subdev); 2199 2152 _(TIMER , device->timer , &device->timer->subdev); 2153 + _(TOP , device->top , &device->top->subdev); 2200 2154 _(VOLT , device->volt , &device->volt->subdev); 2201 2155 #undef _ 2202 2156 default: ··· 2571 2523 case 0x106: device->chip = &nv106_chipset; break; 2572 2524 case 0x108: device->chip = &nv108_chipset; break; 2573 2525 case 0x117: device->chip = &nv117_chipset; break; 2526 + case 0x118: device->chip = &nv118_chipset; break; 2574 2527 case 0x120: device->chip = &nv120_chipset; break; 2575 2528 case 0x124: device->chip = &nv124_chipset; break; 2576 2529 case 0x126: device->chip = &nv126_chipset; break; ··· 2653 2604 _(NVKM_SUBDEV_SECBOOT , secboot); 2654 2605 _(NVKM_SUBDEV_THERM , therm); 2655 2606 _(NVKM_SUBDEV_TIMER , timer); 2607 + _(NVKM_SUBDEV_TOP , top); 2656 2608 _(NVKM_SUBDEV_VOLT , volt); 2657 2609 _(NVKM_ENGINE_BSP , bsp); 2658 2610 _(NVKM_ENGINE_CE0 , ce[0]);
+1
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
··· 22 22 #include <subdev/pmu.h> 23 23 #include <subdev/therm.h> 24 24 #include <subdev/timer.h> 25 + #include <subdev/top.h> 25 26 #include <subdev/volt.h> 26 27 #include <subdev/secboot.h> 27 28
+1 -2
drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c
··· 298 298 disp->func = func; 299 299 disp->head.nr = heads; 300 300 301 - ret = nvkm_engine_ctor(&nvkm_disp, device, index, 0, 302 - true, &disp->engine); 301 + ret = nvkm_engine_ctor(&nvkm_disp, device, index, true, &disp->engine); 303 302 if (ret) 304 303 return ret; 305 304
+1 -2
drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c
··· 152 152 return -ENOMEM; 153 153 dma->func = func; 154 154 155 - return nvkm_engine_ctor(&nvkm_dma, device, index, 156 - 0, true, &dma->engine); 155 + return nvkm_engine_ctor(&nvkm_dma, device, index, true, &dma->engine); 157 156 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/falcon.c
··· 348 348 falcon->data.size = func->data.size; 349 349 *pengine = &falcon->engine; 350 350 351 - return nvkm_engine_ctor(&nvkm_falcon, device, index, func->pmc_enable, 351 + return nvkm_engine_ctor(&nvkm_falcon, device, index, 352 352 enable, &falcon->engine); 353 353 }
+12 -2
drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
··· 178 178 const struct nvkm_fifo_chan_oclass *sclass; 179 179 int c = 0; 180 180 181 + if (fifo->func->class_get) { 182 + int ret = fifo->func->class_get(fifo, index, &sclass); 183 + if (ret == 0) { 184 + oclass->base = sclass->base; 185 + oclass->engn = sclass; 186 + *class = &nvkm_fifo_class; 187 + return 0; 188 + } 189 + return ret; 190 + } 191 + 181 192 while ((sclass = fifo->func->chan[c])) { 182 193 if (c++ == index) { 183 194 oclass->base = sclass->base; ··· 272 261 fifo->nr = nr; 273 262 bitmap_clear(fifo->mask, 0, fifo->nr); 274 263 275 - ret = nvkm_engine_ctor(&nvkm_fifo, device, index, 0x00000100, 276 - true, &fifo->engine); 264 + ret = nvkm_engine_ctor(&nvkm_fifo, device, index, true, &fifo->engine); 277 265 if (ret) 278 266 return ret; 279 267
+198 -207
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
··· 25 25 #include "changk104.h" 26 26 27 27 #include <core/client.h> 28 - #include <core/enum.h> 29 28 #include <core/gpuobj.h> 30 29 #include <subdev/bar.h> 30 + #include <subdev/top.h> 31 31 #include <engine/sw.h> 32 32 33 33 #include <nvif/class.h> 34 34 35 - void 35 + static int 36 + gk104_fifo_class_get(struct nvkm_fifo *base, int index, 37 + const struct nvkm_fifo_chan_oclass **psclass) 38 + { 39 + struct gk104_fifo *fifo = gk104_fifo(base); 40 + int c = 0; 41 + 42 + while ((*psclass = fifo->func->chan[c])) { 43 + if (c++ == index) 44 + return 0; 45 + } 46 + 47 + return c; 48 + } 49 + 50 + static void 36 51 gk104_fifo_uevent_fini(struct nvkm_fifo *fifo) 37 52 { 38 53 struct nvkm_device *device = fifo->engine.subdev.device; 39 54 nvkm_mask(device, 0x002140, 0x80000000, 0x00000000); 40 55 } 41 56 42 - void 57 + static void 43 58 gk104_fifo_uevent_init(struct nvkm_fifo *fifo) 44 59 { 45 60 struct nvkm_device *device = fifo->engine.subdev.device; ··· 282 267 nvkm_error(subdev, "DROPPED_MMU_FAULT %08x\n", stat); 283 268 } 284 269 285 - static const struct nvkm_enum 286 - gk104_fifo_fault_engine[] = { 287 - { 0x00, "GR", NULL, NVKM_ENGINE_GR }, 288 - { 0x03, "IFB", NULL, NVKM_ENGINE_IFB }, 289 - { 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR }, 290 - { 0x05, "BAR3", NULL, NVKM_SUBDEV_INSTMEM }, 291 - { 0x07, "PBDMA0", NULL, NVKM_ENGINE_FIFO }, 292 - { 0x08, "PBDMA1", NULL, NVKM_ENGINE_FIFO }, 293 - { 0x09, "PBDMA2", NULL, NVKM_ENGINE_FIFO }, 294 - { 0x10, "MSVLD", NULL, NVKM_ENGINE_MSVLD }, 295 - { 0x11, "MSPPP", NULL, NVKM_ENGINE_MSPPP }, 296 - { 0x13, "PERF" }, 297 - { 0x14, "MSPDEC", NULL, NVKM_ENGINE_MSPDEC }, 298 - { 0x15, "CE0", NULL, NVKM_ENGINE_CE0 }, 299 - { 0x16, "CE1", NULL, NVKM_ENGINE_CE1 }, 300 - { 0x17, "PMU" }, 301 - { 0x19, "MSENC", NULL, NVKM_ENGINE_MSENC }, 302 - { 0x1b, "CE2", NULL, NVKM_ENGINE_CE2 }, 303 - {} 304 - }; 305 - 306 - static const struct nvkm_enum 307 - gk104_fifo_fault_reason[] = { 308 - { 0x00, "PDE" }, 309 - { 0x01, "PDE_SIZE" }, 310 - { 0x02, "PTE" }, 311 - { 0x03, "VA_LIMIT_VIOLATION" }, 312 - { 0x04, "UNBOUND_INST_BLOCK" }, 313 - { 0x05, "PRIV_VIOLATION" }, 314 - { 0x06, "RO_VIOLATION" }, 315 - { 0x07, "WO_VIOLATION" }, 316 - { 0x08, "PITCH_MASK_VIOLATION" }, 317 - { 0x09, "WORK_CREATION" }, 318 - { 0x0a, "UNSUPPORTED_APERTURE" }, 319 - { 0x0b, "COMPRESSION_FAILURE" }, 320 - { 0x0c, "UNSUPPORTED_KIND" }, 321 - { 0x0d, "REGION_VIOLATION" }, 322 - { 0x0e, "BOTH_PTES_VALID" }, 323 - { 0x0f, "INFO_TYPE_POISONED" }, 324 - {} 325 - }; 326 - 327 - static const struct nvkm_enum 328 - gk104_fifo_fault_hubclient[] = { 329 - { 0x00, "VIP" }, 330 - { 0x01, "CE0" }, 331 - { 0x02, "CE1" }, 332 - { 0x03, "DNISO" }, 333 - { 0x04, "FE" }, 334 - { 0x05, "FECS" }, 335 - { 0x06, "HOST" }, 336 - { 0x07, "HOST_CPU" }, 337 - { 0x08, "HOST_CPU_NB" }, 338 - { 0x09, "ISO" }, 339 - { 0x0a, "MMU" }, 340 - { 0x0b, "MSPDEC" }, 341 - { 0x0c, "MSPPP" }, 342 - { 0x0d, "MSVLD" }, 343 - { 0x0e, "NISO" }, 344 - { 0x0f, "P2P" }, 345 - { 0x10, "PD" }, 346 - { 0x11, "PERF" }, 347 - { 0x12, "PMU" }, 348 - { 0x13, "RASTERTWOD" }, 349 - { 0x14, "SCC" }, 350 - { 0x15, "SCC_NB" }, 351 - { 0x16, "SEC" }, 352 - { 0x17, "SSYNC" }, 353 - { 0x18, "GR_CE" }, 354 - { 0x19, "CE2" }, 355 - { 0x1a, "XV" }, 356 - { 0x1b, "MMU_NB" }, 357 - { 0x1c, "MSENC" }, 358 - { 0x1d, "DFALCON" }, 359 - { 0x1e, "SKED" }, 360 - { 0x1f, "AFALCON" }, 361 - {} 362 - }; 363 - 364 - static const struct nvkm_enum 365 - gk104_fifo_fault_gpcclient[] = { 366 - { 0x00, "L1_0" }, { 0x01, "T1_0" }, { 0x02, "PE_0" }, 367 - { 0x03, "L1_1" }, { 0x04, "T1_1" }, { 0x05, "PE_1" }, 368 - { 0x06, "L1_2" }, { 0x07, "T1_2" }, { 0x08, "PE_2" }, 369 - { 0x09, "L1_3" }, { 0x0a, "T1_3" }, { 0x0b, "PE_3" }, 370 - { 0x0c, "RAST" }, 371 - { 0x0d, "GCC" }, 372 - { 0x0e, "GPCCS" }, 373 - { 0x0f, "PROP_0" }, 374 - { 0x10, "PROP_1" }, 375 - { 0x11, "PROP_2" }, 376 - { 0x12, "PROP_3" }, 377 - { 0x13, "L1_4" }, { 0x14, "T1_4" }, { 0x15, "PE_4" }, 378 - { 0x16, "L1_5" }, { 0x17, "T1_5" }, { 0x18, "PE_5" }, 379 - { 0x19, "L1_6" }, { 0x1a, "T1_6" }, { 0x1b, "PE_6" }, 380 - { 0x1c, "L1_7" }, { 0x1d, "T1_7" }, { 0x1e, "PE_7" }, 381 - { 0x1f, "GPM" }, 382 - { 0x20, "LTP_UTLB_0" }, 383 - { 0x21, "LTP_UTLB_1" }, 384 - { 0x22, "LTP_UTLB_2" }, 385 - { 0x23, "LTP_UTLB_3" }, 386 - { 0x24, "GPC_RGG_UTLB" }, 387 - {} 388 - }; 389 - 390 270 static void 391 271 gk104_fifo_intr_fault(struct gk104_fifo *fifo, int unit) 392 272 { ··· 300 390 struct nvkm_engine *engine = NULL; 301 391 struct nvkm_fifo_chan *chan; 302 392 unsigned long flags; 303 - char gpcid[8] = ""; 393 + char gpcid[8] = "", en[16] = ""; 304 394 305 - er = nvkm_enum_find(gk104_fifo_fault_reason, reason); 306 - eu = nvkm_enum_find(gk104_fifo_fault_engine, unit); 395 + er = nvkm_enum_find(fifo->func->fault.reason, reason); 396 + eu = nvkm_enum_find(fifo->func->fault.engine, unit); 307 397 if (hub) { 308 - ec = nvkm_enum_find(gk104_fifo_fault_hubclient, client); 398 + ec = nvkm_enum_find(fifo->func->fault.hubclient, client); 309 399 } else { 310 - ec = nvkm_enum_find(gk104_fifo_fault_gpcclient, client); 400 + ec = nvkm_enum_find(fifo->func->fault.gpcclient, client); 311 401 snprintf(gpcid, sizeof(gpcid), "GPC%d/", gpc); 312 402 } 313 403 ··· 328 418 } 329 419 } 330 420 421 + if (eu == NULL) { 422 + enum nvkm_devidx engidx = nvkm_top_fault(device->top, unit); 423 + if (engidx < NVKM_SUBDEV_NR) { 424 + const char *src = nvkm_subdev_name[engidx]; 425 + char *dst = en; 426 + do { 427 + *dst++ = toupper(*src++); 428 + } while(*src); 429 + engine = nvkm_device_engine(device, engidx); 430 + } 431 + } else { 432 + snprintf(en, sizeof(en), "%s", eu->name); 433 + } 434 + 331 435 chan = nvkm_fifo_chan_inst(&fifo->base, (u64)inst << 12, &flags); 332 436 333 437 nvkm_error(subdev, 334 438 "%s fault at %010llx engine %02x [%s] client %02x [%s%s] " 335 439 "reason %02x [%s] on channel %d [%010llx %s]\n", 336 440 write ? "write" : "read", (u64)vahi << 32 | valo, 337 - unit, eu ? eu->name : "", client, gpcid, ec ? ec->name : "", 441 + unit, en, client, gpcid, ec ? ec->name : "", 338 442 reason, er ? er->name : "", chan ? chan->chid : -1, 339 443 (u64)inst << 12, 340 444 chan ? chan->object.client->name : "unknown"); ··· 481 557 nvkm_fifo_uevent(&fifo->base); 482 558 } 483 559 484 - void 560 + static void 485 561 gk104_fifo_intr(struct nvkm_fifo *base) 486 562 { 487 563 struct gk104_fifo *fifo = gk104_fifo(base); ··· 573 649 } 574 650 } 575 651 576 - void 652 + static void 577 653 gk104_fifo_fini(struct nvkm_fifo *base) 578 654 { 579 655 struct gk104_fifo *fifo = gk104_fifo(base); ··· 583 659 nvkm_mask(device, 0x002140, 0x10000000, 0x10000000); 584 660 } 585 661 586 - int 662 + static int 587 663 gk104_fifo_oneinit(struct nvkm_fifo *base) 588 664 { 589 665 struct gk104_fifo *fifo = gk104_fifo(base); 590 666 struct nvkm_subdev *subdev = &fifo->base.engine.subdev; 591 667 struct nvkm_device *device = subdev->device; 592 - int ret, i; 668 + struct nvkm_top *top = device->top; 669 + int engn, runl, pbid, ret, i, j; 670 + enum nvkm_devidx engidx; 593 671 u32 *map; 594 672 595 673 /* Determine number of PBDMAs by checking valid enable bits. */ ··· 606 680 for (i = 0; i < fifo->pbdma_nr; i++) 607 681 map[i] = nvkm_rd32(device, 0x002390 + (i * 0x04)); 608 682 609 - /* Read device topology from HW. */ 610 - for (i = 0; i < 64; i++) { 611 - int type = -1, pbid = -1, engidx = -1; 612 - int engn = -1, runl = -1, intr = -1, mcen = -1; 613 - int fault = -1, j; 614 - u32 data, addr = 0; 615 - 616 - do { 617 - data = nvkm_rd32(device, 0x022700 + (i * 0x04)); 618 - nvkm_trace(subdev, "%02x: %08x\n", i, data); 619 - switch (data & 0x00000003) { 620 - case 0x00000000: /* NOT_VALID */ 621 - continue; 622 - case 0x00000001: /* DATA */ 623 - addr = (data & 0x00fff000); 624 - fault = (data & 0x000000f8) >> 3; 625 - break; 626 - case 0x00000002: /* ENUM */ 627 - if (data & 0x00000020) 628 - engn = (data & 0x3c000000) >> 26; 629 - if (data & 0x00000010) 630 - runl = (data & 0x01e00000) >> 21; 631 - if (data & 0x00000008) 632 - intr = (data & 0x000f8000) >> 15; 633 - if (data & 0x00000004) 634 - mcen = (data & 0x00003e00) >> 9; 635 - break; 636 - case 0x00000003: /* ENGINE_TYPE */ 637 - type = (data & 0x7ffffffc) >> 2; 638 - break; 639 - } 640 - } while ((data & 0x80000000) && ++i < 64); 641 - 642 - if (!data) 643 - continue; 644 - 683 + /* Determine runlist configuration from topology device info. */ 684 + i = 0; 685 + while ((int)(engidx = nvkm_top_engine(top, i++, &runl, &engn)) >= 0) { 645 686 /* Determine which PBDMA handles requests for this engine. */ 646 - for (j = 0; runl >= 0 && j < fifo->pbdma_nr; j++) { 687 + for (j = 0, pbid = -1; j < fifo->pbdma_nr; j++) { 647 688 if (map[j] & (1 << runl)) { 648 689 pbid = j; 649 690 break; 650 691 } 651 692 } 652 693 653 - /* Translate engine type to NVKM engine identifier. */ 654 - switch (type) { 655 - case 0x00000000: engidx = NVKM_ENGINE_GR; break; 656 - case 0x00000001: engidx = NVKM_ENGINE_CE0; break; 657 - case 0x00000002: engidx = NVKM_ENGINE_CE1; break; 658 - case 0x00000003: engidx = NVKM_ENGINE_CE2; break; 659 - case 0x00000008: engidx = NVKM_ENGINE_MSPDEC; break; 660 - case 0x00000009: engidx = NVKM_ENGINE_MSPPP; break; 661 - case 0x0000000a: engidx = NVKM_ENGINE_MSVLD; break; 662 - case 0x0000000b: engidx = NVKM_ENGINE_MSENC; break; 663 - case 0x0000000c: engidx = NVKM_ENGINE_VIC; break; 664 - case 0x0000000d: engidx = NVKM_ENGINE_SEC; break; 665 - case 0x0000000e: engidx = NVKM_ENGINE_NVENC0; break; 666 - case 0x0000000f: engidx = NVKM_ENGINE_NVENC1; break; 667 - case 0x00000010: engidx = NVKM_ENGINE_NVDEC; break; 668 - break; 669 - default: 670 - break; 671 - } 694 + nvkm_debug(subdev, "engine %2d: runlist %2d pbdma %2d\n", 695 + engn, runl, pbid); 672 696 673 - nvkm_debug(subdev, "%02x (%8s): engine %2d runlist %2d " 674 - "pbdma %2d intr %2d reset %2d " 675 - "fault %2d addr %06x\n", type, 676 - engidx < 0 ? NULL : nvkm_subdev_name[engidx], 677 - engn, runl, pbid, intr, mcen, fault, addr); 678 - 679 - /* Mark the engine as supported if everything checks out. */ 680 - if (engn >= 0 && runl >= 0) { 681 - fifo->engine[engn].engine = engidx < 0 ? NULL : 682 - nvkm_device_engine(device, engidx); 683 - fifo->engine[engn].runl = runl; 684 - fifo->engine[engn].pbid = pbid; 685 - fifo->engine_nr = max(fifo->engine_nr, engn + 1); 686 - fifo->runlist[runl].engm |= 1 << engn; 687 - fifo->runlist_nr = max(fifo->runlist_nr, runl + 1); 688 - } 697 + fifo->engine[engn].engine = nvkm_device_engine(device, engidx); 698 + fifo->engine[engn].runl = runl; 699 + fifo->engine[engn].pbid = pbid; 700 + fifo->engine_nr = max(fifo->engine_nr, engn + 1); 701 + fifo->runlist[runl].engm |= 1 << engn; 702 + fifo->runlist_nr = max(fifo->runlist_nr, runl + 1); 689 703 } 690 704 691 705 kfree(map); ··· 662 796 return 0; 663 797 } 664 798 665 - void 799 + static void 666 800 gk104_fifo_init(struct nvkm_fifo *base) 667 801 { 668 802 struct gk104_fifo *fifo = gk104_fifo(base); ··· 691 825 nvkm_wr32(device, 0x002140, 0x7fffffff); 692 826 } 693 827 694 - void * 828 + static void * 695 829 gk104_fifo_dtor(struct nvkm_fifo *base) 696 830 { 697 831 struct gk104_fifo *fifo = gk104_fifo(base); ··· 708 842 return fifo; 709 843 } 710 844 711 - int 712 - gk104_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device, 713 - int index, int nr, struct nvkm_fifo **pfifo) 714 - { 715 - struct gk104_fifo *fifo; 716 - 717 - if (!(fifo = kzalloc(sizeof(*fifo), GFP_KERNEL))) 718 - return -ENOMEM; 719 - INIT_WORK(&fifo->recover.work, gk104_fifo_recover_work); 720 - *pfifo = &fifo->base; 721 - 722 - return nvkm_fifo_ctor(func, device, index, nr, &fifo->base); 723 - } 724 - 725 845 static const struct nvkm_fifo_func 726 - gk104_fifo = { 846 + gk104_fifo_ = { 727 847 .dtor = gk104_fifo_dtor, 728 848 .oneinit = gk104_fifo_oneinit, 729 849 .init = gk104_fifo_init, ··· 717 865 .intr = gk104_fifo_intr, 718 866 .uevent_init = gk104_fifo_uevent_init, 719 867 .uevent_fini = gk104_fifo_uevent_fini, 868 + .class_get = gk104_fifo_class_get, 869 + }; 870 + 871 + int 872 + gk104_fifo_new_(const struct gk104_fifo_func *func, struct nvkm_device *device, 873 + int index, int nr, struct nvkm_fifo **pfifo) 874 + { 875 + struct gk104_fifo *fifo; 876 + 877 + if (!(fifo = kzalloc(sizeof(*fifo), GFP_KERNEL))) 878 + return -ENOMEM; 879 + fifo->func = func; 880 + INIT_WORK(&fifo->recover.work, gk104_fifo_recover_work); 881 + *pfifo = &fifo->base; 882 + 883 + return nvkm_fifo_ctor(&gk104_fifo_, device, index, nr, &fifo->base); 884 + } 885 + 886 + const struct nvkm_enum 887 + gk104_fifo_fault_engine[] = { 888 + { 0x00, "GR", NULL, NVKM_ENGINE_GR }, 889 + { 0x01, "DISPLAY" }, 890 + { 0x02, "CAPTURE" }, 891 + { 0x03, "IFB", NULL, NVKM_ENGINE_IFB }, 892 + { 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR }, 893 + { 0x05, "BAR2", NULL, NVKM_SUBDEV_INSTMEM }, 894 + { 0x06, "SCHED" }, 895 + { 0x07, "HOST0" }, 896 + { 0x08, "HOST1" }, 897 + { 0x09, "HOST2" }, 898 + { 0x0a, "HOST3" }, 899 + { 0x0b, "HOST4" }, 900 + { 0x0c, "HOST5" }, 901 + { 0x0d, "HOST6" }, 902 + { 0x0e, "HOST7" }, 903 + { 0x0f, "HOSTSR" }, 904 + { 0x10, "MSVLD", NULL, NVKM_ENGINE_MSVLD }, 905 + { 0x11, "MSPPP", NULL, NVKM_ENGINE_MSPPP }, 906 + { 0x13, "PERF" }, 907 + { 0x14, "MSPDEC", NULL, NVKM_ENGINE_MSPDEC }, 908 + { 0x15, "CE0", NULL, NVKM_ENGINE_CE0 }, 909 + { 0x16, "CE1", NULL, NVKM_ENGINE_CE1 }, 910 + { 0x17, "PMU" }, 911 + { 0x18, "PTP" }, 912 + { 0x19, "MSENC", NULL, NVKM_ENGINE_MSENC }, 913 + { 0x1b, "CE2", NULL, NVKM_ENGINE_CE2 }, 914 + {} 915 + }; 916 + 917 + const struct nvkm_enum 918 + gk104_fifo_fault_reason[] = { 919 + { 0x00, "PDE" }, 920 + { 0x01, "PDE_SIZE" }, 921 + { 0x02, "PTE" }, 922 + { 0x03, "VA_LIMIT_VIOLATION" }, 923 + { 0x04, "UNBOUND_INST_BLOCK" }, 924 + { 0x05, "PRIV_VIOLATION" }, 925 + { 0x06, "RO_VIOLATION" }, 926 + { 0x07, "WO_VIOLATION" }, 927 + { 0x08, "PITCH_MASK_VIOLATION" }, 928 + { 0x09, "WORK_CREATION" }, 929 + { 0x0a, "UNSUPPORTED_APERTURE" }, 930 + { 0x0b, "COMPRESSION_FAILURE" }, 931 + { 0x0c, "UNSUPPORTED_KIND" }, 932 + { 0x0d, "REGION_VIOLATION" }, 933 + { 0x0e, "BOTH_PTES_VALID" }, 934 + { 0x0f, "INFO_TYPE_POISONED" }, 935 + {} 936 + }; 937 + 938 + const struct nvkm_enum 939 + gk104_fifo_fault_hubclient[] = { 940 + { 0x00, "VIP" }, 941 + { 0x01, "CE0" }, 942 + { 0x02, "CE1" }, 943 + { 0x03, "DNISO" }, 944 + { 0x04, "FE" }, 945 + { 0x05, "FECS" }, 946 + { 0x06, "HOST" }, 947 + { 0x07, "HOST_CPU" }, 948 + { 0x08, "HOST_CPU_NB" }, 949 + { 0x09, "ISO" }, 950 + { 0x0a, "MMU" }, 951 + { 0x0b, "MSPDEC" }, 952 + { 0x0c, "MSPPP" }, 953 + { 0x0d, "MSVLD" }, 954 + { 0x0e, "NISO" }, 955 + { 0x0f, "P2P" }, 956 + { 0x10, "PD" }, 957 + { 0x11, "PERF" }, 958 + { 0x12, "PMU" }, 959 + { 0x13, "RASTERTWOD" }, 960 + { 0x14, "SCC" }, 961 + { 0x15, "SCC_NB" }, 962 + { 0x16, "SEC" }, 963 + { 0x17, "SSYNC" }, 964 + { 0x18, "GR_CE" }, 965 + { 0x19, "CE2" }, 966 + { 0x1a, "XV" }, 967 + { 0x1b, "MMU_NB" }, 968 + { 0x1c, "MSENC" }, 969 + { 0x1d, "DFALCON" }, 970 + { 0x1e, "SKED" }, 971 + { 0x1f, "AFALCON" }, 972 + {} 973 + }; 974 + 975 + const struct nvkm_enum 976 + gk104_fifo_fault_gpcclient[] = { 977 + { 0x00, "L1_0" }, { 0x01, "T1_0" }, { 0x02, "PE_0" }, 978 + { 0x03, "L1_1" }, { 0x04, "T1_1" }, { 0x05, "PE_1" }, 979 + { 0x06, "L1_2" }, { 0x07, "T1_2" }, { 0x08, "PE_2" }, 980 + { 0x09, "L1_3" }, { 0x0a, "T1_3" }, { 0x0b, "PE_3" }, 981 + { 0x0c, "RAST" }, 982 + { 0x0d, "GCC" }, 983 + { 0x0e, "GPCCS" }, 984 + { 0x0f, "PROP_0" }, 985 + { 0x10, "PROP_1" }, 986 + { 0x11, "PROP_2" }, 987 + { 0x12, "PROP_3" }, 988 + { 0x13, "L1_4" }, { 0x14, "T1_4" }, { 0x15, "PE_4" }, 989 + { 0x16, "L1_5" }, { 0x17, "T1_5" }, { 0x18, "PE_5" }, 990 + { 0x19, "L1_6" }, { 0x1a, "T1_6" }, { 0x1b, "PE_6" }, 991 + { 0x1c, "L1_7" }, { 0x1d, "T1_7" }, { 0x1e, "PE_7" }, 992 + { 0x1f, "GPM" }, 993 + { 0x20, "LTP_UTLB_0" }, 994 + { 0x21, "LTP_UTLB_1" }, 995 + { 0x22, "LTP_UTLB_2" }, 996 + { 0x23, "LTP_UTLB_3" }, 997 + { 0x24, "GPC_RGG_UTLB" }, 998 + {} 999 + }; 1000 + 1001 + static const struct gk104_fifo_func 1002 + gk104_fifo = { 1003 + .fault.engine = gk104_fifo_fault_engine, 1004 + .fault.reason = gk104_fifo_fault_reason, 1005 + .fault.hubclient = gk104_fifo_fault_hubclient, 1006 + .fault.gpcclient = gk104_fifo_fault_gpcclient, 720 1007 .chan = { 721 1008 &gk104_fifo_gpfifo_oclass, 722 1009 NULL
+21 -8
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h
··· 3 3 #define gk104_fifo(p) container_of((p), struct gk104_fifo, base) 4 4 #include "priv.h" 5 5 6 + #include <core/enum.h> 6 7 #include <subdev/mmu.h> 7 8 8 9 struct gk104_fifo_chan; 9 10 struct gk104_fifo { 11 + const struct gk104_fifo_func *func; 10 12 struct nvkm_fifo base; 11 13 12 14 struct { ··· 41 39 } user; 42 40 }; 43 41 44 - int gk104_fifo_new_(const struct nvkm_fifo_func *, struct nvkm_device *, 42 + struct gk104_fifo_func { 43 + struct { 44 + const struct nvkm_enum *engine; 45 + const struct nvkm_enum *reason; 46 + const struct nvkm_enum *hubclient; 47 + const struct nvkm_enum *gpcclient; 48 + } fault; 49 + 50 + const struct nvkm_fifo_chan_oclass *chan[]; 51 + }; 52 + 53 + int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *, 45 54 int index, int nr, struct nvkm_fifo **); 46 - void *gk104_fifo_dtor(struct nvkm_fifo *); 47 - int gk104_fifo_oneinit(struct nvkm_fifo *); 48 - void gk104_fifo_init(struct nvkm_fifo *); 49 - void gk104_fifo_fini(struct nvkm_fifo *); 50 - void gk104_fifo_intr(struct nvkm_fifo *); 51 - void gk104_fifo_uevent_init(struct nvkm_fifo *); 52 - void gk104_fifo_uevent_fini(struct nvkm_fifo *); 53 55 void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *); 54 56 void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *); 55 57 void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl); ··· 76 70 return 0; 77 71 } 78 72 } 73 + 74 + extern const struct nvkm_enum gk104_fifo_fault_engine[]; 75 + extern const struct nvkm_enum gk104_fifo_fault_reason[]; 76 + extern const struct nvkm_enum gk104_fifo_fault_hubclient[]; 77 + extern const struct nvkm_enum gk104_fifo_fault_gpcclient[]; 78 + 79 + extern const struct nvkm_enum gm107_fifo_fault_engine[]; 79 80 #endif
+5 -8
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c
··· 24 24 #include "gk104.h" 25 25 #include "changk104.h" 26 26 27 - static const struct nvkm_fifo_func 27 + static const struct gk104_fifo_func 28 28 gk110_fifo = { 29 - .dtor = gk104_fifo_dtor, 30 - .oneinit = gk104_fifo_oneinit, 31 - .init = gk104_fifo_init, 32 - .fini = gk104_fifo_fini, 33 - .intr = gk104_fifo_intr, 34 - .uevent_init = gk104_fifo_uevent_init, 35 - .uevent_fini = gk104_fifo_uevent_fini, 29 + .fault.engine = gk104_fifo_fault_engine, 30 + .fault.reason = gk104_fifo_fault_reason, 31 + .fault.hubclient = gk104_fifo_fault_hubclient, 32 + .fault.gpcclient = gk104_fifo_fault_gpcclient, 36 33 .chan = { 37 34 &gk110_fifo_gpfifo_oclass, 38 35 NULL
+5 -8
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c
··· 24 24 #include "gk104.h" 25 25 #include "changk104.h" 26 26 27 - static const struct nvkm_fifo_func 27 + static const struct gk104_fifo_func 28 28 gk208_fifo = { 29 - .dtor = gk104_fifo_dtor, 30 - .oneinit = gk104_fifo_oneinit, 31 - .init = gk104_fifo_init, 32 - .fini = gk104_fifo_fini, 33 - .intr = gk104_fifo_intr, 34 - .uevent_init = gk104_fifo_uevent_init, 35 - .uevent_fini = gk104_fifo_uevent_fini, 29 + .fault.engine = gk104_fifo_fault_engine, 30 + .fault.reason = gk104_fifo_fault_reason, 31 + .fault.hubclient = gk104_fifo_fault_hubclient, 32 + .fault.gpcclient = gk104_fifo_fault_gpcclient, 36 33 .chan = { 37 34 &gk104_fifo_gpfifo_oclass, 38 35 NULL
+5 -8
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk20a.c
··· 22 22 #include "gk104.h" 23 23 #include "changk104.h" 24 24 25 - static const struct nvkm_fifo_func 25 + static const struct gk104_fifo_func 26 26 gk20a_fifo = { 27 - .dtor = gk104_fifo_dtor, 28 - .oneinit = gk104_fifo_oneinit, 29 - .init = gk104_fifo_init, 30 - .fini = gk104_fifo_fini, 31 - .intr = gk104_fifo_intr, 32 - .uevent_init = gk104_fifo_uevent_init, 33 - .uevent_fini = gk104_fifo_uevent_fini, 27 + .fault.engine = gk104_fifo_fault_engine, 28 + .fault.reason = gk104_fifo_fault_reason, 29 + .fault.hubclient = gk104_fifo_fault_hubclient, 30 + .fault.gpcclient = gk104_fifo_fault_gpcclient, 34 31 .chan = { 35 32 &gk104_fifo_gpfifo_oclass, 36 33 NULL
+28 -8
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c
··· 24 24 #include "gk104.h" 25 25 #include "changk104.h" 26 26 27 - static const struct nvkm_fifo_func 27 + const struct nvkm_enum 28 + gm107_fifo_fault_engine[] = { 29 + { 0x01, "DISPLAY" }, 30 + { 0x02, "CAPTURE" }, 31 + { 0x03, "IFB", NULL, NVKM_ENGINE_IFB }, 32 + { 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR }, 33 + { 0x05, "BAR2", NULL, NVKM_SUBDEV_INSTMEM }, 34 + { 0x06, "SCHED" }, 35 + { 0x07, "HOST0" }, 36 + { 0x08, "HOST1" }, 37 + { 0x09, "HOST2" }, 38 + { 0x0a, "HOST3" }, 39 + { 0x0b, "HOST4" }, 40 + { 0x0c, "HOST5" }, 41 + { 0x0d, "HOST6" }, 42 + { 0x0e, "HOST7" }, 43 + { 0x0f, "HOSTSR" }, 44 + { 0x13, "PERF" }, 45 + { 0x17, "PMU" }, 46 + { 0x18, "PTP" }, 47 + {} 48 + }; 49 + 50 + static const struct gk104_fifo_func 28 51 gm107_fifo = { 29 - .dtor = gk104_fifo_dtor, 30 - .oneinit = gk104_fifo_oneinit, 31 - .init = gk104_fifo_init, 32 - .fini = gk104_fifo_fini, 33 - .intr = gk104_fifo_intr, 34 - .uevent_init = gk104_fifo_uevent_init, 35 - .uevent_fini = gk104_fifo_uevent_fini, 52 + .fault.engine = gm107_fifo_fault_engine, 53 + .fault.reason = gk104_fifo_fault_reason, 54 + .fault.hubclient = gk104_fifo_fault_hubclient, 55 + .fault.gpcclient = gk104_fifo_fault_gpcclient, 36 56 .chan = { 37 57 &gk110_fifo_gpfifo_oclass, 38 58 NULL
+5 -8
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c
··· 24 24 #include "gk104.h" 25 25 #include "changk104.h" 26 26 27 - static const struct nvkm_fifo_func 27 + static const struct gk104_fifo_func 28 28 gm200_fifo = { 29 - .dtor = gk104_fifo_dtor, 30 - .oneinit = gk104_fifo_oneinit, 31 - .init = gk104_fifo_init, 32 - .fini = gk104_fifo_fini, 33 - .intr = gk104_fifo_intr, 34 - .uevent_init = gk104_fifo_uevent_init, 35 - .uevent_fini = gk104_fifo_uevent_fini, 29 + .fault.engine = gm107_fifo_fault_engine, 30 + .fault.reason = gk104_fifo_fault_reason, 31 + .fault.hubclient = gk104_fifo_fault_hubclient, 32 + .fault.gpcclient = gk104_fifo_fault_gpcclient, 36 33 .chan = { 37 34 &gm200_fifo_gpfifo_oclass, 38 35 NULL
+5 -8
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c
··· 22 22 #include "gk104.h" 23 23 #include "changk104.h" 24 24 25 - static const struct nvkm_fifo_func 25 + static const struct gk104_fifo_func 26 26 gm20b_fifo = { 27 - .dtor = gk104_fifo_dtor, 28 - .oneinit = gk104_fifo_oneinit, 29 - .init = gk104_fifo_init, 30 - .fini = gk104_fifo_fini, 31 - .intr = gk104_fifo_intr, 32 - .uevent_init = gk104_fifo_uevent_init, 33 - .uevent_fini = gk104_fifo_uevent_fini, 27 + .fault.engine = gm107_fifo_fault_engine, 28 + .fault.reason = gk104_fifo_fault_reason, 29 + .fault.hubclient = gk104_fifo_fault_hubclient, 30 + .fault.gpcclient = gk104_fifo_fault_gpcclient, 34 31 .chan = { 35 32 &gm200_fifo_gpfifo_oclass, 36 33 NULL
+3
drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
··· 7 7 int index, int nr, struct nvkm_fifo *); 8 8 void nvkm_fifo_uevent(struct nvkm_fifo *); 9 9 10 + struct nvkm_fifo_chan_oclass; 10 11 struct nvkm_fifo_func { 11 12 void *(*dtor)(struct nvkm_fifo *); 12 13 int (*oneinit)(struct nvkm_fifo *); ··· 18 17 void (*start)(struct nvkm_fifo *, unsigned long *); 19 18 void (*uevent_init)(struct nvkm_fifo *); 20 19 void (*uevent_fini)(struct nvkm_fifo *); 20 + int (*class_get)(struct nvkm_fifo *, int index, 21 + const struct nvkm_fifo_chan_oclass **); 21 22 const struct nvkm_fifo_chan_oclass *chan[]; 22 23 }; 23 24
+2 -3
drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c
··· 128 128 129 129 int 130 130 nvkm_gr_ctor(const struct nvkm_gr_func *func, struct nvkm_device *device, 131 - int index, u32 pmc_enable, bool enable, struct nvkm_gr *gr) 131 + int index, bool enable, struct nvkm_gr *gr) 132 132 { 133 133 gr->func = func; 134 - return nvkm_engine_ctor(&nvkm_gr, device, index, pmc_enable, 135 - enable, &gr->engine); 134 + return nvkm_engine_ctor(&nvkm_gr, device, index, enable, &gr->engine); 136 135 }
+6 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c
··· 1181 1181 1182 1182 /* GPC_BROADCAST */ 1183 1183 nvkm_wr32(device, 0x418bb8, (gr->tpc_total << 8) | 1184 - gr->magic_not_rop_nr); 1184 + gr->screen_tile_row_offset); 1185 1185 for (i = 0; i < 6; i++) 1186 1186 nvkm_wr32(device, 0x418b08 + (i * 4), data[i]); 1187 1187 1188 1188 /* GPC_BROADCAST.TP_BROADCAST */ 1189 1189 nvkm_wr32(device, 0x419bd0, (gr->tpc_total << 8) | 1190 - gr->magic_not_rop_nr | data2[0]); 1190 + gr->screen_tile_row_offset | data2[0]); 1191 1191 nvkm_wr32(device, 0x419be4, data2[1]); 1192 1192 for (i = 0; i < 6; i++) 1193 1193 nvkm_wr32(device, 0x419b00 + (i * 4), data[i]); 1194 1194 1195 1195 /* UNK78xx */ 1196 1196 nvkm_wr32(device, 0x4078bc, (gr->tpc_total << 8) | 1197 - gr->magic_not_rop_nr); 1197 + gr->screen_tile_row_offset); 1198 1198 for (i = 0; i < 6; i++) 1199 1199 nvkm_wr32(device, 0x40780c + (i * 4), data[i]); 1200 1200 } ··· 1238 1238 { 1239 1239 struct nvkm_device *device = gr->base.engine.subdev.device; 1240 1240 const struct gf100_grctx_func *grctx = gr->func->grctx; 1241 + u32 idle_timeout; 1241 1242 1242 1243 nvkm_mc_unk260(device->mc, 0); 1243 1244 ··· 1248 1247 gf100_gr_mmio(gr, grctx->tpc); 1249 1248 gf100_gr_mmio(gr, grctx->ppc); 1250 1249 1251 - nvkm_wr32(device, 0x404154, 0x00000000); 1250 + idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); 1252 1251 1253 1252 grctx->bundle(info); 1254 1253 grctx->pagepool(info); ··· 1262 1261 gf100_grctx_generate_r406800(gr); 1263 1262 1264 1263 gf100_gr_icmd(gr, grctx->icmd); 1265 - nvkm_wr32(device, 0x404154, 0x00000400); 1264 + nvkm_wr32(device, 0x404154, idle_timeout); 1266 1265 gf100_gr_mthd(gr, grctx->mthd); 1267 1266 nvkm_mc_unk260(device->mc, 1); 1268 1267 }
-3
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h
··· 81 81 void gk104_grctx_generate_pagepool(struct gf100_grctx *); 82 82 void gk104_grctx_generate_unkn(struct gf100_gr *); 83 83 void gk104_grctx_generate_r418bb8(struct gf100_gr *); 84 - void gk104_grctx_generate_rop_active_fbps(struct gf100_gr *); 85 - 86 84 87 85 void gm107_grctx_generate_bundle(struct gf100_grctx *); 88 86 void gm107_grctx_generate_pagepool(struct gf100_grctx *); ··· 96 98 void gm107_grctx_generate_attrib(struct gf100_grctx *); 97 99 98 100 extern const struct gf100_grctx_func gm200_grctx; 99 - void gm200_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *); 100 101 void gm200_grctx_generate_tpcid(struct gf100_gr *); 101 102 void gm200_grctx_generate_405b60(struct gf100_gr *); 102 103
+3 -2
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c
··· 223 223 { 224 224 struct nvkm_device *device = gr->base.engine.subdev.device; 225 225 const struct gf100_grctx_func *grctx = gr->func->grctx; 226 + u32 idle_timeout; 226 227 int i; 227 228 228 229 nvkm_mc_unk260(device->mc, 0); ··· 234 233 gf100_gr_mmio(gr, grctx->tpc); 235 234 gf100_gr_mmio(gr, grctx->ppc); 236 235 237 - nvkm_wr32(device, 0x404154, 0x00000000); 236 + idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); 238 237 239 238 grctx->bundle(info); 240 239 grctx->pagepool(info); ··· 251 250 nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000); 252 251 253 252 gf100_gr_icmd(gr, grctx->icmd); 254 - nvkm_wr32(device, 0x404154, 0x00000400); 253 + nvkm_wr32(device, 0x404154, idle_timeout); 255 254 gf100_gr_mthd(gr, grctx->mthd); 256 255 nvkm_mc_unk260(device->mc, 1); 257 256 }
+6 -15
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c
··· 924 924 925 925 /* GPC_BROADCAST */ 926 926 nvkm_wr32(device, 0x418bb8, (gr->tpc_total << 8) | 927 - gr->magic_not_rop_nr); 927 + gr->screen_tile_row_offset); 928 928 for (i = 0; i < 6; i++) 929 929 nvkm_wr32(device, 0x418b08 + (i * 4), data[i]); 930 930 931 931 /* GPC_BROADCAST.TP_BROADCAST */ 932 932 nvkm_wr32(device, 0x41bfd0, (gr->tpc_total << 8) | 933 - gr->magic_not_rop_nr | data2[0]); 933 + gr->screen_tile_row_offset | data2[0]); 934 934 nvkm_wr32(device, 0x41bfe4, data2[1]); 935 935 for (i = 0; i < 6; i++) 936 936 nvkm_wr32(device, 0x41bf00 + (i * 4), data[i]); 937 937 938 938 /* UNK78xx */ 939 939 nvkm_wr32(device, 0x4078bc, (gr->tpc_total << 8) | 940 - gr->magic_not_rop_nr); 940 + gr->screen_tile_row_offset); 941 941 for (i = 0; i < 6; i++) 942 942 nvkm_wr32(device, 0x40780c + (i * 4), data[i]); 943 - } 944 - 945 - void 946 - gk104_grctx_generate_rop_active_fbps(struct gf100_gr *gr) 947 - { 948 - struct nvkm_device *device = gr->base.engine.subdev.device; 949 - const u32 fbp_count = nvkm_rd32(device, 0x120074); 950 - nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */ 951 - nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */ 952 943 } 953 944 954 945 void ··· 947 956 { 948 957 struct nvkm_device *device = gr->base.engine.subdev.device; 949 958 const struct gf100_grctx_func *grctx = gr->func->grctx; 959 + u32 idle_timeout; 950 960 int i; 951 961 952 962 nvkm_mc_unk260(device->mc, 0); ··· 958 966 gf100_gr_mmio(gr, grctx->tpc); 959 967 gf100_gr_mmio(gr, grctx->ppc); 960 968 961 - nvkm_wr32(device, 0x404154, 0x00000000); 969 + idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); 962 970 963 971 grctx->bundle(info); 964 972 grctx->pagepool(info); ··· 974 982 nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000); 975 983 976 984 nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); 977 - gk104_grctx_generate_rop_active_fbps(gr); 978 985 nvkm_mask(device, 0x419f78, 0x00000001, 0x00000000); 979 986 980 987 gf100_gr_icmd(gr, grctx->icmd); 981 - nvkm_wr32(device, 0x404154, 0x00000400); 988 + nvkm_wr32(device, 0x404154, idle_timeout); 982 989 gf100_gr_mthd(gr, grctx->mthd); 983 990 nvkm_mc_unk260(device->mc, 1); 984 991
+3 -6
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c
··· 29 29 { 30 30 struct nvkm_device *device = gr->base.engine.subdev.device; 31 31 const struct gf100_grctx_func *grctx = gr->func->grctx; 32 - int idle_timeout_save; 32 + u32 idle_timeout; 33 33 int i; 34 34 35 35 gf100_gr_mmio(gr, gr->fuc_sw_ctx); 36 36 37 37 gf100_gr_wait_idle(gr); 38 38 39 - idle_timeout_save = nvkm_rd32(device, 0x404154); 40 - nvkm_wr32(device, 0x404154, 0x00000000); 39 + idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); 41 40 42 41 grctx->attrib(info); 43 42 ··· 52 53 53 54 nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); 54 55 55 - gk104_grctx_generate_rop_active_fbps(gr); 56 - 57 56 nvkm_mask(device, 0x5044b0, 0x08000000, 0x08000000); 58 57 59 58 gf100_gr_wait_idle(gr); 60 59 61 - nvkm_wr32(device, 0x404154, idle_timeout_save); 60 + nvkm_wr32(device, 0x404154, idle_timeout); 62 61 gf100_gr_wait_idle(gr); 63 62 64 63 gf100_gr_mthd(gr, gr->fuc_method);
+6 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c
··· 920 920 const u32 bs = attrib * gr->ppc_tpc_nr[gpc][ppc]; 921 921 const u32 u = 0x418ea0 + (n * 0x04); 922 922 const u32 o = PPC_UNIT(gpc, ppc, 0); 923 + if (!(gr->ppc_mask[gpc] & (1 << ppc))) 924 + continue; 923 925 mmio_wr32(info, o + 0xc0, bs); 924 926 mmio_wr32(info, o + 0xf4, bo); 925 927 bo += grctx->attrib_nr_max * gr->ppc_tpc_nr[gpc][ppc]; 926 928 mmio_wr32(info, o + 0xe4, as); 927 929 mmio_wr32(info, o + 0xf8, ao); 928 930 ao += grctx->alpha_nr_max * gr->ppc_tpc_nr[gpc][ppc]; 929 - mmio_wr32(info, u, ((bs / 3 /*XXX*/) << 16) | bs); 931 + mmio_wr32(info, u, ((bs / 3) << 16) | bs); 930 932 } 931 933 } 932 934 } ··· 959 957 { 960 958 struct nvkm_device *device = gr->base.engine.subdev.device; 961 959 const struct gf100_grctx_func *grctx = gr->func->grctx; 960 + u32 idle_timeout; 962 961 int i; 963 962 964 963 gf100_gr_mmio(gr, grctx->hub); ··· 968 965 gf100_gr_mmio(gr, grctx->tpc); 969 966 gf100_gr_mmio(gr, grctx->ppc); 970 967 971 - nvkm_wr32(device, 0x404154, 0x00000000); 968 + idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); 972 969 973 970 grctx->bundle(info); 974 971 grctx->pagepool(info); ··· 987 984 988 985 nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); 989 986 990 - gk104_grctx_generate_rop_active_fbps(gr); 991 - 992 987 gf100_gr_icmd(gr, grctx->icmd); 993 - nvkm_wr32(device, 0x404154, 0x00000400); 988 + nvkm_wr32(device, 0x404154, idle_timeout); 994 989 gf100_gr_mthd(gr, grctx->mthd); 995 990 996 991 nvkm_mask(device, 0x419e00, 0x00808080, 0x00808080);
+5 -16
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c
··· 33 33 struct nvkm_device *device = gr->base.engine.subdev.device; 34 34 int gpc, tpc, id; 35 35 36 - for (tpc = 0, id = 0; tpc < 4; tpc++) { 36 + for (tpc = 0, id = 0; tpc < TPC_MAX_PER_GPC; tpc++) { 37 37 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 38 38 if (tpc < gr->tpc_nr[gpc]) { 39 39 nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x698), id); ··· 43 43 } 44 44 } 45 45 } 46 - } 47 - 48 - static void 49 - gm200_grctx_generate_rop_active_fbps(struct gf100_gr *gr) 50 - { 51 - struct nvkm_device *device = gr->base.engine.subdev.device; 52 - const u32 fbp_count = nvkm_rd32(device, 0x12006c); 53 - nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */ 54 - nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */ 55 46 } 56 47 57 48 void ··· 77 86 nvkm_wr32(device, 0x405ba0 + (i * 4), gpcs[i]); 78 87 } 79 88 80 - void 89 + static void 81 90 gm200_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) 82 91 { 83 92 struct nvkm_device *device = gr->base.engine.subdev.device; 84 93 const struct gf100_grctx_func *grctx = gr->func->grctx; 85 - u32 tmp; 94 + u32 idle_timeout, tmp; 86 95 int i; 87 96 88 97 gf100_gr_mmio(gr, gr->fuc_sw_ctx); 89 98 90 - nvkm_wr32(device, 0x404154, 0x00000000); 99 + idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); 91 100 92 101 grctx->bundle(info); 93 102 grctx->pagepool(info); ··· 104 113 105 114 nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); 106 115 107 - gm200_grctx_generate_rop_active_fbps(gr); 108 - 109 116 for (tmp = 0, i = 0; i < gr->gpc_nr; i++) 110 117 tmp |= ((1 << gr->tpc_nr[i]) - 1) << (i * 4); 111 118 nvkm_wr32(device, 0x4041c4, tmp); ··· 111 122 gm200_grctx_generate_405b60(gr); 112 123 113 124 gf100_gr_icmd(gr, gr->fuc_bundle); 114 - nvkm_wr32(device, 0x404154, 0x00000800); 125 + nvkm_wr32(device, 0x404154, idle_timeout); 115 126 gf100_gr_mthd(gr, gr->fuc_method); 116 127 117 128 nvkm_mask(device, 0x418e94, 0xffffffff, 0xc4230000);
+3 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c
··· 40 40 { 41 41 struct nvkm_device *device = gr->base.engine.subdev.device; 42 42 const struct gf100_grctx_func *grctx = gr->func->grctx; 43 - int idle_timeout_save; 43 + u32 idle_timeout; 44 44 int i, tmp; 45 45 46 46 gf100_gr_mmio(gr, gr->fuc_sw_ctx); 47 47 48 48 gf100_gr_wait_idle(gr); 49 49 50 - idle_timeout_save = nvkm_rd32(device, 0x404154); 51 - nvkm_wr32(device, 0x404154, 0x00000000); 50 + idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); 52 51 53 52 grctx->attrib(info); 54 53 ··· 62 63 63 64 nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); 64 65 65 - gk104_grctx_generate_rop_active_fbps(gr); 66 66 nvkm_wr32(device, 0x408908, nvkm_rd32(device, 0x410108) | 0x80000000); 67 67 68 68 for (tmp = 0, i = 0; i < gr->gpc_nr; i++) ··· 72 74 73 75 gf100_gr_wait_idle(gr); 74 76 75 - nvkm_wr32(device, 0x404154, idle_timeout_save); 77 + nvkm_wr32(device, 0x404154, idle_timeout); 76 78 gf100_gr_wait_idle(gr); 77 79 78 80 gf100_gr_mthd(gr, gr->fuc_method);
+4 -3
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc
··· 291 291 // Main program loop, very simple, sleeps until woken up by the interrupt 292 292 // handler, pulls a command from the queue and executes its handler 293 293 // 294 - main: 295 - bset $flags $p0 294 + wait: 296 295 sleep $p0 296 + bset $flags $p0 297 + main: 297 298 mov $r13 #cmd_queue 298 299 call(queue_get) 299 - bra $p1 #main 300 + bra $p1 #wait 300 301 301 302 // 0x0000-0x0003 are all context transfers 302 303 cmpu b32 $r14 0x04
+5 -4
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h
··· 370 370 0xf11f29f0, 371 371 0xf0080007, 372 372 0x02d00203, 373 - /* 0x04bb: main */ 373 + /* 0x04bb: wait */ 374 374 0xf404bd00, 375 - 0x28f40031, 375 + 0x31f40028, 376 + /* 0x04c1: main */ 376 377 0x1cd7f000, 377 378 0xf43921f4, 378 379 0xe4b0f401, ··· 385 384 0x0018fe05, 386 385 0x05b421f5, 387 386 /* 0x04eb: main_not_ctx_xfer */ 388 - 0x94d30ef4, 387 + 0x94d90ef4, 389 388 0xf5f010ef, 390 389 0x7e21f501, 391 - 0xc60ef403, 390 + 0xcc0ef403, 392 391 /* 0x04f8: ih */ 393 392 0x80f900f9, 394 393 0xf90188fe,
+6 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h
··· 397 397 0x080007f1, 398 398 0xd00203f0, 399 399 0x04bd0002, 400 - /* 0x0508: main */ 401 - 0xf40031f4, 402 - 0xd7f00028, 400 + /* 0x0508: wait */ 401 + 0xf40028f4, 402 + /* 0x050e: main */ 403 + 0xd7f00031, 403 404 0x3921f424, 404 405 0xb0f401f4, 405 406 0x18f404e4, ··· 410 409 0xfd01e4b6, 411 410 0x18fe051e, 412 411 0x0121f500, 413 - 0xd30ef406, 412 + 0xd90ef406, 414 413 /* 0x0538: main_not_ctx_xfer */ 415 414 0xf010ef94, 416 415 0x21f501f5, 417 416 0x0ef4037e, 418 417 /* 0x0545: ih */ 419 - 0xf900f9c6, 418 + 0xf900f9cc, 420 419 0x0188fe80, 421 420 0x90f980f9, 422 421 0xb0f9a0f9,
+6 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h
··· 397 397 0x080007f1, 398 398 0xd00203f0, 399 399 0x04bd0002, 400 - /* 0x0508: main */ 401 - 0xf40031f4, 402 - 0xd7f00028, 400 + /* 0x0508: wait */ 401 + 0xf40028f4, 402 + /* 0x050e: main */ 403 + 0xd7f00031, 403 404 0x3921f424, 404 405 0xb0f401f4, 405 406 0x18f404e4, ··· 410 409 0xfd01e4b6, 411 410 0x18fe051e, 412 411 0x0121f500, 413 - 0xd30ef406, 412 + 0xd90ef406, 414 413 /* 0x0538: main_not_ctx_xfer */ 415 414 0xf010ef94, 416 415 0x21f501f5, 417 416 0x0ef4037e, 418 417 /* 0x0545: ih */ 419 - 0xf900f9c6, 418 + 0xf900f9cc, 420 419 0x0188fe80, 421 420 0x90f980f9, 422 421 0xb0f9a0f9,
+6 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h
··· 397 397 0x300007f1, 398 398 0xd00203f0, 399 399 0x04bd0002, 400 - /* 0x0508: main */ 401 - 0xf40031f4, 402 - 0xd7f00028, 400 + /* 0x0508: wait */ 401 + 0xf40028f4, 402 + /* 0x050e: main */ 403 + 0xd7f00031, 403 404 0x3921f424, 404 405 0xb0f401f4, 405 406 0x18f404e4, ··· 410 409 0xfd01e4b6, 411 410 0x18fe051e, 412 411 0x0121f500, 413 - 0xd30ef406, 412 + 0xd90ef406, 414 413 /* 0x0538: main_not_ctx_xfer */ 415 414 0xf010ef94, 416 415 0x21f501f5, 417 416 0x0ef4037e, 418 417 /* 0x0545: ih */ 419 - 0xf900f9c6, 418 + 0xf900f9cc, 420 419 0x0188fe80, 421 420 0x90f980f9, 422 421 0xb0f9a0f9,
+6 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h
··· 349 349 0x801f29f0, 350 350 0xf6023000, 351 351 0x04bd0002, 352 - /* 0x0448: main */ 353 - 0xf40031f4, 354 - 0x240d0028, 352 + /* 0x0448: wait */ 353 + 0xf40028f4, 354 + /* 0x044e: main */ 355 + 0x240d0031, 355 356 0x0000377e, 356 357 0xb0f401f4, 357 358 0x18f404e4, ··· 363 362 0x0018fe05, 364 363 0x00051f7e, 365 364 /* 0x0477: main_not_ctx_xfer */ 366 - 0x94d40ef4, 365 + 0x94da0ef4, 367 366 0xf5f010ef, 368 367 0x02f87e01, 369 - 0xc70ef400, 368 + 0xcd0ef400, 370 369 /* 0x0484: ih */ 371 370 0x80f900f9, 372 371 0xf90188fe,
+6 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h
··· 427 427 0x1f29f024, 428 428 0x02300080, 429 429 0xbd0002f6, 430 - /* 0x0571: main */ 431 - 0x0031f404, 432 - 0x0d0028f4, 430 + /* 0x0571: wait */ 431 + 0x0028f404, 432 + /* 0x0577: main */ 433 + 0x0d0031f4, 433 434 0x00377e24, 434 435 0xf401f400, 435 436 0xf404e4b0, ··· 440 439 0xfd01e4b6, 441 440 0x18fe051e, 442 441 0x06487e00, 443 - 0xd40ef400, 442 + 0xda0ef400, 444 443 /* 0x05a0: main_not_ctx_xfer */ 445 444 0xf010ef94, 446 445 0xf87e01f5, 447 446 0x0ef40002, 448 447 /* 0x05ad: ih */ 449 - 0xf900f9c7, 448 + 0xf900f9cd, 450 449 0x0188fe80, 451 450 0x90f980f9, 452 451 0xb0f9a0f9,
+4 -3
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc
··· 218 218 // Main program loop, very simple, sleeps until woken up by the interrupt 219 219 // handler, pulls a command from the queue and executes its handler 220 220 // 221 - main: 221 + wait: 222 222 // sleep until we have something to do 223 - bset $flags $p0 224 223 sleep $p0 224 + bset $flags $p0 225 + main: 225 226 mov $r13 #cmd_queue 226 227 call(queue_get) 227 - bra $p1 #main 228 + bra $p1 #wait 228 229 229 230 // context switch, requested by GPU? 230 231 cmpu b32 $r14 0x4001
+7 -6
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h
··· 584 584 0x080007f1, 585 585 0xd00203f0, 586 586 0x04bd0001, 587 - /* 0x0564: main */ 588 - 0xf40031f4, 589 - 0xd7f00028, 587 + /* 0x0564: wait */ 588 + 0xf40028f4, 589 + /* 0x056a: main */ 590 + 0xd7f00031, 590 591 0x3921f410, 591 592 0xb1f401f4, 592 593 0xf54001e4, ··· 651 650 0x170007f1, 652 651 0xd00203f0, 653 652 0x04bd0009, 654 - 0xff080ef5, 653 + 0xff0e0ef5, 655 654 /* 0x0660: main_not_ctx_switch */ 656 655 0xf401e4b0, 657 656 0xf2b90d1b, ··· 676 675 0xf501f5f0, 677 676 0xf5037e21, 678 677 /* 0x06b3: main_done */ 679 - 0xbdfeb50e, 678 + 0xbdfebb0e, 680 679 0x1f29f024, 681 680 0x080007f1, 682 681 0xd00203f0, 683 682 0x04bd0002, 684 - 0xfea00ef5, 683 + 0xfea60ef5, 685 684 /* 0x06c8: ih */ 686 685 0x80f900f9, 687 686 0xf90188fe,
+7 -6
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h
··· 584 584 0x080007f1, 585 585 0xd00203f0, 586 586 0x04bd0001, 587 - /* 0x0564: main */ 588 - 0xf40031f4, 589 - 0xd7f00028, 587 + /* 0x0564: wait */ 588 + 0xf40028f4, 589 + /* 0x056a: main */ 590 + 0xd7f00031, 590 591 0x3921f410, 591 592 0xb1f401f4, 592 593 0xf54001e4, ··· 651 650 0x170007f1, 652 651 0xd00203f0, 653 652 0x04bd0009, 654 - 0xff080ef5, 653 + 0xff0e0ef5, 655 654 /* 0x0660: main_not_ctx_switch */ 656 655 0xf401e4b0, 657 656 0xf2b90d1b, ··· 676 675 0xf501f5f0, 677 676 0xf5037e21, 678 677 /* 0x06b3: main_done */ 679 - 0xbdfeb50e, 678 + 0xbdfebb0e, 680 679 0x1f29f024, 681 680 0x080007f1, 682 681 0xd00203f0, 683 682 0x04bd0002, 684 - 0xfea00ef5, 683 + 0xfea60ef5, 685 684 /* 0x06c8: ih */ 686 685 0x80f900f9, 687 686 0xf90188fe,
+7 -6
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h
··· 584 584 0x080007f1, 585 585 0xd00203f0, 586 586 0x04bd0001, 587 - /* 0x0564: main */ 588 - 0xf40031f4, 589 - 0xd7f00028, 587 + /* 0x0564: wait */ 588 + 0xf40028f4, 589 + /* 0x056a: main */ 590 + 0xd7f00031, 590 591 0x3921f410, 591 592 0xb1f401f4, 592 593 0xf54001e4, ··· 651 650 0x170007f1, 652 651 0xd00203f0, 653 652 0x04bd0009, 654 - 0xff080ef5, 653 + 0xff0e0ef5, 655 654 /* 0x0660: main_not_ctx_switch */ 656 655 0xf401e4b0, 657 656 0xf2b90d1b, ··· 676 675 0xf501f5f0, 677 676 0xf5037e21, 678 677 /* 0x06b3: main_done */ 679 - 0xbdfeb50e, 678 + 0xbdfebb0e, 680 679 0x1f29f024, 681 680 0x080007f1, 682 681 0xd00203f0, 683 682 0x04bd0002, 684 - 0xfea00ef5, 683 + 0xfea60ef5, 685 684 /* 0x06c8: ih */ 686 685 0x80f900f9, 687 686 0xf90188fe,
+7 -6
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h
··· 584 584 0x300007f1, 585 585 0xd00203f0, 586 586 0x04bd0001, 587 - /* 0x0564: main */ 588 - 0xf40031f4, 589 - 0xd7f00028, 587 + /* 0x0564: wait */ 588 + 0xf40028f4, 589 + /* 0x056a: main */ 590 + 0xd7f00031, 590 591 0x3921f410, 591 592 0xb1f401f4, 592 593 0xf54001e4, ··· 651 650 0x170007f1, 652 651 0xd00203f0, 653 652 0x04bd0009, 654 - 0xff080ef5, 653 + 0xff0e0ef5, 655 654 /* 0x0660: main_not_ctx_switch */ 656 655 0xf401e4b0, 657 656 0xf2b90d1b, ··· 676 675 0xf501f5f0, 677 676 0xf5037e21, 678 677 /* 0x06b3: main_done */ 679 - 0xbdfeb50e, 678 + 0xbdfebb0e, 680 679 0x1f29f024, 681 680 0x300007f1, 682 681 0xd00203f0, 683 682 0x04bd0002, 684 - 0xfea00ef5, 683 + 0xfea60ef5, 685 684 /* 0x06c8: ih */ 686 685 0x80f900f9, 687 686 0xf90188fe,
+7 -6
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h
··· 531 531 0x1f19f014, 532 532 0x02300080, 533 533 0xbd0001f6, 534 - /* 0x0491: main */ 535 - 0x0031f404, 536 - 0x0d0028f4, 534 + /* 0x0491: wait */ 535 + 0x0028f404, 536 + /* 0x0497: main */ 537 + 0x0d0031f4, 537 538 0x00377e10, 538 539 0xf401f400, 539 540 0x4001e4b1, ··· 591 590 0x09f60217, 592 591 0xf504bd00, 593 592 /* 0x056b: main_not_ctx_switch */ 594 - 0xb0ff2a0e, 593 + 0xb0ff300e, 595 594 0x1bf401e4, 596 595 0x7ef2b20c, 597 596 0xf4000820, ··· 613 612 0x7e01f5f0, 614 613 0xf50002f8, 615 614 /* 0x05b7: main_done */ 616 - 0xbdfede0e, 615 + 0xbdfee40e, 617 616 0x1f29f024, 618 617 0x02300080, 619 618 0xbd0002f6, 620 - 0xcc0ef504, 619 + 0xd20ef504, 621 620 /* 0x05c9: ih */ 622 621 0xf900f9fe, 623 622 0x0188fe80,
+7 -6
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h
··· 531 531 0x1f19f014, 532 532 0x02300080, 533 533 0xbd0001f6, 534 - /* 0x0491: main */ 535 - 0x0031f404, 536 - 0x0d0028f4, 534 + /* 0x0491: wait */ 535 + 0x0028f404, 536 + /* 0x0497: main */ 537 + 0x0d0031f4, 537 538 0x00377e10, 538 539 0xf401f400, 539 540 0x4001e4b1, ··· 591 590 0x09f60217, 592 591 0xf504bd00, 593 592 /* 0x056b: main_not_ctx_switch */ 594 - 0xb0ff2a0e, 593 + 0xb0ff300e, 595 594 0x1bf401e4, 596 595 0x7ef2b20c, 597 596 0xf4000820, ··· 613 612 0x7e01f5f0, 614 613 0xf50002f8, 615 614 /* 0x05b7: main_done */ 616 - 0xbdfede0e, 615 + 0xbdfee40e, 617 616 0x1f29f024, 618 617 0x02300080, 619 618 0xbd0002f6, 620 - 0xcc0ef504, 619 + 0xd20ef504, 621 620 /* 0x05c9: ih */ 622 621 0xf900f9fe, 623 622 0x0188fe80,
+27 -40
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
··· 702 702 * PGRAPH engine/subdev functions 703 703 ******************************************************************************/ 704 704 705 + int 706 + gf100_gr_rops(struct gf100_gr *gr) 707 + { 708 + struct nvkm_device *device = gr->base.engine.subdev.device; 709 + return (nvkm_rd32(device, 0x409604) & 0x001f0000) >> 16; 710 + } 711 + 705 712 void 706 713 gf100_gr_zbc_init(struct gf100_gr *gr) 707 714 { ··· 1616 1609 { 1617 1610 struct gf100_gr *gr = gf100_gr(base); 1618 1611 struct nvkm_device *device = gr->base.engine.subdev.device; 1619 - int ret, i, j; 1612 + int i, j; 1620 1613 1621 1614 nvkm_pmu_pgob(device->pmu, false); 1622 1615 1623 - ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x1000, 256, false, 1624 - &gr->unk4188b4); 1625 - if (ret) 1626 - return ret; 1627 - 1628 - ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x1000, 256, false, 1629 - &gr->unk4188b8); 1630 - if (ret) 1631 - return ret; 1632 - 1633 - nvkm_kmap(gr->unk4188b4); 1634 - for (i = 0; i < 0x1000; i += 4) 1635 - nvkm_wo32(gr->unk4188b4, i, 0x00000010); 1636 - nvkm_done(gr->unk4188b4); 1637 - 1638 - nvkm_kmap(gr->unk4188b8); 1639 - for (i = 0; i < 0x1000; i += 4) 1640 - nvkm_wo32(gr->unk4188b8, i, 0x00000010); 1641 - nvkm_done(gr->unk4188b8); 1642 - 1643 - gr->rop_nr = (nvkm_rd32(device, 0x409604) & 0x001f0000) >> 16; 1644 - gr->gpc_nr = nvkm_rd32(device, 0x409604) & 0x0000001f; 1616 + gr->rop_nr = gr->func->rops(gr); 1617 + gr->gpc_nr = nvkm_rd32(device, 0x409604) & 0x0000001f; 1645 1618 for (i = 0; i < gr->gpc_nr; i++) { 1646 1619 gr->tpc_nr[i] = nvkm_rd32(device, GPC_UNIT(i, 0x2608)); 1647 1620 gr->tpc_total += gr->tpc_nr[i]; ··· 1638 1651 switch (device->chipset) { 1639 1652 case 0xc0: 1640 1653 if (gr->tpc_total == 11) { /* 465, 3/4/4/0, 4 */ 1641 - gr->magic_not_rop_nr = 0x07; 1654 + gr->screen_tile_row_offset = 0x07; 1642 1655 } else 1643 1656 if (gr->tpc_total == 14) { /* 470, 3/3/4/4, 5 */ 1644 - gr->magic_not_rop_nr = 0x05; 1657 + gr->screen_tile_row_offset = 0x05; 1645 1658 } else 1646 1659 if (gr->tpc_total == 15) { /* 480, 3/4/4/4, 6 */ 1647 - gr->magic_not_rop_nr = 0x06; 1660 + gr->screen_tile_row_offset = 0x06; 1648 1661 } 1649 1662 break; 1650 1663 case 0xc3: /* 450, 4/0/0/0, 2 */ 1651 - gr->magic_not_rop_nr = 0x03; 1664 + gr->screen_tile_row_offset = 0x03; 1652 1665 break; 1653 1666 case 0xc4: /* 460, 3/4/0/0, 4 */ 1654 - gr->magic_not_rop_nr = 0x01; 1667 + gr->screen_tile_row_offset = 0x01; 1655 1668 break; 1656 1669 case 0xc1: /* 2/0/0/0, 1 */ 1657 - gr->magic_not_rop_nr = 0x01; 1670 + gr->screen_tile_row_offset = 0x01; 1658 1671 break; 1659 1672 case 0xc8: /* 4/4/3/4, 5 */ 1660 - gr->magic_not_rop_nr = 0x06; 1673 + gr->screen_tile_row_offset = 0x06; 1661 1674 break; 1662 1675 case 0xce: /* 4/4/0/0, 4 */ 1663 - gr->magic_not_rop_nr = 0x03; 1676 + gr->screen_tile_row_offset = 0x03; 1664 1677 break; 1665 1678 case 0xcf: /* 4/0/0/0, 3 */ 1666 - gr->magic_not_rop_nr = 0x03; 1679 + gr->screen_tile_row_offset = 0x03; 1667 1680 break; 1668 1681 case 0xd7: 1669 1682 case 0xd9: /* 1/0/0/0, 1 */ 1670 1683 case 0xea: /* gk20a */ 1671 1684 case 0x12b: /* gm20b */ 1672 - gr->magic_not_rop_nr = 0x01; 1685 + gr->screen_tile_row_offset = 0x01; 1673 1686 break; 1674 1687 } 1675 1688 ··· 1716 1729 gf100_gr_dtor_init(gr->fuc_sw_ctx); 1717 1730 gf100_gr_dtor_init(gr->fuc_sw_nonctx); 1718 1731 1719 - nvkm_memory_del(&gr->unk4188b8); 1720 - nvkm_memory_del(&gr->unk4188b4); 1721 1732 return gr; 1722 1733 } 1723 1734 ··· 1761 1776 gr->firmware = nvkm_boolopt(device->cfgopt, "NvGrUseFW", 1762 1777 func->fecs.ucode == NULL); 1763 1778 1764 - ret = nvkm_gr_ctor(&gf100_gr_, device, index, 0x08001000, 1779 + ret = nvkm_gr_ctor(&gf100_gr_, device, index, 1765 1780 gr->firmware || func->fecs.ucode != NULL, 1766 1781 &gr->base); 1767 1782 if (ret) ··· 1800 1815 gf100_gr_init(struct gf100_gr *gr) 1801 1816 { 1802 1817 struct nvkm_device *device = gr->base.engine.subdev.device; 1818 + struct nvkm_fb *fb = device->fb; 1803 1819 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); 1804 1820 u32 data[TPC_MAX / 8] = {}; 1805 1821 u8 tpcnr[GPC_MAX]; ··· 1813 1827 nvkm_wr32(device, GPC_BCAST(0x088c), 0x00000000); 1814 1828 nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); 1815 1829 nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); 1816 - nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(gr->unk4188b4) >> 8); 1817 - nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(gr->unk4188b8) >> 8); 1830 + nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(fb->mmu_wr) >> 8); 1831 + nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(fb->mmu_rd) >> 8); 1818 1832 1819 1833 gf100_gr_mmio(gr, gr->func->mmio); 1820 1834 ··· 1837 1851 1838 1852 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 1839 1853 nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), 1840 - gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); 1854 + gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); 1841 1855 nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | 1842 - gr->tpc_total); 1856 + gr->tpc_total); 1843 1857 nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); 1844 1858 } 1845 1859 ··· 1932 1946 .mmio = gf100_gr_pack_mmio, 1933 1947 .fecs.ucode = &gf100_gr_fecs_ucode, 1934 1948 .gpccs.ucode = &gf100_gr_gpccs_ucode, 1949 + .rops = gf100_gr_rops, 1935 1950 .grctx = &gf100_grctx, 1936 1951 .sclass = { 1937 1952 { -1, -1, FERMI_TWOD_A },
+10 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
··· 31 31 #include <subdev/mmu.h> 32 32 33 33 #define GPC_MAX 32 34 - #define TPC_MAX (GPC_MAX * 8) 34 + #define TPC_MAX_PER_GPC 8 35 + #define TPC_MAX (GPC_MAX * TPC_MAX_PER_GPC) 35 36 36 37 #define ROP_BCAST(r) (0x408800 + (r)) 37 38 #define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r)) ··· 101 100 u8 ppc_mask[GPC_MAX]; 102 101 u8 ppc_tpc_nr[GPC_MAX][4]; 103 102 104 - struct nvkm_memory *unk4188b4; 105 - struct nvkm_memory *unk4188b8; 106 - 107 103 struct gf100_gr_data mmio_data[4]; 108 104 struct gf100_gr_mmio mmio_list[4096/8]; 109 105 u32 size; 110 106 u32 *data; 111 107 112 - u8 magic_not_rop_nr; 108 + u8 screen_tile_row_offset; 113 109 }; 114 110 115 111 int gf100_gr_ctor(const struct gf100_gr_func *, struct nvkm_device *, ··· 119 121 void (*dtor)(struct gf100_gr *); 120 122 int (*init)(struct gf100_gr *); 121 123 void (*init_gpc_mmu)(struct gf100_gr *); 124 + void (*init_rop_active_fbps)(struct gf100_gr *); 125 + void (*init_ppc_exceptions)(struct gf100_gr *); 122 126 void (*set_hww_esr_report_mask)(struct gf100_gr *); 123 127 const struct gf100_gr_pack *mmio; 124 128 struct { ··· 129 129 struct { 130 130 struct gf100_gr_ucode *ucode; 131 131 } gpccs; 132 + int (*rops)(struct gf100_gr *); 132 133 int ppc_nr; 133 134 const struct gf100_grctx_func *grctx; 134 135 struct nvkm_sclass sclass[]; 135 136 }; 136 137 137 138 int gf100_gr_init(struct gf100_gr *); 139 + int gf100_gr_rops(struct gf100_gr *); 138 140 139 141 int gk104_gr_init(struct gf100_gr *); 142 + void gk104_gr_init_rop_active_fbps(struct gf100_gr *); 143 + void gk104_gr_init_ppc_exceptions(struct gf100_gr *); 140 144 141 145 int gk20a_gr_init(struct gf100_gr *); 142 146 143 147 int gm200_gr_init(struct gf100_gr *); 148 + int gm200_gr_rops(struct gf100_gr *); 144 149 145 150 #define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object) 146 151
+1
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf104.c
··· 118 118 .mmio = gf104_gr_pack_mmio, 119 119 .fecs.ucode = &gf100_gr_fecs_ucode, 120 120 .gpccs.ucode = &gf100_gr_gpccs_ucode, 121 + .rops = gf100_gr_rops, 121 122 .grctx = &gf104_grctx, 122 123 .sclass = { 123 124 { -1, -1, FERMI_TWOD_A },
+1
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c
··· 109 109 .mmio = gf108_gr_pack_mmio, 110 110 .fecs.ucode = &gf100_gr_fecs_ucode, 111 111 .gpccs.ucode = &gf100_gr_gpccs_ucode, 112 + .rops = gf100_gr_rops, 112 113 .grctx = &gf108_grctx, 113 114 .sclass = { 114 115 { -1, -1, FERMI_TWOD_A },
+1
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf110.c
··· 90 90 .mmio = gf110_gr_pack_mmio, 91 91 .fecs.ucode = &gf100_gr_fecs_ucode, 92 92 .gpccs.ucode = &gf100_gr_gpccs_ucode, 93 + .rops = gf100_gr_rops, 93 94 .grctx = &gf110_grctx, 94 95 .sclass = { 95 96 { -1, -1, FERMI_TWOD_A },
+1
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf117.c
··· 126 126 .mmio = gf117_gr_pack_mmio, 127 127 .fecs.ucode = &gf117_gr_fecs_ucode, 128 128 .gpccs.ucode = &gf117_gr_gpccs_ucode, 129 + .rops = gf100_gr_rops, 129 130 .ppc_nr = 1, 130 131 .grctx = &gf117_grctx, 131 132 .sclass = {
+1
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf119.c
··· 181 181 .mmio = gf119_gr_pack_mmio, 182 182 .fecs.ucode = &gf100_gr_fecs_ucode, 183 183 .gpccs.ucode = &gf100_gr_gpccs_ucode, 184 + .rops = gf100_gr_rops, 184 185 .grctx = &gf119_grctx, 185 186 .sclass = { 186 187 { -1, -1, FERMI_TWOD_A },
+38 -5
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk104.c
··· 24 24 #include "gf100.h" 25 25 #include "ctxgf100.h" 26 26 27 + #include <subdev/fb.h> 28 + 27 29 #include <nvif/class.h> 28 30 29 31 /******************************************************************************* ··· 179 177 * PGRAPH engine/subdev functions 180 178 ******************************************************************************/ 181 179 180 + void 181 + gk104_gr_init_rop_active_fbps(struct gf100_gr *gr) 182 + { 183 + struct nvkm_device *device = gr->base.engine.subdev.device; 184 + const u32 fbp_count = nvkm_rd32(device, 0x120074); 185 + nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */ 186 + nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */ 187 + } 188 + 189 + void 190 + gk104_gr_init_ppc_exceptions(struct gf100_gr *gr) 191 + { 192 + struct nvkm_device *device = gr->base.engine.subdev.device; 193 + int gpc, ppc; 194 + 195 + for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 196 + for (ppc = 0; ppc < gr->ppc_nr[gpc]; ppc++) { 197 + if (!(gr->ppc_mask[gpc] & (1 << ppc))) 198 + continue; 199 + nvkm_wr32(device, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000); 200 + } 201 + } 202 + } 203 + 182 204 int 183 205 gk104_gr_init(struct gf100_gr *gr) 184 206 { 185 207 struct nvkm_device *device = gr->base.engine.subdev.device; 208 + struct nvkm_fb *fb = device->fb; 186 209 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); 187 210 u32 data[TPC_MAX / 8] = {}; 188 211 u8 tpcnr[GPC_MAX]; ··· 220 193 nvkm_wr32(device, GPC_BCAST(0x088c), 0x00000000); 221 194 nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); 222 195 nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); 223 - nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(gr->unk4188b4) >> 8); 224 - nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(gr->unk4188b8) >> 8); 196 + nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(fb->mmu_wr) >> 8); 197 + nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(fb->mmu_rd) >> 8); 225 198 226 199 gf100_gr_mmio(gr, gr->func->mmio); 227 200 ··· 245 218 246 219 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 247 220 nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), 248 - gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); 221 + gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); 249 222 nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | 250 - gr->tpc_total); 223 + gr->tpc_total); 251 224 nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); 252 225 } 253 226 254 227 nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); 255 228 nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); 229 + 230 + gr->func->init_rop_active_fbps(gr); 256 231 257 232 nvkm_wr32(device, 0x400500, 0x00010001); 258 233 ··· 275 246 nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); 276 247 nvkm_mask(device, 0x419eb4, 0x00001000, 0x00001000); 277 248 249 + gr->func->init_ppc_exceptions(gr); 250 + 278 251 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 279 - nvkm_wr32(device, GPC_UNIT(gpc, 0x3038), 0xc0000000); 280 252 nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); 281 253 nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); 282 254 nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); ··· 339 309 static const struct gf100_gr_func 340 310 gk104_gr = { 341 311 .init = gk104_gr_init, 312 + .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, 313 + .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, 342 314 .mmio = gk104_gr_pack_mmio, 343 315 .fecs.ucode = &gk104_gr_fecs_ucode, 344 316 .gpccs.ucode = &gk104_gr_gpccs_ucode, 317 + .rops = gf100_gr_rops, 345 318 .ppc_nr = 1, 346 319 .grctx = &gk104_grctx, 347 320 .sclass = {
+3
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110.c
··· 183 183 static const struct gf100_gr_func 184 184 gk110_gr = { 185 185 .init = gk104_gr_init, 186 + .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, 187 + .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, 186 188 .mmio = gk110_gr_pack_mmio, 187 189 .fecs.ucode = &gk110_gr_fecs_ucode, 188 190 .gpccs.ucode = &gk110_gr_gpccs_ucode, 191 + .rops = gf100_gr_rops, 189 192 .ppc_nr = 2, 190 193 .grctx = &gk110_grctx, 191 194 .sclass = {
+3
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110b.c
··· 103 103 static const struct gf100_gr_func 104 104 gk110b_gr = { 105 105 .init = gk104_gr_init, 106 + .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, 107 + .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, 106 108 .mmio = gk110b_gr_pack_mmio, 107 109 .fecs.ucode = &gk110_gr_fecs_ucode, 108 110 .gpccs.ucode = &gk110_gr_gpccs_ucode, 111 + .rops = gf100_gr_rops, 109 112 .ppc_nr = 2, 110 113 .grctx = &gk110b_grctx, 111 114 .sclass = {
+3
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk208.c
··· 162 162 static const struct gf100_gr_func 163 163 gk208_gr = { 164 164 .init = gk104_gr_init, 165 + .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, 166 + .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, 165 167 .mmio = gk208_gr_pack_mmio, 166 168 .fecs.ucode = &gk208_gr_fecs_ucode, 167 169 .gpccs.ucode = &gk208_gr_gpccs_ucode, 170 + .rops = gf100_gr_rops, 168 171 .ppc_nr = 1, 169 172 .grctx = &gk208_grctx, 170 173 .sclass = {
+5 -4
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c
··· 239 239 return ret; 240 240 241 241 /* MMU debug buffer */ 242 - nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(gr->unk4188b4) >> 8); 243 - nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(gr->unk4188b8) >> 8); 244 - 245 242 if (gr->func->init_gpc_mmu) 246 243 gr->func->init_gpc_mmu(gr); 247 244 ··· 264 267 265 268 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 266 269 nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), 267 - gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); 270 + gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); 268 271 nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | 269 272 gr->tpc_total); 270 273 nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); 271 274 } 272 275 273 276 nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); 277 + 278 + gr->func->init_rop_active_fbps(gr); 274 279 275 280 /* Enable FIFO access */ 276 281 nvkm_wr32(device, 0x400500, 0x00010001); ··· 311 312 static const struct gf100_gr_func 312 313 gk20a_gr = { 313 314 .init = gk20a_gr_init, 315 + .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, 314 316 .set_hww_esr_report_mask = gk20a_gr_set_hww_esr_report_mask, 317 + .rops = gf100_gr_rops, 315 318 .ppc_nr = 1, 316 319 .grctx = &gk20a_grctx, 317 320 .sclass = {
+14 -7
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm107.c
··· 26 26 27 27 #include <subdev/bios.h> 28 28 #include <subdev/bios/P0260.h> 29 + #include <subdev/fb.h> 29 30 30 31 #include <nvif/class.h> 31 32 ··· 312 311 gm107_gr_init(struct gf100_gr *gr) 313 312 { 314 313 struct nvkm_device *device = gr->base.engine.subdev.device; 314 + struct nvkm_fb *fb = device->fb; 315 315 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); 316 316 u32 data[TPC_MAX / 8] = {}; 317 317 u8 tpcnr[GPC_MAX]; 318 - int gpc, tpc, ppc, rop; 318 + int gpc, tpc, rop; 319 319 int i; 320 320 321 321 nvkm_wr32(device, GPC_BCAST(0x0880), 0x00000000); 322 322 nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); 323 323 nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); 324 - nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(gr->unk4188b4) >> 8); 325 - nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(gr->unk4188b8) >> 8); 324 + nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(fb->mmu_wr) >> 8); 325 + nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(fb->mmu_rd) >> 8); 326 326 327 327 gf100_gr_mmio(gr, gr->func->mmio); 328 328 ··· 349 347 350 348 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 351 349 nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), 352 - gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); 350 + gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); 353 351 nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | 354 - gr->tpc_total); 352 + gr->tpc_total); 355 353 nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); 356 354 } 357 355 358 356 nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); 359 357 nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); 358 + 359 + gr->func->init_rop_active_fbps(gr); 360 360 361 361 nvkm_wr32(device, 0x400500, 0x00010001); 362 362 ··· 377 373 nvkm_wr32(device, 0x405844, 0x00ffffff); 378 374 nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); 379 375 376 + gr->func->init_ppc_exceptions(gr); 377 + 380 378 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 381 - for (ppc = 0; ppc < 2 /* gr->ppc_nr[gpc] */; ppc++) 382 - nvkm_wr32(device, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000); 383 379 nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); 384 380 nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); 385 381 nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); ··· 442 438 static const struct gf100_gr_func 443 439 gm107_gr = { 444 440 .init = gm107_gr_init, 441 + .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, 442 + .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, 445 443 .mmio = gm107_gr_pack_mmio, 446 444 .fecs.ucode = &gm107_gr_fecs_ucode, 447 445 .gpccs.ucode = &gm107_gr_gpccs_ucode, 446 + .rops = gf100_gr_rops, 448 447 .ppc_nr = 2, 449 448 .grctx = &gm107_grctx, 450 449 .sclass = {
+42 -18
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
··· 33 33 ******************************************************************************/ 34 34 35 35 int 36 + gm200_gr_rops(struct gf100_gr *gr) 37 + { 38 + return nvkm_rd32(gr->base.engine.subdev.device, 0x12006c); 39 + } 40 + 41 + static void 42 + gm200_gr_init_gpc_mmu(struct gf100_gr *gr) 43 + { 44 + struct nvkm_device *device = gr->base.engine.subdev.device; 45 + 46 + nvkm_wr32(device, 0x418880, nvkm_rd32(device, 0x100c80) & 0xf0001fff); 47 + nvkm_wr32(device, 0x418890, 0x00000000); 48 + nvkm_wr32(device, 0x418894, 0x00000000); 49 + 50 + nvkm_wr32(device, 0x4188b4, nvkm_rd32(device, 0x100cc8)); 51 + nvkm_wr32(device, 0x4188b8, nvkm_rd32(device, 0x100ccc)); 52 + nvkm_wr32(device, 0x4188b0, nvkm_rd32(device, 0x100cc4)); 53 + } 54 + 55 + static void 56 + gm200_gr_init_rop_active_fbps(struct gf100_gr *gr) 57 + { 58 + struct nvkm_device *device = gr->base.engine.subdev.device; 59 + const u32 fbp_count = nvkm_rd32(device, 0x12006c); 60 + nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */ 61 + nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */ 62 + } 63 + 64 + int 36 65 gm200_gr_init(struct gf100_gr *gr) 37 66 { 38 67 struct nvkm_device *device = gr->base.engine.subdev.device; 39 68 const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); 40 - u32 data[TPC_MAX / 8] = {}, tmp; 69 + u32 data[TPC_MAX / 8] = {}; 41 70 u8 tpcnr[GPC_MAX]; 42 - int gpc, tpc, ppc, rop; 71 + int gpc, tpc, rop; 43 72 int i; 44 73 45 - tmp = nvkm_rd32(device, 0x100c80); /*XXX: mask? */ 46 - nvkm_wr32(device, 0x418880, 0x00001000 | (tmp & 0x00000fff)); 47 - nvkm_wr32(device, 0x418890, 0x00000000); 48 - nvkm_wr32(device, 0x418894, 0x00000000); 49 - nvkm_wr32(device, 0x4188b4, nvkm_memory_addr(gr->unk4188b4) >> 8); 50 - nvkm_wr32(device, 0x4188b8, nvkm_memory_addr(gr->unk4188b8) >> 8); 51 - nvkm_mask(device, 0x4188b0, 0x00040000, 0x00040000); 52 - 53 - /*XXX: belongs in fb */ 54 - nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(gr->unk4188b4) >> 8); 55 - nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(gr->unk4188b8) >> 8); 56 - nvkm_mask(device, 0x100cc4, 0x00040000, 0x00040000); 74 + gr->func->init_gpc_mmu(gr); 57 75 58 76 gf100_gr_mmio(gr, gr->fuc_sw_nonctx); 59 77 ··· 97 79 98 80 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 99 81 nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), 100 - gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); 82 + gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); 101 83 nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | 102 - gr->tpc_total); 84 + gr->tpc_total); 103 85 nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); 104 86 } 105 87 106 88 nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); 107 89 nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); 108 90 nvkm_wr32(device, GPC_BCAST(0x033c), nvkm_rd32(device, 0x100804)); 91 + 92 + gr->func->init_rop_active_fbps(gr); 109 93 110 94 nvkm_wr32(device, 0x400500, 0x00010001); 111 95 nvkm_wr32(device, 0x400100, 0xffffffff); ··· 126 106 nvkm_wr32(device, 0x405844, 0x00ffffff); 127 107 nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); 128 108 109 + gr->func->init_ppc_exceptions(gr); 110 + 129 111 for (gpc = 0; gpc < gr->gpc_nr; gpc++) { 130 - for (ppc = 0; ppc < gr->ppc_nr[gpc]; ppc++) 131 - nvkm_wr32(device, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000); 132 112 nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); 133 113 nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); 134 114 nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); ··· 209 189 static const struct gf100_gr_func 210 190 gm200_gr = { 211 191 .init = gm200_gr_init, 192 + .init_gpc_mmu = gm200_gr_init_gpc_mmu, 193 + .init_rop_active_fbps = gm200_gr_init_rop_active_fbps, 194 + .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, 195 + .rops = gm200_gr_rops, 212 196 .ppc_nr = 2, 213 197 .grctx = &gm200_grctx, 214 198 .sclass = {
+3 -1
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c
··· 42 42 } 43 43 44 44 val = nvkm_rd32(device, 0x100c80); 45 - val &= 0xf000087f; 45 + val &= 0xf000187f; 46 46 nvkm_wr32(device, 0x418880, val); 47 47 nvkm_wr32(device, 0x418890, 0); 48 48 nvkm_wr32(device, 0x418894, 0); ··· 66 66 gm20b_gr = { 67 67 .init = gk20a_gr_init, 68 68 .init_gpc_mmu = gm20b_gr_init_gpc_mmu, 69 + .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, 69 70 .set_hww_esr_report_mask = gm20b_gr_set_hww_esr_report_mask, 71 + .rops = gm200_gr_rops, 70 72 .ppc_nr = 1, 71 73 .grctx = &gm20b_grctx, 72 74 .sclass = {
+1 -2
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c
··· 1422 1422 spin_lock_init(&gr->lock); 1423 1423 *pgr = &gr->base; 1424 1424 1425 - return nvkm_gr_ctor(&nv04_gr, device, index, 0x00001000, 1426 - true, &gr->base); 1425 + return nvkm_gr_ctor(&nv04_gr, device, index, true, &gr->base); 1427 1426 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c
··· 1182 1182 spin_lock_init(&gr->lock); 1183 1183 *pgr = &gr->base; 1184 1184 1185 - return nvkm_gr_ctor(func, device, index, 0x00001000, true, &gr->base); 1185 + return nvkm_gr_ctor(func, device, index, true, &gr->base); 1186 1186 } 1187 1187 1188 1188 static const struct nvkm_gr_func
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c
··· 337 337 return -ENOMEM; 338 338 *pgr = &gr->base; 339 339 340 - return nvkm_gr_ctor(func, device, index, 0x00001000, true, &gr->base); 340 + return nvkm_gr_ctor(func, device, index, true, &gr->base); 341 341 } 342 342 343 343 static const struct nvkm_gr_func
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c
··· 438 438 *pgr = &gr->base; 439 439 INIT_LIST_HEAD(&gr->chan); 440 440 441 - return nvkm_gr_ctor(func, device, index, 0x00001000, true, &gr->base); 441 + return nvkm_gr_ctor(func, device, index, true, &gr->base); 442 442 } 443 443 444 444 static const struct nvkm_gr_func
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c
··· 768 768 spin_lock_init(&gr->lock); 769 769 *pgr = &gr->base; 770 770 771 - return nvkm_gr_ctor(func, device, index, 0x00201000, true, &gr->base); 771 + return nvkm_gr_ctor(func, device, index, true, &gr->base); 772 772 } 773 773 774 774 static const struct nvkm_gr_func
+1 -2
drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h
··· 7 7 struct nvkm_fifo_chan; 8 8 9 9 int nvkm_gr_ctor(const struct nvkm_gr_func *, struct nvkm_device *, 10 - int index, u32 pmc_enable, bool enable, 11 - struct nvkm_gr *); 10 + int index, bool enable, struct nvkm_gr *); 12 11 13 12 bool nv04_gr_idle(struct nvkm_gr *); 14 13
+1 -2
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/g84.c
··· 39 39 int 40 40 g84_mpeg_new(struct nvkm_device *device, int index, struct nvkm_engine **pmpeg) 41 41 { 42 - return nvkm_engine_new_(&g84_mpeg, device, index, 0x00000002, 43 - true, pmpeg); 42 + return nvkm_engine_new_(&g84_mpeg, device, index, true, pmpeg); 44 43 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c
··· 278 278 mpeg->func = func; 279 279 *pmpeg = &mpeg->engine; 280 280 281 - return nvkm_engine_ctor(&nv31_mpeg_, device, index, 0x00000002, 281 + return nvkm_engine_ctor(&nv31_mpeg_, device, index, 282 282 true, &mpeg->engine); 283 283 } 284 284
+1 -2
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c
··· 212 212 INIT_LIST_HEAD(&mpeg->chan); 213 213 *pmpeg = &mpeg->engine; 214 214 215 - return nvkm_engine_ctor(&nv44_mpeg, device, index, 0x00000002, 216 - true, &mpeg->engine); 215 + return nvkm_engine_ctor(&nv44_mpeg, device, index, true, &mpeg->engine); 217 216 }
+1 -2
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv50.c
··· 130 130 int 131 131 nv50_mpeg_new(struct nvkm_device *device, int index, struct nvkm_engine **pmpeg) 132 132 { 133 - return nvkm_engine_new_(&nv50_mpeg, device, index, 0x00400002, 134 - true, pmpeg); 133 + return nvkm_engine_new_(&nv50_mpeg, device, index, true, pmpeg); 135 134 }
-1
drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c
··· 35 35 36 36 static const struct nvkm_falcon_func 37 37 g98_mspdec = { 38 - .pmc_enable = 0x01020000, 39 38 .init = g98_mspdec_init, 40 39 .sclass = { 41 40 { -1, -1, G98_MSPDEC },
-1
drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c
··· 35 35 36 36 static const struct nvkm_falcon_func 37 37 gf100_mspdec = { 38 - .pmc_enable = 0x00020000, 39 38 .init = gf100_mspdec_init, 40 39 .sclass = { 41 40 { -1, -1, GF100_MSPDEC },
-1
drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c
··· 27 27 28 28 static const struct nvkm_falcon_func 29 29 gk104_mspdec = { 30 - .pmc_enable = 0x00020000, 31 30 .init = gf100_mspdec_init, 32 31 .sclass = { 33 32 { -1, -1, GK104_MSPDEC },
-1
drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gt215.c
··· 27 27 28 28 static const struct nvkm_falcon_func 29 29 gt215_mspdec = { 30 - .pmc_enable = 0x01020000, 31 30 .init = g98_mspdec_init, 32 31 .sclass = { 33 32 { -1, -1, GT212_MSPDEC },
-1
drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c
··· 35 35 36 36 static const struct nvkm_falcon_func 37 37 g98_msppp = { 38 - .pmc_enable = 0x00400002, 39 38 .init = g98_msppp_init, 40 39 .sclass = { 41 40 { -1, -1, G98_MSPPP },
-1
drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c
··· 35 35 36 36 static const struct nvkm_falcon_func 37 37 gf100_msppp = { 38 - .pmc_enable = 0x00000002, 39 38 .init = gf100_msppp_init, 40 39 .sclass = { 41 40 { -1, -1, GF100_MSPPP },
-1
drivers/gpu/drm/nouveau/nvkm/engine/msppp/gt215.c
··· 27 27 28 28 static const struct nvkm_falcon_func 29 29 gt215_msppp = { 30 - .pmc_enable = 0x00400002, 31 30 .init = g98_msppp_init, 32 31 .sclass = { 33 32 { -1, -1, GT212_MSPPP },
-1
drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c
··· 35 35 36 36 static const struct nvkm_falcon_func 37 37 g98_msvld = { 38 - .pmc_enable = 0x04008000, 39 38 .init = g98_msvld_init, 40 39 .sclass = { 41 40 { -1, -1, G98_MSVLD },
-1
drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c
··· 35 35 36 36 static const struct nvkm_falcon_func 37 37 gf100_msvld = { 38 - .pmc_enable = 0x00008000, 39 38 .init = gf100_msvld_init, 40 39 .sclass = { 41 40 { -1, -1, GF100_MSVLD },
-1
drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c
··· 27 27 28 28 static const struct nvkm_falcon_func 29 29 gk104_msvld = { 30 - .pmc_enable = 0x00008000, 31 30 .init = gf100_msvld_init, 32 31 .sclass = { 33 32 { -1, -1, GK104_MSVLD },
-1
drivers/gpu/drm/nouveau/nvkm/engine/msvld/gt215.c
··· 27 27 28 28 static const struct nvkm_falcon_func 29 29 gt215_msvld = { 30 - .pmc_enable = 0x04008000, 31 30 .init = g98_msvld_init, 32 31 .sclass = { 33 32 { -1, -1, GT212_MSVLD },
-1
drivers/gpu/drm/nouveau/nvkm/engine/msvld/mcp89.c
··· 27 27 28 28 static const struct nvkm_falcon_func 29 29 mcp89_msvld = { 30 - .pmc_enable = 0x04008000, 31 30 .init = g98_msvld_init, 32 31 .sclass = { 33 32 { -1, -1, IGT21A_MSVLD },
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c
··· 863 863 pm->func = func; 864 864 INIT_LIST_HEAD(&pm->domains); 865 865 INIT_LIST_HEAD(&pm->sources); 866 - return nvkm_engine_ctor(&nvkm_pm, device, index, 0, true, &pm->engine); 866 + return nvkm_engine_ctor(&nvkm_pm, device, index, true, &pm->engine); 867 867 }
-1
drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c
··· 66 66 .code.size = sizeof(g98_sec_code), 67 67 .data.data = g98_sec_data, 68 68 .data.size = sizeof(g98_sec_data), 69 - .pmc_enable = 0x00004000, 70 69 .intr = g98_sec_intr, 71 70 .sclass = { 72 71 { -1, -1, G98_SEC },
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c
··· 106 106 INIT_LIST_HEAD(&sw->chan); 107 107 sw->func = func; 108 108 109 - return nvkm_engine_ctor(&nvkm_sw, device, index, 0, true, &sw->engine); 109 + return nvkm_engine_ctor(&nvkm_sw, device, index, true, &sw->engine); 110 110 }
-1
drivers/gpu/drm/nouveau/nvkm/engine/vp/g84.c
··· 27 27 28 28 static const struct nvkm_xtensa_func 29 29 g84_vp = { 30 - .pmc_enable = 0x01020000, 31 30 .fifo_val = 0x111, 32 31 .unkd28 = 0x9c544, 33 32 .sclass = {
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/xtensa.c
··· 187 187 xtensa->addr = addr; 188 188 *pengine = &xtensa->engine; 189 189 190 - return nvkm_engine_ctor(&nvkm_xtensa, device, index, func->pmc_enable, 190 + return nvkm_engine_ctor(&nvkm_xtensa, device, index, 191 191 enable, &xtensa->engine); 192 192 }
+1
drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild
··· 19 19 include $(src)/nvkm/subdev/secboot/Kbuild 20 20 include $(src)/nvkm/subdev/therm/Kbuild 21 21 include $(src)/nvkm/subdev/timer/Kbuild 22 + include $(src)/nvkm/subdev/top/Kbuild 22 23 include $(src)/nvkm/subdev/volt/Kbuild
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c
··· 77 77 nvkm_bar_ctor(const struct nvkm_bar_func *func, struct nvkm_device *device, 78 78 int index, struct nvkm_bar *bar) 79 79 { 80 - nvkm_subdev_ctor(&nvkm_bar, device, index, 0, &bar->subdev); 80 + nvkm_subdev_ctor(&nvkm_bar, device, index, &bar->subdev); 81 81 bar->func = func; 82 82 spin_lock_init(&bar->lock); 83 83 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
··· 105 105 106 106 if (!(bios = *pbios = kzalloc(sizeof(*bios), GFP_KERNEL))) 107 107 return -ENOMEM; 108 - nvkm_subdev_ctor(&nvkm_bios, device, index, 0, &bios->subdev); 108 + nvkm_subdev_ctor(&nvkm_bios, device, index, &bios->subdev); 109 109 110 110 ret = nvbios_shadow(bios); 111 111 if (ret)
+8 -6
drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c
··· 81 81 pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) 82 82 { 83 83 struct bit_entry bit_C; 84 + u16 data = 0x0000; 84 85 85 - if (!bit_entry(bios, 'C', &bit_C) && bit_C.length >= 10) { 86 - u16 data = nvbios_rd16(bios, bit_C.offset + 8); 86 + if (!bit_entry(bios, 'C', &bit_C)) { 87 + if (bit_C.version == 1 && bit_C.length >= 10) 88 + data = nvbios_rd16(bios, bit_C.offset + 8); 87 89 if (data) { 88 90 *ver = nvbios_rd08(bios, data + 0); 89 91 *hdr = nvbios_rd08(bios, data + 1); ··· 96 94 } 97 95 98 96 if (bmp_version(bios) >= 0x0524) { 99 - u16 data = nvbios_rd16(bios, bios->bmp_offset + 142); 97 + data = nvbios_rd16(bios, bios->bmp_offset + 142); 100 98 if (data) { 101 99 *ver = nvbios_rd08(bios, data + 0); 102 100 *hdr = 1; ··· 107 105 } 108 106 109 107 *ver = 0x00; 110 - return 0x0000; 108 + return data; 111 109 } 112 110 113 111 static struct pll_mapping * ··· 158 156 } 159 157 160 158 map = pll_map(bios); 161 - while (map->reg) { 159 + while (map && map->reg) { 162 160 if (map->reg == reg && *ver >= 0x20) { 163 161 u16 addr = (data += hdr); 164 162 *type = map->type; ··· 200 198 } 201 199 202 200 map = pll_map(bios); 203 - while (map->reg) { 201 + while (map && map->reg) { 204 202 if (map->type == type && *ver >= 0x20) { 205 203 u16 addr = (data += hdr); 206 204 *reg = map->reg;
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c
··· 58 58 struct nvkm_bus *bus; 59 59 if (!(bus = *pbus = kzalloc(sizeof(*bus), GFP_KERNEL))) 60 60 return -ENOMEM; 61 - nvkm_subdev_ctor(&nvkm_bus, device, index, 0, &bus->subdev); 61 + nvkm_subdev_ctor(&nvkm_bus, device, index, &bus->subdev); 62 62 bus->func = func; 63 63 return 0; 64 64 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
··· 564 564 int ret, idx, arglen; 565 565 const char *mode; 566 566 567 - nvkm_subdev_ctor(&nvkm_clk, device, index, 0, &clk->subdev); 567 + nvkm_subdev_ctor(&nvkm_clk, device, index, &clk->subdev); 568 568 clk->func = func; 569 569 INIT_LIST_HEAD(&clk->states); 570 570 clk->domains = func->domains;
+8 -2
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c
··· 83 83 if (init->func->preinit) 84 84 init->func->preinit(init); 85 85 86 + /* Override the post flag during the first call if NvForcePost is set */ 87 + if (init->force_post) { 88 + init->post = init->force_post; 89 + init->force_post = false; 90 + } 91 + 86 92 /* unlock the extended vga crtc regs */ 87 93 nvkm_lockvgac(subdev->device, false); 88 94 return 0; ··· 130 124 struct nvkm_device *device, int index, 131 125 struct nvkm_devinit *init) 132 126 { 133 - nvkm_subdev_ctor(&nvkm_devinit, device, index, 0, &init->subdev); 127 + nvkm_subdev_ctor(&nvkm_devinit, device, index, &init->subdev); 134 128 init->func = func; 135 - init->post = nvkm_boolopt(device->cfgopt, "NvForcePost", false); 129 + init->force_post = nvkm_boolopt(device->cfgopt, "NvForcePost", false); 136 130 }
+5 -3
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c
··· 97 97 struct nvkm_subdev *subdev = &init->base.subdev; 98 98 struct nvkm_device *device = subdev->device; 99 99 100 - /* This bit is set by devinit, and flips back to 0 on suspend */ 101 - if (!base->post) 102 - base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0); 100 + /* 101 + * This bit is set by devinit, and flips back to 0 on suspend. We 102 + * can use it as a reliable way to know whether we should run devinit. 103 + */ 104 + base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0); 103 105 } 104 106 105 107 static const struct nvkm_devinit_func
+1
drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild
··· 23 23 nvkm-y += nvkm/subdev/fb/gk104.o 24 24 nvkm-y += nvkm/subdev/fb/gk20a.o 25 25 nvkm-y += nvkm/subdev/fb/gm107.o 26 + nvkm-y += nvkm/subdev/fb/gm200.o 26 27 27 28 nvkm-y += nvkm/subdev/fb/ram.o 28 29 nvkm-y += nvkm/subdev/fb/ramnv04.o
+13 -1
drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c
··· 24 24 #include "priv.h" 25 25 #include "ram.h" 26 26 27 + #include <core/memory.h> 27 28 #include <subdev/bios.h> 28 29 #include <subdev/bios/M0203.h> 29 30 #include <engine/gr.h> ··· 99 98 nvkm_fb_oneinit(struct nvkm_subdev *subdev) 100 99 { 101 100 struct nvkm_fb *fb = nvkm_fb(subdev); 101 + 102 102 if (fb->func->ram_new) { 103 103 int ret = fb->func->ram_new(fb, &fb->ram); 104 104 if (ret) { ··· 107 105 return ret; 108 106 } 109 107 } 108 + 109 + if (fb->func->oneinit) { 110 + int ret = fb->func->oneinit(fb); 111 + if (ret) 112 + return ret; 113 + } 114 + 110 115 return 0; 111 116 } 112 117 ··· 143 134 struct nvkm_fb *fb = nvkm_fb(subdev); 144 135 int i; 145 136 137 + nvkm_memory_del(&fb->mmu_wr); 138 + nvkm_memory_del(&fb->mmu_rd); 139 + 146 140 for (i = 0; i < fb->tile.regions; i++) 147 141 fb->func->tile.fini(fb, i, &fb->tile.region[i]); 148 142 ··· 168 156 nvkm_fb_ctor(const struct nvkm_fb_func *func, struct nvkm_device *device, 169 157 int index, struct nvkm_fb *fb) 170 158 { 171 - nvkm_subdev_ctor(&nvkm_fb, device, index, 0, &fb->subdev); 159 + nvkm_subdev_ctor(&nvkm_fb, device, index, &fb->subdev); 172 160 fb->func = func; 173 161 fb->tile.regions = fb->func->tile.regions; 174 162 }
+26
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c
··· 24 24 #include "gf100.h" 25 25 #include "ram.h" 26 26 27 + #include <core/memory.h> 28 + #include <core/option.h> 29 + 27 30 extern const u8 gf100_pte_storage_type_map[256]; 28 31 29 32 bool ··· 47 44 nvkm_debug(subdev, "PFFB intr\n"); 48 45 if (intr & 0x00002000) 49 46 nvkm_debug(subdev, "PBFB intr\n"); 47 + } 48 + 49 + int 50 + gf100_fb_oneinit(struct nvkm_fb *fb) 51 + { 52 + struct nvkm_device *device = fb->subdev.device; 53 + int ret, size = 0x1000; 54 + 55 + size = nvkm_longopt(device->cfgopt, "MmuDebugBufferSize", size); 56 + size = min(size, 0x1000); 57 + 58 + ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, size, 0x1000, 59 + false, &fb->mmu_rd); 60 + if (ret) 61 + return ret; 62 + 63 + ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, size, 0x1000, 64 + false, &fb->mmu_wr); 65 + if (ret) 66 + return ret; 67 + 68 + return 0; 50 69 } 51 70 52 71 void ··· 123 98 static const struct nvkm_fb_func 124 99 gf100_fb = { 125 100 .dtor = gf100_fb_dtor, 101 + .oneinit = gf100_fb_oneinit, 126 102 .init = gf100_fb_init, 127 103 .intr = gf100_fb_intr, 128 104 .ram_new = gf100_ram_new,
+1
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c
··· 27 27 static const struct nvkm_fb_func 28 28 gk104_fb = { 29 29 .dtor = gf100_fb_dtor, 30 + .oneinit = gf100_fb_oneinit, 30 31 .init = gf100_fb_init, 31 32 .intr = gf100_fb_intr, 32 33 .ram_new = gk104_ram_new,
+5
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk20a.c
··· 21 21 */ 22 22 #include "priv.h" 23 23 24 + #include <core/memory.h> 25 + 24 26 static void 25 27 gk20a_fb_init(struct nvkm_fb *fb) 26 28 { 27 29 struct nvkm_device *device = fb->subdev.device; 28 30 nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ 31 + nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(fb->mmu_wr) >> 8); 32 + nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(fb->mmu_rd) >> 8); 29 33 } 30 34 31 35 static const struct nvkm_fb_func 32 36 gk20a_fb = { 37 + .oneinit = gf100_fb_oneinit, 33 38 .init = gk20a_fb_init, 34 39 .memtype_valid = gf100_fb_memtype_valid, 35 40 };
+1
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c
··· 27 27 static const struct nvkm_fb_func 28 28 gm107_fb = { 29 29 .dtor = gf100_fb_dtor, 30 + .oneinit = gf100_fb_oneinit, 30 31 .init = gf100_fb_init, 31 32 .intr = gf100_fb_intr, 32 33 .ram_new = gm107_ram_new,
+60
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c
··· 1 + /* 2 + * Copyright 2012 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs 23 + */ 24 + #include "gf100.h" 25 + #include "ram.h" 26 + 27 + #include <core/memory.h> 28 + 29 + static void 30 + gm200_fb_init(struct nvkm_fb *base) 31 + { 32 + struct gf100_fb *fb = gf100_fb(base); 33 + struct nvkm_device *device = fb->base.subdev.device; 34 + 35 + if (fb->r100c10_page) 36 + nvkm_wr32(device, 0x100c10, fb->r100c10 >> 8); 37 + 38 + nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ 39 + 40 + nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(fb->base.mmu_wr) >> 8); 41 + nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(fb->base.mmu_rd) >> 8); 42 + nvkm_mask(device, 0x100cc4, 0x00060000, 43 + min(nvkm_memory_size(fb->base.mmu_rd) >> 16, (u64)2) << 17); 44 + } 45 + 46 + static const struct nvkm_fb_func 47 + gm200_fb = { 48 + .dtor = gf100_fb_dtor, 49 + .oneinit = gf100_fb_oneinit, 50 + .init = gm200_fb_init, 51 + .intr = gf100_fb_intr, 52 + .ram_new = gm107_ram_new, 53 + .memtype_valid = gf100_fb_memtype_valid, 54 + }; 55 + 56 + int 57 + gm200_fb_new(struct nvkm_device *device, int index, struct nvkm_fb **pfb) 58 + { 59 + return gf100_fb_new_(&gm200_fb, device, index, pfb); 60 + }
+2
drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h
··· 6 6 7 7 struct nvkm_fb_func { 8 8 void *(*dtor)(struct nvkm_fb *); 9 + int (*oneinit)(struct nvkm_fb *); 9 10 void (*init)(struct nvkm_fb *); 10 11 void (*intr)(struct nvkm_fb *); 11 12 ··· 59 58 void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size, 60 59 u32 pitch, u32 flags, struct nvkm_fb_tile *); 61 60 61 + int gf100_fb_oneinit(struct nvkm_fb *); 62 62 bool gf100_fb_memtype_valid(struct nvkm_fb *, u32); 63 63 #endif
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c
··· 47 47 struct nvkm_fuse *fuse; 48 48 if (!(fuse = *pfuse = kzalloc(sizeof(*fuse), GFP_KERNEL))) 49 49 return -ENOMEM; 50 - nvkm_subdev_ctor(&nvkm_fuse, device, index, 0, &fuse->subdev); 50 + nvkm_subdev_ctor(&nvkm_fuse, device, index, &fuse->subdev); 51 51 fuse->func = func; 52 52 spin_lock_init(&fuse->lock); 53 53 return 0;
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c
··· 216 216 if (!(gpio = *pgpio = kzalloc(sizeof(*gpio), GFP_KERNEL))) 217 217 return -ENOMEM; 218 218 219 - nvkm_subdev_ctor(&nvkm_gpio, device, index, 0, &gpio->subdev); 219 + nvkm_subdev_ctor(&nvkm_gpio, device, index, &gpio->subdev); 220 220 gpio->func = func; 221 221 222 222 return nvkm_event_init(&nvkm_gpio_intr_func, 2, func->lines,
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
··· 254 254 if (!(i2c = *pi2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) 255 255 return -ENOMEM; 256 256 257 - nvkm_subdev_ctor(&nvkm_i2c, device, index, 0, &i2c->subdev); 257 + nvkm_subdev_ctor(&nvkm_i2c, device, index, &i2c->subdev); 258 258 i2c->func = func; 259 259 INIT_LIST_HEAD(&i2c->pad); 260 260 INIT_LIST_HEAD(&i2c->bus);
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c
··· 117 117 struct nvkm_subdev *ibus; 118 118 if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) 119 119 return -ENOMEM; 120 - nvkm_subdev_ctor(&gf100_ibus, device, index, 0, ibus); 120 + nvkm_subdev_ctor(&gf100_ibus, device, index, ibus); 121 121 return 0; 122 122 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf117.c
··· 46 46 struct nvkm_subdev *ibus; 47 47 if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) 48 48 return -ENOMEM; 49 - nvkm_subdev_ctor(&gf117_ibus, device, index, 0, ibus); 49 + nvkm_subdev_ctor(&gf117_ibus, device, index, ibus); 50 50 return 0; 51 51 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c
··· 120 120 struct nvkm_subdev *ibus; 121 121 if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) 122 122 return -ENOMEM; 123 - nvkm_subdev_ctor(&gk104_ibus, device, index, 0, ibus); 123 + nvkm_subdev_ctor(&gk104_ibus, device, index, ibus); 124 124 return 0; 125 125 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk20a.c
··· 84 84 struct nvkm_subdev *ibus; 85 85 if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) 86 86 return -ENOMEM; 87 - nvkm_subdev_ctor(&gk20a_ibus, device, index, 0, ibus); 87 + nvkm_subdev_ctor(&gk20a_ibus, device, index, ibus); 88 88 return 0; 89 89 }
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm200.c
··· 35 35 struct nvkm_subdev *ibus; 36 36 if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) 37 37 return -ENOMEM; 38 - nvkm_subdev_ctor(&gm200_ibus, device, index, 0, ibus); 38 + nvkm_subdev_ctor(&gm200_ibus, device, index, ibus); 39 39 return 0; 40 40 }
+186 -65
drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
··· 30 30 31 31 static bool 32 32 nvkm_iccsense_validate_device(struct i2c_adapter *i2c, u8 addr, 33 - enum nvbios_extdev_type type, u8 rail) 33 + enum nvbios_extdev_type type) 34 34 { 35 35 switch (type) { 36 36 case NVBIOS_EXTDEV_INA209: 37 37 case NVBIOS_EXTDEV_INA219: 38 - return rail == 0 && nv_rd16i2cr(i2c, addr, 0x0) >= 0; 38 + return nv_rd16i2cr(i2c, addr, 0x0) >= 0; 39 39 case NVBIOS_EXTDEV_INA3221: 40 - return rail <= 3 && 41 - nv_rd16i2cr(i2c, addr, 0xff) == 0x3220 && 40 + return nv_rd16i2cr(i2c, addr, 0xff) == 0x3220 && 42 41 nv_rd16i2cr(i2c, addr, 0xfe) == 0x5449; 43 42 default: 44 43 return false; ··· 66 67 struct nvkm_iccsense_rail *rail, 67 68 u8 shunt_reg, u8 bus_reg) 68 69 { 69 - return nvkm_iccsense_poll_lane(rail->i2c, rail->addr, shunt_reg, 0, 70 - bus_reg, 3, rail->mohm, 10 * 4); 70 + return nvkm_iccsense_poll_lane(rail->sensor->i2c, rail->sensor->addr, 71 + shunt_reg, 0, bus_reg, 3, rail->mohm, 72 + 10 * 4); 71 73 } 72 74 73 75 static int ··· 89 89 nvkm_iccsense_ina3221_read(struct nvkm_iccsense *iccsense, 90 90 struct nvkm_iccsense_rail *rail) 91 91 { 92 - return nvkm_iccsense_poll_lane(rail->i2c, rail->addr, 93 - 1 + (rail->rail * 2), 3, 94 - 2 + (rail->rail * 2), 3, rail->mohm, 92 + return nvkm_iccsense_poll_lane(rail->sensor->i2c, rail->sensor->addr, 93 + 1 + (rail->idx * 2), 3, 94 + 2 + (rail->idx * 2), 3, rail->mohm, 95 95 40 * 8); 96 96 } 97 97 98 - int 99 - nvkm_iccsense_read(struct nvkm_iccsense *iccsense, u8 idx) 98 + static void 99 + nvkm_iccsense_ina209_config(struct nvkm_iccsense *iccsense, 100 + struct nvkm_iccsense_sensor *sensor) 100 101 { 101 - struct nvkm_iccsense_rail *rail; 102 + struct nvkm_subdev *subdev = &iccsense->subdev; 103 + /* configuration: 104 + * 0x0007: 0x0007 shunt and bus continous 105 + * 0x0078: 0x0078 128 samples shunt 106 + * 0x0780: 0x0780 128 samples bus 107 + * 0x1800: 0x0000 +-40 mV shunt range 108 + * 0x2000: 0x0000 16V FSR 109 + */ 110 + u16 value = 0x07ff; 111 + nvkm_debug(subdev, "config for sensor id %i: 0x%x\n", sensor->id, value); 112 + nv_wr16i2cr(sensor->i2c, sensor->addr, 0x00, value); 113 + } 102 114 103 - if (!iccsense || idx >= iccsense->rail_count) 104 - return -EINVAL; 115 + static void 116 + nvkm_iccsense_ina3221_config(struct nvkm_iccsense *iccsense, 117 + struct nvkm_iccsense_sensor *sensor) 118 + { 119 + struct nvkm_subdev *subdev = &iccsense->subdev; 120 + /* configuration: 121 + * 0x0007: 0x0007 shunt and bus continous 122 + * 0x0031: 0x0000 140 us conversion time shunt 123 + * 0x01c0: 0x0000 140 us conversion time bus 124 + * 0x0f00: 0x0f00 1024 samples 125 + * 0x7000: 0x?000 channels 126 + */ 127 + u16 value = 0x0e07; 128 + if (sensor->rail_mask & 0x1) 129 + value |= 0x1 << 14; 130 + if (sensor->rail_mask & 0x2) 131 + value |= 0x1 << 13; 132 + if (sensor->rail_mask & 0x4) 133 + value |= 0x1 << 12; 134 + nvkm_debug(subdev, "config for sensor id %i: 0x%x\n", sensor->id, value); 135 + nv_wr16i2cr(sensor->i2c, sensor->addr, 0x00, value); 136 + } 105 137 106 - rail = &iccsense->rails[idx]; 107 - if (!rail->read) 108 - return -ENODEV; 109 - 110 - return rail->read(iccsense, rail); 138 + static void 139 + nvkm_iccsense_sensor_config(struct nvkm_iccsense *iccsense, 140 + struct nvkm_iccsense_sensor *sensor) 141 + { 142 + switch (sensor->type) { 143 + case NVBIOS_EXTDEV_INA209: 144 + case NVBIOS_EXTDEV_INA219: 145 + nvkm_iccsense_ina209_config(iccsense, sensor); 146 + break; 147 + case NVBIOS_EXTDEV_INA3221: 148 + nvkm_iccsense_ina3221_config(iccsense, sensor); 149 + break; 150 + default: 151 + break; 152 + } 111 153 } 112 154 113 155 int 114 156 nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense) 115 157 { 116 - int result = 0, i; 117 - for (i = 0; i < iccsense->rail_count; ++i) { 118 - int res = nvkm_iccsense_read(iccsense, i); 119 - if (res >= 0) 120 - result += res; 121 - else 158 + int result = 0; 159 + struct nvkm_iccsense_rail *rail; 160 + 161 + if (!iccsense) 162 + return -EINVAL; 163 + 164 + list_for_each_entry(rail, &iccsense->rails, head) { 165 + int res; 166 + if (!rail->read) 167 + return -ENODEV; 168 + 169 + res = rail->read(iccsense, rail); 170 + if (res < 0) 122 171 return res; 172 + result += res; 123 173 } 124 174 return result; 125 175 } ··· 178 128 nvkm_iccsense_dtor(struct nvkm_subdev *subdev) 179 129 { 180 130 struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); 131 + struct nvkm_iccsense_sensor *sensor, *tmps; 132 + struct nvkm_iccsense_rail *rail, *tmpr; 181 133 182 - if (iccsense->rails) 183 - kfree(iccsense->rails); 134 + list_for_each_entry_safe(sensor, tmps, &iccsense->sensors, head) { 135 + list_del(&sensor->head); 136 + kfree(sensor); 137 + } 138 + list_for_each_entry_safe(rail, tmpr, &iccsense->rails, head) { 139 + list_del(&rail->head); 140 + kfree(rail); 141 + } 184 142 185 143 return iccsense; 144 + } 145 + 146 + static struct nvkm_iccsense_sensor* 147 + nvkm_iccsense_create_sensor(struct nvkm_iccsense *iccsense, u8 id) 148 + { 149 + 150 + struct nvkm_subdev *subdev = &iccsense->subdev; 151 + struct nvkm_bios *bios = subdev->device->bios; 152 + struct nvkm_i2c *i2c = subdev->device->i2c; 153 + struct nvbios_extdev_func extdev; 154 + struct nvkm_i2c_bus *i2c_bus; 155 + struct nvkm_iccsense_sensor *sensor; 156 + u8 addr; 157 + 158 + if (!i2c || !bios || nvbios_extdev_parse(bios, id, &extdev)) 159 + return NULL; 160 + 161 + if (extdev.type == 0xff) 162 + return NULL; 163 + 164 + if (extdev.type != NVBIOS_EXTDEV_INA209 && 165 + extdev.type != NVBIOS_EXTDEV_INA219 && 166 + extdev.type != NVBIOS_EXTDEV_INA3221) { 167 + iccsense->data_valid = false; 168 + nvkm_error(subdev, "Unknown sensor type %x, power reading " 169 + "disabled\n", extdev.type); 170 + return NULL; 171 + } 172 + 173 + if (extdev.bus) 174 + i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_SEC); 175 + else 176 + i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_PRI); 177 + if (!i2c_bus) 178 + return NULL; 179 + 180 + addr = extdev.addr >> 1; 181 + if (!nvkm_iccsense_validate_device(&i2c_bus->i2c, addr, 182 + extdev.type)) { 183 + iccsense->data_valid = false; 184 + nvkm_warn(subdev, "found invalid sensor id: %i, power reading" 185 + "might be invalid\n", id); 186 + return NULL; 187 + } 188 + 189 + sensor = kmalloc(sizeof(*sensor), GFP_KERNEL); 190 + if (!sensor) 191 + return NULL; 192 + 193 + list_add_tail(&sensor->head, &iccsense->sensors); 194 + sensor->id = id; 195 + sensor->type = extdev.type; 196 + sensor->i2c = &i2c_bus->i2c; 197 + sensor->addr = addr; 198 + sensor->rail_mask = 0x0; 199 + return sensor; 200 + } 201 + 202 + static struct nvkm_iccsense_sensor* 203 + nvkm_iccsense_get_sensor(struct nvkm_iccsense *iccsense, u8 id) 204 + { 205 + struct nvkm_iccsense_sensor *sensor; 206 + list_for_each_entry(sensor, &iccsense->sensors, head) { 207 + if (sensor->id == id) 208 + return sensor; 209 + } 210 + return nvkm_iccsense_create_sensor(iccsense, id); 186 211 } 187 212 188 213 static int ··· 265 140 { 266 141 struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); 267 142 struct nvkm_bios *bios = subdev->device->bios; 268 - struct nvkm_i2c *i2c = subdev->device->i2c; 269 143 struct nvbios_iccsense stbl; 270 144 int i; 271 145 272 - if (!i2c || !bios || nvbios_iccsense_parse(bios, &stbl) 273 - || !stbl.nr_entry) 146 + if (!bios || nvbios_iccsense_parse(bios, &stbl) || !stbl.nr_entry) 274 147 return 0; 275 - 276 - iccsense->rails = kmalloc(sizeof(*iccsense->rails) * stbl.nr_entry, 277 - GFP_KERNEL); 278 - if (!iccsense->rails) 279 - return -ENOMEM; 280 148 281 149 iccsense->data_valid = true; 282 150 for (i = 0; i < stbl.nr_entry; ++i) { 283 151 struct pwr_rail_t *r = &stbl.rail[i]; 284 - struct nvbios_extdev_func extdev; 285 152 struct nvkm_iccsense_rail *rail; 286 - struct nvkm_i2c_bus *i2c_bus; 287 - u8 addr; 153 + struct nvkm_iccsense_sensor *sensor; 288 154 289 155 if (!r->mode || r->resistor_mohm == 0) 290 156 continue; 291 157 292 - if (nvbios_extdev_parse(bios, r->extdev_id, &extdev)) 158 + sensor = nvkm_iccsense_get_sensor(iccsense, r->extdev_id); 159 + if (!sensor) 293 160 continue; 294 161 295 - if (extdev.type == 0xff) 296 - continue; 162 + rail = kmalloc(sizeof(*rail), GFP_KERNEL); 163 + if (!rail) 164 + return -ENOMEM; 297 165 298 - if (extdev.bus) 299 - i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_SEC); 300 - else 301 - i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_PRI); 302 - if (!i2c_bus) 303 - continue; 304 - 305 - addr = extdev.addr >> 1; 306 - if (!nvkm_iccsense_validate_device(&i2c_bus->i2c, addr, 307 - extdev.type, r->rail)) { 308 - iccsense->data_valid = false; 309 - nvkm_warn(subdev, "found unknown or invalid rail entry" 310 - " type 0x%x rail %i, power reading might be" 311 - " invalid\n", extdev.type, r->rail); 312 - continue; 313 - } 314 - 315 - rail = &iccsense->rails[iccsense->rail_count]; 316 - switch (extdev.type) { 166 + switch (sensor->type) { 317 167 case NVBIOS_EXTDEV_INA209: 168 + if (r->rail != 0) 169 + continue; 318 170 rail->read = nvkm_iccsense_ina209_read; 319 171 break; 320 172 case NVBIOS_EXTDEV_INA219: 173 + if (r->rail != 0) 174 + continue; 321 175 rail->read = nvkm_iccsense_ina219_read; 322 176 break; 323 177 case NVBIOS_EXTDEV_INA3221: 178 + if (r->rail >= 3) 179 + continue; 324 180 rail->read = nvkm_iccsense_ina3221_read; 325 181 break; 182 + default: 183 + continue; 326 184 } 327 185 328 - rail->addr = addr; 329 - rail->rail = r->rail; 186 + sensor->rail_mask |= 1 << r->rail; 187 + rail->sensor = sensor; 188 + rail->idx = r->rail; 330 189 rail->mohm = r->resistor_mohm; 331 - rail->i2c = &i2c_bus->i2c; 332 - ++iccsense->rail_count; 190 + list_add_tail(&rail->head, &iccsense->rails); 333 191 } 192 + return 0; 193 + } 194 + 195 + static int 196 + nvkm_iccsense_init(struct nvkm_subdev *subdev) 197 + { 198 + struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); 199 + struct nvkm_iccsense_sensor *sensor; 200 + list_for_each_entry(sensor, &iccsense->sensors, head) 201 + nvkm_iccsense_sensor_config(iccsense, sensor); 334 202 return 0; 335 203 } 336 204 337 205 struct nvkm_subdev_func iccsense_func = { 338 206 .oneinit = nvkm_iccsense_oneinit, 207 + .init = nvkm_iccsense_init, 339 208 .dtor = nvkm_iccsense_dtor, 340 209 }; 341 210 ··· 337 218 nvkm_iccsense_ctor(struct nvkm_device *device, int index, 338 219 struct nvkm_iccsense *iccsense) 339 220 { 340 - nvkm_subdev_ctor(&iccsense_func, device, index, 0, &iccsense->subdev); 221 + nvkm_subdev_ctor(&iccsense_func, device, index, &iccsense->subdev); 341 222 } 342 223 343 224 int ··· 346 227 { 347 228 if (!(*iccsense = kzalloc(sizeof(**iccsense), GFP_KERNEL))) 348 229 return -ENOMEM; 230 + INIT_LIST_HEAD(&(*iccsense)->sensors); 231 + INIT_LIST_HEAD(&(*iccsense)->rails); 349 232 nvkm_iccsense_ctor(device, index, *iccsense); 350 233 return 0; 351 234 }
+13 -3
drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h
··· 2 2 #define __NVKM_ICCSENSE_PRIV_H__ 3 3 #define nvkm_iccsense(p) container_of((p), struct nvkm_iccsense, subdev) 4 4 #include <subdev/iccsense.h> 5 + #include <subdev/bios/extdev.h> 5 6 6 - struct nvkm_iccsense_rail { 7 - int (*read)(struct nvkm_iccsense *, struct nvkm_iccsense_rail *); 7 + struct nvkm_iccsense_sensor { 8 + struct list_head head; 9 + int id; 10 + enum nvbios_extdev_type type; 8 11 struct i2c_adapter *i2c; 9 12 u8 addr; 10 - u8 rail; 13 + u8 rail_mask; 14 + }; 15 + 16 + struct nvkm_iccsense_rail { 17 + struct list_head head; 18 + int (*read)(struct nvkm_iccsense *, struct nvkm_iccsense_rail *); 19 + struct nvkm_iccsense_sensor *sensor; 20 + u8 idx; 11 21 u8 mohm; 12 22 }; 13 23
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c
··· 311 311 struct nvkm_device *device, int index, 312 312 struct nvkm_instmem *imem) 313 313 { 314 - nvkm_subdev_ctor(&nvkm_instmem, device, index, 0, &imem->subdev); 314 + nvkm_subdev_ctor(&nvkm_instmem, device, index, &imem->subdev); 315 315 imem->func = func; 316 316 spin_lock_init(&imem->lock); 317 317 INIT_LIST_HEAD(&imem->list);
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c
··· 138 138 if (!(ltc = *pltc = kzalloc(sizeof(*ltc), GFP_KERNEL))) 139 139 return -ENOMEM; 140 140 141 - nvkm_subdev_ctor(&nvkm_ltc, device, index, 0, &ltc->subdev); 141 + nvkm_subdev_ctor(&nvkm_ltc, device, index, &ltc->subdev); 142 142 ltc->func = func; 143 143 ltc->zbc_min = 1; /* reserve 0 for disabled */ 144 144 ltc->zbc_max = min(func->zbc, NVKM_LTC_MAX_ZBC_CNT) - 1;
+5
drivers/gpu/drm/nouveau/nvkm/subdev/mc/Kbuild
··· 1 1 nvkm-y += nvkm/subdev/mc/base.o 2 2 nvkm-y += nvkm/subdev/mc/nv04.o 3 + nvkm-y += nvkm/subdev/mc/nv11.o 4 + nvkm-y += nvkm/subdev/mc/nv17.o 3 5 nvkm-y += nvkm/subdev/mc/nv44.o 4 6 nvkm-y += nvkm/subdev/mc/nv50.o 7 + nvkm-y += nvkm/subdev/mc/g84.o 5 8 nvkm-y += nvkm/subdev/mc/g98.o 9 + nvkm-y += nvkm/subdev/mc/gt215.o 6 10 nvkm-y += nvkm/subdev/mc/gf100.o 11 + nvkm-y += nvkm/subdev/mc/gk104.o 7 12 nvkm-y += nvkm/subdev/mc/gk20a.o
+44 -4
drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c
··· 24 24 #include "priv.h" 25 25 26 26 #include <core/option.h> 27 + #include <subdev/top.h> 27 28 28 29 void 29 30 nvkm_mc_unk260(struct nvkm_mc *mc, u32 data) ··· 59 58 { 60 59 struct nvkm_device *device = mc->subdev.device; 61 60 struct nvkm_subdev *subdev; 62 - const struct nvkm_mc_intr *map = mc->func->intr; 63 - u32 stat, intr; 61 + const struct nvkm_mc_map *map = mc->func->intr; 62 + u32 stat, intr = nvkm_mc_intr_mask(mc); 63 + u64 subdevs; 64 64 65 - stat = intr = nvkm_mc_intr_mask(mc); 65 + stat = nvkm_top_intr(device->top, intr, &subdevs); 66 + while (subdevs) { 67 + enum nvkm_devidx subidx = __ffs64(subdevs); 68 + subdev = nvkm_device_subdev(device, subidx); 69 + if (subdev) 70 + nvkm_subdev_intr(subdev); 71 + subdevs &= ~BIT_ULL(subidx); 72 + } 73 + 66 74 while (map->stat) { 67 75 if (intr & map->stat) { 68 76 subdev = nvkm_device_subdev(device, map->unit); ··· 85 75 if (stat) 86 76 nvkm_error(&mc->subdev, "intr %08x\n", stat); 87 77 *handled = intr != 0; 78 + } 79 + 80 + static void 81 + nvkm_mc_reset_(struct nvkm_mc *mc, enum nvkm_devidx devidx) 82 + { 83 + struct nvkm_device *device = mc->subdev.device; 84 + const struct nvkm_mc_map *map; 85 + u64 pmc_enable; 86 + 87 + if (!(pmc_enable = nvkm_top_reset(device->top, devidx))) { 88 + for (map = mc->func->reset; map && map->stat; map++) { 89 + if (map->unit == devidx) { 90 + pmc_enable = map->stat; 91 + break; 92 + } 93 + } 94 + } 95 + 96 + if (pmc_enable) { 97 + nvkm_mask(device, 0x000200, pmc_enable, 0x00000000); 98 + nvkm_mask(device, 0x000200, pmc_enable, pmc_enable); 99 + nvkm_rd32(device, 0x000200); 100 + } 101 + } 102 + 103 + void 104 + nvkm_mc_reset(struct nvkm_mc *mc, enum nvkm_devidx devidx) 105 + { 106 + if (likely(mc)) 107 + nvkm_mc_reset_(mc, devidx); 88 108 } 89 109 90 110 static int ··· 157 117 if (!(mc = *pmc = kzalloc(sizeof(*mc), GFP_KERNEL))) 158 118 return -ENOMEM; 159 119 160 - nvkm_subdev_ctor(&nvkm_mc, device, index, 0, &mc->subdev); 120 + nvkm_subdev_ctor(&nvkm_mc, device, index, &mc->subdev); 161 121 mc->func = func; 162 122 return 0; 163 123 }
+68
drivers/gpu/drm/nouveau/nvkm/subdev/mc/g84.c
··· 1 + /* 2 + * Copyright 2012 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs 23 + */ 24 + #include "priv.h" 25 + 26 + static const struct nvkm_mc_map 27 + g84_mc_reset[] = { 28 + { 0x04008000, NVKM_ENGINE_BSP }, 29 + { 0x02004000, NVKM_ENGINE_CIPHER }, 30 + { 0x01020000, NVKM_ENGINE_VP }, 31 + { 0x00400002, NVKM_ENGINE_MPEG }, 32 + { 0x00201000, NVKM_ENGINE_GR }, 33 + { 0x00000100, NVKM_ENGINE_FIFO }, 34 + {} 35 + }; 36 + 37 + const struct nvkm_mc_map 38 + g84_mc_intr[] = { 39 + { 0x04000000, NVKM_ENGINE_DISP }, 40 + { 0x00020000, NVKM_ENGINE_VP }, 41 + { 0x00008000, NVKM_ENGINE_BSP }, 42 + { 0x00004000, NVKM_ENGINE_CIPHER }, 43 + { 0x00001000, NVKM_ENGINE_GR }, 44 + { 0x00000100, NVKM_ENGINE_FIFO }, 45 + { 0x00000001, NVKM_ENGINE_MPEG }, 46 + { 0x0002d101, NVKM_SUBDEV_FB }, 47 + { 0x10000000, NVKM_SUBDEV_BUS }, 48 + { 0x00200000, NVKM_SUBDEV_GPIO }, 49 + { 0x00200000, NVKM_SUBDEV_I2C }, 50 + { 0x00100000, NVKM_SUBDEV_TIMER }, 51 + {}, 52 + }; 53 + 54 + static const struct nvkm_mc_func 55 + g84_mc = { 56 + .init = nv50_mc_init, 57 + .intr = g84_mc_intr, 58 + .intr_unarm = nv04_mc_intr_unarm, 59 + .intr_rearm = nv04_mc_intr_rearm, 60 + .intr_mask = nv04_mc_intr_mask, 61 + .reset = g84_mc_reset, 62 + }; 63 + 64 + int 65 + g84_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) 66 + { 67 + return nvkm_mc_new_(&g84_mc, device, index, pmc); 68 + }
+23 -15
drivers/gpu/drm/nouveau/nvkm/subdev/mc/g98.c
··· 23 23 */ 24 24 #include "priv.h" 25 25 26 - static const struct nvkm_mc_intr 27 - g98_mc_intr[] = { 28 - { 0x04000000, NVKM_ENGINE_DISP }, /* DISP first, so pageflip timestamps work */ 29 - { 0x00000001, NVKM_ENGINE_MSPPP }, 26 + static const struct nvkm_mc_map 27 + g98_mc_reset[] = { 28 + { 0x04008000, NVKM_ENGINE_MSVLD }, 29 + { 0x02004000, NVKM_ENGINE_SEC }, 30 + { 0x01020000, NVKM_ENGINE_MSPDEC }, 31 + { 0x00400002, NVKM_ENGINE_MSPPP }, 32 + { 0x00201000, NVKM_ENGINE_GR }, 30 33 { 0x00000100, NVKM_ENGINE_FIFO }, 31 - { 0x00001000, NVKM_ENGINE_GR }, 32 - { 0x00004000, NVKM_ENGINE_SEC }, /* NV84:NVA3 */ 33 - { 0x00008000, NVKM_ENGINE_MSVLD }, 34 + {} 35 + }; 36 + 37 + static const struct nvkm_mc_map 38 + g98_mc_intr[] = { 39 + { 0x04000000, NVKM_ENGINE_DISP }, 34 40 { 0x00020000, NVKM_ENGINE_MSPDEC }, 35 - { 0x00040000, NVKM_SUBDEV_PMU }, /* NVA3:NVC0 */ 36 - { 0x00080000, NVKM_SUBDEV_THERM }, /* NVA3:NVC0 */ 37 - { 0x00100000, NVKM_SUBDEV_TIMER }, 38 - { 0x00200000, NVKM_SUBDEV_GPIO }, /* PMGR->GPIO */ 39 - { 0x00200000, NVKM_SUBDEV_I2C }, /* PMGR->I2C/AUX */ 40 - { 0x00400000, NVKM_ENGINE_CE0 }, /* NVA3- */ 41 + { 0x00008000, NVKM_ENGINE_MSVLD }, 42 + { 0x00004000, NVKM_ENGINE_SEC }, 43 + { 0x00001000, NVKM_ENGINE_GR }, 44 + { 0x00000100, NVKM_ENGINE_FIFO }, 45 + { 0x00000001, NVKM_ENGINE_MSPPP }, 46 + { 0x0002d101, NVKM_SUBDEV_FB }, 41 47 { 0x10000000, NVKM_SUBDEV_BUS }, 42 - { 0x80000000, NVKM_ENGINE_SW }, 43 - { 0x0042d101, NVKM_SUBDEV_FB }, 48 + { 0x00200000, NVKM_SUBDEV_GPIO }, 49 + { 0x00200000, NVKM_SUBDEV_I2C }, 50 + { 0x00100000, NVKM_SUBDEV_TIMER }, 44 51 {}, 45 52 }; 46 53 ··· 58 51 .intr_unarm = nv04_mc_intr_unarm, 59 52 .intr_rearm = nv04_mc_intr_rearm, 60 53 .intr_mask = nv04_mc_intr_mask, 54 + .reset = g98_mc_reset, 61 55 }; 62 56 63 57 int
+31 -20
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gf100.c
··· 23 23 */ 24 24 #include "priv.h" 25 25 26 - const struct nvkm_mc_intr 27 - gf100_mc_intr[] = { 28 - { 0x04000000, NVKM_ENGINE_DISP }, /* DISP first, so pageflip timestamps work. */ 29 - { 0x00000001, NVKM_ENGINE_MSPPP }, 30 - { 0x00000020, NVKM_ENGINE_CE0 }, 31 - { 0x00000040, NVKM_ENGINE_CE1 }, 32 - { 0x00000080, NVKM_ENGINE_CE2 }, 33 - { 0x00000100, NVKM_ENGINE_FIFO }, 34 - { 0x00001000, NVKM_ENGINE_GR }, 35 - { 0x00002000, NVKM_SUBDEV_FB }, 36 - { 0x00008000, NVKM_ENGINE_MSVLD }, 37 - { 0x00040000, NVKM_SUBDEV_THERM }, 26 + static const struct nvkm_mc_map 27 + gf100_mc_reset[] = { 38 28 { 0x00020000, NVKM_ENGINE_MSPDEC }, 39 - { 0x00100000, NVKM_SUBDEV_TIMER }, 40 - { 0x00200000, NVKM_SUBDEV_GPIO }, /* PMGR->GPIO */ 41 - { 0x00200000, NVKM_SUBDEV_I2C }, /* PMGR->I2C/AUX */ 42 - { 0x01000000, NVKM_SUBDEV_PMU }, 43 - { 0x02000000, NVKM_SUBDEV_LTC }, 44 - { 0x08000000, NVKM_SUBDEV_FB }, 45 - { 0x10000000, NVKM_SUBDEV_BUS }, 29 + { 0x00008000, NVKM_ENGINE_MSVLD }, 30 + { 0x00001000, NVKM_ENGINE_GR }, 31 + { 0x00000100, NVKM_ENGINE_FIFO }, 32 + { 0x00000080, NVKM_ENGINE_CE1 }, 33 + { 0x00000040, NVKM_ENGINE_CE0 }, 34 + { 0x00000002, NVKM_ENGINE_MSPPP }, 35 + {} 36 + }; 37 + 38 + static const struct nvkm_mc_map 39 + gf100_mc_intr[] = { 40 + { 0x04000000, NVKM_ENGINE_DISP }, 41 + { 0x00020000, NVKM_ENGINE_MSPDEC }, 42 + { 0x00008000, NVKM_ENGINE_MSVLD }, 43 + { 0x00001000, NVKM_ENGINE_GR }, 44 + { 0x00000100, NVKM_ENGINE_FIFO }, 45 + { 0x00000040, NVKM_ENGINE_CE1 }, 46 + { 0x00000020, NVKM_ENGINE_CE0 }, 47 + { 0x00000001, NVKM_ENGINE_MSPPP }, 46 48 { 0x40000000, NVKM_SUBDEV_IBUS }, 47 - { 0x80000000, NVKM_ENGINE_SW }, 49 + { 0x10000000, NVKM_SUBDEV_BUS }, 50 + { 0x08000000, NVKM_SUBDEV_FB }, 51 + { 0x02000000, NVKM_SUBDEV_LTC }, 52 + { 0x01000000, NVKM_SUBDEV_PMU }, 53 + { 0x00200000, NVKM_SUBDEV_GPIO }, 54 + { 0x00200000, NVKM_SUBDEV_I2C }, 55 + { 0x00100000, NVKM_SUBDEV_TIMER }, 56 + { 0x00040000, NVKM_SUBDEV_THERM }, 57 + { 0x00002000, NVKM_SUBDEV_FB }, 48 58 {}, 49 59 }; 50 60 ··· 97 87 .intr_unarm = gf100_mc_intr_unarm, 98 88 .intr_rearm = gf100_mc_intr_rearm, 99 89 .intr_mask = gf100_mc_intr_mask, 90 + .reset = gf100_mc_reset, 100 91 .unk260 = gf100_mc_unk260, 101 92 }; 102 93
+64
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk104.c
··· 1 + /* 2 + * Copyright 2016 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs 23 + */ 24 + #include "priv.h" 25 + 26 + const struct nvkm_mc_map 27 + gk104_mc_reset[] = { 28 + { 0x00000100, NVKM_ENGINE_FIFO }, 29 + {} 30 + }; 31 + 32 + const struct nvkm_mc_map 33 + gk104_mc_intr[] = { 34 + { 0x04000000, NVKM_ENGINE_DISP }, 35 + { 0x00000100, NVKM_ENGINE_FIFO }, 36 + { 0x40000000, NVKM_SUBDEV_IBUS }, 37 + { 0x10000000, NVKM_SUBDEV_BUS }, 38 + { 0x08000000, NVKM_SUBDEV_FB }, 39 + { 0x02000000, NVKM_SUBDEV_LTC }, 40 + { 0x01000000, NVKM_SUBDEV_PMU }, 41 + { 0x00200000, NVKM_SUBDEV_GPIO }, 42 + { 0x00200000, NVKM_SUBDEV_I2C }, 43 + { 0x00100000, NVKM_SUBDEV_TIMER }, 44 + { 0x00040000, NVKM_SUBDEV_THERM }, 45 + { 0x00002000, NVKM_SUBDEV_FB }, 46 + {}, 47 + }; 48 + 49 + static const struct nvkm_mc_func 50 + gk104_mc = { 51 + .init = nv50_mc_init, 52 + .intr = gk104_mc_intr, 53 + .intr_unarm = gf100_mc_intr_unarm, 54 + .intr_rearm = gf100_mc_intr_rearm, 55 + .intr_mask = gf100_mc_intr_mask, 56 + .reset = gk104_mc_reset, 57 + .unk260 = gf100_mc_unk260, 58 + }; 59 + 60 + int 61 + gk104_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) 62 + { 63 + return nvkm_mc_new_(&gk104_mc, device, index, pmc); 64 + }
+2 -1
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk20a.c
··· 26 26 static const struct nvkm_mc_func 27 27 gk20a_mc = { 28 28 .init = nv50_mc_init, 29 - .intr = gf100_mc_intr, 29 + .intr = gk104_mc_intr, 30 30 .intr_unarm = gf100_mc_intr_unarm, 31 31 .intr_rearm = gf100_mc_intr_rearm, 32 32 .intr_mask = gf100_mc_intr_mask, 33 + .reset = gk104_mc_reset, 33 34 }; 34 35 35 36 int
+70
drivers/gpu/drm/nouveau/nvkm/subdev/mc/gt215.c
··· 1 + /* 2 + * Copyright 2016 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs 23 + */ 24 + #include "priv.h" 25 + 26 + static const struct nvkm_mc_map 27 + gt215_mc_reset[] = { 28 + { 0x04008000, NVKM_ENGINE_MSVLD }, 29 + { 0x01020000, NVKM_ENGINE_MSPDEC }, 30 + { 0x00802000, NVKM_ENGINE_CE0 }, 31 + { 0x00400002, NVKM_ENGINE_MSPPP }, 32 + { 0x00201000, NVKM_ENGINE_GR }, 33 + { 0x00000100, NVKM_ENGINE_FIFO }, 34 + {} 35 + }; 36 + 37 + static const struct nvkm_mc_map 38 + gt215_mc_intr[] = { 39 + { 0x04000000, NVKM_ENGINE_DISP }, 40 + { 0x00400000, NVKM_ENGINE_CE0 }, 41 + { 0x00020000, NVKM_ENGINE_MSPDEC }, 42 + { 0x00008000, NVKM_ENGINE_MSVLD }, 43 + { 0x00001000, NVKM_ENGINE_GR }, 44 + { 0x00000100, NVKM_ENGINE_FIFO }, 45 + { 0x00000001, NVKM_ENGINE_MSPPP }, 46 + { 0x00429101, NVKM_SUBDEV_FB }, 47 + { 0x10000000, NVKM_SUBDEV_BUS }, 48 + { 0x00200000, NVKM_SUBDEV_GPIO }, 49 + { 0x00200000, NVKM_SUBDEV_I2C }, 50 + { 0x00100000, NVKM_SUBDEV_TIMER }, 51 + { 0x00080000, NVKM_SUBDEV_THERM }, 52 + { 0x00040000, NVKM_SUBDEV_PMU }, 53 + {}, 54 + }; 55 + 56 + static const struct nvkm_mc_func 57 + gt215_mc = { 58 + .init = nv50_mc_init, 59 + .intr = gt215_mc_intr, 60 + .intr_unarm = nv04_mc_intr_unarm, 61 + .intr_rearm = nv04_mc_intr_rearm, 62 + .intr_mask = nv04_mc_intr_mask, 63 + .reset = gt215_mc_reset, 64 + }; 65 + 66 + int 67 + gt215_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) 68 + { 69 + return nvkm_mc_new_(&gt215_mc, device, index, pmc); 70 + }
+13 -10
drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv04.c
··· 23 23 */ 24 24 #include "priv.h" 25 25 26 - const struct nvkm_mc_intr 27 - nv04_mc_intr[] = { 28 - { 0x00000001, NVKM_ENGINE_MPEG }, /* NV17- MPEG/ME */ 29 - { 0x00000100, NVKM_ENGINE_FIFO }, 26 + const struct nvkm_mc_map 27 + nv04_mc_reset[] = { 30 28 { 0x00001000, NVKM_ENGINE_GR }, 31 - { 0x00010000, NVKM_ENGINE_DISP }, 32 - { 0x00020000, NVKM_ENGINE_VP }, /* NV40- */ 33 - { 0x00100000, NVKM_SUBDEV_TIMER }, 34 - { 0x01000000, NVKM_ENGINE_DISP }, /* NV04- PCRTC0 */ 35 - { 0x02000000, NVKM_ENGINE_DISP }, /* NV11- PCRTC1 */ 29 + { 0x00000100, NVKM_ENGINE_FIFO }, 30 + {} 31 + }; 32 + 33 + static const struct nvkm_mc_map 34 + nv04_mc_intr[] = { 35 + { 0x01010000, NVKM_ENGINE_DISP }, 36 + { 0x00001000, NVKM_ENGINE_GR }, 37 + { 0x00000100, NVKM_ENGINE_FIFO }, 36 38 { 0x10000000, NVKM_SUBDEV_BUS }, 37 - { 0x80000000, NVKM_ENGINE_SW }, 39 + { 0x00100000, NVKM_SUBDEV_TIMER }, 38 40 {} 39 41 }; 40 42 ··· 76 74 .intr_unarm = nv04_mc_intr_unarm, 77 75 .intr_rearm = nv04_mc_intr_rearm, 78 76 .intr_mask = nv04_mc_intr_mask, 77 + .reset = nv04_mc_reset, 79 78 }; 80 79 81 80 int
+50
drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv11.c
··· 1 + /* 2 + * Copyright 2016 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs <bskeggs@redhat.com> 23 + */ 24 + #include "priv.h" 25 + 26 + static const struct nvkm_mc_map 27 + nv11_mc_intr[] = { 28 + { 0x03010000, NVKM_ENGINE_DISP }, 29 + { 0x00001000, NVKM_ENGINE_GR }, 30 + { 0x00000100, NVKM_ENGINE_FIFO }, 31 + { 0x10000000, NVKM_SUBDEV_BUS }, 32 + { 0x00100000, NVKM_SUBDEV_TIMER }, 33 + {} 34 + }; 35 + 36 + static const struct nvkm_mc_func 37 + nv11_mc = { 38 + .init = nv04_mc_init, 39 + .intr = nv11_mc_intr, 40 + .intr_unarm = nv04_mc_intr_unarm, 41 + .intr_rearm = nv04_mc_intr_rearm, 42 + .intr_mask = nv04_mc_intr_mask, 43 + .reset = nv04_mc_reset, 44 + }; 45 + 46 + int 47 + nv11_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) 48 + { 49 + return nvkm_mc_new_(&nv11_mc, device, index, pmc); 50 + }
+59
drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv17.c
··· 1 + /* 2 + * Copyright 2016 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs <bskeggs@redhat.com> 23 + */ 24 + #include "priv.h" 25 + 26 + const struct nvkm_mc_map 27 + nv17_mc_reset[] = { 28 + { 0x00001000, NVKM_ENGINE_GR }, 29 + { 0x00000100, NVKM_ENGINE_FIFO }, 30 + { 0x00000002, NVKM_ENGINE_MPEG }, 31 + {} 32 + }; 33 + 34 + const struct nvkm_mc_map 35 + nv17_mc_intr[] = { 36 + { 0x03010000, NVKM_ENGINE_DISP }, 37 + { 0x00001000, NVKM_ENGINE_GR }, 38 + { 0x00000100, NVKM_ENGINE_FIFO }, 39 + { 0x00000001, NVKM_ENGINE_MPEG }, 40 + { 0x10000000, NVKM_SUBDEV_BUS }, 41 + { 0x00100000, NVKM_SUBDEV_TIMER }, 42 + {} 43 + }; 44 + 45 + static const struct nvkm_mc_func 46 + nv17_mc = { 47 + .init = nv04_mc_init, 48 + .intr = nv17_mc_intr, 49 + .intr_unarm = nv04_mc_intr_unarm, 50 + .intr_rearm = nv04_mc_intr_rearm, 51 + .intr_mask = nv04_mc_intr_mask, 52 + .reset = nv17_mc_reset, 53 + }; 54 + 55 + int 56 + nv17_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) 57 + { 58 + return nvkm_mc_new_(&nv17_mc, device, index, pmc); 59 + }
+2 -1
drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv44.c
··· 40 40 static const struct nvkm_mc_func 41 41 nv44_mc = { 42 42 .init = nv44_mc_init, 43 - .intr = nv04_mc_intr, 43 + .intr = nv17_mc_intr, 44 44 .intr_unarm = nv04_mc_intr_unarm, 45 45 .intr_rearm = nv04_mc_intr_rearm, 46 46 .intr_mask = nv04_mc_intr_mask, 47 + .reset = nv17_mc_reset, 47 48 }; 48 49 49 50 int
+9 -12
drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv50.c
··· 23 23 */ 24 24 #include "priv.h" 25 25 26 - const struct nvkm_mc_intr 26 + static const struct nvkm_mc_map 27 27 nv50_mc_intr[] = { 28 - { 0x04000000, NVKM_ENGINE_DISP }, /* DISP before FIFO, so pageflip-timestamping works! */ 29 - { 0x00000001, NVKM_ENGINE_MPEG }, 30 - { 0x00000100, NVKM_ENGINE_FIFO }, 28 + { 0x04000000, NVKM_ENGINE_DISP }, 31 29 { 0x00001000, NVKM_ENGINE_GR }, 32 - { 0x00004000, NVKM_ENGINE_CIPHER }, /* NV84- */ 33 - { 0x00008000, NVKM_ENGINE_BSP }, /* NV84- */ 34 - { 0x00020000, NVKM_ENGINE_VP }, /* NV84- */ 35 - { 0x00100000, NVKM_SUBDEV_TIMER }, 36 - { 0x00200000, NVKM_SUBDEV_GPIO }, /* PMGR->GPIO */ 37 - { 0x00200000, NVKM_SUBDEV_I2C }, /* PMGR->I2C/AUX */ 30 + { 0x00000100, NVKM_ENGINE_FIFO }, 31 + { 0x00000001, NVKM_ENGINE_MPEG }, 32 + { 0x00001101, NVKM_SUBDEV_FB }, 38 33 { 0x10000000, NVKM_SUBDEV_BUS }, 39 - { 0x80000000, NVKM_ENGINE_SW }, 40 - { 0x0002d101, NVKM_SUBDEV_FB }, 34 + { 0x00200000, NVKM_SUBDEV_GPIO }, 35 + { 0x00200000, NVKM_SUBDEV_I2C }, 36 + { 0x00100000, NVKM_SUBDEV_TIMER }, 41 37 {}, 42 38 }; 43 39 ··· 51 55 .intr_unarm = nv04_mc_intr_unarm, 52 56 .intr_rearm = nv04_mc_intr_rearm, 53 57 .intr_mask = nv04_mc_intr_mask, 58 + .reset = nv17_mc_reset, 54 59 }; 55 60 56 61 int
+10 -5
drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h
··· 6 6 int nvkm_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *, 7 7 int index, struct nvkm_mc **); 8 8 9 - struct nvkm_mc_intr { 9 + struct nvkm_mc_map { 10 10 u32 stat; 11 11 u32 unit; 12 12 }; 13 13 14 14 struct nvkm_mc_func { 15 15 void (*init)(struct nvkm_mc *); 16 - const struct nvkm_mc_intr *intr; 16 + const struct nvkm_mc_map *intr; 17 17 /* disable reporting of interrupts to host */ 18 18 void (*intr_unarm)(struct nvkm_mc *); 19 19 /* enable reporting of interrupts to host */ 20 20 void (*intr_rearm)(struct nvkm_mc *); 21 21 /* retrieve pending interrupt mask (NV_PMC_INTR) */ 22 22 u32 (*intr_mask)(struct nvkm_mc *); 23 + const struct nvkm_mc_map *reset; 23 24 void (*unk260)(struct nvkm_mc *, u32); 24 25 }; 25 26 26 27 void nv04_mc_init(struct nvkm_mc *); 27 - extern const struct nvkm_mc_intr nv04_mc_intr[]; 28 28 void nv04_mc_intr_unarm(struct nvkm_mc *); 29 29 void nv04_mc_intr_rearm(struct nvkm_mc *); 30 30 u32 nv04_mc_intr_mask(struct nvkm_mc *); 31 + extern const struct nvkm_mc_map nv04_mc_reset[]; 32 + 33 + extern const struct nvkm_mc_map nv17_mc_intr[]; 34 + extern const struct nvkm_mc_map nv17_mc_reset[]; 31 35 32 36 void nv44_mc_init(struct nvkm_mc *); 33 37 34 38 void nv50_mc_init(struct nvkm_mc *); 35 - extern const struct nvkm_mc_intr nv50_mc_intr[]; 36 39 37 - extern const struct nvkm_mc_intr gf100_mc_intr[]; 38 40 void gf100_mc_intr_unarm(struct nvkm_mc *); 39 41 void gf100_mc_intr_rearm(struct nvkm_mc *); 40 42 u32 gf100_mc_intr_mask(struct nvkm_mc *); 41 43 void gf100_mc_unk260(struct nvkm_mc *, u32); 44 + 45 + extern const struct nvkm_mc_map gk104_mc_intr[]; 46 + extern const struct nvkm_mc_map gk104_mc_reset[]; 42 47 #endif
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c
··· 524 524 nvkm_mmu_ctor(const struct nvkm_mmu_func *func, struct nvkm_device *device, 525 525 int index, struct nvkm_mmu *mmu) 526 526 { 527 - nvkm_subdev_ctor(&nvkm_mmu, device, index, 0, &mmu->subdev); 527 + nvkm_subdev_ctor(&nvkm_mmu, device, index, &mmu->subdev); 528 528 mmu->func = func; 529 529 mmu->limit = func->limit; 530 530 mmu->dma_bits = func->dma_bits;
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c
··· 241 241 if (!(mxm = *pmxm = kzalloc(sizeof(*mxm), GFP_KERNEL))) 242 242 return -ENOMEM; 243 243 244 - nvkm_subdev_ctor(&nvkm_mxm, device, index, 0, &mxm->subdev); 244 + nvkm_subdev_ctor(&nvkm_mxm, device, index, &mxm->subdev); 245 245 246 246 data = mxm_table(bios, &ver, &len); 247 247 if (!data || !(ver = nvbios_rd08(bios, data))) {
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c
··· 168 168 169 169 if (!(pci = *ppci = kzalloc(sizeof(**ppci), GFP_KERNEL))) 170 170 return -ENOMEM; 171 - nvkm_subdev_ctor(&nvkm_pci_func, device, index, 0, &pci->subdev); 171 + nvkm_subdev_ctor(&nvkm_pci_func, device, index, &pci->subdev); 172 172 pci->func = func; 173 173 pci->pdev = device->func->pci(device)->pdev; 174 174 pci->irq = -1;
+6 -4
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
··· 40 40 struct nvkm_device *device = subdev->device; 41 41 u32 addr; 42 42 43 + mutex_lock(&subdev->mutex); 43 44 /* wait for a free slot in the fifo */ 44 45 addr = nvkm_rd32(device, 0x10a4a0); 45 46 if (nvkm_msec(device, 2000, 46 47 u32 tmp = nvkm_rd32(device, 0x10a4b0); 47 48 if (tmp != (addr ^ 8)) 48 49 break; 49 - ) < 0) 50 + ) < 0) { 51 + mutex_unlock(&subdev->mutex); 50 52 return -EBUSY; 53 + } 51 54 52 55 /* we currently only support a single process at a time waiting 53 56 * on a synchronous reply, take the PMU mutex and tell the 54 57 * receive handler what we're waiting for 55 58 */ 56 59 if (reply) { 57 - mutex_lock(&subdev->mutex); 58 60 pmu->recv.message = message; 59 61 pmu->recv.process = process; 60 62 } ··· 83 81 wait_event(pmu->recv.wait, (pmu->recv.process == 0)); 84 82 reply[0] = pmu->recv.data[0]; 85 83 reply[1] = pmu->recv.data[1]; 86 - mutex_unlock(&subdev->mutex); 87 84 } 88 85 86 + mutex_unlock(&subdev->mutex); 89 87 return 0; 90 88 } 91 89 ··· 274 272 struct nvkm_pmu *pmu; 275 273 if (!(pmu = *ppmu = kzalloc(sizeof(*pmu), GFP_KERNEL))) 276 274 return -ENOMEM; 277 - nvkm_subdev_ctor(&nvkm_pmu, device, index, 0, &pmu->subdev); 275 + nvkm_subdev_ctor(&nvkm_pmu, device, index, &pmu->subdev); 278 276 pmu->func = func; 279 277 INIT_WORK(&pmu->recv.work, nvkm_pmu_recv); 280 278 init_waitqueue_head(&pmu->recv.wait);
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c
··· 220 220 pmu->base.func = &func; 221 221 *ppmu = &pmu->base; 222 222 223 - nvkm_subdev_ctor(&gk20a_pmu, device, index, 0, &pmu->base.subdev); 223 + nvkm_subdev_ctor(&gk20a_pmu, device, index, &pmu->base.subdev); 224 224 pmu->data = &gk20a_dvfs_data; 225 225 nvkm_alarm_init(&pmu->alarm, gk20a_pmu_dvfs_work); 226 226 return 0;
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c
··· 264 264 { 265 265 unsigned long fid; 266 266 267 - nvkm_subdev_ctor(&nvkm_secboot, device, index, 0, &sb->subdev); 267 + nvkm_subdev_ctor(&nvkm_secboot, device, index, &sb->subdev); 268 268 sb->func = func; 269 269 270 270 /* setup the performing falcon's base address and masks */
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c
··· 366 366 if (!(therm = *ptherm = kzalloc(sizeof(*therm), GFP_KERNEL))) 367 367 return -ENOMEM; 368 368 369 - nvkm_subdev_ctor(&nvkm_therm, device, index, 0, &therm->subdev); 369 + nvkm_subdev_ctor(&nvkm_therm, device, index, &therm->subdev); 370 370 therm->func = func; 371 371 372 372 nvkm_alarm_init(&therm->alarm, nvkm_therm_alarm);
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c
··· 143 143 if (!(tmr = *ptmr = kzalloc(sizeof(*tmr), GFP_KERNEL))) 144 144 return -ENOMEM; 145 145 146 - nvkm_subdev_ctor(&nvkm_timer, device, index, 0, &tmr->subdev); 146 + nvkm_subdev_ctor(&nvkm_timer, device, index, &tmr->subdev); 147 147 tmr->func = func; 148 148 INIT_LIST_HEAD(&tmr->alarms); 149 149 spin_lock_init(&tmr->lock);
+2
drivers/gpu/drm/nouveau/nvkm/subdev/top/Kbuild
··· 1 + nvkm-y += nvkm/subdev/top/base.o 2 + nvkm-y += nvkm/subdev/top/gk104.o
+148
drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c
··· 1 + /* 2 + * Copyright 2016 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs <bskeggs@redhat.com> 23 + */ 24 + #include "priv.h" 25 + 26 + struct nvkm_top_device * 27 + nvkm_top_device_new(struct nvkm_top *top) 28 + { 29 + struct nvkm_top_device *info = kmalloc(sizeof(*info), GFP_KERNEL); 30 + if (info) { 31 + info->index = NVKM_SUBDEV_NR; 32 + info->addr = 0; 33 + info->fault = -1; 34 + info->engine = -1; 35 + info->runlist = -1; 36 + info->reset = -1; 37 + info->intr = -1; 38 + list_add_tail(&info->head, &top->device); 39 + } 40 + return info; 41 + } 42 + 43 + u32 44 + nvkm_top_reset(struct nvkm_top *top, enum nvkm_devidx index) 45 + { 46 + struct nvkm_top_device *info; 47 + 48 + if (top) { 49 + list_for_each_entry(info, &top->device, head) { 50 + if (info->index == index && info->reset >= 0) 51 + return BIT(info->reset); 52 + } 53 + } 54 + 55 + return 0; 56 + } 57 + 58 + u32 59 + nvkm_top_intr(struct nvkm_top *top, u32 intr, u64 *psubdevs) 60 + { 61 + struct nvkm_top_device *info; 62 + u64 subdevs = 0; 63 + u32 handled = 0; 64 + 65 + if (top) { 66 + list_for_each_entry(info, &top->device, head) { 67 + if (info->index != NVKM_SUBDEV_NR && info->intr >= 0) { 68 + if (intr & BIT(info->intr)) { 69 + subdevs |= BIT_ULL(info->index); 70 + handled |= BIT(info->intr); 71 + } 72 + } 73 + } 74 + } 75 + 76 + *psubdevs = subdevs; 77 + return intr & ~handled; 78 + } 79 + 80 + enum nvkm_devidx 81 + nvkm_top_fault(struct nvkm_top *top, int fault) 82 + { 83 + struct nvkm_top_device *info; 84 + 85 + list_for_each_entry(info, &top->device, head) { 86 + if (info->fault == fault) 87 + return info->index; 88 + } 89 + 90 + return NVKM_SUBDEV_NR; 91 + } 92 + 93 + enum nvkm_devidx 94 + nvkm_top_engine(struct nvkm_top *top, int index, int *runl, int *engn) 95 + { 96 + struct nvkm_top_device *info; 97 + int n = 0; 98 + 99 + list_for_each_entry(info, &top->device, head) { 100 + if (info->engine >= 0 && info->runlist >= 0 && n++ == index) { 101 + *runl = info->runlist; 102 + *engn = info->engine; 103 + return info->index; 104 + } 105 + } 106 + 107 + return -ENODEV; 108 + } 109 + 110 + static int 111 + nvkm_top_oneinit(struct nvkm_subdev *subdev) 112 + { 113 + struct nvkm_top *top = nvkm_top(subdev); 114 + return top->func->oneinit(top); 115 + } 116 + 117 + static void * 118 + nvkm_top_dtor(struct nvkm_subdev *subdev) 119 + { 120 + struct nvkm_top *top = nvkm_top(subdev); 121 + struct nvkm_top_device *info, *temp; 122 + 123 + list_for_each_entry_safe(info, temp, &top->device, head) { 124 + list_del(&info->head); 125 + kfree(info); 126 + } 127 + 128 + return top; 129 + } 130 + 131 + static const struct nvkm_subdev_func 132 + nvkm_top = { 133 + .dtor = nvkm_top_dtor, 134 + .oneinit = nvkm_top_oneinit, 135 + }; 136 + 137 + int 138 + nvkm_top_new_(const struct nvkm_top_func *func, struct nvkm_device *device, 139 + int index, struct nvkm_top **ptop) 140 + { 141 + struct nvkm_top *top; 142 + if (!(top = *ptop = kzalloc(sizeof(*top), GFP_KERNEL))) 143 + return -ENOMEM; 144 + nvkm_subdev_ctor(&nvkm_top, device, index, &top->subdev); 145 + top->func = func; 146 + INIT_LIST_HEAD(&top->device); 147 + return 0; 148 + }
+110
drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c
··· 1 + /* 2 + * Copyright 2016 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs <bskeggs@redhat.com> 23 + */ 24 + #include "priv.h" 25 + 26 + static int 27 + gk104_top_oneinit(struct nvkm_top *top) 28 + { 29 + struct nvkm_subdev *subdev = &top->subdev; 30 + struct nvkm_device *device = subdev->device; 31 + struct nvkm_top_device *info = NULL; 32 + u32 data, type; 33 + int i; 34 + 35 + for (i = 0; i < 64; i++) { 36 + if (!info) { 37 + if (!(info = nvkm_top_device_new(top))) 38 + return -ENOMEM; 39 + type = ~0; 40 + } 41 + 42 + data = nvkm_rd32(device, 0x022700 + (i * 0x04)); 43 + nvkm_trace(subdev, "%02x: %08x\n", i, data); 44 + switch (data & 0x00000003) { 45 + case 0x00000000: /* NOT_VALID */ 46 + continue; 47 + case 0x00000001: /* DATA */ 48 + info->addr = (data & 0x00fff000); 49 + info->fault = (data & 0x000000f8) >> 3; 50 + break; 51 + case 0x00000002: /* ENUM */ 52 + if (data & 0x00000020) 53 + info->engine = (data & 0x3c000000) >> 26; 54 + if (data & 0x00000010) 55 + info->runlist = (data & 0x01e00000) >> 21; 56 + if (data & 0x00000008) 57 + info->intr = (data & 0x000f8000) >> 15; 58 + if (data & 0x00000004) 59 + info->reset = (data & 0x00003e00) >> 9; 60 + break; 61 + case 0x00000003: /* ENGINE_TYPE */ 62 + type = (data & 0x7ffffffc) >> 2; 63 + break; 64 + } 65 + 66 + if (data & 0x80000000) 67 + continue; 68 + 69 + /* Translate engine type to NVKM engine identifier. */ 70 + switch (type) { 71 + case 0x00000000: info->index = NVKM_ENGINE_GR; break; 72 + case 0x00000001: info->index = NVKM_ENGINE_CE0; break; 73 + case 0x00000002: info->index = NVKM_ENGINE_CE1; break; 74 + case 0x00000003: info->index = NVKM_ENGINE_CE2; break; 75 + case 0x00000008: info->index = NVKM_ENGINE_MSPDEC; break; 76 + case 0x00000009: info->index = NVKM_ENGINE_MSPPP; break; 77 + case 0x0000000a: info->index = NVKM_ENGINE_MSVLD; break; 78 + case 0x0000000b: info->index = NVKM_ENGINE_MSENC; break; 79 + case 0x0000000c: info->index = NVKM_ENGINE_VIC; break; 80 + case 0x0000000d: info->index = NVKM_ENGINE_SEC; break; 81 + case 0x0000000e: info->index = NVKM_ENGINE_NVENC0; break; 82 + case 0x0000000f: info->index = NVKM_ENGINE_NVENC1; break; 83 + case 0x00000010: info->index = NVKM_ENGINE_NVDEC; break; 84 + break; 85 + default: 86 + break; 87 + } 88 + 89 + nvkm_debug(subdev, "%02x (%8s): addr %06x fault %2d engine %2d " 90 + "runlist %2d intr %2d reset %2d\n", type, 91 + info->index == NVKM_SUBDEV_NR ? NULL : 92 + nvkm_subdev_name[info->index], 93 + info->addr, info->fault, info->engine, info->runlist, 94 + info->intr, info->reset); 95 + info = NULL; 96 + } 97 + 98 + return 0; 99 + } 100 + 101 + static const struct nvkm_top_func 102 + gk104_top = { 103 + .oneinit = gk104_top_oneinit, 104 + }; 105 + 106 + int 107 + gk104_top_new(struct nvkm_device *device, int index, struct nvkm_top **ptop) 108 + { 109 + return nvkm_top_new_(&gk104_top, device, index, ptop); 110 + }
+25
drivers/gpu/drm/nouveau/nvkm/subdev/top/priv.h
··· 1 + #ifndef __NVKM_TOP_PRIV_H__ 2 + #define __NVKM_TOP_PRIV_H__ 3 + #define nvkm_top(p) container_of((p), struct nvkm_top, subdev) 4 + #include <subdev/top.h> 5 + 6 + struct nvkm_top_func { 7 + int (*oneinit)(struct nvkm_top *); 8 + }; 9 + 10 + int nvkm_top_new_(const struct nvkm_top_func *, struct nvkm_device *, 11 + int, struct nvkm_top **); 12 + 13 + struct nvkm_top_device { 14 + enum nvkm_devidx index; 15 + u32 addr; 16 + int fault; 17 + int engine; 18 + int runlist; 19 + int reset; 20 + int intr; 21 + struct list_head head; 22 + }; 23 + 24 + struct nvkm_top_device *nvkm_top_device_new(struct nvkm_top *); 25 + #endif
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c
··· 177 177 struct nvkm_bios *bios = device->bios; 178 178 int i; 179 179 180 - nvkm_subdev_ctor(&nvkm_volt, device, index, 0, &volt->subdev); 180 + nvkm_subdev_ctor(&nvkm_volt, device, index, &volt->subdev); 181 181 volt->func = func; 182 182 183 183 /* Assuming the non-bios device should build the voltage table later */
+1 -1
drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c
··· 56 56 57 57 /* the blob uses this crystal frequency, let's use it too. */ 58 58 div = 27648000 / bios->pwm_freq; 59 - duty = (uv - bios->base) * div / bios->pwm_range; 59 + duty = DIV_ROUND_UP((uv - bios->base) * div, bios->pwm_range); 60 60 61 61 nvkm_wr32(device, 0x20340, div); 62 62 nvkm_wr32(device, 0x20344, 0x80000000 | duty);