broadcom(cle,clif,common,simulator): add 7.1 version on the list of versions to build

This adds 7.1 to the list of available V3D_VERSION, and first changes
on the simulator needed to get it working.

Note that we needed to touch all those 4 codebases because it is
needed if we want to use V3D_DEBUG=clif with the simulator, that it is
the easier way to see which packets a vulkan program is using.

About the simulator, this commit only handle the rename of some
registers. Any additional changes needed to get a proper support for
v71 will be handled them on following commits.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25450>
This commit is contained in:
Alejandro Piñeiro 2021-04-26 00:02:21 +02:00 committed by Marge Bot
parent 470bb614e0
commit d858332201
9 changed files with 106 additions and 24 deletions

View file

@ -23,7 +23,8 @@ v3d_versions = [
[21, 21],
[33, 33],
[41, 33],
[42, 33]
[42, 33],
[71, 33]
]
v3d_xml_files = []

View file

@ -37,6 +37,8 @@
# include "cle/v3d_packet_v41_pack.h"
#elif (V3D_VERSION == 42)
# include "cle/v3d_packet_v42_pack.h"
#elif (V3D_VERSION == 71)
# include "cle/v3d_packet_v71_pack.h"
#else
# error "Need to add a pack header include for this v3d version"
#endif

View file

@ -101,6 +101,8 @@ bool v3d41_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
const uint8_t *cl, uint32_t *size, bool reloc_mode);
bool v3d42_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
const uint8_t *cl, uint32_t *size, bool reloc_mode);
bool v3d71_clif_dump_packet(struct clif_dump *clif, uint32_t offset,
const uint8_t *cl, uint32_t *size, bool reloc_mode);
static inline void
out(struct clif_dump *clif, const char *fmt, ...)

View file

@ -66,6 +66,7 @@ v3d_get_device_info(int fd, struct v3d_device_info* devinfo, v3d_ioctl_fun drm_i
case 33:
case 41:
case 42:
case 71:
break;
default:
fprintf(stderr,

View file

@ -41,6 +41,9 @@
#elif (V3D_VERSION == 42)
# define V3DX(x) V3D42_##x
# define v3dX(x) v3d42_##x
#elif (V3D_VERSION == 71)
# define V3DX(x) V3D71_##x
# define v3dX(x) v3d71_##x
#else
# error "Need to add prefixing macros for this v3d version"
#endif

View file

@ -22,7 +22,7 @@ inc_broadcom = include_directories('.', 'cle')
subdir('cle')
v3d_versions = ['33', '41', '42']
v3d_versions = ['33', '41', '42', '71']
v3d_libs = []
if with_gallium_v3d or with_broadcom_vk

View file

@ -490,10 +490,20 @@ v3d_simulator_submit_cl_ioctl(int fd, struct drm_v3d_submit_cl *submit)
v3d_simulator_perfmon_switch(fd, submit->perfmon_id);
if (sim_state.ver >= 41)
v3d41_simulator_submit_cl_ioctl(sim_state.v3d, submit, file->gmp->ofs);
else
v3d33_simulator_submit_cl_ioctl(sim_state.v3d, submit, file->gmp->ofs);
switch(sim_state.ver) {
case 33:
v3d33_simulator_submit_cl_ioctl(sim_state.v3d, submit, file->gmp->ofs);
break;
case 41:
case 42:
v3d41_simulator_submit_cl_ioctl(sim_state.v3d, submit, file->gmp->ofs);
break;
case 71:
v3d71_simulator_submit_cl_ioctl(sim_state.v3d, submit, file->gmp->ofs);
break;
default:
unreachable("Unsupported V3D version\n");
}
util_dynarray_foreach(&sim_state.bin_oom, struct v3d_simulator_bo *,
sim_bo) {
@ -635,10 +645,17 @@ v3d_simulator_gem_close_ioctl(int fd, struct drm_gem_close *args)
static int
v3d_simulator_get_param_ioctl(int fd, struct drm_v3d_get_param *args)
{
if (sim_state.ver >= 41)
return v3d41_simulator_get_param_ioctl(sim_state.v3d, args);
else
switch(sim_state.ver) {
case 33:
return v3d33_simulator_get_param_ioctl(sim_state.v3d, args);
case 41:
case 42:
return v3d41_simulator_get_param_ioctl(sim_state.v3d, args);
case 71:
return v3d71_simulator_get_param_ioctl(sim_state.v3d, args);
default:
unreachable("Unsupported V3D version\n");
}
}
static int
@ -652,10 +669,20 @@ v3d_simulator_submit_tfu_ioctl(int fd, struct drm_v3d_submit_tfu *args)
v3d_simulator_copy_in_handle(file, args->bo_handles[2]);
v3d_simulator_copy_in_handle(file, args->bo_handles[3]);
if (sim_state.ver >= 41)
ret = v3d41_simulator_submit_tfu_ioctl(sim_state.v3d, args);
else
switch(sim_state.ver) {
case 33:
ret = v3d33_simulator_submit_tfu_ioctl(sim_state.v3d, args);
break;
case 41:
case 42:
ret = v3d41_simulator_submit_tfu_ioctl(sim_state.v3d, args);
break;
case 71:
ret = v3d71_simulator_submit_tfu_ioctl(sim_state.v3d, args);
break;
default:
unreachable("Unsupported V3D version\n");
}
v3d_simulator_copy_out_handle(file, args->bo_handles[0]);
@ -682,11 +709,19 @@ v3d_simulator_submit_csd_ioctl(int fd, struct drm_v3d_submit_csd *args)
v3d_simulator_perfmon_switch(fd, args->perfmon_id);
if (sim_state.ver >= 41)
ret = v3d41_simulator_submit_csd_ioctl(sim_state.v3d, args,
file->gmp->ofs);
else
ret = -1;
switch(sim_state.ver) {
case 41:
case 42:
ret = v3d41_simulator_submit_csd_ioctl(sim_state.v3d, args,
file->gmp->ofs);
break;
case 71:
ret = v3d71_simulator_submit_csd_ioctl(sim_state.v3d, args,
file->gmp->ofs);
break;
default:
ret = -1;
}
for (int i = 0; i < args->bo_handle_count; i++)
v3d_simulator_copy_out_handle(file, bo_handles[i]);
@ -880,10 +915,20 @@ v3d_simulator_init_global()
util_dynarray_init(&sim_state.bin_oom, NULL);
if (sim_state.ver >= 41)
v3d41_simulator_init_regs(sim_state.v3d);
else
switch(sim_state.ver) {
case 33:
v3d33_simulator_init_regs(sim_state.v3d);
break;
case 41:
case 42:
v3d41_simulator_init_regs(sim_state.v3d);
break;
case 71:
v3d71_simulator_init_regs(sim_state.v3d);
break;
default:
unreachable("Not supported V3D version\n");
}
}
struct v3d_simulator_file *

View file

@ -52,6 +52,11 @@ uint32_t v3d_simulator_get_mem_free(void);
# define v3dX(x) v3d41_##x
# include "v3dx_simulator.h"
# undef v3dX
# define v3dX(x) v3d71_##x
# include "v3dx_simulator.h"
# undef v3dX
#endif
#endif

View file

@ -46,11 +46,15 @@
#define HW_REGISTER_RO(x) (x)
#define HW_REGISTER_RW(x) (x)
#if V3D_VERSION >= 41
#if V3D_VERSION == 71
#include "libs/core/v3d/registers/7.1.6.0/v3d.h"
#else
#if V3D_VERSION == 41 || V3D_VERSION == 42
#include "libs/core/v3d/registers/4.1.35.0/v3d.h"
#else
#include "libs/core/v3d/registers/3.3.0.0/v3d.h"
#endif
#endif
#define V3D_WRITE(reg, val) v3d_hw_write_reg(v3d, reg, val)
#define V3D_READ(reg) v3d_hw_read_reg(v3d, reg)
@ -310,16 +314,17 @@ v3d_isr_core(struct v3d_hw *v3d,
return;
}
#if V3D_VERSION <= 42
if (core_status & V3D_CTL_0_INT_STS_INT_GMPV_SET) {
fprintf(stderr, "GMP violation at 0x%08x\n",
V3D_READ(V3D_GMP_VIO_ADDR));
abort();
} else {
fprintf(stderr,
"Unexpected ISR with core status 0x%08x\n",
core_status);
}
abort();
#endif
}
static void
@ -396,6 +401,18 @@ v3d_isr_hub(struct v3d_hw *v3d)
}
handle_mmu_interruptions(v3d, hub_status);
#if V3D_VERSION == 71
if (hub_status & V3D_HUB_CTL_INT_STS_INT_GMPV_SET) {
fprintf(stderr, "GMP violation at 0x%08x\n",
V3D_READ(V3D_GMP_VIO_ADDR));
} else {
fprintf(stderr,
"Unexpected ISR with status 0x%08x\n",
hub_status);
}
abort();
#endif
}
static void
@ -436,8 +453,11 @@ v3dX(simulator_init_regs)(struct v3d_hw *v3d)
* for tracing. Perhaps we should evaluate to do the same here and add
* some debug options.
*/
uint32_t core_interrupts = (V3D_CTL_0_INT_STS_INT_GMPV_SET |
V3D_CTL_0_INT_STS_INT_OUTOMEM_SET);
uint32_t core_interrupts = V3D_CTL_0_INT_STS_INT_OUTOMEM_SET;
#if V3D_VERSION <= 42
core_interrupts |= V3D_CTL_0_INT_STS_INT_GMPV_SET;
#endif
V3D_WRITE(V3D_CTL_0_INT_MSK_SET, ~core_interrupts);
V3D_WRITE(V3D_CTL_0_INT_MSK_CLR, core_interrupts);
@ -447,6 +467,9 @@ v3dX(simulator_init_regs)(struct v3d_hw *v3d)
V3D_HUB_CTL_INT_STS_INT_MMU_CAP_SET | /* CAP exceeded */
V3D_HUB_CTL_INT_STS_INT_TFUC_SET); /* TFU conversion */
#if V3D_VERSION == 71
hub_interrupts |= V3D_HUB_CTL_INT_STS_INT_GMPV_SET;
#endif
V3D_WRITE(V3D_HUB_CTL_INT_MSK_SET, ~hub_interrupts);
V3D_WRITE(V3D_HUB_CTL_INT_MSK_CLR, hub_interrupts);