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 i915: more work
details: https://anonhg.NetBSD.org/src/rev/1e288408b758
branches: trunk
changeset: 1028680:1e288408b758
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 11:45:01 2021 +0000
description:
i915: more work
diffstat:
sys/external/bsd/drm2/dist/drm/i915/display/intel_fbdev.c | 6 +-
sys/external/bsd/drm2/dist/drm/i915/display/intel_gmbus.c | 100 ++-
sys/external/bsd/drm2/dist/drm/i915/display/intel_hdmi.c | 6 +-
sys/external/bsd/drm2/dist/drm/i915/gt/intel_gt_pm.c | 8 +-
sys/external/bsd/drm2/dist/drm/i915/gt/intel_gt_requests.c | 14 +-
sys/external/bsd/drm2/dist/drm/i915/gt/intel_gtt.c | 40 +-
sys/external/bsd/drm2/dist/drm/i915/gt/uc/intel_guc.c | 6 +-
sys/external/bsd/drm2/dist/drm/i915/gt/uc/intel_guc_ct.c | 30 +-
sys/external/bsd/drm2/dist/drm/i915/gt/uc/intel_guc_submission.c | 6 +-
sys/external/bsd/drm2/dist/drm/i915/i915_irq.c | 12 +-
sys/external/bsd/drm2/i915drm/files.i915drmkms | 10 +-
sys/external/bsd/drm2/i915drm/intel_gtt.c | 244 ---------
sys/external/bsd/drm2/i915drm/intel_gtt_subr.c | 246 ++++++++++
sys/external/bsd/drm2/include/linux/atomic.h | 7 +-
sys/external/bsd/drm2/include/linux/kref.h | 20 +-
sys/external/bsd/drm2/include/linux/preempt.h | 3 +-
sys/external/bsd/drm2/include/linux/random.h | 12 +-
sys/external/bsd/drm2/include/linux/sched/signal.h | 11 +-
sys/external/bsd/drm2/include/linux/string.h | 23 +-
19 files changed, 443 insertions(+), 361 deletions(-)
diffs (truncated from 1375 to 300 lines):
diff -r 9b06ac60eafe -r 1e288408b758 sys/external/bsd/drm2/dist/drm/i915/display/intel_fbdev.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_fbdev.c Sun Dec 19 11:40:13 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_fbdev.c Sun Dec 19 11:45:01 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_fbdev.c,v 1.7 2021/12/19 11:39:45 riastradh Exp $ */
+/* $NetBSD: intel_fbdev.c,v 1.8 2021/12/19 11:45:01 riastradh Exp $ */
/*
* Copyright © 2007 David Airlie
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_fbdev.c,v 1.7 2021/12/19 11:39:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_fbdev.c,v 1.8 2021/12/19 11:45:01 riastradh Exp $");
#include <linux/async.h>
#include <linux/console.h>
@@ -590,6 +590,7 @@
* processing, fbdev will perform a full connector reprobe if a hotplug event
* was received while HPD was suspended.
*/
+#ifndef __NetBSD__ /* XXX fb suspend */
static void intel_fbdev_hpd_set_suspend(struct intel_fbdev *ifbdev, int state)
{
bool send_hpd = false;
@@ -605,6 +606,7 @@
drm_fb_helper_hotplug_event(&ifbdev->helper);
}
}
+#endif /* __NetBSD__ */
void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous)
{
diff -r 9b06ac60eafe -r 1e288408b758 sys/external/bsd/drm2/dist/drm/i915/display/intel_gmbus.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_gmbus.c Sun Dec 19 11:40:13 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_gmbus.c Sun Dec 19 11:45:01 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_gmbus.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $ */
+/* $NetBSD: intel_gmbus.c,v 1.3 2021/12/19 11:45:01 riastradh Exp $ */
/*
* Copyright (c) 2006 Dave Airlie <airlied%linux.ie@localhost>
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_gmbus.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gmbus.c,v 1.3 2021/12/19 11:45:01 riastradh Exp $");
#include <linux/export.h>
#include <linux/i2c-algo-bit.h>
@@ -332,9 +332,6 @@
static int gmbus_wait(struct drm_i915_private *dev_priv, u32 status, u32 irq_en)
{
-#ifndef __NetBSD__
- DEFINE_WAIT(wait);
-#endif
u32 gmbus2;
int ret;
@@ -342,24 +339,42 @@
* we also need to check for NAKs besides the hw ready/idle signal, we
* need to wake up periodically and check that ourselves.
*/
-#ifdef __NetBSD__
- if (cold || !HAS_GMBUS_IRQ(dev_priv->dev))
+ if (!HAS_GMBUS_IRQ(dev_priv))
irq_en = 0;
-#else
- if (!HAS_GMBUS_IRQ(dev_priv))
+#ifdef __NetBSD__
+ if (cold)
irq_en = 0;
#endif
- add_wait_queue(&dev_priv->gmbus_wait_queue, &wait);
+ spin_lock(&dev_priv->gmbus_wait_lock);
I915_WRITE_FW(GMBUS4, irq_en);
status |= GMBUS_SATOER;
- ret = wait_for_us((gmbus2 = I915_READ_FW(GMBUS2)) & status, 2);
- if (ret)
- ret = wait_for((gmbus2 = I915_READ_FW(GMBUS2)) & status, 50);
+ if (!irq_en) {
+ unsigned timeout = 10*1000;
+
+ ret = 0;
+ while ((gmbus2 = intel_uncore_read_fw(&dev_priv->uncore,
+ GMBUS2)) & GMBUS_ACTIVE) {
+ if (--timeout == 0) {
+ ret = -ETIMEDOUT;
+ break;
+ }
+ udelay(1);
+ }
+ } else {
+ DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret,
+ &dev_priv->gmbus_wait_queue,
+ &dev_priv->gmbus_wait_lock,
+ msecs_to_jiffies_timeout(10),
+ (((gmbus2 = intel_uncore_read_fw(&dev_priv->uncore,
+ GMBUS2))
+ & GMBUS_ACTIVE)
+ == 0));
+ }
I915_WRITE_FW(GMBUS4, 0);
- remove_wait_queue(&dev_priv->gmbus_wait_queue, &wait);
+ spin_unlock(&dev_priv->gmbus_wait_lock);
if (gmbus2 & GMBUS_SATOER)
return -ENXIO;
@@ -370,37 +385,45 @@
static int
gmbus_wait_idle(struct drm_i915_private *dev_priv)
{
- DEFINE_WAIT(wait);
u32 irq_enable;
int ret;
/* Important: The hw handles only the first bit, so set only one! */
irq_enable = 0;
-#ifdef __NetBSD__
- if (cold || !HAS_GMBUS_IRQ(dev_priv->dev))
- irq_enable = GMBUS_IDLE_EN;
-#else
if (HAS_GMBUS_IRQ(dev_priv))
irq_enable = GMBUS_IDLE_EN;
+#ifdef __NetBSD__
+ if (cold)
+ irq_enable = 0;
#endif
- add_wait_queue(&dev_priv->gmbus_wait_queue, &wait);
+ spin_lock(&dev_priv->gmbus_wait_lock);
I915_WRITE_FW(GMBUS4, irq_enable);
-#ifdef __NetBSD__ /* XXX post-merge audit */
- spin_lock(&dev_priv->gmbus_wait_lock);
- DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret, &dev_priv->gmbus_wait_queue,
- &dev_priv->gmbus_wait_lock, msecs_to_jiffies_timeout(10),
- C);
- spin_unlock(&dev_priv->gmbus_wait_lock);
-#else
- ret = intel_wait_for_register_fw(&dev_priv->uncore,
- GMBUS2, GMBUS_ACTIVE, 0,
- 10);
-#endif
+ if (!irq_enable) {
+ unsigned timeout = 10*1000;
+
+ ret = 0;
+ while (intel_uncore_read_fw(&dev_priv->uncore, GMBUS2)
+ & GMBUS_ACTIVE) {
+ if (--timeout == 0) {
+ ret = -ETIMEDOUT;
+ break;
+ }
+ udelay(1);
+ }
+ } else {
+ DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret,
+ &dev_priv->gmbus_wait_queue,
+ &dev_priv->gmbus_wait_lock,
+ msecs_to_jiffies_timeout(10),
+ ((intel_uncore_read_fw(&dev_priv->uncore, GMBUS2)
+ & GMBUS_ACTIVE)
+ == 0));
+ }
I915_WRITE_FW(GMBUS4, 0);
- remove_wait_queue(&dev_priv->gmbus_wait_queue, &wait);
+ spin_unlock(&dev_priv->gmbus_wait_lock);
return ret;
}
@@ -858,7 +881,6 @@
*/
int intel_gmbus_setup(struct drm_i915_private *dev_priv)
{
- struct pci_dev *pdev = dev_priv->drm.pdev;
struct intel_gmbus *bus;
unsigned int pin;
int ret;
@@ -877,12 +899,8 @@
mutex_init(&dev_priv->gmbus_mutex);
-#ifdef __NetBSD__
spin_lock_init(&dev_priv->gmbus_wait_lock);
DRM_INIT_WAITQUEUE(&dev_priv->gmbus_wait_queue, "i915i2c");
-#else
- init_waitqueue_head(&dev_priv->gmbus_wait_queue);
-#endif
for (pin = 0; pin < ARRAY_SIZE(dev_priv->gmbus); pin++) {
if (!intel_gmbus_is_valid_pin(dev_priv, pin))
@@ -897,11 +915,7 @@
"i915 gmbus %s",
get_gmbus_pin(dev_priv, pin)->name);
-#ifdef __NetBSD__
- bus->adapter.dev.parent = dev->dev;
-#else
- bus->adapter.dev.parent = &pdev->dev;
-#endif
+ bus->adapter.dev.parent = dev_priv->drm.dev;
bus->dev_priv = dev_priv;
bus->adapter.algo = &gmbus_algorithm;
@@ -993,9 +1007,7 @@
i2c_del_adapter(&bus->adapter);
}
-#ifdef __NetBSD__
DRM_DESTROY_WAITQUEUE(&dev_priv->gmbus_wait_queue);
spin_lock_destroy(&dev_priv->gmbus_wait_lock);
-#endif
mutex_destroy(&dev_priv->gmbus_mutex);
}
diff -r 9b06ac60eafe -r 1e288408b758 sys/external/bsd/drm2/dist/drm/i915/display/intel_hdmi.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_hdmi.c Sun Dec 19 11:40:13 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_hdmi.c Sun Dec 19 11:45:01 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_hdmi.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $ */
+/* $NetBSD: intel_hdmi.c,v 1.3 2021/12/19 11:45:01 riastradh Exp $ */
/*
* Copyright 2006 Dave Airlie <airlied%linux.ie@localhost>
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_hdmi.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_hdmi.c,v 1.3 2021/12/19 11:45:01 riastradh Exp $");
#include <linux/delay.h>
#include <linux/hdmi.h>
@@ -555,7 +555,7 @@
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
- u32 val, *data = frame;
+ u32 val __unused, *data = frame;
int i;
val = I915_READ(HSW_TVIDEO_DIP_CTL(cpu_transcoder));
diff -r 9b06ac60eafe -r 1e288408b758 sys/external/bsd/drm2/dist/drm/i915/gt/intel_gt_pm.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/intel_gt_pm.c Sun Dec 19 11:40:13 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_gt_pm.c Sun Dec 19 11:45:01 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_gt_pm.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $ */
+/* $NetBSD: intel_gt_pm.c,v 1.3 2021/12/19 11:45:01 riastradh Exp $ */
/*
* SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_gt_pm.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gt_pm.c,v 1.3 2021/12/19 11:45:01 riastradh Exp $");
#include <linux/suspend.h>
@@ -273,6 +273,7 @@
intel_uc_suspend(>->uc);
}
+#ifndef __NetBSD__ /* XXX i915 pm */
static suspend_state_t pm_suspend_target(void)
{
#if IS_ENABLED(CONFIG_SUSPEND) && IS_ENABLED(CONFIG_PM_SLEEP)
@@ -281,6 +282,7 @@
return PM_SUSPEND_TO_IDLE;
#endif
}
+#endif
void intel_gt_suspend_late(struct intel_gt *gt)
{
@@ -294,6 +296,7 @@
GEM_BUG_ON(gt->awake);
+#ifndef __NetBSD__
/*
* On disabling the device, we want to turn off HW access to memory
* that we no longer own.
@@ -306,6 +309,7 @@
*/
if (pm_suspend_target() == PM_SUSPEND_TO_IDLE)
return;
+#endif
with_intel_runtime_pm(gt->uncore->rpm, wakeref) {
intel_rps_disable(>->rps);
diff -r 9b06ac60eafe -r 1e288408b758 sys/external/bsd/drm2/dist/drm/i915/gt/intel_gt_requests.c
Home |
Main Index |
Thread Index |
Old Index