Re: radeon, amdgpu improvements for aarch64

Taylor R Campbell <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
> Date: Thu, 28 Dec 2023 01:02:08 +0100
> From: Tobias Nygren <[email protected]>
> 
> I've spent some time testing GPUs on aarch64 and fixing bugs.
> Attached are some patches to make things more usable.

Cool, thanks!  Some notes below.  Everything else seems fine.

> [2] /libdata/firmware/amdgpu is not shipped.
>     (Can we include these in the sets?)

amdgpu firmware should be included in the gpufw set, I think.

> --- sys/arch/evbarm/fdt/fdt_machdep.c	4 Aug 2023 09:06:33 -0000	1.106
> +++ sys/arch/evbarm/fdt/fdt_machdep.c	27 Dec 2023 22:07:38 -0000
> @@ -194,6 +194,11 @@ fdt_add_boot_physmem(const struct fdt_me
>  	bp->bp_start = atop(saddr);
>  	bp->bp_pages = atop(eaddr) - bp->bp_start;
>  	bp->bp_freelist = VM_FREELIST_DEFAULT;
> +#ifdef _LP64
> +	if (eaddr < (1UL<<40)) {

Tiny nit: I'd spell this as:

	if (eaddr < ((paddr_t)1 << 40)) {

or as:

	if (eaddr <= BITS(0,39)) {

Just to confirm: eaddr is inclusive here, right?  As in, if the range
were [0x10000, 0x20000), we would have saddr=0x10000 eaddr=0x1ffff (or
maybe eaddr=0x1f000), right?

> --- sys/external/bsd/drm2/include/drm/bus_dma_hacks.h	19 Jul 2022 23:19:44 -0000	1.25
> +++ sys/external/bsd/drm2/include/drm/bus_dma_hacks.h	27 Dec 2023 22:07:38 -0000
> @@ -99,6 +99,8 @@ bus_dmamem_pgfl(bus_dma_tag_t tag)
>  {
>  #if defined(__i386__) || defined(__x86_64__)
>  	return x86_select_freelist(tag->_bounce_alloc_hi - 1);
> +#elif defined(__aarch64__)
> +	return VM_FREELIST_FIRST1T;

This should look through the tag->_ranges to choose
VM_FREELIST_FIRST1T if it has been restricted with
bus_dmatag_subregion to lie in that range, and VM_FREELIST_DEFAULT if
not.

> --- sys/uvm/uvm_pglist.c	21 Dec 2021 08:27:49 -0000	1.90
> +++ sys/uvm/uvm_pglist.c	27 Dec 2023 22:06:10 -0000
> @@ -112,8 +112,9 @@ static int
>  uvm_pglistalloc_c_ps(uvm_physseg_t psi, int num, paddr_t low, paddr_t high,
>      paddr_t alignment, paddr_t boundary, struct pglist *rlist)
>  {
> -	signed int candidate, limit, candidateidx, end, idx, skip;
> -	int pagemask;
> +	long candidate, limit, candidateidx, end, idx;
> +	int skip;
> +	long pagemask;

I don't really have an issue with this but I think we may need to
switch int to pfn_t for page frame numbers much more systematically.
Curious how changing only start_hint from int to long helps?  (Commit
message doesn't explain.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.