vchan = hab_get_vchan_fromvcid(vcid, ctx);
if (!vchan) {
- pr_err("vcid %X, vchan %p ctx %p\n", vcid, vchan, ctx);
+ pr_err("vcid %X vchan 0x%pK ctx %pK\n", vcid, vchan, ctx);
return -ENODEV;
}
struct hab_recv *recv_param;
struct hab_send *send_param;
struct hab_info *info_param;
- struct hab_message *msg;
+ struct hab_message *msg = NULL;
void *send_data;
unsigned char data[256] = { 0 };
long ret = 0;
/* debug only */
uint32_t sequence_tx;
uint32_t sequence_rx;
+ uint32_t status;
/* vchans on this pchan */
struct list_head vchannels;
};
struct hab_message {
- size_t sizebytes;
struct list_head node;
+ size_t sizebytes;
uint32_t data[];
};
if (!pfn_table)
return ERR_PTR(-EINVAL);
+ pfn = pfn_table->first_pfn;
+ if (pfn_valid(pfn) == 0 || page_is_ram(pfn) == 0) {
+ pr_err("imp sanity failed pfn %lx valid %d ram %d pchan %s\n",
+ pfn, pfn_valid(pfn),
+ page_is_ram(pfn), exp->pchan->name);
+ return ERR_PTR(-EINVAL);
+ }
+
size = exp->payload_count * sizeof(struct page *);
pages = kmalloc(size, GFP_KERNEL);
if (!pages)
return ERR_PTR(-ENOMEM);
}
- pfn = pfn_table->first_pfn;
for (i = 0; i < pfn_table->nregions; i++) {
for (j = 0; j < pfn_table->region[i].size; j++) {
pages[k] = pfn_to_page(pfn+j);
&pdata_size);
}
if (ret < 0) {
- pr_err("habmem_hyp_grant failed size=%d ret=%d\n",
- pdata_size, ret);
+ pr_err("habmem_hyp_grant vc %x failed size=%d ret=%d\n",
+ param->vcid, pdata_size, ret);
goto err;
}
*/
vchan = hab_vchan_get(pchan, header);
if (!vchan) {
- pr_info("vchan is not found, payload type %d, vchan id %x, sizebytes %zx, session %d\n",
+ pr_debug("vchan not found type %d vcid %x sz %zx sesn %d\n",
payload_type, vchan_id, sizebytes, session_id);
if (sizebytes) {
case HAB_PAYLOAD_TYPE_CLOSE:
/* remote request close */
- pr_info("remote request close vcid %pK %X other id %X session %d refcnt %d\n",
+ pr_debug("remote close vcid %pK %X other id %X session %d refcnt %d\n",
vchan, vchan->id, vchan->otherend_id,
session_id, get_refcnt(vchan->refcount));
hab_vchan_stop(vchan);
continue;
ret = hab_stat_buffer_print(buf, size,
- "mmid %s role %d local %d remote %d vcnt %d:\n",
+ "nm %s r %d lc %d rm %d sq_t %d sq_r %d st 0x%x vn %d:\n",
pchan->name, pchan->is_be, pchan->vmid_local,
- pchan->vmid_remote, pchan->vcnt);
+ pchan->vmid_remote, pchan->sequence_tx,
+ pchan->sequence_rx, pchan->status, pchan->vcnt);
read_lock(&pchan->vchans_lock);
list_for_each_entry(vc, &pchan->vchannels, pnode) {
ret = hab_stat_buffer_print(buf, size,
- "%08X ", vc->id);
+ "%08X(%d:%d) ", vc->id,
+ get_refcnt(vc->refcount),
+ vc->otherend_closed);
}
ret = hab_stat_buffer_print(buf, size, "\n");
read_unlock(&pchan->vchans_lock);
return vchan;
}
+/* wake up local waiting Q, so stop-vchan can be processed */
void hab_vchan_stop(struct virtual_channel *vchan)
{
if (vchan) {
read_unlock(&pchan->vchans_lock);
}
+/* send vchan close to remote and stop receiving anything locally */
void hab_vchan_stop_notify(struct virtual_channel *vchan)
{
hab_send_close_msg(vchan);