Mon Aug 27 06:08:25 2018 UTC ()
some more definitions necessary

ifdef out all the i915 gtt virtual memory stuff that errors,
unless it looks exactly like the old code and then merge the
netbsd ifdefs for it.

we don't want to use their ALIGN(, which has more arguments,
use the old alt function.
merge in the old intel_acpi.c code.
don't duplicate DECLARE_BITMAP

Author: coypu <coypu@sdf.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>


(riastradh)
diff -r1.11 -r1.12 src/sys/external/bsd/common/include/linux/kernel.h
diff -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c
diff -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
diff -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.h
diff -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c
diff -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/hashtable.h

cvs diff -r1.11 -r1.12 src/sys/external/bsd/common/include/linux/kernel.h (expand / switch to unified diff)

--- src/sys/external/bsd/common/include/linux/kernel.h 2018/08/27 06:07:20 1.11
+++ src/sys/external/bsd/common/include/linux/kernel.h 2018/08/27 06:08:25 1.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kernel.h,v 1.11 2018/08/27 06:07:20 riastradh Exp $ */ 1/* $NetBSD: kernel.h,v 1.12 2018/08/27 06:08:25 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -30,26 +30,30 @@ @@ -30,26 +30,30 @@
30 */ 30 */
31 31
32#ifndef _LINUX_KERNEL_H_ 32#ifndef _LINUX_KERNEL_H_
33#define _LINUX_KERNEL_H_ 33#define _LINUX_KERNEL_H_
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36#include <sys/types.h> 36#include <sys/types.h>
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39 39
40#include <lib/libkern/libkern.h> 40#include <lib/libkern/libkern.h>
41#include <linux/printk.h> 41#include <linux/printk.h>
42 42
 43#define U16_MAX UINT16_MAX
 44#define U32_MAX UINT32_MAX
 45#define U64_MAX UINT64_MAX
 46
43#define oops_in_progress (panicstr != NULL) 47#define oops_in_progress (panicstr != NULL)
44 48
45#define IS_ENABLED(option) (option) 49#define IS_ENABLED(option) (option)
46#define IS_BUILTIN(option) (1) /* Probably... */ 50#define IS_BUILTIN(option) (1) /* Probably... */
47 51
48#define __printf __printflike 52#define __printf __printflike
49#define __user 53#define __user
50#define __must_check /* __attribute__((warn_unused_result)), if GCC */ 54#define __must_check /* __attribute__((warn_unused_result)), if GCC */
51#define __always_unused __unused 55#define __always_unused __unused
52 56
53#define barrier() __insn_barrier() 57#define barrier() __insn_barrier()
54#define likely(X) __predict_true(X) 58#define likely(X) __predict_true(X)
55#define unlikely(X) __predict_false(X) 59#define unlikely(X) __predict_false(X)

cvs diff -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c 2018/08/27 04:58:23 1.5
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.c 2018/08/27 06:08:25 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i915_gem_gtt.c,v 1.5 2018/08/27 04:58:23 riastradh Exp $ */ 1/* $NetBSD: i915_gem_gtt.c,v 1.6 2018/08/27 06:08:25 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright © 2010 Daniel Vetter 4 * Copyright © 2010 Daniel Vetter
5 * Copyright © 2011-2014 Intel Corporation 5 * Copyright © 2011-2014 Intel Corporation
6 * 6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a 7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"), 8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation 9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the 11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions: 12 * Software is furnished to do so, subject to the following conditions:
13 * 13 *
14 * The above copyright notice and this permission notice (including the next 14 * The above copyright notice and this permission notice (including the next
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * Software. 16 * Software.
17 * 17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * IN THE SOFTWARE. 24 * IN THE SOFTWARE.
25 * 25 *
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: i915_gem_gtt.c,v 1.5 2018/08/27 04:58:23 riastradh Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: i915_gem_gtt.c,v 1.6 2018/08/27 06:08:25 riastradh Exp $");
30 30
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#include <drm/drmP.h> 33#include <drm/drmP.h>
34#include <drm/i915_drm.h> 34#include <drm/i915_drm.h>
35#include "i915_drv.h" 35#include "i915_drv.h"
36#include "i915_vgpu.h" 36#include "i915_vgpu.h"
37#include "i915_trace.h" 37#include "i915_trace.h"
38#include "intel_drv.h" 38#include "intel_drv.h"
39 39
40#ifdef __NetBSD__ 40#ifdef __NetBSD__
41#include <x86/machdep.h> 41#include <x86/machdep.h>
42#include <x86/pte.h> 42#include <x86/pte.h>
@@ -1676,27 +1676,26 @@ static void gen6_write_pde(struct i915_p @@ -1676,27 +1676,26 @@ static void gen6_write_pde(struct i915_p
1676 const bus_space_handle_t bsh = dev_priv->gtt.bsh; 1676 const bus_space_handle_t bsh = dev_priv->gtt.bsh;
1677 const bus_addr_t pd_base = ppgtt->pd.base.ggtt_offset; 1677 const bus_addr_t pd_base = ppgtt->pd.base.ggtt_offset;
1678#endif 1678#endif
1679 u32 pd_entry; 1679 u32 pd_entry;
1680 1680
1681 pd_entry = GEN6_PDE_ADDR_ENCODE(px_dma(pt)); 1681 pd_entry = GEN6_PDE_ADDR_ENCODE(px_dma(pt));
1682 pd_entry |= GEN6_PDE_VALID; 1682 pd_entry |= GEN6_PDE_VALID;
1683 1683
1684#ifdef __NetBSD__ 1684#ifdef __NetBSD__
1685 bus_space_write_4(bst, bsh, pd_base + pde, pd_entry); 1685 bus_space_write_4(bst, bsh, pd_base + pde, pd_entry);
1686#else 1686#else
1687 writel(pd_entry, ppgtt->pd_addr + pde); 1687 writel(pd_entry, ppgtt->pd_addr + pde);
1688#endif 1688#endif
1689 
1690} 1689}
1691 1690
1692/* Write all the page tables found in the ppgtt structure to incrementing page 1691/* Write all the page tables found in the ppgtt structure to incrementing page
1693 * directories. */ 1692 * directories. */
1694static void gen6_write_page_range(struct drm_i915_private *dev_priv, 1693static void gen6_write_page_range(struct drm_i915_private *dev_priv,
1695 struct i915_page_directory *pd, 1694 struct i915_page_directory *pd,
1696 uint32_t start, uint32_t length) 1695 uint32_t start, uint32_t length)
1697{ 1696{
1698 struct i915_page_table *pt; 1697 struct i915_page_table *pt;
1699 uint32_t pde, temp; 1698 uint32_t pde, temp;
1700 1699
1701 gen6_for_each_pde(pt, pd, start, length, temp, pde) 1700 gen6_for_each_pde(pt, pd, start, length, temp, pde)
1702 gen6_write_pde(pd, pde, pt); 1701 gen6_write_pde(pd, pde, pt);
@@ -3311,27 +3310,26 @@ static int gen6_gmch_probe(struct drm_de @@ -3311,27 +3310,26 @@ static int gen6_gmch_probe(struct drm_de
3311 3310
3312 dev_priv->gtt.base.clear_range = gen6_ggtt_clear_range; 3311 dev_priv->gtt.base.clear_range = gen6_ggtt_clear_range;
3313 dev_priv->gtt.base.insert_entries = gen6_ggtt_insert_entries; 3312 dev_priv->gtt.base.insert_entries = gen6_ggtt_insert_entries;
3314 dev_priv->gtt.base.bind_vma = ggtt_bind_vma; 3313 dev_priv->gtt.base.bind_vma = ggtt_bind_vma;
3315 dev_priv->gtt.base.unbind_vma = ggtt_unbind_vma; 3314 dev_priv->gtt.base.unbind_vma = ggtt_unbind_vma;
3316 3315
3317 dev_priv->gtt.max_paddr = __BITS(39, 0); 3316 dev_priv->gtt.max_paddr = __BITS(39, 0);
3318 3317
3319 return ret; 3318 return ret;
3320} 3319}
3321 3320
3322static void gen6_gmch_remove(struct i915_address_space *vm) 3321static void gen6_gmch_remove(struct i915_address_space *vm)
3323{ 3322{
3324 
3325 struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base); 3323 struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base);
3326 3324
3327#ifdef __NetBSD__ 3325#ifdef __NetBSD__
3328 bus_space_unmap(gtt->bst, gtt->bsh, gtt->size); 3326 bus_space_unmap(gtt->bst, gtt->bsh, gtt->size);
3329#else 3327#else
3330 iounmap(gtt->gsm); 3328 iounmap(gtt->gsm);
3331#endif 3329#endif
3332 free_scratch_page(vm->dev, vm->scratch_page); 3330 free_scratch_page(vm->dev, vm->scratch_page);
3333} 3331}
3334 3332
3335static int i915_gmch_probe(struct drm_device *dev, 3333static int i915_gmch_probe(struct drm_device *dev,
3336 u64 *gtt_total, 3334 u64 *gtt_total,
3337 size_t *stolen, 3335 size_t *stolen,
@@ -3564,57 +3562,64 @@ i915_gem_obj_lookup_or_create_ggtt_vma(s @@ -3564,57 +3562,64 @@ i915_gem_obj_lookup_or_create_ggtt_vma(s
3564 3562
3565 if (!vma) 3563 if (!vma)
3566 vma = __i915_gem_vma_create(obj, ggtt, view); 3564 vma = __i915_gem_vma_create(obj, ggtt, view);
3567 3565
3568 return vma; 3566 return vma;
3569 3567
3570} 3568}
3571 3569
3572static struct scatterlist * 3570static struct scatterlist *
3573rotate_pages(dma_addr_t *in, unsigned int offset, 3571rotate_pages(dma_addr_t *in, unsigned int offset,
3574 unsigned int width, unsigned int height, 3572 unsigned int width, unsigned int height,
3575 struct sg_table *st, struct scatterlist *sg) 3573 struct sg_table *st, struct scatterlist *sg)
3576{ 3574{
 3575#ifdef __NetBSD__
 3576 panic("XXX");
 3577#else
3577 unsigned int column, row; 3578 unsigned int column, row;
3578 unsigned int src_idx; 3579 unsigned int src_idx;
3579 3580
3580 if (!sg) { 3581 if (!sg) {
3581 st->nents = 0; 3582 st->nents = 0;
3582 sg = st->sgl; 3583 sg = st->sgl;
3583 } 3584 }
3584 3585
3585 for (column = 0; column < width; column++) { 3586 for (column = 0; column < width; column++) {
3586 src_idx = width * (height - 1) + column; 3587 src_idx = width * (height - 1) + column;
3587 for (row = 0; row < height; row++) { 3588 for (row = 0; row < height; row++) {
3588 st->nents++; 3589 st->nents++;
3589 /* We don't need the pages, but need to initialize 3590 /* We don't need the pages, but need to initialize
3590 * the entries so the sg list can be happily traversed. 3591 * the entries so the sg list can be happily traversed.
3591 * The only thing we need are DMA addresses. 3592 * The only thing we need are DMA addresses.
3592 */ 3593 */
3593 sg_set_page(sg, NULL, PAGE_SIZE, 0); 3594 sg_set_page(sg, NULL, PAGE_SIZE, 0);
3594 sg_dma_address(sg) = in[offset + src_idx]; 3595 sg_dma_address(sg) = in[offset + src_idx];
3595 sg_dma_len(sg) = PAGE_SIZE; 3596 sg_dma_len(sg) = PAGE_SIZE;
3596 sg = sg_next(sg); 3597 sg = sg_next(sg);
3597 src_idx -= width; 3598 src_idx -= width;
3598 } 3599 }
3599 } 3600 }
3600 3601
3601 return sg; 3602 return sg;
 3603#endif
3602} 3604}
3603 3605
3604static struct sg_table * 3606static struct sg_table *
3605intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view, 3607intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
3606 struct drm_i915_gem_object *obj) 3608 struct drm_i915_gem_object *obj)
3607{ 3609{
 3610#ifdef __NetBSD__
 3611 panic("XXX");
 3612#else
3608 struct intel_rotation_info *rot_info = &ggtt_view->rotation_info; 3613 struct intel_rotation_info *rot_info = &ggtt_view->rotation_info;
3609 unsigned int size_pages = rot_info->size >> PAGE_SHIFT; 3614 unsigned int size_pages = rot_info->size >> PAGE_SHIFT;
3610 unsigned int size_pages_uv; 3615 unsigned int size_pages_uv;
3611 struct sg_page_iter sg_iter; 3616 struct sg_page_iter sg_iter;
3612 unsigned long i; 3617 unsigned long i;
3613 dma_addr_t *page_addr_list; 3618 dma_addr_t *page_addr_list;
3614 struct sg_table *st; 3619 struct sg_table *st;
3615 unsigned int uv_start_page; 3620 unsigned int uv_start_page;
3616 struct scatterlist *sg; 3621 struct scatterlist *sg;
3617 int ret = -ENOMEM; 3622 int ret = -ENOMEM;
3618 3623
3619 /* Allocate a temporary list of source pages for random access. */ 3624 /* Allocate a temporary list of source pages for random access. */
3620 page_addr_list = drm_malloc_ab(obj->base.size / PAGE_SIZE, 3625 page_addr_list = drm_malloc_ab(obj->base.size / PAGE_SIZE,
@@ -3678,32 +3683,36 @@ intel_rotate_fb_obj_pages(struct i915_gg @@ -3678,32 +3683,36 @@ intel_rotate_fb_obj_pages(struct i915_gg
3678 3683
3679err_sg_alloc: 3684err_sg_alloc:
3680 kfree(st); 3685 kfree(st);
3681err_st_alloc: 3686err_st_alloc:
3682 drm_free_large(page_addr_list); 3687 drm_free_large(page_addr_list);
3683 3688
3684 DRM_DEBUG_KMS( 3689 DRM_DEBUG_KMS(
3685 "Failed to create rotated mapping for object size %zu! (%d) (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages (%u plane 0))\n", 3690 "Failed to create rotated mapping for object size %zu! (%d) (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages (%u plane 0))\n",
3686 obj->base.size, ret, rot_info->pitch, rot_info->height, 3691 obj->base.size, ret, rot_info->pitch, rot_info->height,
3687 rot_info->pixel_format, rot_info->width_pages, 3692 rot_info->pixel_format, rot_info->width_pages,
3688 rot_info->height_pages, size_pages + size_pages_uv, 3693 rot_info->height_pages, size_pages + size_pages_uv,
3689 size_pages); 3694 size_pages);
3690 return ERR_PTR(ret); 3695 return ERR_PTR(ret);
 3696#endif
3691} 3697}
3692 3698
3693static struct sg_table * 3699static struct sg_table *
3694intel_partial_pages(const struct i915_ggtt_view *view, 3700intel_partial_pages(const struct i915_ggtt_view *view,
3695 struct drm_i915_gem_object *obj) 3701 struct drm_i915_gem_object *obj)
3696{ 3702{
 3703#ifdef __NetBSD__
 3704 panic("XXX");
 3705#else
3697 struct sg_table *st; 3706 struct sg_table *st;
3698 struct scatterlist *sg; 3707 struct scatterlist *sg;
3699 struct sg_page_iter obj_sg_iter; 3708 struct sg_page_iter obj_sg_iter;
3700 int ret = -ENOMEM; 3709 int ret = -ENOMEM;
3701 3710
3702 st = kmalloc(sizeof(*st), GFP_KERNEL); 3711 st = kmalloc(sizeof(*st), GFP_KERNEL);
3703 if (!st) 3712 if (!st)
3704 goto err_st_alloc; 3713 goto err_st_alloc;
3705 3714
3706 ret = sg_alloc_table(st, view->params.partial.size, GFP_KERNEL); 3715 ret = sg_alloc_table(st, view->params.partial.size, GFP_KERNEL);
3707 if (ret) 3716 if (ret)
3708 goto err_sg_alloc; 3717 goto err_sg_alloc;
3709 3718
@@ -3719,26 +3728,27 @@ intel_partial_pages(const struct i915_gg @@ -3719,26 +3728,27 @@ intel_partial_pages(const struct i915_gg
3719 sg_dma_address(sg) = sg_page_iter_dma_address(&obj_sg_iter); 3728 sg_dma_address(sg) = sg_page_iter_dma_address(&obj_sg_iter);
3720 sg_dma_len(sg) = PAGE_SIZE; 3729 sg_dma_len(sg) = PAGE_SIZE;
3721 3730
3722 sg = sg_next(sg); 3731 sg = sg_next(sg);
3723 st->nents++; 3732 st->nents++;
3724 } 3733 }
3725 3734
3726 return st; 3735 return st;
3727 3736
3728err_sg_alloc: 3737err_sg_alloc:
3729 kfree(st); 3738 kfree(st);
3730err_st_alloc: 3739err_st_alloc:
3731 return ERR_PTR(ret); 3740 return ERR_PTR(ret);
 3741#endif
3732} 3742}
3733 3743
3734static int 3744static int
3735i915_get_ggtt_vma_pages(struct i915_vma *vma) 3745i915_get_ggtt_vma_pages(struct i915_vma *vma)
3736{ 3746{
3737 int ret = 0; 3747 int ret = 0;
3738 3748
3739 if (vma->ggtt_view.pages) 3749 if (vma->ggtt_view.pages)
3740 return 0; 3750 return 0;
3741 3751
3742 if (vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL) 3752 if (vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL)
3743 vma->ggtt_view.pages = vma->obj->pages; 3753 vma->ggtt_view.pages = vma->obj->pages;
3744 else if (vma->ggtt_view.type == I915_GGTT_VIEW_ROTATED) 3754 else if (vma->ggtt_view.type == I915_GGTT_VIEW_ROTATED)

cvs diff -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/i915/Attic/i915_gem_stolen.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/Attic/i915_gem_stolen.c 2018/08/27 04:58:23 1.5
+++ src/sys/external/bsd/drm2/dist/drm/i915/Attic/i915_gem_stolen.c 2018/08/27 06:08:25 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i915_gem_stolen.c,v 1.5 2018/08/27 04:58:23 riastradh Exp $ */ 1/* $NetBSD: i915_gem_stolen.c,v 1.6 2018/08/27 06:08:25 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright © 2008-2012 Intel Corporation 4 * Copyright © 2008-2012 Intel Corporation
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice (including the next 13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the 14 * paragraph) shall be included in all copies or substantial portions of the
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 * IN THE SOFTWARE. 23 * IN THE SOFTWARE.
24 * 24 *
25 * Authors: 25 * Authors:
26 * Eric Anholt <eric@anholt.net> 26 * Eric Anholt <eric@anholt.net>
27 * Chris Wilson <chris@chris-wilson.co.uk> 27 * Chris Wilson <chris@chris-wilson.co.uk>
28 * 28 *
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.5 2018/08/27 04:58:23 riastradh Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: i915_gem_stolen.c,v 1.6 2018/08/27 06:08:25 riastradh Exp $");
33 33
34#include <linux/printk.h> 34#include <linux/printk.h>
35#include <linux/err.h> 35#include <linux/err.h>
36#include <drm/drmP.h> 36#include <drm/drmP.h>
37#include <drm/i915_drm.h> 37#include <drm/i915_drm.h>
38#include "i915_drv.h" 38#include "i915_drv.h"
39 39
40#define KB(x) ((x) * 1024) 40#define KB(x) ((x) * 1024)
41#define MB(x) (KB(x) * 1024) 41#define MB(x) (KB(x) * 1024)
42 42
43/* 43/*
44 * The BIOS typically reserves some of the system's memory for the exclusive 44 * The BIOS typically reserves some of the system's memory for the exclusive
45 * use of the integrated graphics. This memory is no longer available for 45 * use of the integrated graphics. This memory is no longer available for
@@ -406,27 +406,31 @@ static void bdw_get_stolen_reserved(stru @@ -406,27 +406,31 @@ static void bdw_get_stolen_reserved(stru
406 * nothing reserved. */ 406 * nothing reserved. */
407 if (*base == 0) 407 if (*base == 0)
408 *size = 0; 408 *size = 0;
409 else 409 else
410 *size = stolen_top - *base; 410 *size = stolen_top - *base;
411} 411}
412 412
413int i915_gem_init_stolen(struct drm_device *dev) 413int i915_gem_init_stolen(struct drm_device *dev)
414{ 414{
415 struct drm_i915_private *dev_priv = dev->dev_private; 415 struct drm_i915_private *dev_priv = dev->dev_private;
416 unsigned long reserved_total, reserved_base = 0, reserved_size; 416 unsigned long reserved_total, reserved_base = 0, reserved_size;
417 unsigned long stolen_top; 417 unsigned long stolen_top;
418 418
 419#ifdef __NetBSD__
 420 linux_mutex_init(&dev_priv->mm.stolen_lock);
 421#else
419 mutex_init(&dev_priv->mm.stolen_lock); 422 mutex_init(&dev_priv->mm.stolen_lock);
 423#endif
420 424
421#ifdef CONFIG_INTEL_IOMMU 425#ifdef CONFIG_INTEL_IOMMU
422 if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) { 426 if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) {
423 DRM_INFO("DMAR active, disabling use of stolen memory\n"); 427 DRM_INFO("DMAR active, disabling use of stolen memory\n");
424 return 0; 428 return 0;
425 } 429 }
426#endif 430#endif
427 431
428 if (dev_priv->gtt.stolen_size == 0) 432 if (dev_priv->gtt.stolen_size == 0)
429 return 0; 433 return 0;
430 434
431 dev_priv->mm.stolen_base = i915_stolen_to_physical(dev); 435 dev_priv->mm.stolen_base = i915_stolen_to_physical(dev);
432 if (dev_priv->mm.stolen_base == 0) 436 if (dev_priv->mm.stolen_base == 0)
@@ -503,26 +507,29 @@ int i915_gem_init_stolen(struct drm_devi @@ -503,26 +507,29 @@ int i915_gem_init_stolen(struct drm_devi
503 * i915_gem_stolen_insert_node_in_range(). We may want to fix the fbcon 507 * i915_gem_stolen_insert_node_in_range(). We may want to fix the fbcon
504 * problem later. 508 * problem later.
505 */ 509 */
506 drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_usable_size); 510 drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_usable_size);
507 511
508 return 0; 512 return 0;
509} 513}
510 514
511#ifndef __NetBSD__ 515#ifndef __NetBSD__
512static struct sg_table * 516static struct sg_table *
513i915_pages_create_for_stolen(struct drm_device *dev, 517i915_pages_create_for_stolen(struct drm_device *dev,
514 u32 offset, u32 size) 518 u32 offset, u32 size)
515{ 519{
 520#ifdef __NetBSD__
 521 panic("XXX");
 522#else
516 struct drm_i915_private *dev_priv = dev->dev_private; 523 struct drm_i915_private *dev_priv = dev->dev_private;
517 struct sg_table *st; 524 struct sg_table *st;
518 struct scatterlist *sg; 525 struct scatterlist *sg;
519 526
520 DRM_DEBUG_DRIVER("offset=0x%x, size=%d\n", offset, size); 527 DRM_DEBUG_DRIVER("offset=0x%x, size=%d\n", offset, size);
521 BUG_ON(offset > dev_priv->gtt.stolen_size - size); 528 BUG_ON(offset > dev_priv->gtt.stolen_size - size);
522 529
523 /* We hide that we have no struct page backing our stolen object 530 /* We hide that we have no struct page backing our stolen object
524 * by wrapping the contiguous physical allocation with a fake 531 * by wrapping the contiguous physical allocation with a fake
525 * dma mapping in a single scatterlist. 532 * dma mapping in a single scatterlist.
526 */ 533 */
527 534
528 st = kmalloc(sizeof(*st), GFP_KERNEL); 535 st = kmalloc(sizeof(*st), GFP_KERNEL);
@@ -532,26 +539,27 @@ i915_pages_create_for_stolen(struct drm_ @@ -532,26 +539,27 @@ i915_pages_create_for_stolen(struct drm_
532 if (sg_alloc_table(st, 1, GFP_KERNEL)) { 539 if (sg_alloc_table(st, 1, GFP_KERNEL)) {
533 kfree(st); 540 kfree(st);
534 return NULL; 541 return NULL;
535 } 542 }
536 543
537 sg = st->sgl; 544 sg = st->sgl;
538 sg->offset = 0; 545 sg->offset = 0;
539 sg->length = size; 546 sg->length = size;
540 547
541 sg_dma_address(sg) = (dma_addr_t)dev_priv->mm.stolen_base + offset; 548 sg_dma_address(sg) = (dma_addr_t)dev_priv->mm.stolen_base + offset;
542 sg_dma_len(sg) = size; 549 sg_dma_len(sg) = size;
543 550
544 return st; 551 return st;
 552#endif
545} 553}
546#endif 554#endif
547 555
548static int i915_gem_object_get_pages_stolen(struct drm_i915_gem_object *obj) 556static int i915_gem_object_get_pages_stolen(struct drm_i915_gem_object *obj)
549{ 557{
550 BUG(); 558 BUG();
551 return -EINVAL; 559 return -EINVAL;
552} 560}
553 561
554static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj) 562static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj)
555{ 563{
556 /* Should only be called during free */ 564 /* Should only be called during free */
557#ifdef __NetBSD__ 565#ifdef __NetBSD__

cvs diff -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.h 2018/08/27 05:35:11 1.3
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_gtt.h 2018/08/27 06:08:25 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i915_gem_gtt.h,v 1.3 2018/08/27 05:35:11 riastradh Exp $ */ 1/* $NetBSD: i915_gem_gtt.h,v 1.4 2018/08/27 06:08:25 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright © 2014 Intel Corporation 4 * Copyright © 2014 Intel Corporation
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice (including the next 13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the 14 * paragraph) shall be included in all copies or substantial portions of the
@@ -425,34 +425,45 @@ struct i915_hw_ppgtt { @@ -425,34 +425,45 @@ struct i915_hw_ppgtt {
425 int (*switch_mm)(struct i915_hw_ppgtt *ppgtt, 425 int (*switch_mm)(struct i915_hw_ppgtt *ppgtt,
426 struct drm_i915_gem_request *req); 426 struct drm_i915_gem_request *req);
427 void (*debug_dump)(struct i915_hw_ppgtt *ppgtt, struct seq_file *m); 427 void (*debug_dump)(struct i915_hw_ppgtt *ppgtt, struct seq_file *m);
428}; 428};
429 429
430/* For each pde iterates over every pde between from start until start + length. 430/* For each pde iterates over every pde between from start until start + length.
431 * If start, and start+length are not perfectly divisible, the macro will round 431 * If start, and start+length are not perfectly divisible, the macro will round
432 * down, and up as needed. The macro modifies pde, start, and length. Dev is 432 * down, and up as needed. The macro modifies pde, start, and length. Dev is
433 * only used to differentiate shift values. Temp is temp. On gen6/7, start = 0, 433 * only used to differentiate shift values. Temp is temp. On gen6/7, start = 0,
434 * and length = 2G effectively iterates over every PDE in the system. 434 * and length = 2G effectively iterates over every PDE in the system.
435 * 435 *
436 * XXX: temp is not actually needed, but it saves doing the ALIGN operation. 436 * XXX: temp is not actually needed, but it saves doing the ALIGN operation.
437 */ 437 */
 438#ifdef __NetBSD__ /* ALIGN means something else */
 439#define gen6_for_each_pde(pt, pd, start, length, temp, iter) \
 440 for (iter = gen6_pde_index(start); \
 441 length > 0 && iter < I915_PDES ? \
 442 (pt = (pd)->page_table[iter]), 1 : 0; \
 443 iter++, \
 444 temp = round_up(start+1, 1 << GEN6_PDE_SHIFT) - start, \
 445 temp = min_t(unsigned, temp, length), \
 446 start += temp, length -= temp)
 447#else
438#define gen6_for_each_pde(pt, pd, start, length, temp, iter) \ 448#define gen6_for_each_pde(pt, pd, start, length, temp, iter) \
439 for (iter = gen6_pde_index(start); \ 449 for (iter = gen6_pde_index(start); \
440 length > 0 && iter < I915_PDES ? \ 450 length > 0 && iter < I915_PDES ? \
441 (pt = (pd)->page_table[iter]), 1 : 0; \ 451 (pt = (pd)->page_table[iter]), 1 : 0; \
442 iter++, \ 452 iter++, \
443 temp = ALIGN(start+1, 1 << GEN6_PDE_SHIFT) - start, \ 453 temp = ALIGN(start+1, 1 << GEN6_PDE_SHIFT) - start, \
444 temp = min_t(unsigned, temp, length), \ 454 temp = min_t(unsigned, temp, length), \
445 start += temp, length -= temp) 455 start += temp, length -= temp)
 456#endif
446 457
447#define gen6_for_all_pdes(pt, ppgtt, iter) \ 458#define gen6_for_all_pdes(pt, ppgtt, iter) \
448 for (iter = 0; \ 459 for (iter = 0; \
449 pt = ppgtt->pd.page_table[iter], iter < I915_PDES; \ 460 pt = ppgtt->pd.page_table[iter], iter < I915_PDES; \
450 iter++) 461 iter++)
451 462
452static inline uint32_t i915_pte_index(uint64_t address, uint32_t pde_shift) 463static inline uint32_t i915_pte_index(uint64_t address, uint32_t pde_shift)
453{ 464{
454 const uint32_t mask = NUM_PTE(pde_shift) - 1; 465 const uint32_t mask = NUM_PTE(pde_shift) - 1;
455 466
456 return (address >> PAGE_SHIFT) & mask; 467 return (address >> PAGE_SHIFT) & mask;
457} 468}
458 469
@@ -491,52 +502,83 @@ static inline size_t gen6_pte_count(uint @@ -491,52 +502,83 @@ static inline size_t gen6_pte_count(uint
491{ 502{
492 return i915_pte_count(addr, length, GEN6_PDE_SHIFT); 503 return i915_pte_count(addr, length, GEN6_PDE_SHIFT);
493} 504}
494 505
495static inline uint32_t gen6_pde_index(uint32_t addr) 506static inline uint32_t gen6_pde_index(uint32_t addr)
496{ 507{
497 return i915_pde_index(addr, GEN6_PDE_SHIFT); 508 return i915_pde_index(addr, GEN6_PDE_SHIFT);
498} 509}
499 510
500/* Equivalent to the gen6 version, For each pde iterates over every pde 511/* Equivalent to the gen6 version, For each pde iterates over every pde
501 * between from start until start + length. On gen8+ it simply iterates 512 * between from start until start + length. On gen8+ it simply iterates
502 * over every page directory entry in a page directory. 513 * over every page directory entry in a page directory.
503 */ 514 */
 515#ifdef __NetBSD__ /* ALIGN means something else */
 516
 517#define gen8_for_each_pde(pt, pd, start, length, temp, iter) \
 518 for (iter = gen8_pde_index(start); \
 519 length > 0 && iter < I915_PDES ? \
 520 (pt = (pd)->page_table[iter]), 1 : 0; \
 521 iter++, \
 522 temp = round_up(start+1, 1 << GEN8_PDE_SHIFT) - start, \
 523 temp = min(temp, length), \
 524 start += temp, length -= temp)
 525#define gen8_for_each_pdpe(pd, pdp, start, length, temp, iter) \
 526 for (iter = gen8_pdpe_index(start); \
 527 length > 0 && (iter < I915_PDPES_PER_PDP(dev)) ? \
 528 (pd = (pdp)->page_directory[iter]), 1 : 0; \
 529 iter++, \
 530 temp = round_up(start+1, 1 << GEN8_PDPE_SHIFT) - start, \
 531 temp = min(temp, length), \
 532 start += temp, length -= temp)
 533
 534#define gen8_for_each_pml4e(pdp, pml4, start, length, temp, iter) \
 535 for (iter = gen8_pml4e_index(start); \
 536 length > 0 && iter < GEN8_PML4ES_PER_PML4 ? \
 537 (pdp = (pml4)->pdps[iter]), 1 : 0; \
 538 iter++, \
 539 temp = round_up(start+1, 1ULL << GEN8_PML4E_SHIFT) - start, \
 540 temp = min(temp, length), \
 541 start += temp, length -= temp)
 542
 543#else
 544
504#define gen8_for_each_pde(pt, pd, start, length, temp, iter) \ 545#define gen8_for_each_pde(pt, pd, start, length, temp, iter) \
505 for (iter = gen8_pde_index(start); \ 546 for (iter = gen8_pde_index(start); \
506 length > 0 && iter < I915_PDES ? \ 547 length > 0 && iter < I915_PDES ? \
507 (pt = (pd)->page_table[iter]), 1 : 0; \ 548 (pt = (pd)->page_table[iter]), 1 : 0; \
508 iter++, \ 549 iter++, \
509 temp = ALIGN(start+1, 1 << GEN8_PDE_SHIFT) - start, \ 550 temp = ALIGN(start+1, 1 << GEN8_PDE_SHIFT) - start, \
510 temp = min(temp, length), \ 551 temp = min(temp, length), \
511 start += temp, length -= temp) 552 start += temp, length -= temp)
512 553
513#define gen8_for_each_pdpe(pd, pdp, start, length, temp, iter) \ 554#define gen8_for_each_pdpe(pd, pdp, start, length, temp, iter) \
514 for (iter = gen8_pdpe_index(start); \ 555 for (iter = gen8_pdpe_index(start); \
515 length > 0 && (iter < I915_PDPES_PER_PDP(dev)) ? \ 556 length > 0 && (iter < I915_PDPES_PER_PDP(dev)) ? \
516 (pd = (pdp)->page_directory[iter]), 1 : 0; \ 557 (pd = (pdp)->page_directory[iter]), 1 : 0; \
517 iter++, \ 558 iter++, \
518 temp = ALIGN(start+1, 1 << GEN8_PDPE_SHIFT) - start, \ 559 temp = ALIGN(start+1, 1 << GEN8_PDPE_SHIFT) - start, \
519 temp = min(temp, length), \ 560 temp = min(temp, length), \
520 start += temp, length -= temp) 561 start += temp, length -= temp)
521 562
522#define gen8_for_each_pml4e(pdp, pml4, start, length, temp, iter) \ 563#define gen8_for_each_pml4e(pdp, pml4, start, length, temp, iter) \
523 for (iter = gen8_pml4e_index(start); \ 564 for (iter = gen8_pml4e_index(start); \
524 length > 0 && iter < GEN8_PML4ES_PER_PML4 ? \ 565 length > 0 && iter < GEN8_PML4ES_PER_PML4 ? \
525 (pdp = (pml4)->pdps[iter]), 1 : 0; \ 566 (pdp = (pml4)->pdps[iter]), 1 : 0; \
526 iter++, \ 567 iter++, \
527 temp = ALIGN(start+1, 1ULL << GEN8_PML4E_SHIFT) - start, \ 568 temp = ALIGN(start+1, 1ULL << GEN8_PML4E_SHIFT) - start, \
528 temp = min(temp, length), \ 569 temp = min(temp, length), \
529 start += temp, length -= temp) 570 start += temp, length -= temp)
 571#endif
530 572
531static inline uint32_t gen8_pte_index(uint64_t address) 573static inline uint32_t gen8_pte_index(uint64_t address)
532{ 574{
533 return i915_pte_index(address, GEN8_PDE_SHIFT); 575 return i915_pte_index(address, GEN8_PDE_SHIFT);
534} 576}
535 577
536static inline uint32_t gen8_pde_index(uint64_t address) 578static inline uint32_t gen8_pde_index(uint64_t address)
537{ 579{
538 return i915_pde_index(address, GEN8_PDE_SHIFT); 580 return i915_pde_index(address, GEN8_PDE_SHIFT);
539} 581}
540 582
541static inline uint32_t gen8_pdpe_index(uint64_t address) 583static inline uint32_t gen8_pdpe_index(uint64_t address)
542{ 584{

cvs diff -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c 2018/08/27 05:57:29 1.6
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gpu_error.c 2018/08/27 06:08:25 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i915_gpu_error.c,v 1.6 2018/08/27 05:57:29 riastradh Exp $ */ 1/* $NetBSD: i915_gpu_error.c,v 1.7 2018/08/27 06:08:25 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2008 Intel Corporation 4 * Copyright (c) 2008 Intel Corporation
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice (including the next 13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the 14 * paragraph) shall be included in all copies or substantial portions of the
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 * IN THE SOFTWARE. 23 * IN THE SOFTWARE.
24 * 24 *
25 * Authors: 25 * Authors:
26 * Eric Anholt <eric@anholt.net> 26 * Eric Anholt <eric@anholt.net>
27 * Keith Packard <keithp@keithp.com> 27 * Keith Packard <keithp@keithp.com>
28 * Mika Kuoppala <mika.kuoppala@intel.com> 28 * Mika Kuoppala <mika.kuoppala@intel.com>
29 * 29 *
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: i915_gpu_error.c,v 1.6 2018/08/27 05:57:29 riastradh Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: i915_gpu_error.c,v 1.7 2018/08/27 06:08:25 riastradh Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36 36
37#include <asm/io.h> 37#include <asm/io.h>
38#include <linux/irqflags.h> 38#include <linux/irqflags.h>
39#include "i915_drv.h" 39#include "i915_drv.h"
40 40
41static const char *ring_str(int ring) 41static const char *ring_str(int ring)
42{ 42{
43 switch (ring) { 43 switch (ring) {
44 case RCS: return "render"; 44 case RCS: return "render";
45 case VCS: return "bsd"; 45 case VCS: return "bsd";
46 case BCS: return "blt"; 46 case BCS: return "blt";
@@ -345,27 +345,27 @@ int i915_error_state_to_str(struct drm_i @@ -345,27 +345,27 @@ int i915_error_state_to_str(struct drm_i
345 struct drm_i915_error_state *error = error_priv->error; 345 struct drm_i915_error_state *error = error_priv->error;
346 struct drm_i915_error_object *obj; 346 struct drm_i915_error_object *obj;
347 int i, j, offset, elt; 347 int i, j, offset, elt;
348 int max_hangcheck_score; 348 int max_hangcheck_score;
349 349
350 if (!error) { 350 if (!error) {
351 err_printf(m, "no error state collected\n"); 351 err_printf(m, "no error state collected\n");
352 goto out; 352 goto out;
353 } 353 }
354 354
355 err_printf(m, "%s\n", error->error_msg); 355 err_printf(m, "%s\n", error->error_msg);
356 err_printf(m, "Time: %"PRIdMAX" s %ld us\n", (intmax_t)error->time.tv_sec, 356 err_printf(m, "Time: %"PRIdMAX" s %ld us\n", (intmax_t)error->time.tv_sec,
357 (long)error->time.tv_usec); 357 (long)error->time.tv_usec);
358 err_printf(m, "Kernel: " __NetBSD_Version__ "\n"); 358 err_printf(m, "Kernel: %d\n", __NetBSD_Version__);
359 err_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec, 359 err_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
360 error->time.tv_usec); 360 error->time.tv_usec);
361 max_hangcheck_score = 0; 361 max_hangcheck_score = 0;
362 for (i = 0; i < ARRAY_SIZE(error->ring); i++) { 362 for (i = 0; i < ARRAY_SIZE(error->ring); i++) {
363 if (error->ring[i].hangcheck_score > max_hangcheck_score) 363 if (error->ring[i].hangcheck_score > max_hangcheck_score)
364 max_hangcheck_score = error->ring[i].hangcheck_score; 364 max_hangcheck_score = error->ring[i].hangcheck_score;
365 } 365 }
366 for (i = 0; i < ARRAY_SIZE(error->ring); i++) { 366 for (i = 0; i < ARRAY_SIZE(error->ring); i++) {
367 if (error->ring[i].hangcheck_score == max_hangcheck_score && 367 if (error->ring[i].hangcheck_score == max_hangcheck_score &&
368 error->ring[i].pid != -1) { 368 error->ring[i].pid != -1) {
369 err_printf(m, "Active process (on ring %s): %s [%d]\n", 369 err_printf(m, "Active process (on ring %s): %s [%d]\n",
370 ring_str(i), 370 ring_str(i),
371 error->ring[i].comm, 371 error->ring[i].comm,

cvs diff -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/hashtable.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/linux/hashtable.h 2018/08/27 06:08:09 1.2
+++ src/sys/external/bsd/drm2/include/linux/hashtable.h 2018/08/27 06:08:25 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $OpenBSD: drm_linux.h,v 1.89 2018/06/25 22:29:16 kettenis Exp $ */ 1/* $OpenBSD$ */
2/* 2/*
3 * Copyright (c) 2013, 2014, 2015 Mark Kettenis 3 * Copyright (c) 2013, 2014, 2015 Mark Kettenis
4 * Copyright (c) 2017 Martin Pieuchot 4 * Copyright (c) 2017 Martin Pieuchot
5 * 5 *
6 * Permission to use, copy, modify, and distribute this software for any 6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above 7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies. 8 * copyright notice and this permission notice appear in all copies.
9 * 9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
@@ -48,18 +48,14 @@ __hash_empty(struct list_head *table, u_ @@ -48,18 +48,14 @@ __hash_empty(struct list_head *table, u_
48#define __hash(table, key) &table[key % (nitems(table) - 1)] 48#define __hash(table, key) &table[key % (nitems(table) - 1)]
49 49
50#define hash_init(table) __hash_init(table, nitems(table)) 50#define hash_init(table) __hash_init(table, nitems(table))
51#define hash_add(table, node, key) \ 51#define hash_add(table, node, key) \
52 hlist_add_head(node, __hash(table, key)) 52 hlist_add_head(node, __hash(table, key))
53#define hash_del(node) hlist_del_init(node) 53#define hash_del(node) hlist_del_init(node)
54#define hash_empty(table) __hash_empty(table, nitems(table)) 54#define hash_empty(table) __hash_empty(table, nitems(table))
55#define hash_for_each_possible(table, obj, member, key) \ 55#define hash_for_each_possible(table, obj, member, key) \
56 hlist_for_each_entry(obj, __hash(table, key), member) 56 hlist_for_each_entry(obj, __hash(table, key), member)
57#define hash_for_each_safe(table, i, tmp, obj, member) \ 57#define hash_for_each_safe(table, i, tmp, obj, member) \
58 for (i = 0; i < nitems(table); i++) \ 58 for (i = 0; i < nitems(table); i++) \
59 list_for_each_entry_safe(obj, tmp, &table[i], member) 59 list_for_each_entry_safe(obj, tmp, &table[i], member)
60 60
61#define DECLARE_HASHTABLE(__a,__b) \ 
62 uint64_t __a /* XXX */ 
63 
64 
65#endif /*_LINUX_HASHTABLE_H_*/ 61#endif /*_LINUX_HASHTABLE_H_*/