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/i915 Distribute local changes...
details: https://anonhg.NetBSD.org/src/rev/0f4c3c2de5fb
branches: trunk
changeset: 1028295:0f4c3c2de5fb
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 10:28:31 2021 +0000
description:
Distribute local changes from i915_dma.c
diffstat:
sys/external/bsd/drm2/dist/drm/i915/gt/intel_ggtt.c | 42 +-
sys/external/bsd/drm2/dist/drm/i915/i915_dma.c | 1424 -------------------
sys/external/bsd/drm2/dist/drm/i915/i915_drv.c | 22 +-
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c | 11 +-
sys/external/bsd/drm2/dist/drm/i915/intel_uncore.c | 14 +-
5 files changed, 76 insertions(+), 1437 deletions(-)
diffs (truncated from 1667 to 300 lines):
diff -r ae86e9d81d99 -r 0f4c3c2de5fb sys/external/bsd/drm2/dist/drm/i915/gt/intel_ggtt.c
--- a/sys/external/bsd/drm2/dist/drm/i915/gt/intel_ggtt.c Sun Dec 19 10:25:15 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/gt/intel_ggtt.c Sun Dec 19 10:28:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_ggtt.c,v 1.4 2021/12/19 01:35:35 riastradh Exp $ */
+/* $NetBSD: intel_ggtt.c,v 1.5 2021/12/19 10:28:31 riastradh Exp $ */
// SPDX-License-Identifier: MIT
/*
@@ -6,7 +6,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_ggtt.c,v 1.4 2021/12/19 01:35:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_ggtt.c,v 1.5 2021/12/19 10:28:31 riastradh Exp $");
#include <linux/stop_machine.h>
@@ -57,12 +57,25 @@
ggtt->vm.mm.color_adjust = i915_ggtt_color_adjust;
if (ggtt->mappable_end) {
+#ifdef __NetBSD__
+ if (!drm_io_mapping_init_wc(&i915->drm, &ggtt->iomap,
+ ggtt->gmadr.start, ggtt->mappable_end)) {
+ ggtt->vm.cleanup(&ggtt->vm);
+ return -EIO;
+ }
+ /*
+ * Note: mappable_end is the size, not end paddr, of
+ * the aperture.
+ */
+ pmap_pv_track(ggtt->gmadr.start, ggtt->mappable_end);
+#else
if (!io_mapping_init_wc(&ggtt->iomap,
ggtt->gmadr.start,
ggtt->mappable_end)) {
ggtt->vm.cleanup(&ggtt->vm);
return -EIO;
}
+#endif
ggtt->mtrr = arch_phys_wc_add(ggtt->gmadr.start,
ggtt->mappable_end);
@@ -807,6 +820,11 @@
mutex_unlock(&ggtt->vm.mutex);
i915_address_space_fini(&ggtt->vm);
+#ifdef __NetBSD__
+ if (ggtt->mappable_end)
+ pmap_pv_untrack(ggtt->gmadr.start, ggtt->mappable_end);
+#endif
+
arch_phys_wc_del(ggtt->mtrr);
if (ggtt->iomap.size)
@@ -1217,16 +1235,16 @@
#ifdef __NetBSD__
ggtt->gmadr.start = gmadr_base;
- /* Based on i915_drv.c, i915_driver_init_hw. */
+ /* Based on i915_drv.c, i915_driver_hw_probe. */
if (INTEL_INFO(dev)->gen <= 2)
- dev_priv->ggtt.max_paddr = DMA_BIT_MASK(30);
+ ggtt->max_paddr = DMA_BIT_MASK(30);
else if ((INTEL_INFO(dev)->gen <= 3) ||
IS_BROADWATER(dev) || IS_CRESTLINE(dev))
- dev_priv->ggtt.max_paddr = DMA_BIT_MASK(32);
+ ggtt->max_paddr = DMA_BIT_MASK(32);
else if (INTEL_INFO(dev)->gen <= 5)
- dev_priv->ggtt.max_paddr = DMA_BIT_MASK(36);
+ ggtt->max_paddr = DMA_BIT_MASK(36);
else
- dev_priv->ggtt.max_paddr = DMA_BIT_MASK(40);
+ ggtt->max_paddr = DMA_BIT_MASK(40);
#else
ggtt->gmadr =
(struct resource)DEFINE_RES_MEM(gmadr_base, ggtt->mappable_end);
@@ -1274,6 +1292,16 @@
if (ret)
return ret;
+#ifdef __NetBSD__
+ ggtt->pgfl = x86_select_freelist(ggtt->max_paddr);
+ ret = drm_limit_dma_space(&i915->drm, 0, ggtt->max_paddr);
+ if (ret) {
+ DRM_ERROR("Unable to limit DMA paddr allocations: %d\n", ret);
+ i915_ggtt_driver_release(i915);
+ return ret;
+ }
+#endif
+
if ((ggtt->vm.total - 1) >> 32) {
DRM_ERROR("We never expected a Global GTT with more than 32bits"
" of address space! Found %lldM!\n",
diff -r ae86e9d81d99 -r 0f4c3c2de5fb sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c Sun Dec 19 10:25:15 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1424 +0,0 @@
-/* $NetBSD: i915_dma.c,v 1.34 2021/12/19 01:24:25 riastradh Exp $ */
-
-/* i915_dma.c -- DMA support for the I915 -*- linux-c -*-
- */
-/*
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_dma.c,v 1.34 2021/12/19 01:24:25 riastradh Exp $");
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/async.h>
-#include <drm/drmP.h>
-#include <drm/drm_crtc_helper.h>
-#include <drm/drm_fb_helper.h>
-#include <drm/drm_legacy.h>
-#include "intel_drv.h"
-#include <drm/i915_drm.h>
-#include "i915_drv.h"
-#include "i915_vgpu.h"
-#include "i915_trace.h"
-#include <linux/pci.h>
-#include <linux/console.h>
-#include <linux/vt.h>
-#include <linux/vgaarb.h>
-#include <linux/acpi.h>
-#include <linux/pnp.h>
-#include <linux/vga_switcheroo.h>
-#include <linux/slab.h>
-#include <acpi/video.h>
-#include <linux/pm.h>
-#include <linux/pm_runtime.h>
-#include <linux/oom.h>
-
-#include <linux/nbsd-namespace.h>
-
-static int i915_getparam(struct drm_device *dev, void *data,
- struct drm_file *file_priv)
-{
- struct drm_i915_private *dev_priv = dev->dev_private;
- drm_i915_getparam_t *param = data;
- int value;
-
- switch (param->param) {
- case I915_PARAM_IRQ_ACTIVE:
- case I915_PARAM_ALLOW_BATCHBUFFER:
- case I915_PARAM_LAST_DISPATCH:
- /* Reject all old ums/dri params. */
- return -ENODEV;
- case I915_PARAM_CHIPSET_ID:
- value = dev->pdev->device;
- break;
- case I915_PARAM_REVISION:
- value = dev->pdev->revision;
- break;
- case I915_PARAM_HAS_GEM:
- value = 1;
- break;
- case I915_PARAM_NUM_FENCES_AVAIL:
- value = dev_priv->num_fence_regs;
- break;
- case I915_PARAM_HAS_OVERLAY:
- value = dev_priv->overlay ? 1 : 0;
- break;
- case I915_PARAM_HAS_PAGEFLIPPING:
- value = 1;
- break;
- case I915_PARAM_HAS_EXECBUF2:
- /* depends on GEM */
- value = 1;
- break;
- case I915_PARAM_HAS_BSD:
- value = intel_ring_initialized(&dev_priv->ring[VCS]);
- break;
- case I915_PARAM_HAS_BLT:
- value = intel_ring_initialized(&dev_priv->ring[BCS]);
- break;
- case I915_PARAM_HAS_VEBOX:
- value = intel_ring_initialized(&dev_priv->ring[VECS]);
- break;
- case I915_PARAM_HAS_BSD2:
- value = intel_ring_initialized(&dev_priv->ring[VCS2]);
- break;
- case I915_PARAM_HAS_RELAXED_FENCING:
- value = 1;
- break;
- case I915_PARAM_HAS_COHERENT_RINGS:
- value = 1;
- break;
- case I915_PARAM_HAS_EXEC_CONSTANTS:
- value = INTEL_INFO(dev)->gen >= 4;
- break;
- case I915_PARAM_HAS_RELAXED_DELTA:
- value = 1;
- break;
- case I915_PARAM_HAS_GEN7_SOL_RESET:
- value = 1;
- break;
- case I915_PARAM_HAS_LLC:
- value = HAS_LLC(dev);
- break;
- case I915_PARAM_HAS_WT:
- value = HAS_WT(dev);
- break;
- case I915_PARAM_HAS_ALIASING_PPGTT:
- value = USES_PPGTT(dev);
- break;
- case I915_PARAM_HAS_WAIT_TIMEOUT:
- value = 1;
- break;
- case I915_PARAM_HAS_SEMAPHORES:
- value = i915_semaphore_is_enabled(dev);
- break;
- case I915_PARAM_HAS_PRIME_VMAP_FLUSH:
- value = 1;
- break;
- case I915_PARAM_HAS_SECURE_BATCHES:
- value = HAS_SECURE_BATCHES(dev_priv) && capable(CAP_SYS_ADMIN);
- break;
- case I915_PARAM_HAS_PINNED_BATCHES:
- value = 1;
- break;
- case I915_PARAM_HAS_EXEC_NO_RELOC:
- value = 1;
- break;
- case I915_PARAM_HAS_EXEC_HANDLE_LUT:
- value = 1;
- break;
- case I915_PARAM_CMD_PARSER_VERSION:
- value = i915_cmd_parser_get_version(dev_priv);
- break;
- case I915_PARAM_HAS_COHERENT_PHYS_GTT:
- value = 1;
- break;
- case I915_PARAM_MMAP_VERSION:
-#ifdef __NetBSD__
- dev_priv->quirks |= QUIRK_NETBSD_VERSION_CALLED;
-#endif
- value = 1;
- break;
- case I915_PARAM_SUBSLICE_TOTAL:
- value = INTEL_INFO(dev)->subslice_total;
- if (!value)
- return -ENODEV;
- break;
- case I915_PARAM_EU_TOTAL:
- value = INTEL_INFO(dev)->eu_total;
- if (!value)
- return -ENODEV;
- break;
- case I915_PARAM_HAS_GPU_RESET:
- value = i915.enable_hangcheck &&
- intel_has_gpu_reset(dev);
- break;
- case I915_PARAM_HAS_RESOURCE_STREAMER:
- value = HAS_RESOURCE_STREAMER(dev);
- break;
- default:
- DRM_DEBUG("Unknown parameter %d\n", param->param);
- return -EINVAL;
- }
-
- if (copy_to_user(param->value, &value, sizeof(int))) {
- DRM_ERROR("copy_to_user failed\n");
- return -EFAULT;
- }
-
- return 0;
-}
-
-static int i915_get_bridge_dev(struct drm_device *dev)
-{
- struct drm_i915_private *dev_priv = dev->dev_private;
-
- dev_priv->bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
- if (!dev_priv->bridge_dev) {
- DRM_ERROR("bridge device not found\n");
Home |
Main Index |
Thread Index |
Old Index