mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 19:56:18 +00:00
drm/radeon/kms: prevent parallel AtomBIOS calls
This just adds a mutex around the atombios table execution so we don't call it from two contexts at once. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
d79766fab9
commit
c31ad97f18
3 changed files with 12 additions and 2 deletions
|
@ -58,6 +58,7 @@ typedef struct {
|
||||||
} atom_exec_context;
|
} atom_exec_context;
|
||||||
|
|
||||||
int atom_debug = 0;
|
int atom_debug = 0;
|
||||||
|
static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params);
|
||||||
void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params);
|
void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params);
|
||||||
|
|
||||||
static uint32_t atom_arg_mask[8] =
|
static uint32_t atom_arg_mask[8] =
|
||||||
|
@ -573,7 +574,7 @@ static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg)
|
||||||
else
|
else
|
||||||
SDEBUG(" table: %d\n", idx);
|
SDEBUG(" table: %d\n", idx);
|
||||||
if (U16(ctx->ctx->cmd_table + 4 + 2 * idx))
|
if (U16(ctx->ctx->cmd_table + 4 + 2 * idx))
|
||||||
atom_execute_table(ctx->ctx, idx, ctx->ps + ctx->ps_shift);
|
atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg)
|
static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg)
|
||||||
|
@ -1040,7 +1041,7 @@ static struct {
|
||||||
atom_op_shr, ATOM_ARG_MC}, {
|
atom_op_shr, ATOM_ARG_MC}, {
|
||||||
atom_op_debug, 0},};
|
atom_op_debug, 0},};
|
||||||
|
|
||||||
void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
|
static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params)
|
||||||
{
|
{
|
||||||
int base = CU16(ctx->cmd_table + 4 + 2 * index);
|
int base = CU16(ctx->cmd_table + 4 + 2 * index);
|
||||||
int len, ws, ps, ptr;
|
int len, ws, ps, ptr;
|
||||||
|
@ -1092,6 +1093,13 @@ void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
|
||||||
kfree(ectx.ws);
|
kfree(ectx.ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params)
|
||||||
|
{
|
||||||
|
mutex_lock(&ctx->mutex);
|
||||||
|
atom_execute_table_locked(ctx, index, params);
|
||||||
|
mutex_unlock(&ctx->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 };
|
static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 };
|
||||||
|
|
||||||
static void atom_index_iio(struct atom_context *ctx, int base)
|
static void atom_index_iio(struct atom_context *ctx, int base)
|
||||||
|
|
|
@ -120,6 +120,7 @@ struct card_info {
|
||||||
|
|
||||||
struct atom_context {
|
struct atom_context {
|
||||||
struct card_info *card;
|
struct card_info *card;
|
||||||
|
struct mutex mutex;
|
||||||
void *bios;
|
void *bios;
|
||||||
uint32_t cmd_table, data_table;
|
uint32_t cmd_table, data_table;
|
||||||
uint16_t *iio;
|
uint16_t *iio;
|
||||||
|
|
|
@ -481,6 +481,7 @@ int radeon_atombios_init(struct radeon_device *rdev)
|
||||||
atom_card_info->pll_write = cail_pll_write;
|
atom_card_info->pll_write = cail_pll_write;
|
||||||
|
|
||||||
rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios);
|
rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios);
|
||||||
|
mutex_init(&rdev->mode_info.atom_context->mutex);
|
||||||
radeon_atom_initialize_bios_scratch_regs(rdev->ddev);
|
radeon_atom_initialize_bios_scratch_regs(rdev->ddev);
|
||||||
atom_allocate_fb_scratch(rdev->mode_info.atom_context);
|
atom_allocate_fb_scratch(rdev->mode_info.atom_context);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue