Thu Dec 23 17:09:25 2021 UTC ()
Cast addr to uint64_t before printing.
Ok: riastradh@


(hannken)
diff -r1.23 -r1.24 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c
diff -r1.29 -r1.30 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c

cvs diff -r1.23 -r1.24 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c 2021/12/19 12:23:58 1.23
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c 2021/12/23 17:09:25 1.24
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: radeon_ttm.c,v 1.23 2021/12/19 12:23:58 riastradh Exp $ */ 1/* $NetBSD: radeon_ttm.c,v 1.24 2021/12/23 17:09:25 hannken Exp $ */
2 2
3/* 3/*
4 * Copyright 2009 Jerome Glisse. 4 * Copyright 2009 Jerome Glisse.
5 * All Rights Reserved. 5 * All Rights Reserved.
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 8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including 9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish, 10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to 11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to 12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions: 13 * the following conditions:
14 * 14 *
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * The above copyright notice and this permission notice (including the 23 * The above copyright notice and this permission notice (including the
24 * next paragraph) shall be included in all copies or substantial portions 24 * next paragraph) shall be included in all copies or substantial portions
25 * of the Software. 25 * of the Software.
26 * 26 *
27 */ 27 */
28/* 28/*
29 * Authors: 29 * Authors:
30 * Jerome Glisse <glisse@freedesktop.org> 30 * Jerome Glisse <glisse@freedesktop.org>
31 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> 31 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
32 * Dave Airlie 32 * Dave Airlie
33 */ 33 */
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: radeon_ttm.c,v 1.23 2021/12/19 12:23:58 riastradh Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: radeon_ttm.c,v 1.24 2021/12/23 17:09:25 hannken Exp $");
37 37
38#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
39#include <linux/pagemap.h> 39#include <linux/pagemap.h>
40#include <linux/pci.h> 40#include <linux/pci.h>
41#include <linux/seq_file.h> 41#include <linux/seq_file.h>
42#include <linux/slab.h> 42#include <linux/slab.h>
43#include <linux/swap.h> 43#include <linux/swap.h>
44#include <linux/swiotlb.h> 44#include <linux/swiotlb.h>
45 45
46#include <drm/drm_agpsupport.h> 46#include <drm/drm_agpsupport.h>
47#include <drm/drm_debugfs.h> 47#include <drm/drm_debugfs.h>
48#include <drm/drm_device.h> 48#include <drm/drm_device.h>
49#include <drm/drm_file.h> 49#include <drm/drm_file.h>
@@ -436,28 +436,28 @@ static int radeon_ttm_io_mem_reserve(str @@ -436,28 +436,28 @@ static int radeon_ttm_io_mem_reserve(str
436 return -EINVAL; 436 return -EINVAL;
437 switch (mem->mem_type) { 437 switch (mem->mem_type) {
438 case TTM_PL_SYSTEM: 438 case TTM_PL_SYSTEM:
439 /* system memory */ 439 /* system memory */
440 return 0; 440 return 0;
441 case TTM_PL_TT: 441 case TTM_PL_TT:
442#if IS_ENABLED(CONFIG_AGP) 442#if IS_ENABLED(CONFIG_AGP)
443 if (rdev->flags & RADEON_IS_AGP) { 443 if (rdev->flags & RADEON_IS_AGP) {
444 /* RADEON_IS_AGP is set only if AGP is active */ 444 /* RADEON_IS_AGP is set only if AGP is active */
445 mem->bus.offset = mem->start << PAGE_SHIFT; 445 mem->bus.offset = mem->start << PAGE_SHIFT;
446 mem->bus.base = rdev->mc.agp_base; 446 mem->bus.base = rdev->mc.agp_base;
447 mem->bus.is_iomem = !rdev->ddev->agp->cant_use_aperture; 447 mem->bus.is_iomem = !rdev->ddev->agp->cant_use_aperture;
448 KASSERTMSG((mem->bus.base & (PAGE_SIZE - 1)) == 0, 448 KASSERTMSG((mem->bus.base & (PAGE_SIZE - 1)) == 0,
449 "agp aperture is not page-aligned: %lx", 449 "agp aperture is not page-aligned: %" PRIx64 "",
450 mem->bus.base); 450 (uint64_t)mem->bus.base);
451 KASSERT((mem->bus.offset & (PAGE_SIZE - 1)) == 0); 451 KASSERT((mem->bus.offset & (PAGE_SIZE - 1)) == 0);
452 } 452 }
453#endif 453#endif
454 break; 454 break;
455 case TTM_PL_VRAM: 455 case TTM_PL_VRAM:
456 mem->bus.offset = mem->start << PAGE_SHIFT; 456 mem->bus.offset = mem->start << PAGE_SHIFT;
457 /* check if it's visible */ 457 /* check if it's visible */
458 if ((mem->bus.offset + mem->bus.size) > rdev->mc.visible_vram_size) 458 if ((mem->bus.offset + mem->bus.size) > rdev->mc.visible_vram_size)
459 return -EINVAL; 459 return -EINVAL;
460 mem->bus.base = rdev->mc.aper_base; 460 mem->bus.base = rdev->mc.aper_base;
461 mem->bus.is_iomem = true; 461 mem->bus.is_iomem = true;
462#ifdef __alpha__ 462#ifdef __alpha__
463 /* 463 /*
@@ -475,28 +475,28 @@ static int radeon_ttm_io_mem_reserve(str @@ -475,28 +475,28 @@ static int radeon_ttm_io_mem_reserve(str
475 if (!mem->bus.addr) 475 if (!mem->bus.addr)
476 return -ENOMEM; 476 return -ENOMEM;
477 477
478 /* 478 /*
479 * Alpha: Use just the bus offset plus 479 * Alpha: Use just the bus offset plus
480 * the hose/domain memory base for bus.base. 480 * the hose/domain memory base for bus.base.
481 * It then can be used to build PTEs for VRAM 481 * It then can be used to build PTEs for VRAM
482 * access, as done in ttm_bo_vm_fault(). 482 * access, as done in ttm_bo_vm_fault().
483 */ 483 */
484 mem->bus.base = (mem->bus.base & 0x0ffffffffUL) + 484 mem->bus.base = (mem->bus.base & 0x0ffffffffUL) +
485 rdev->ddev->hose->dense_mem_base; 485 rdev->ddev->hose->dense_mem_base;
486#endif 486#endif
487 KASSERTMSG((mem->bus.base & (PAGE_SIZE - 1)) == 0, 487 KASSERTMSG((mem->bus.base & (PAGE_SIZE - 1)) == 0,
488 "mc aperture is not page-aligned: %lx", 488 "mc aperture is not page-aligned: %" PRIx64 "",
489 mem->bus.base); 489 (uint64_t)mem->bus.base);
490 KASSERT((mem->bus.offset & (PAGE_SIZE - 1)) == 0); 490 KASSERT((mem->bus.offset & (PAGE_SIZE - 1)) == 0);
491 break; 491 break;
492 default: 492 default:
493 return -EINVAL; 493 return -EINVAL;
494 } 494 }
495 return 0; 495 return 0;
496} 496}
497 497
498static void radeon_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) 498static void radeon_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
499{ 499{
500} 500}
501 501
502/* 502/*

cvs diff -r1.29 -r1.30 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c 2021/12/19 12:40:44 1.29
+++ src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c 2021/12/23 17:09:25 1.30
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ttm_bo.c,v 1.29 2021/12/19 12:40:44 riastradh Exp $ */ 1/* $NetBSD: ttm_bo.c,v 1.30 2021/12/23 17:09:25 hannken Exp $ */
2 2
3/* SPDX-License-Identifier: GPL-2.0 OR MIT */ 3/* SPDX-License-Identifier: GPL-2.0 OR MIT */
4/************************************************************************** 4/**************************************************************************
5 * 5 *
6 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA 6 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
7 * All Rights Reserved. 7 * All Rights Reserved.
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the 10 * copy of this software and associated documentation files (the
11 * "Software"), to deal in the Software without restriction, including 11 * "Software"), to deal in the Software without restriction, including
12 * without limitation the rights to use, copy, modify, merge, publish, 12 * without limitation the rights to use, copy, modify, merge, publish,
13 * distribute, sub license, and/or sell copies of the Software, and to 13 * distribute, sub license, and/or sell copies of the Software, and to
14 * permit persons to whom the Software is furnished to do so, subject to 14 * permit persons to whom the Software is furnished to do so, subject to
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 23 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
24 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 24 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
25 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 25 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 26 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
27 * USE OR OTHER DEALINGS IN THE SOFTWARE. 27 * USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * 28 *
29 **************************************************************************/ 29 **************************************************************************/
30/* 30/*
31 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> 31 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: ttm_bo.c,v 1.29 2021/12/19 12:40:44 riastradh Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: ttm_bo.c,v 1.30 2021/12/23 17:09:25 hannken Exp $");
36 36
37#define pr_fmt(fmt) "[TTM] " fmt 37#define pr_fmt(fmt) "[TTM] " fmt
38 38
39#ifdef __NetBSD__ 39#ifdef __NetBSD__
40#include <sys/types.h> 40#include <sys/types.h>
41#include <uvm/uvm_extern.h> 41#include <uvm/uvm_extern.h>
42#include <uvm/uvm_object.h> 42#include <uvm/uvm_object.h>
43#endif 43#endif
44 44
45#include <drm/drm_prime.h> 45#include <drm/drm_prime.h>
46#include <drm/ttm/ttm_module.h> 46#include <drm/ttm/ttm_module.h>
47#include <drm/ttm/ttm_bo_driver.h> 47#include <drm/ttm/ttm_bo_driver.h>
48#include <drm/ttm/ttm_placement.h> 48#include <drm/ttm/ttm_placement.h>
@@ -1828,28 +1828,28 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_de @@ -1828,28 +1828,28 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_de
1828 if (mem->placement & TTM_PL_FLAG_CACHED) 1828 if (mem->placement & TTM_PL_FLAG_CACHED)
1829 return false; 1829 return false;
1830 } 1830 }
1831 return true; 1831 return true;
1832} 1832}
1833 1833
1834void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo) 1834void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo)
1835{ 1835{
1836#ifdef __NetBSD__ 1836#ifdef __NetBSD__
1837 if (bo->mem.bus.is_iomem) { 1837 if (bo->mem.bus.is_iomem) {
1838 paddr_t start, end, pa; 1838 paddr_t start, end, pa;
1839 1839
1840 KASSERTMSG((bo->mem.bus.base & (PAGE_SIZE - 1)) == 0, 1840 KASSERTMSG((bo->mem.bus.base & (PAGE_SIZE - 1)) == 0,
1841 "bo bus base addr not page-aligned: %lx", 1841 "bo bus base addr not page-aligned: %" PRIx64 "",
1842 bo->mem.bus.base); 1842 (uint64_t)bo->mem.bus.base);
1843 KASSERTMSG((bo->mem.bus.offset & (PAGE_SIZE - 1)) == 0, 1843 KASSERTMSG((bo->mem.bus.offset & (PAGE_SIZE - 1)) == 0,
1844 "bo bus offset not page-aligned: %lx", 1844 "bo bus offset not page-aligned: %lx",
1845 bo->mem.bus.offset); 1845 bo->mem.bus.offset);
1846 start = bo->mem.bus.base + bo->mem.bus.offset; 1846 start = bo->mem.bus.base + bo->mem.bus.offset;
1847 KASSERT((bo->mem.bus.size & (PAGE_SIZE - 1)) == 0); 1847 KASSERT((bo->mem.bus.size & (PAGE_SIZE - 1)) == 0);
1848 end = start + bo->mem.bus.size; 1848 end = start + bo->mem.bus.size;
1849 1849
1850 for (pa = start; pa < end; pa += PAGE_SIZE) 1850 for (pa = start; pa < end; pa += PAGE_SIZE)
1851 pmap_pv_protect(pa, VM_PROT_NONE); 1851 pmap_pv_protect(pa, VM_PROT_NONE);
1852 } else if (bo->ttm != NULL) { 1852 } else if (bo->ttm != NULL) {
1853 unsigned i; 1853 unsigned i;
1854 1854
1855 rw_enter(bo->uvmobj.vmobjlock, RW_WRITER); 1855 rw_enter(bo->uvmobj.vmobjlock, RW_WRITER);