Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on aarch64 #89

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
SUBDIR= linuxkpi \
lindebugfs \
drm \
i915 \
amd \
radeon \
${_drivers} \
${_staging}

.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
_drivers= i915 amd radeon
.elif ${MACHINE_CPUARCH} == "aarch64"
_drivers= amd radeon
.endif

.if defined(STAGING)
_staging= staging
Expand Down
2 changes: 1 addition & 1 deletion amd/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# $FreeBSD$

.if ${MACHINE_CPUARCH} == "amd64"
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "aarch64"
_amdgpu= amdgpu
_amdkfd= amdkfd
.endif
Expand Down
27 changes: 16 additions & 11 deletions amd/amdgpu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ SRCS+= amd_powerplay.c \


CFLAGS+= -I${.CURDIR:H:H}/linuxkpi/gplv2/include
CFLAGS+= -I${.CURDIR:H:H}/linuxkpi/gplv2/arch/${MACHINE_CPUARCH}/include
CFLAGS+= -I${SYSDIR}/compat/linuxkpi/common/include
CFLAGS+= -I${.CURDIR:H:H}/linuxkpi/dummy/include

Expand Down Expand Up @@ -393,18 +394,22 @@ SRCS+= device_if.h vnode_if.h bus_if.h pci_if.h device_if.h iicbus_if.h opt_drm.

.include <bsd.kmod.mk>

CFLAGS.dcn_calcs.c= -msse -mstack-alignment=4
CFLAGS.dcn_calc_auto.c= -msse -mstack-alignment=4
CFLAGS.dcn_calc_math.c= -msse -mstack-alignment=4 -Wno-tautological-compare
.if ${MACHINE_CPUARCH} == "amd64"
_sse=-=msse
.endif

CFLAGS.display_mode_vba.c= -msse -mstack-alignment=4
CFLAGS.display_mode_lib.c= -msse -mstack-alignment=4
CFLAGS.display_pipe_clocks.c= -msse -mstack-alignment=4
CFLAGS.display_rq_dlg_calc.c= -msse -mstack-alignment=4
CFLAGS.dml1_display_rq_dlg_calc.c= -msse -mstack-alignment=4
CFLAGS.display_rq_dlg_helpers.c= -msse -mstack-alignment=4
CFLAGS.soc_bounding_box.c= -msse -mstack-alignment=4
CFLAGS.dml_common_defs.c= -msse -mstack-alignment=4
CFLAGS.dcn_calcs.c= ${_sse} -mstack-alignment=4
CFLAGS.dcn_calc_auto.c= ${_sse} -mstack-alignment=4
CFLAGS.dcn_calc_math.c= ${_sse} -mstack-alignment=4 -Wno-tautological-compare

CFLAGS.display_mode_vba.c= ${_sse} -mstack-alignment=4
CFLAGS.display_mode_lib.c= ${_sse} -mstack-alignment=4
CFLAGS.display_pipe_clocks.c= ${_sse} -mstack-alignment=4
CFLAGS.display_rq_dlg_calc.c= ${_sse} -mstack-alignment=4
CFLAGS.dml1_display_rq_dlg_calc.c= ${_sse} -mstack-alignment=4
CFLAGS.display_rq_dlg_helpers.c= ${_sse} -mstack-alignment=4
CFLAGS.soc_bounding_box.c= ${_sse} -mstack-alignment=4
CFLAGS.dml_common_defs.c= ${_sse} -mstack-alignment=4

CWARNFLAGS+= -Wno-pointer-arith -Wno-format
CWARNFLAGS+= -Wno-pointer-sign ${CWARNFLAGS.${.IMPSRC:T}}
Expand Down
1 change: 1 addition & 0 deletions amd/amdkfd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SRCS = \
# kfd_topology.c

CFLAGS+= -I${.CURDIR:H:H}/linuxkpi/gplv2/include
CFLAGS+= -I${.CURDIR:H:H}/linuxkpi/gplv2/arch/${MACHINE_CPUARCH}/include
CFLAGS+= -I${SYSDIR}/compat/linuxkpi/common/include
CFLAGS+= -I${.CURDIR:H:H}/linuxkpi/dummy/include

Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ __FBSDID("$FreeBSD$");
#include <drm/drm_crtc_helper.h>

MODULE_DEPEND(amdgpu, drmn, 2, 2, 2);
#ifdef CONFIG_AGP
MODULE_DEPEND(amdgpu, agp, 1, 1, 1);
#endif
MODULE_DEPEND(amdgpu, linuxkpi, 1, 1, 1);
MODULE_DEPEND(amdgpu, linuxkpi_gplv2, 1, 1, 1);
MODULE_DEPEND(amdgpu, firmware, 1, 1, 1);
Expand Down
11 changes: 8 additions & 3 deletions drivers/gpu/drm/amd/display/dc/calcs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@
# It calculates Bandwidth and Watermarks values for HW programming
#

CFLAGS_dcn_calcs.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_dcn_calc_auto.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_dcn_calc_math.o := -mhard-float -msse -mpreferred-stack-boundary=4 -Wno-tautological-compare

.if ${MACHINE_CPUARCH} == "amd64"
_sse=-=msse
.endif

CFLAGS_dcn_calcs.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_dcn_calc_auto.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_dcn_calc_math.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4 -Wno-tautological-compare

BW_CALCS = dce_calcs.o bw_fixed.o custom_float.o

Expand Down
20 changes: 12 additions & 8 deletions drivers/gpu/drm/amd/display/dc/dml/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@
# It provides the general basic services required by other DAL
# subcomponents.

CFLAGS_display_mode_vba.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_display_mode_lib.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_display_pipe_clocks.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_display_rq_dlg_calc.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_dml1_display_rq_dlg_calc.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_display_rq_dlg_helpers.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_soc_bounding_box.o := -mhard-float -msse -mpreferred-stack-boundary=4
CFLAGS_dml_common_defs.o := -mhard-float -msse -mpreferred-stack-boundary=4
.if ${MACHINE_CPUARCH} == "amd64"
_sse=-=msse
.endif

CFLAGS_display_mode_vba.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_display_mode_lib.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_display_pipe_clocks.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_display_rq_dlg_calc.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_dml1_display_rq_dlg_calc.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_display_rq_dlg_helpers.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_soc_bounding_box.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4
CFLAGS_dml_common_defs.o := -mhard-float ${_sse} -mpreferred-stack-boundary=4


DML = display_mode_lib.o display_rq_dlg_calc.o \
Expand Down
16 changes: 10 additions & 6 deletions drivers/gpu/drm/drm_os_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,27 @@
#define CONFIG_64BIT 1
#endif

#if defined(__i386__) || defined(__amd64__)
#define CONFIG_PCI 1
#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__)
#define CONFIG_PCI 1
#define CONFIG_ACPI 1
#endif

#if defined(__i386__) || defined(__amd64__)
#define CONFIG_ACPI_SLEEP 1
#define CONFIG_DRM_I915_KMS 1
#undef CONFIG_INTEL_IOMMU
// For platforms with SSE4.1 (needed for GuC)
#define CONFIG_AS_MOVNTDQA
#define CONFIG_AGP 1
#define CONFIG_MTRR 1
#endif

#undef CONFIG_INTEL_IOMMU

#ifdef _KERNEL
#define __KERNEL__
#endif


#define CONFIG_AGP 1
#define CONFIG_MTRR 1

#define CONFIG_FB 1

#undef CONFIG_VGA_CONSOLE
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/drm_os_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ static moduledata_t drm_mod = {

DECLARE_MODULE(drmn, drm_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
MODULE_VERSION(drmn, 2);
#ifdef CONFIG_AGP
MODULE_DEPEND(drmn, agp, 1, 1, 1);
#endif
MODULE_DEPEND(drmn, pci, 1, 1, 1);
MODULE_DEPEND(drmn, mem, 1, 1, 1);
MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/drm_vblank.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ static bool
drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
ktime_t *tvblank, bool in_vblank_irq);

static unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */
unsigned int drm_timestamp_precision = 20; /* Default to 20 usecs. */

static int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */
int drm_vblank_offdelay = 5000; /* Default to 5000 msecs. */

module_param_named(vblankoffdelay, drm_vblank_offdelay, int, 0600);
module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600);
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/radeon/radeon_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ __FBSDID("$FreeBSD$");
#include <drm/drm_crtc_helper.h>

MODULE_DEPEND(radeonkms, drmn, 2, 2, 2);
#ifdef CONFIG_AGP
MODULE_DEPEND(radeonkms, agp, 1, 1, 1);
#endif
MODULE_DEPEND(radeonkms, linuxkpi, 1, 1, 1);
MODULE_DEPEND(radeonkms, linuxkpi_gplv2, 1, 1, 1);
MODULE_DEPEND(radeonkms, firmware, 1, 1, 1);
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/vc4/vc4_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ __FBSDID("$FreeBSD$");


MODULE_DEPEND(vc4, drmn, 2, 2, 2);
MODULE_DEPEND(vc4, agp, 1, 1, 1);
MODULE_DEPEND(vc4, linuxkpi, 1, 1, 1);
MODULE_DEPEND(vc4, linuxkpi_gplv2, 1, 1, 1);
MODULE_DEPEND(vc4, debugfs, 1, 1, 1);
9 changes: 7 additions & 2 deletions drm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ SRCDIR= ${.CURDIR:H}/drivers/gpu/drm

KMOD= drm
SRCS= ati_pcigart.c \
drm_agpsupport.c \
drm_atomic.c \
drm_atomic_helper.c \
drm_auth.c \
Expand Down Expand Up @@ -79,7 +78,6 @@ SRCS= ati_pcigart.c \
linux_fb.c \
tainted_linux_fb.c \
linux_hdmi.c \
ttm_agp_backend.c \
ttm_lock.c \
ttm_object.c \
ttm_tt.c \
Expand All @@ -96,8 +94,15 @@ SRCS= ati_pcigart.c \
# drm scheduler (moved from amdgpu)
SRCS+= gpu_scheduler.c \
sched_fence.c
# drm_fops.c \ deleted in v4.12

.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
SRCS+= drm_agpsupport.c \
ttm_agp_backend.c
.endif

CFLAGS+= -I${.CURDIR:H}/linuxkpi/gplv2/include
CFLAGS+= -I${.CURDIR:H}/linuxkpi/gplv2/arch/${MACHINE_CPUARCH}/include
CFLAGS+= -I${SYSDIR}/compat/linuxkpi/common/include
CFLAGS+= -I${.CURDIR:H}/linuxkpi/dummy/include # fallback to dummy
CFLAGS+= -I${SRCDIR}
Expand Down
1 change: 1 addition & 0 deletions i915/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ SRCS= \
CLEANFILES+= ${KMOD}.ko.full ${KMOD}.ko.debug

CFLAGS+= -I${.CURDIR:H}/linuxkpi/gplv2/include
CFLAGS+= -I${.CURDIR:H}/linuxkpi/gplv2/arch/${MACHINE_CPUARCH}/include
CFLAGS+= -I${SYSDIR}/compat/linuxkpi/common/include
CFLAGS+= -I${.CURDIR:H}/linuxkpi/dummy/include

Expand Down
3 changes: 2 additions & 1 deletion include/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@
#include <linux/interrupt.h>
#include <linux/pagemap.h>


#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif
#include <drm/drm_os_freebsd.h>
#include <drm/drm_agpsupport.h>
#include <drm/drm_crtc.h>
Expand Down
1 change: 1 addition & 0 deletions lindebugfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SRCS= vnode_if.h \

CFLAGS+= -I${.CURDIR}/../linuxkpi/dummy/include
CFLAGS+= -I${.CURDIR}/../linuxkpi/gplv2/include
CFLAGS+= -I${.CURDIR}/../linuxkpi/gplv2/arch/${MACHINE_CPUARCH}/include
CFLAGS+= -I${SYSDIR}/compat/linuxkpi/common/include

.include <bsd.kmod.mk>
6 changes: 5 additions & 1 deletion linuxkpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ SRCS= linux_kmod_gplv2.c \
linux_interval_tree.c \
linux_irq.c \
linux_llist.c \
linux_mtrr.c \
linux_notifier.c \
linux_page.c \
linux_rbtree.c \
Expand All @@ -39,10 +38,15 @@ SRCS+= bus_if.h \
pci_if.h \
vnode_if.h

.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
SRCS+= linux_mtrr.c
.endif

CFLAGS+= -include ${.CURDIR:H}/drivers/gpu/drm/drm_os_config.h
CFLAGS+= -I${.CURDIR:H}/include
CFLAGS+= -I${.CURDIR}/dummy/include
CFLAGS+= -I${.CURDIR}/gplv2/include
CFLAGS+= -I${.CURDIR}/gplv2/arch/${MACHINE_CPUARCH}/include
CFLAGS+= -I${SYSDIR}/compat/linuxkpi/common/include
CFLAGS+= '-DKBUILD_MODNAME="${KMOD}"'

Expand Down
Empty file.
8 changes: 8 additions & 0 deletions linuxkpi/gplv2/arch/aarch64/include/asm/pgtable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ASM_GPLV2_PGTABLE_H_
#define _ASM_GPLV2_PGTABLE_H_

#include_next <asm/pgtable.h>

#define pgprot_val(x) ((x))

#endif /* _ASM_GPLV2_PGTABLE_H_ */
13 changes: 13 additions & 0 deletions linuxkpi/gplv2/arch/aarch64/include/asm/processor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef _ASM_GPLV2_PROCESSOR_H_
#define _ASM_GPLV2_PROCESSOR_H_

#define smp_mb() mb()
#define smp_rmb() rmb()
#define smp_wmb() wmb()

static inline void cpu_relax(void)
{
__asm __volatile("yield" ::: "memory");
}

#endif
57 changes: 57 additions & 0 deletions linuxkpi/gplv2/include/linux/io.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2006 PathScale, Inc. All Rights Reserved.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _LINUX_GPLV2_IO_H_
#define _LINUX_GPLV2_IO_H_

Expand All @@ -6,6 +22,47 @@
#if defined(__amd64__) || defined(__i386__)
extern int arch_io_reserve_memtype_wc(resource_size_t start, resource_size_t size);
extern void arch_io_free_memtype_wc(resource_size_t start, resource_size_t size);
#else
static inline int arch_io_reserve_memtype_wc(resource_size_t base, resource_size_t size)
{
return 0;
}

static inline void arch_io_free_memtype_wc(resource_size_t base, resource_size_t size)
{
}
#endif

/*
* Some systems (x86 without PAT) have a somewhat reliable way to mark a
* physical address range such that uncached mappings will actually
* end up write-combining. This facility should be used in conjunction
* with pgprot_writecombine, ioremap-wc, or set_memory_wc, since it has
* no effect if the per-page mechanisms are functional.
* (On x86 without PAT, these functions manipulate MTRRs.)
*
* arch_phys_del_wc(0) or arch_phys_del_wc(any error code) is guaranteed
* to have no effect.
*/
#ifndef arch_phys_wc_add
static inline int __must_check arch_phys_wc_add(unsigned long base,
unsigned long size)
{
return 0; /* It worked (i.e. did nothing). */
}

static inline void arch_phys_wc_del(int handle)
{
}

#define arch_phys_wc_add arch_phys_wc_add
#ifndef arch_phys_wc_index
static inline int arch_phys_wc_index(int handle)
{
return -1;
}
#define arch_phys_wc_index arch_phys_wc_index
#endif
#endif

#endif /* _LINUX_IO_H_ */
2 changes: 2 additions & 0 deletions linuxkpi/gplv2/include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#if defined(__i386__) || defined(__amd64__)
#define NR_IRQS 512 /* XXX need correct value */
#elif defined(__aarch64__)
#define NR_IRQS 64
#else
#error "NR_IRQS not defined"
#endif
Expand Down