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 add support for kabylake and skyl...



details:   https://anonhg.NetBSD.org/src/rev/cfc79e6674f4
branches:  trunk
changeset: 433405:cfc79e6674f4
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Sep 13 08:25:55 2018 +0000

description:
add support for kabylake and skylake GT4 (untested) GPUs.
largely taken from openbsd and linux 4.13 trees (which
have this code identical), with mimimal porting to netbsd.

i have not installed (and thus tested) the newer referenced
firmware files.

only real local change is to fix IS_BROXTON() macro to check
the things valid in this era of drm.  previous match would
attach on KBL, and then a loop would never exit.

tested on kabylake P630.  needs mesa 11.x or newer for GL
to work.

ok @riastradh.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/i915_dma.c         |   7 +-
 sys/external/bsd/drm2/dist/drm/i915/i915_drv.c         |  52 ++++++++++++-
 sys/external/bsd/drm2/dist/drm/i915/i915_drv.h         |  45 ++++++++++-
 sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c  |   7 +-
 sys/external/bsd/drm2/dist/drm/i915/i915_irq.c         |   8 +-
 sys/external/bsd/drm2/dist/drm/i915/i915_reg.h         |  13 +++-
 sys/external/bsd/drm2/dist/drm/i915/intel_csr.c        |  28 ++++++-
 sys/external/bsd/drm2/dist/drm/i915/intel_ddi.c        |  30 +++---
 sys/external/bsd/drm2/dist/drm/i915/intel_display.c    |  16 ++--
 sys/external/bsd/drm2/dist/drm/i915/intel_dp.c         |  10 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_fbc.c        |   7 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_guc_loader.c |  11 ++-
 sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c        |   8 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_mocs.c       |   6 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_panel.c      |   7 +-
 sys/external/bsd/drm2/dist/drm/i915/intel_pm.c         |  15 ++-
 sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c |  68 +++++++++++++++++-
 sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c |  18 ++--
 sys/external/bsd/drm2/dist/include/drm/i915_pciids.h   |  48 ++++++++++++-
 19 files changed, 315 insertions(+), 89 deletions(-)

diffs (truncated from 1142 to 300 lines):

diff -r e380230b0208 -r cfc79e6674f4 sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c    Thu Sep 13 01:55:16 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c    Thu Sep 13 08:25:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_dma.c,v 1.25 2018/08/28 03:41:38 riastradh Exp $  */
+/*     $NetBSD: i915_dma.c,v 1.26 2018/09/13 08:25:55 mrg Exp $        */
 
 /* i915_dma.c -- DMA support for the I915 -*- linux-c -*-
  */
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_dma.c,v 1.25 2018/08/28 03:41:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_dma.c,v 1.26 2018/09/13 08:25:55 mrg Exp $");
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -693,7 +693,8 @@
         * supports EU power gating on devices with more than one EU
         * pair per subslice.
        */
-       info->has_slice_pg = (IS_SKYLAKE(dev) && (info->slice_total > 1));
+       info->has_slice_pg = ((IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) &&
+                              (info->slice_total > 1));
        info->has_subslice_pg = (IS_BROXTON(dev) && (info->subslice_total > 1));
        info->has_eu_pg = (info->eu_per_subslice > 2);
 }
diff -r e380230b0208 -r cfc79e6674f4 sys/external/bsd/drm2/dist/drm/i915/i915_drv.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c    Thu Sep 13 01:55:16 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c    Thu Sep 13 08:25:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_drv.c,v 1.15 2018/08/27 15:22:54 riastradh Exp $  */
+/*     $NetBSD: i915_drv.c,v 1.16 2018/09/13 08:25:55 mrg Exp $        */
 
 /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
  */
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.15 2018/08/27 15:22:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_drv.c,v 1.16 2018/09/13 08:25:55 mrg Exp $");
 
 #include <linux/device.h>
 #include <linux/acpi.h>
@@ -406,6 +406,34 @@
        IVB_CURSOR_OFFSETS,
 };
 
+static const struct intel_device_info intel_kabylake_info = {
+       .is_kabylake = 1,
+       .gen = 9,
+       .num_pipes = 3,
+       .need_gfx_hws = 1, .has_hotplug = 1,
+       .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
+       .has_llc = 1,
+       .has_ddi = 1,
+       .has_fpga_dbg = 1,
+       .has_fbc = 1,
+       GEN_DEFAULT_PIPEOFFSETS,
+       IVB_CURSOR_OFFSETS,
+};
+
+static const struct intel_device_info intel_kabylake_gt3_info = {
+       .is_kabylake = 1,
+       .gen = 9,
+       .num_pipes = 3,
+       .need_gfx_hws = 1, .has_hotplug = 1,
+       .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
+       .has_llc = 1,
+       .has_ddi = 1,
+       .has_fpga_dbg = 1,
+       .has_fbc = 1,
+       GEN_DEFAULT_PIPEOFFSETS,
+       IVB_CURSOR_OFFSETS,
+};
+
 /*
  * Make sure any device matches here are from most specific to most
  * general.  For example, since the Quanta match is based on the subsystem
@@ -446,7 +474,13 @@
        INTEL_SKL_GT1_IDS(&intel_skylake_info), \
        INTEL_SKL_GT2_IDS(&intel_skylake_info), \
        INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),     \
-       INTEL_BXT_IDS(&intel_broxton_info)
+       INTEL_SKL_GT4_IDS(&intel_skylake_gt3_info),     \
+       INTEL_BXT_IDS(&intel_broxton_info),     \
+       INTEL_KBL_GT1_IDS(&intel_kabylake_info),        \
+       INTEL_KBL_GT2_IDS(&intel_kabylake_info),        \
+       INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),    \
+       INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info)
+
 
 static const struct pci_device_id pciidlist[] = {              /* aka */
        INTEL_PCI_IDS,
@@ -475,7 +509,7 @@
        } else if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
                ret = PCH_LPT;
                DRM_DEBUG_KMS("Assuming LynxPoint PCH\n");
-       } else if (IS_SKYLAKE(dev)) {
+       } else if (IS_SKYLAKE(dev) || IS_KABYLAKE(dev)) {
                ret = PCH_SPT;
                DRM_DEBUG_KMS("Assuming SunrisePoint PCH\n");
        }
@@ -544,11 +578,17 @@
                        } else if (id == INTEL_PCH_SPT_DEVICE_ID_TYPE) {
                                dev_priv->pch_type = PCH_SPT;
                                DRM_DEBUG_KMS("Found SunrisePoint PCH\n");
-                               WARN_ON(!IS_SKYLAKE(dev));
+                               WARN_ON(!IS_SKYLAKE(dev) &&
+                                       !IS_KABYLAKE(dev));
                        } else if (id == INTEL_PCH_SPT_LP_DEVICE_ID_TYPE) {
                                dev_priv->pch_type = PCH_SPT;
                                DRM_DEBUG_KMS("Found SunrisePoint LP PCH\n");
-                               WARN_ON(!IS_SKYLAKE(dev));
+                               WARN_ON(!IS_SKYLAKE(dev) &&
+                                       !IS_KABYLAKE(dev));
+                       } else if (id == INTEL_PCH_KBP_DEVICE_ID_TYPE) {
+                               dev_priv->pch_type = PCH_KBP;
+                               DRM_DEBUG_KMS("Found KabyPoint PCH\n");
+                               WARN_ON(!IS_KABYLAKE(dev_priv));
                        } else if ((id == INTEL_PCH_P2X_DEVICE_ID_TYPE) ||
                                   ((id == INTEL_PCH_QEMU_DEVICE_ID_TYPE) &&
                                    pch->subsystem_vendor == 0x1af4 &&
diff -r e380230b0208 -r cfc79e6674f4 sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h    Thu Sep 13 01:55:16 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h    Thu Sep 13 08:25:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_drv.h,v 1.27 2018/08/27 15:22:54 riastradh Exp $  */
+/*     $NetBSD: i915_drv.h,v 1.28 2018/09/13 08:25:55 mrg Exp $        */
 
 /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
  */
@@ -800,6 +800,7 @@
        func(is_valleyview) sep \
        func(is_haswell) sep \
        func(is_skylake) sep \
+       func(is_kabylake) sep \
        func(is_preliminary) sep \
        func(has_fbc) sep \
        func(has_pipe_cxsr) sep \
@@ -1027,6 +1028,7 @@
        PCH_CPT,        /* Cougarpoint PCH */
        PCH_LPT,        /* Lynxpoint PCH */
        PCH_SPT,        /* Sunrisepoint PCH */
+       PCH_KBP,        /* Kabypoint PCH */
        PCH_NOP,
 };
 
@@ -2521,6 +2523,16 @@
 #define INTEL_DEVID(p) (INTEL_INFO(p)->device_id)
 #define INTEL_REVID(p) (__I915__(p)->dev->pdev->revision)
 
+#define REVID_FOREVER  (0xff)
+
+/*
+ * Return true if revision is in range [since,until] inclusive.
+ *
+ * Use 0 for open-ended since, and REVID_FOREVER for open-ended until.
+ */
+#define IS_REVID(p, since, until) \
+       (INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
+
 #define IS_I830(dev)           (INTEL_DEVID(dev) == 0x3577)
 #define IS_845G(dev)           (INTEL_DEVID(dev) == 0x2562)
 #define IS_I85X(dev)           (INTEL_INFO(dev)->is_i85x)
@@ -2544,10 +2556,12 @@
                                 INTEL_DEVID(dev) == 0x015a)
 #define IS_VALLEYVIEW(dev)     (INTEL_INFO(dev)->is_valleyview)
 #define IS_CHERRYVIEW(dev)     (INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
-#define IS_HASWELL(dev)        (INTEL_INFO(dev)->is_haswell)
+#define IS_HASWELL(dev)                (INTEL_INFO(dev)->is_haswell)
 #define IS_BROADWELL(dev)      (!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev))
-#define IS_SKYLAKE(dev)        (INTEL_INFO(dev)->is_skylake)
-#define IS_BROXTON(dev)        (!INTEL_INFO(dev)->is_skylake && IS_GEN9(dev))
+#define IS_SKYLAKE(dev)                (INTEL_INFO(dev)->is_skylake)
+#define IS_KABYLAKE(dev)       (INTEL_INFO(dev)->is_kabylake)
+#define IS_BROXTON(dev)                (!IS_SKYLAKE(dev) && !IS_KABYLAKE(dev) && \
+                                IS_GEN9(dev))
 #define IS_MOBILE(dev)         (INTEL_INFO(dev)->is_mobile)
 #define IS_HSW_EARLY_SDV(dev)  (IS_HASWELL(dev) && \
                                 (INTEL_DEVID(dev) & 0xFF00) == 0x0C00)
@@ -2575,6 +2589,14 @@
 #define IS_SKL_ULX(dev)                (INTEL_DEVID(dev) == 0x190E || \
                                 INTEL_DEVID(dev) == 0x1915 || \
                                 INTEL_DEVID(dev) == 0x191E)
+#define IS_KBL_ULT(dev)                (INTEL_DEVID(dev) == 0x5906 || \
+                                INTEL_DEVID(dev) == 0x5913 || \
+                                INTEL_DEVID(dev) == 0x5916 || \
+                                INTEL_DEVID(dev) == 0x5921 || \
+                                INTEL_DEVID(dev) == 0x5926)
+#define IS_KBL_ULX(dev)                (INTEL_DEVID(dev) == 0x590E || \
+                                INTEL_DEVID(dev) == 0x5915 || \
+                                INTEL_DEVID(dev) == 0x591E)
 #define IS_SKL_GT3(dev)                (IS_SKYLAKE(dev) && \
                                 (INTEL_DEVID(dev) & 0x00F0) == 0x0020)
 #define IS_SKL_GT4(dev)                (IS_SKYLAKE(dev) && \
@@ -2589,10 +2611,23 @@
 #define SKL_REVID_E0           (0x4)
 #define SKL_REVID_F0           (0x5)
 
+#define IS_SKL_REVID(p, since, until) (IS_SKYLAKE(p) && IS_REVID(p, since, until))
+
 #define BXT_REVID_A0           (0x0)
+#define BXT_REVID_A1           (0x1)
 #define BXT_REVID_B0           (0x3)
 #define BXT_REVID_C0           (0x9)
 
+#define IS_BXT_REVID(p, since, until) (IS_BROXTON(p) && IS_REVID(p, since, until))
+
+#define KBL_REVID_A0           (0x0)
+#define KBL_REVID_B0           (0x1)
+#define KBL_REVID_C0           (0x2)
+#define KBL_REVID_D0           (0x3)
+#define KBL_REVID_E0           (0x4)
+
+#define IS_KBL_REVID(p, since, until) (IS_KABYLAKE(p) && IS_REVID(p, since, until))
+
 /*
  * The genX designation typically refers to the render engine, so render
  * capability related checks should use IS_GEN, while display and other checks
@@ -2689,10 +2724,12 @@
 #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE                0x9c00
 #define INTEL_PCH_SPT_DEVICE_ID_TYPE           0xA100
 #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE                0x9D00
+#define INTEL_PCH_KBP_DEVICE_ID_TYPE           0xA200
 #define INTEL_PCH_P2X_DEVICE_ID_TYPE           0x7100
 #define INTEL_PCH_QEMU_DEVICE_ID_TYPE          0x2900 /* qemu q35 has 2918 */
 
 #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type)
+#define HAS_PCH_KBP(dev) (INTEL_PCH_TYPE(dev) == PCH_KBP)
 #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT)
 #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)
 #define HAS_PCH_LPT_LP(dev) (__I915__(dev)->pch_id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE)
diff -r e380230b0208 -r cfc79e6674f4 sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c     Thu Sep 13 01:55:16 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c     Thu Sep 13 08:25:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_gem_stolen.c,v 1.10 2018/08/27 07:20:39 riastradh Exp $   */
+/*     $NetBSD: i915_gem_stolen.c,v 1.11 2018/09/13 08:25:55 mrg Exp $ */
 
 /*
  * Copyright © 2008-2012 Intel Corporation
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.10 2018/08/27 07:20:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.11 2018/09/13 08:25:55 mrg Exp $");
 
 #include <linux/printk.h>
 #include <linux/err.h>
@@ -465,7 +465,8 @@
                                         &reserved_size);
                break;
        default:
-               if (IS_BROADWELL(dev_priv) || IS_SKYLAKE(dev_priv))
+               if (IS_BROADWELL(dev_priv) ||
+                   IS_SKYLAKE(dev_priv) || IS_KABYLAKE(dev))
                        bdw_get_stolen_reserved(dev_priv, &reserved_base,
                                                &reserved_size);
                else
diff -r e380230b0208 -r cfc79e6674f4 sys/external/bsd/drm2/dist/drm/i915/i915_irq.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c    Thu Sep 13 01:55:16 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c    Thu Sep 13 08:25:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_irq.c,v 1.16 2018/08/27 14:52:56 riastradh Exp $  */
+/*     $NetBSD: i915_irq.c,v 1.17 2018/09/13 08:25:55 mrg Exp $        */
 
 /* i915_irq.c -- IRQ support for the I915 -*- linux-c -*-
  */
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_irq.c,v 1.16 2018/08/27 14:52:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_irq.c,v 1.17 2018/09/13 08:25:55 mrg Exp $");
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -2381,7 +2381,7 @@
                        I915_WRITE(SDEIIR, pch_iir);
                        ret = IRQ_HANDLED;
 
-                       if (HAS_PCH_SPT(dev_priv))
+                       if (HAS_PCH_SPT(dev_priv) || HAS_PCH_KBP(dev_priv))
                                spt_irq_handler(dev, pch_iir);
                        else
                                cpt_irq_handler(dev, pch_iir);
@@ -4572,7 +4572,7 @@
                dev->driver->disable_vblank = gen8_disable_vblank;
                if (IS_BROXTON(dev))
                        dev_priv->display.hpd_irq_setup = bxt_hpd_irq_setup;
-               else if (HAS_PCH_SPT(dev))
+               else if (HAS_PCH_SPT(dev) || HAS_PCH_KBP(dev))
                        dev_priv->display.hpd_irq_setup = spt_hpd_irq_setup;
                else
                        dev_priv->display.hpd_irq_setup = ilk_hpd_irq_setup;
diff -r e380230b0208 -r cfc79e6674f4 sys/external/bsd/drm2/dist/drm/i915/i915_reg.h



Home | Main Index | Thread Index | Old Index