Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu Tired of fine-grai...



details:   https://anonhg.NetBSD.org/src/rev/0034f960845c
branches:  trunk
changeset: 364700:0034f960845c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 14:04:50 2018 +0000

description:
Tired of fine-grained commits.  Have an amdgpu(4).

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h               |   61 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c          |    7 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c        |    8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c |    8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c      |   59 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_benchmark.c     |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bios.c          |   50 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c       |   14 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cgs.c           |   21 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c            |   17 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c           |   12 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c        |  251 +++++++++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c       |   10 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dpm.c           |   53 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_drv.c           |   33 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c            |   68 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c         |  103 +++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c          |  169 ++++++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c           |   28 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx.c           |    5 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_i2c.c           |   21 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ih.c            |   66 ++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ih.h            |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_irq.c           |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_irq.h           |    4 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_kms.c           |   20 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_object.c        |   16 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_object.h        |    7 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_pll.c           |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_pm.c            |   18 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_pm.h            |    8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ring.c          |    8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_sa.c            |   48 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_test.c          |   24 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c           |   99 +++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ucode.c         |   25 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_uvd.c           |   36 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vce.c           |    9 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c            |   22 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/atom.c                 |   11 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/atombios_crtc.c        |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/atombios_dp.c          |   13 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/atombios_encoders.c    |   16 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/atombios_i2c.c         |   13 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/ci_dpm.c               |    8 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/cz_dpm.c               |   19 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/cz_ih.c                |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/cz_smc.c               |   24 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/dce_v10_0.c            |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/dce_v11_0.c            |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/fiji_dpm.c             |    5 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/fiji_smc.c             |    9 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/gfx_v8_0.c             |   41 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/gmc_v7_0.c             |   34 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/gmc_v8_0.c             |   34 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/iceland_dpm.c          |    5 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/iceland_ih.c           |    7 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/iceland_smc.c          |   13 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/sdma_v2_4.c            |   13 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/sdma_v3_0.c            |   13 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/tonga_dpm.c            |    5 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/tonga_ih.c             |    6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/tonga_smc.c            |    9 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/uvd_v5_0.c             |    7 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/uvd_v6_0.c             |    7 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/vce_v3_0.c             |    9 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/vi.c                   |    8 +-
 67 files changed, 1473 insertions(+), 312 deletions(-)

diffs (truncated from 5366 to 300 lines):

diff -r 097569811224 -r 0034f960845c sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h        Mon Aug 27 14:03:38 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h        Mon Aug 27 14:04:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu.h,v 1.2 2018/08/27 04:58:19 riastradh Exp $     */
+/*     $NetBSD: amdgpu.h,v 1.3 2018/08/27 14:04:50 riastradh Exp $     */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -361,7 +361,12 @@
  * Dummy page
  */
 struct amdgpu_dummy_page {
+#ifdef __NetBSD__
+       bus_dma_segment_t       adp_seg;
+       bus_dmamap_t            adp_map;
+#else
        struct page     *page;
+#endif
        dma_addr_t      addr;
 };
 int amdgpu_dummy_page_init(struct amdgpu_device *adev);
@@ -400,7 +405,13 @@
        struct amdgpu_irq_src           *irq_src;
        unsigned                        irq_type;
        struct timer_list               fallback_timer;
+#ifdef __NetBSD__
+       spinlock_t                      fence_lock;
+       drm_waitqueue_t                 fence_queue;
+       TAILQ_HEAD(, amdgpu_fence)      fence_check;
+#else
        wait_queue_head_t               fence_queue;
+#endif
 };
 
 /* some special values for the owner field */
@@ -420,7 +431,11 @@
        /* filp or special value for fence creator */
        void                            *owner;
 
+#ifdef __NetBSD__
+       TAILQ_ENTRY(amdgpu_fence)       fence_check;
+#else
        wait_queue_t                    fence_wake;
+#endif
 };
 
 struct amdgpu_user_fence {
@@ -478,7 +493,12 @@
                       uint32_t byte_count,
                       struct reservation_object *resv,
                       struct fence **fence);
+#ifdef __NetBSD__
+int amdgpu_mmap_object(struct drm_device *, off_t, size_t, vm_prot_t,
+    struct uvm_object **, voff_t *, struct file *);
+#else
 int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma);
+#endif
 
 struct amdgpu_bo_list_entry {
        struct amdgpu_bo                *robj;
@@ -595,7 +615,12 @@
  * alignment).
  */
 struct amdgpu_sa_manager {
+#ifdef __NetBSD__
+       spinlock_t              wq_lock;
+       drm_waitqueue_t         wq;
+#else
        wait_queue_head_t       wq;
+#endif
        struct amdgpu_bo        *bo;
        struct list_head        *hole;
        struct list_head        flist[AMDGPU_MAX_RINGS];
@@ -693,6 +718,10 @@
 #define AMDGPU_GPU_PAGE_ALIGN(a) (((a) + AMDGPU_GPU_PAGE_MASK) & ~AMDGPU_GPU_PAGE_MASK)
 
 struct amdgpu_gart {
+#ifdef __NetBSD__
+       bus_dma_segment_t               ag_table_seg;
+       bus_dmamap_t                    ag_table_map;
+#endif
        dma_addr_t                      table_addr;
        struct amdgpu_bo                *robj;
        void                            *ptr;
@@ -713,11 +742,19 @@
 void amdgpu_gart_table_vram_unpin(struct amdgpu_device *adev);
 int amdgpu_gart_init(struct amdgpu_device *adev);
 void amdgpu_gart_fini(struct amdgpu_device *adev);
+#ifdef __NetBSD__
+void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t gpu_start,
+    unsigned npages);
+int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t gpu_start,
+    unsigned npages, struct page **pagelist, bus_dmamap_t dmamap,
+    uint32_t flags);
+#else
 void amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
                        int pages);
 int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
                     int pages, struct page **pagelist,
                     dma_addr_t *dma_addr, uint32_t flags);
+#endif
 
 /*
  * GPU MC structures, functions & helpers
@@ -774,7 +811,12 @@
        /* doorbell mmio */
        resource_size_t         base;
        resource_size_t         size;
+#ifdef __NetBSD__
+       bus_space_tag_t         bst;
+       bus_space_handle_t      bsh;
+#else
        u32 __iomem             *ptr;
+#endif
        u32                     num_doorbells;  /* Number of doorbells actually reserved for amdgpu. */
 };
 
@@ -1296,7 +1338,7 @@
        volatile uint32_t       *wb;
        uint64_t                gpu_addr;
        u32                     num_wb; /* Number of wb slots actually reserved for amdgpu. */
-       unsigned long           used[DIV_ROUND_UP(AMDGPU_MAX_WB, BITS_PER_LONG)];
+       unsigned long           used[DIV_ROUND_UP(AMDGPU_MAX_WB, NBBY*sizeof(unsigned long))];
 };
 
 int amdgpu_wb_get(struct amdgpu_device *adev, u32 *wb);
@@ -1995,9 +2037,16 @@
        uint32_t                        bios_scratch[AMDGPU_BIOS_NUM_SCRATCH];
 
        /* Register/doorbell mmio */
+#ifdef __NetBSD__
+       bus_space_tag_t                 rmmiot;
+       bus_space_handle_t              rmmioh;
+       bus_addr_t                      rmmio_base;
+       bus_size_t                      rmmio_size;
+#else
        resource_size_t                 rmmio_base;
        resource_size_t                 rmmio_size;
        void __iomem                    *rmmio;
+#endif
        /* protects concurrent MM_INDEX/DATA based register access */
        spinlock_t mmio_idx_lock;
        /* protects concurrent SMC based register access */
@@ -2020,8 +2069,14 @@
        spinlock_t audio_endpt_idx_lock;
        amdgpu_block_rreg_t             audio_endpt_rreg;
        amdgpu_block_wreg_t             audio_endpt_wreg;
+#ifdef __NetBSD__
+       bus_space_tag_t                 rio_memt;
+       bus_space_handle_t              rio_memh;
+       bus_size_t                      rio_mem_size;
+#else
        void __iomem                    *rio_mem;
        resource_size_t                 rio_mem_size;
+#endif
        struct amdgpu_doorbell          doorbell;
 
        /* clock/pll info */
@@ -2327,6 +2382,8 @@
 void amdgpu_program_register_sequence(struct amdgpu_device *adev,
                                             const u32 *registers,
                                             const u32 array_size);
+int amdgpu_ttm_init(struct amdgpu_device *adev);
+void amdgpu_ttm_fini(struct amdgpu_device *adev);
 
 bool amdgpu_device_is_px(struct drm_device *dev);
 /* atpx handler */
diff -r 097569811224 -r 0034f960845c sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c   Mon Aug 27 14:03:38 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_acpi.c   Mon Aug 27 14:04:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_acpi.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $        */
+/*     $NetBSD: amdgpu_acpi.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $        */
 
 /*
  * Copyright 2012 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_acpi.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_acpi.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $");
 
 #include <linux/pci.h>
 #include <linux/acpi.h>
@@ -35,12 +35,11 @@
 #include <drm/drm_crtc_helper.h>
 #include "amdgpu.h"
 #include "amdgpu_acpi.h"
+#include "amdgpu_pm.h"
 #include "atom.h"
 
 #define ACPI_AC_CLASS           "ac_adapter"
 
-extern void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
-
 struct atif_verify_interface {
        u16 size;               /* structure size in bytes (includes size field) */
        u16 version;            /* version */
diff -r 097569811224 -r 0034f960845c sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c Mon Aug 27 14:03:38 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd.c Mon Aug 27 14:04:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_amdkfd.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $      */
+/*     $NetBSD: amdgpu_amdkfd.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $      */
 
 /*
  * Copyright 2014 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_amdkfd.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_amdkfd.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $");
 
 #include "amdgpu_amdkfd.h"
 #include "amd_shared.h"
@@ -102,7 +102,9 @@
 {
        if (kgd2kfd) {
                kgd2kfd->exit();
+#ifndef __NetBSD__
                symbol_put(kgd2kfd_init);
+#endif
        }
 }
 
@@ -163,6 +165,7 @@
        return r;
 }
 
+#ifndef __NetBSD__             /* XXX unused? */
 u32 pool_to_domain(enum kgd_memory_pool p)
 {
        switch (p) {
@@ -170,6 +173,7 @@
        default: return AMDGPU_GEM_DOMAIN_GTT;
        }
 }
+#endif
 
 int alloc_gtt_mem(struct kgd_dev *kgd, size_t size,
                        void **mem_obj, uint64_t *gpu_addr,
diff -r 097569811224 -r 0034f960845c sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c  Mon Aug 27 14:03:38 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v8.c  Mon Aug 27 14:04:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_amdkfd_gfx_v8.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $       */
+/*     $NetBSD: amdgpu_amdkfd_gfx_v8.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $       */
 
 /*
  * Copyright 2014 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_amdkfd_gfx_v8.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_amdkfd_gfx_v8.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $");
 
 #include <linux/module.h>
 #include <linux/fdtable.h>
@@ -120,9 +120,9 @@
        .get_fw_version = get_fw_version
 };
 
-struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions()
+struct kfd2kgd_calls *amdgpu_amdkfd_gfx_8_0_get_functions(void)
 {
-       return (struct kfd2kgd_calls *)&kfd2kgd;
+       return (struct kfd2kgd_calls *)__UNCONST(&kfd2kgd); /* XXX */
 }
 
 static inline struct amdgpu_device *get_amdgpu_device(struct kgd_dev *kgd)
diff -r 097569811224 -r 0034f960845c sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c       Mon Aug 27 14:03:38 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c       Mon Aug 27 14:04:50 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_atombios.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $    */
+/*     $NetBSD: amdgpu_atombios.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $    */
 
 /*
  * Copyright 2007-8 Advanced Micro Devices, Inc.
@@ -26,8 +26,9 @@
  *          Alex Deucher
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_atombios.c,v 1.2 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_atombios.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $");
 
+#include <asm/byteorder.h>
 #include <drm/drmP.h>
 #include <drm/amdgpu_drm.h>
 #include "amdgpu.h"
@@ -104,7 +105,7 @@
        i2c.valid = false;
 
        if (amdgpu_atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
-               i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
+               i2c_info = (struct _ATOM_GPIO_I2C_INFO *)((char *)ctx->bios + data_offset);



Home | Main Index | Thread Index | Old Index