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 amdgpu: Take a short pass over amdgpu.



details:   https://anonhg.NetBSD.org/src/rev/8f0197265fbb
branches:  trunk
changeset: 1028646:8f0197265fbb
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 11:35:06 2021 +0000

description:
amdgpu: Take a short pass over amdgpu.

diffstat:

 sys/external/bsd/drm2/amdgpu/files.amdgpu                                   |  10 +++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h                          |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c                   |  30 +++++++++-
 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_df_v3_6.c                  |  20 +++++-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/calcs/amdgpu_dcn_calcs.c      |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/dcn21/amdgpu_dcn21_hubp.c     |   6 +-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/dcn21/amdgpu_dcn21_resource.c |  10 ++-
 sys/external/bsd/drm2/dist/drm/amd/display/dc/os_types.h                    |   8 ++-
 8 files changed, 80 insertions(+), 16 deletions(-)

diffs (truncated from 375 to 300 lines):

diff -r d6b75ed89c22 -r 8f0197265fbb sys/external/bsd/drm2/amdgpu/files.amdgpu
--- a/sys/external/bsd/drm2/amdgpu/files.amdgpu Sun Dec 19 11:34:56 2021 +0000
+++ b/sys/external/bsd/drm2/amdgpu/files.amdgpu Sun Dec 19 11:35:06 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.amdgpu,v 1.17 2021/12/19 11:24:37 riastradh Exp $
+#      $NetBSD: files.amdgpu,v 1.18 2021/12/19 11:35:06 riastradh Exp $
 
 version        20180827
 
@@ -48,6 +48,14 @@
 # overflow in arithmetic, which is the opposite of helpful.  &@!#*
 makeoptions    amdgpu  "CWARNFLAGS.amdgpu_bo_list.c"+="-Wno-type-limits"
 
+ifdef amd64
+makeoptions    amdgpu  "COPTS.amdgpu_dcn20_resource.c"+="-mhard-float -msse -msse2"
+makeoptions    amdgpu  "COPTS.amdgpu_dcn21_resource.c"+="-mhard-float -msse -msse2"
+makeoptions    amdgpu  "COPTS.amdgpu_dcn_calc_auto.c"+="-mhard-float -msse -msse2"
+makeoptions    amdgpu  "COPTS.amdgpu_dcn_calc_math.c"+="-mhard-float -msse -msse2"
+makeoptions    amdgpu  "COPTS.amdgpu_dcn_calcs.c"+="-mhard-float -msse -msse2"
+endif
+
 # Local additions.
 file   external/bsd/drm2/amdgpu/amdgpu_module.c        amdgpu
 file   external/bsd/drm2/amdgpu/amdgpu_pci.c           amdgpu
diff -r d6b75ed89c22 -r 8f0197265fbb sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h        Sun Dec 19 11:34:56 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu.h        Sun Dec 19 11:35:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu.h,v 1.5 2021/12/18 23:44:58 riastradh Exp $     */
+/*     $NetBSD: amdgpu.h,v 1.6 2021/12/19 11:35:06 riastradh Exp $     */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -1264,6 +1264,9 @@
 
 #include "amdgpu_object.h"
 
+#ifdef __NetBSD__             /* XXX amdgpu sysfs */
+#define        AMDGPU_PMU_ATTR(_name, _object) CTASSERT(1)
+#else
 /* used by df_v3_6.c and amdgpu_pmu.c */
 #define AMDGPU_PMU_ATTR(_name, _object)                                        \
 static ssize_t                                                         \
@@ -1276,6 +1279,7 @@
 }                                                                      \
                                                                        \
 static struct device_attribute pmu_attr_##_name = __ATTR_RO(_name)
+#endif
 
 #endif
 
diff -r d6b75ed89c22 -r 8f0197265fbb sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c Sun Dec 19 11:34:56 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c Sun Dec 19 11:35:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_device.c,v 1.7 2021/12/18 23:44:58 riastradh Exp $      */
+/*     $NetBSD: amdgpu_device.c,v 1.8 2021/12/19 11:35:07 riastradh Exp $      */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *          Jerome Glisse
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.7 2021/12/18 23:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.8 2021/12/19 11:35:07 riastradh Exp $");
 
 #include <linux/power_supply.h>
 #include <linux/kthread.h>
@@ -119,6 +119,8 @@
        "LAST",
 };
 
+#ifndef __NetBSD__             /* XXX amdgpu sysfs */
+
 /**
  * DOC: pcie_replay_count
  *
@@ -141,6 +143,8 @@
 static DEVICE_ATTR(pcie_replay_count, S_IRUGO,
                amdgpu_device_get_pcie_replay_count, NULL);
 
+#endif /* __NetBSD__ */
+
 static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev);
 
 /**
@@ -266,7 +270,12 @@
  */
 uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset) {
        if (offset < adev->rmmio_size)
+#ifdef __NetBSD__
+               return bus_space_read_1(adev->rmmiot, adev->rmmioh,
+                   adev->rmmio_base + offset);
+#else
                return (readb(adev->rmmio + offset));
+#endif
        BUG();
 }
 
@@ -287,7 +296,12 @@
  */
 void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value) {
        if (offset < adev->rmmio_size)
+#ifdef __NetBSD__
+               bus_space_write_1(adev->rmmiot, adev->rmmioh,
+                   adev->rmmio_base + offset, value);
+#else
                writeb(value, adev->rmmio + offset);
+#endif
        else
                BUG();
 }
@@ -467,7 +481,12 @@
 u64 amdgpu_mm_rdoorbell64(struct amdgpu_device *adev, u32 index)
 {
        if (index < adev->doorbell.num_doorbells) {
+#ifdef __NetBSD__
+               return bus_space_read_8(adev->doorbell.bst, adev->doorbell.bsh,
+                   4*index);
+#else
                return atomic64_read((atomic64_t *)(adev->doorbell.ptr + index));
+#endif
        } else {
                DRM_ERROR("reading beyond doorbell aperture: 0x%08x!\n", index);
                return 0;
@@ -487,7 +506,12 @@
 void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v)
 {
        if (index < adev->doorbell.num_doorbells) {
+#ifdef __NetBSD__
+               bus_space_write_8(adev->doorbell.bst, adev->doorbell.bsh,
+                   4*index, v);
+#else
                atomic64_set((atomic64_t *)(adev->doorbell.ptr + index), v);
+#endif
        } else {
                DRM_ERROR("writing beyond doorbell aperture: 0x%08x!\n", index);
        }
@@ -3252,11 +3276,13 @@
        queue_delayed_work(system_wq, &adev->delayed_init_work,
                           msecs_to_jiffies(AMDGPU_RESUME_MS));
 
+#ifndef __NetBSD__             /* XXX amdgpu sysfs */
        r = device_create_file(adev->dev, &dev_attr_pcie_replay_count);
        if (r) {
                dev_err(adev->dev, "Could not create pcie_replay_count");
                return r;
        }
+#endif
 
        if (IS_ENABLED(CONFIG_PERF_EVENTS))
                r = amdgpu_pmu_init(adev);
diff -r d6b75ed89c22 -r 8f0197265fbb sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_df_v3_6.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_df_v3_6.c        Sun Dec 19 11:34:56 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_df_v3_6.c        Sun Dec 19 11:35:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_df_v3_6.c,v 1.2 2021/12/18 23:44:58 riastradh Exp $     */
+/*     $NetBSD: amdgpu_df_v3_6.c,v 1.3 2021/12/19 11:35:07 riastradh Exp $     */
 
 /*
  * Copyright 2018 Advanced Micro Devices, Inc.
@@ -23,7 +23,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_df_v3_6.c,v 1.2 2021/12/18 23:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_df_v3_6.c,v 1.3 2021/12/19 11:35:07 riastradh Exp $");
 
 #include "amdgpu.h"
 #include "df_v3_6.h"
@@ -38,6 +38,8 @@
 static u32 df_v3_6_channel_number[] = {1, 2, 0, 4, 0, 8, 0,
                                       16, 32, 0, 0, 0, 2, 4, 8};
 
+#ifndef __NetBSD__             /* XXX amdgpu sysfs */
+
 /* init df format attrs */
 AMDGPU_PMU_ATTR(event,         "config:0-7");
 AMDGPU_PMU_ATTR(instance,      "config:8-15");
@@ -101,6 +103,8 @@
                NULL
 };
 
+#endif /* __NetBSD__ */
+
 static uint64_t df_v3_6_get_fica(struct amdgpu_device *adev,
                                 uint32_t ficaa_val)
 {
@@ -246,6 +250,8 @@
        return countdown > 0 ? 0 : -ETIME;
 }
 
+#ifndef __NetBSD__             /* XXX amdgpu sysfs */
+
 /* get the number of df counters available */
 static ssize_t df_v3_6_get_df_cntr_avail(struct device *dev,
                struct device_attribute *attr,
@@ -270,6 +276,8 @@
 /* device attr for available perfmon counters */
 static DEVICE_ATTR(df_cntr_avail, S_IRUGO, df_v3_6_get_df_cntr_avail, NULL);
 
+#endif /* __NetBSD__ */
+
 static void df_v3_6_query_hashes(struct amdgpu_device *adev)
 {
        u32 tmp;
@@ -301,9 +309,13 @@
 {
        int i, ret;
 
+#ifdef __NetBSD__              /* XXX amdgpu sysfs */
+       __USE(ret);
+#else
        ret = device_create_file(adev->dev, &dev_attr_df_cntr_avail);
        if (ret)
                DRM_ERROR("failed to create file for available df counters\n");
+#endif
 
        for (i = 0; i < AMDGPU_MAX_DF_PERFMONS; i++)
                adev->df_perfmon_config_assign_mask[i] = 0;
@@ -314,7 +326,9 @@
 static void df_v3_6_sw_fini(struct amdgpu_device *adev)
 {
 
+#ifndef __NetBSD__             /* XXX amdgpu sysfs */
        device_remove_file(adev->dev, &dev_attr_df_cntr_avail);
+#endif
 
 }
 
@@ -485,7 +499,7 @@
        *lo_val = (unitmask << 8) | (instance_10 << 6) | eventsel | (1 << 22);
        *hi_val = (instance_76 << 29) | instance_5432;
 
-       DRM_DEBUG_DRIVER("config=%llx addr=%08x:%08x val=%08x:%08x",
+       DRM_DEBUG_DRIVER("config=%"PRIx64" addr=%08x:%08x val=%08x:%08x",
                config, *lo_base_addr, *hi_base_addr, *lo_val, *hi_val);
 
        return 0;
diff -r d6b75ed89c22 -r 8f0197265fbb sys/external/bsd/drm2/dist/drm/amd/display/dc/calcs/amdgpu_dcn_calcs.c
--- a/sys/external/bsd/drm2/dist/drm/amd/display/dc/calcs/amdgpu_dcn_calcs.c    Sun Dec 19 11:34:56 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/display/dc/calcs/amdgpu_dcn_calcs.c    Sun Dec 19 11:35:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_dcn_calcs.c,v 1.2 2021/12/18 23:45:01 riastradh Exp $   */
+/*     $NetBSD: amdgpu_dcn_calcs.c,v 1.3 2021/12/19 11:35:07 riastradh Exp $   */
 
 /*
  * Copyright 2017 Advanced Micro Devices, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_dcn_calcs.c,v 1.2 2021/12/18 23:45:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_dcn_calcs.c,v 1.3 2021/12/19 11:35:07 riastradh Exp $");
 
 #include "dm_services.h"
 #include "dc.h"
@@ -446,7 +446,7 @@
                struct pipe_ctx *pipe,
                int in_idx)
 {
-       struct display_mode_lib *dml = (struct display_mode_lib *)(&dc->dml);
+       struct display_mode_lib *dml = (struct display_mode_lib *)__UNCONST(&dc->dml);
        struct _vcs_dpi_display_dlg_regs_st *dlg_regs = &pipe->dlg_regs;
        struct _vcs_dpi_display_ttu_regs_st *ttu_regs = &pipe->ttu_regs;
        struct _vcs_dpi_display_rq_regs_st *rq_regs = &pipe->rq_regs;
diff -r d6b75ed89c22 -r 8f0197265fbb sys/external/bsd/drm2/dist/drm/amd/display/dc/dcn21/amdgpu_dcn21_hubp.c
--- a/sys/external/bsd/drm2/dist/drm/amd/display/dc/dcn21/amdgpu_dcn21_hubp.c   Sun Dec 19 11:34:56 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/display/dc/dcn21/amdgpu_dcn21_hubp.c   Sun Dec 19 11:35:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_dcn21_hubp.c,v 1.2 2021/12/18 23:45:03 riastradh Exp $  */
+/*     $NetBSD: amdgpu_dcn21_hubp.c,v 1.3 2021/12/19 11:35:07 riastradh Exp $  */
 
 /*
 * Copyright 2018 Advanced Micro Devices, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_dcn21_hubp.c,v 1.2 2021/12/18 23:45:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_dcn21_hubp.c,v 1.3 2021/12/19 11:35:07 riastradh Exp $");
 
 #include "dcn10/dcn10_hubp.h"
 #include "dcn21_hubp.h"
@@ -330,7 +330,7 @@
 {
        struct dcn21_hubp *hubp21 = TO_DCN21_HUBP(hubp);
 
-       PHYSICAL_ADDRESS_LOC mc_vm_apt_default;
+       PHYSICAL_ADDRESS_LOC mc_vm_apt_default __unused;
        PHYSICAL_ADDRESS_LOC mc_vm_apt_low;
        PHYSICAL_ADDRESS_LOC mc_vm_apt_high;
 
diff -r d6b75ed89c22 -r 8f0197265fbb sys/external/bsd/drm2/dist/drm/amd/display/dc/dcn21/amdgpu_dcn21_resource.c
--- a/sys/external/bsd/drm2/dist/drm/amd/display/dc/dcn21/amdgpu_dcn21_resource.c       Sun Dec 19 11:34:56 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/display/dc/dcn21/amdgpu_dcn21_resource.c       Sun Dec 19 11:35:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_dcn21_resource.c,v 1.2 2021/12/18 23:45:03 riastradh Exp $      */
+/*     $NetBSD: amdgpu_dcn21_resource.c,v 1.3 2021/12/19 11:35:07 riastradh Exp $      */



Home | Main Index | Thread Index | Old Index