On Mon, Jun 15, 2026 at 02:09:13PM +1000, Jonathan Gray wrote:
> On Sun, Jun 14, 2026 at 09:52:53PM +0300, Petre Rodan wrote:
> >  9:0:0: ATI Navi 21
> >     0x0000: Vendor ID: 1002, Product ID: 73bf
> >     0x0004: Command: 0006, Status: 0010
> >     0x0008: Class: 03 Display, Subclass: 00 VGA,
> >             Interface: 00, Revision: c3
> >     0x000c: BIST: 00, Header Type: 80, Latency Timer: 00,
> >             Cache Line Size: 10
> >     0x0010: BAR mem prefetchable 64bit addr: 0x0000007800000000/0x400000000
> >     0x0018: BAR mem prefetchable 64bit addr: 0x0000007c00000000/0x10000000
> >     0x0020: BAR io addr: 0x0000e000/0x0100
> >     0x0024: BAR mem 32bit addr: 0xfca00000/0x00100000
> 
> framebuffer memory is described by pci bar 0x10
> 
> the window size here is already 16GB, even without resizing the bar
> 
> can you try this diff to force visible vram to 512MB?
> 
> Index: sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c,v
> diff -u -p -r1.20 amdgpu_gmc.c
> --- sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c   25 May 2026 08:56:32 -0000      
> 1.20
> +++ sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c   15 Jun 2026 03:53:34 -0000
> @@ -216,6 +216,8 @@ void amdgpu_gmc_vram_location(struct amd
>       uint64_t vis_limit = (uint64_t)amdgpu_vis_vram_limit << 20;
>       uint64_t limit = (uint64_t)amdgpu_vram_limit << 20;
>  
> +     vis_limit = 512ULL << 20;
> +
>       mc->vram_start = base;
>       mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
>       if (limit < mc->real_vram_size)

I compared the amdgpu driver behaviour in OpenBSD vs Linux kernel 6.18.35 and 
to me it looks like the errors start at this bsd specific #ifdef block:

RCS file: /cvs/src/sys/dev/pci/drm/amd/amdgpu/amdgpu_ttm.c,v
diff -u -p -r1.30 amdgpu_ttm.c
--- amdgpu_ttm.c        9 Mar 2026 23:57:53 -0000       1.30
+++ amdgpu_ttm.c        15 Jun 2026 19:00:39 -0000
@@ -2022,x +2022,y @@ int amdgpu_ttm_init(struct amdgpu_device
 #else
        if (bus_space_map(adev->memt, adev->gmc.aper_base,
            adev->gmc.visible_vram_size,                
            BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
            &adev->mman.aper_bsh)) {
                adev->mman.aper_base_kaddr = NULL;
+        printf("~~~ explicit NULL, visible_vram_size 0x%llX\n", 
adev->gmc.visible_vram_size);
        } else {
                adev->mman.aper_base_kaddr = bus_space_vaddr(adev->memt,
                    adev->mman.aper_bsh);
+        printf("~~~ aper_base_kaddr %p, visible_vram_size 0x%llX\n", 
adev->mman.aper_base_kaddr,
+               adev->gmc.visible_vram_size);
        }
 #endif

<TLDR>
in OpenBSD if bus_space_map() is true then aper_base_kaddr is explicitly NULLed 
out,
and for some reason this happens if visible_vram_size > 2GB.
in Linux aper_base_kaddr is a non-NULL pointer in all my tests.
</TLDR>

# in OpenBSD with vis_limit between 512-2048MB, startx is happy to use the 
modsetting driver:

VRAM: 16368M 0x0000008000000000 - 0x00000083FEFFFFFF (16368M used)
GART: 512M 0x0000000000000000 - 0x000000001FFFFFFF                
~~~ aper_base_kaddr 0xffff8000699ea000, visible_vram_size 0x80000000
amdgpu0: SIENNA_CICHLID GC 10.3.0 60 CU rev 0x01                        
amdgpu0: 1920x1080, 32bpp                       
wsdisplay0 at amdgpu0 mux 1


# in OpenBSD with vis_limit >= 2560UL<<20, aper_base_kaddr is explicitly set to 
NULL and the init failure chain happens:

VRAM: 16368M 0x0000008000000000 - 0x00000083FEFFFFFF (16368M used)
GART: 512M 0x0000000000000000 - 0x000000001FFFFFFF                
~~~ explicit NULL, visible_vram_size 0xA0000000     
[drm] *ERROR* v11 visible_vram_size a0000000 or aper_base_kaddr 0x0 is not 
initialized.
drm:pid0:psp_sw_init *ERROR* Failed to process memory training!                 
       
drm:pid0:amdgpu_device_ip_init *ERROR* sw_init of IP block <psp> failed -22
drm:pid0:amdgpu_device_init *ERROR* amdgpu_device_ip_init failed           
drm:pid0:amdgpu_driver_load_kms *ERROR* Fatal error during GPU init
WARNING !amdgpu_irq_enabled(adev, src, type) failed at 
/sys/dev/pci/drm/amd/amdgpu/amdgpu_irq.c:650


# in linux, even with the default unlimited vis_limit, aper_base_kaddr does not 
get NULLed out:

[    8.101797] amdgpu 0000:09:00.0: amdgpu: VRAM: 16368M 0x0000008000000000 - 
0x00000083FEFFFFFF (16368M used)
[    8.101799] amdgpu 0000:09:00.0: amdgpu: GART: 512M 0x0000000000000000 - 
0x000000001FFFFFFF
[    8.101809] [drm] Detected VRAM RAM=16368M, BAR=16384M
[    8.101810] [drm] RAM width 256bits GDDR6
[    8.101908] amdgpu: ~~~ aper_base_kaddr 00000000dbe1887b, visible_vram_size 
0x3FF000000
[    8.101937] amdgpu 0000:09:00.0: amdgpu: amdgpu: 16368M of VRAM memory ready
[    8.101939] amdgpu 0000:09:00.0: amdgpu: amdgpu: 16002M of GTT memory ready.

am I getting warmer?

cheers,
peter

Reply via email to