Merge "soc: hab: change lifecycle of exp_id from vchan to ctx"
This commit is contained in:
commit
62866132b1
3 changed files with 11 additions and 10 deletions
|
@ -32,6 +32,7 @@ struct pages_list {
|
||||||
struct dma_buf *dmabuf;
|
struct dma_buf *dmabuf;
|
||||||
int32_t export_id;
|
int32_t export_id;
|
||||||
int32_t vcid;
|
int32_t vcid;
|
||||||
|
struct physical_channel *pchan;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct importer_context {
|
struct importer_context {
|
||||||
|
@ -511,6 +512,7 @@ static int habmem_imp_hyp_map_fd(void *imp_ctx,
|
||||||
pglist->userflags = userflags;
|
pglist->userflags = userflags;
|
||||||
pglist->export_id = exp->export_id;
|
pglist->export_id = exp->export_id;
|
||||||
pglist->vcid = exp->vcid_remote;
|
pglist->vcid = exp->vcid_remote;
|
||||||
|
pglist->pchan = exp->pchan;
|
||||||
|
|
||||||
if (!(userflags & HABMM_IMPORT_FLAGS_CACHED))
|
if (!(userflags & HABMM_IMPORT_FLAGS_CACHED))
|
||||||
prot = pgprot_writecombine(prot);
|
prot = pgprot_writecombine(prot);
|
||||||
|
@ -589,6 +591,7 @@ static int habmem_imp_hyp_map_kva(void *imp_ctx,
|
||||||
pglist->userflags = userflags;
|
pglist->userflags = userflags;
|
||||||
pglist->export_id = exp->export_id;
|
pglist->export_id = exp->export_id;
|
||||||
pglist->vcid = exp->vcid_remote;
|
pglist->vcid = exp->vcid_remote;
|
||||||
|
pglist->pchan = exp->pchan;
|
||||||
|
|
||||||
if (!(userflags & HABMM_IMPORT_FLAGS_CACHED))
|
if (!(userflags & HABMM_IMPORT_FLAGS_CACHED))
|
||||||
prot = pgprot_writecombine(prot);
|
prot = pgprot_writecombine(prot);
|
||||||
|
@ -658,6 +661,7 @@ static int habmem_imp_hyp_map_uva(void *imp_ctx,
|
||||||
pglist->userflags = userflags;
|
pglist->userflags = userflags;
|
||||||
pglist->export_id = exp->export_id;
|
pglist->export_id = exp->export_id;
|
||||||
pglist->vcid = exp->vcid_remote;
|
pglist->vcid = exp->vcid_remote;
|
||||||
|
pglist->pchan = exp->pchan;
|
||||||
|
|
||||||
write_lock(&priv->implist_lock);
|
write_lock(&priv->implist_lock);
|
||||||
list_add_tail(&pglist->list, &priv->imp_list);
|
list_add_tail(&pglist->list, &priv->imp_list);
|
||||||
|
@ -699,7 +703,7 @@ int habmm_imp_hyp_unmap(void *imp_ctx, struct export_desc *exp, int kernel)
|
||||||
write_lock(&priv->implist_lock);
|
write_lock(&priv->implist_lock);
|
||||||
list_for_each_entry_safe(pglist, tmp, &priv->imp_list, list) {
|
list_for_each_entry_safe(pglist, tmp, &priv->imp_list, list) {
|
||||||
if (pglist->export_id == exp->export_id &&
|
if (pglist->export_id == exp->export_id &&
|
||||||
pglist->vcid == exp->vcid_remote) {
|
pglist->pchan == exp->pchan) {
|
||||||
found = 1;
|
found = 1;
|
||||||
list_del(&pglist->list);
|
list_del(&pglist->list);
|
||||||
priv->cnt--;
|
priv->cnt--;
|
||||||
|
@ -776,7 +780,7 @@ int habmm_imp_hyp_map_check(void *imp_ctx, struct export_desc *exp)
|
||||||
read_lock(&priv->implist_lock);
|
read_lock(&priv->implist_lock);
|
||||||
list_for_each_entry(pglist, &priv->imp_list, list) {
|
list_for_each_entry(pglist, &priv->imp_list, list) {
|
||||||
if (pglist->export_id == exp->export_id &&
|
if (pglist->export_id == exp->export_id &&
|
||||||
pglist->vcid == exp->vcid_remote) {
|
pglist->pchan == exp->pchan) {
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,8 +319,7 @@ int hab_mem_unexport(struct uhab_context *ctx,
|
||||||
write_lock(&ctx->exp_lock);
|
write_lock(&ctx->exp_lock);
|
||||||
list_for_each_entry_safe(exp, tmp, &ctx->exp_whse, node) {
|
list_for_each_entry_safe(exp, tmp, &ctx->exp_whse, node) {
|
||||||
if (param->exportid == exp->export_id &&
|
if (param->exportid == exp->export_id &&
|
||||||
param->vcid == exp->vcid_local) {
|
vchan->pchan == exp->pchan) {
|
||||||
/* same vchan guarantees the pchan for idr */
|
|
||||||
list_del(&exp->node);
|
list_del(&exp->node);
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -367,10 +366,7 @@ int hab_mem_import(struct uhab_context *ctx,
|
||||||
spin_lock_bh(&ctx->imp_lock);
|
spin_lock_bh(&ctx->imp_lock);
|
||||||
list_for_each_entry(exp, &ctx->imp_whse, node) {
|
list_for_each_entry(exp, &ctx->imp_whse, node) {
|
||||||
if ((exp->export_id == param->exportid) &&
|
if ((exp->export_id == param->exportid) &&
|
||||||
(param->vcid == exp->vcid_remote)) {
|
(exp->pchan == vchan->pchan)) {
|
||||||
/* only allow import on the vchan recevied from
|
|
||||||
* remote
|
|
||||||
*/
|
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -424,8 +420,8 @@ int hab_mem_unimport(struct uhab_context *ctx,
|
||||||
spin_lock_bh(&ctx->imp_lock);
|
spin_lock_bh(&ctx->imp_lock);
|
||||||
list_for_each_entry_safe(exp, exp_tmp, &ctx->imp_whse, node) {
|
list_for_each_entry_safe(exp, exp_tmp, &ctx->imp_whse, node) {
|
||||||
if (exp->export_id == param->exportid &&
|
if (exp->export_id == param->exportid &&
|
||||||
param->vcid == exp->vcid_remote) {
|
exp->pchan == vchan->pchan) {
|
||||||
/* same vchan is expected here */
|
/* same pchan is expected here */
|
||||||
list_del(&exp->node);
|
list_del(&exp->node);
|
||||||
ctx->import_total--;
|
ctx->import_total--;
|
||||||
found = 1;
|
found = 1;
|
||||||
|
|
|
@ -282,6 +282,7 @@ int hab_msg_recv(struct physical_channel *pchan,
|
||||||
}
|
}
|
||||||
|
|
||||||
exp_desc->domid_local = pchan->dom_id;
|
exp_desc->domid_local = pchan->dom_id;
|
||||||
|
exp_desc->pchan = pchan;
|
||||||
|
|
||||||
hab_export_enqueue(vchan, exp_desc);
|
hab_export_enqueue(vchan, exp_desc);
|
||||||
hab_send_export_ack(vchan, pchan, exp_desc);
|
hab_send_export_ack(vchan, pchan, exp_desc);
|
||||||
|
|
Loading…
Add table
Reference in a new issue