arm: apple: rtkit: Add default buffer handlers

For devices without specific buffer methods, just assume we can give
them raw memory pointers when they request a buffer.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2022-08-01 22:11:31 +09:00 committed by Mark Kettenis
parent 7c631d3d33
commit 92e8fd4ec2

View file

@ -96,6 +96,13 @@ void apple_rtkit_free(struct apple_rtkit *rtk)
rtk->shmem_destroy(rtk->cookie, &rtk->crashlog_buffer);
if (rtk->ioreport_buffer.buffer)
rtk->shmem_destroy(rtk->cookie, &rtk->ioreport_buffer);
} else {
if (rtk->syslog_buffer.buffer)
free(rtk->syslog_buffer.buffer);
if (rtk->crashlog_buffer.buffer)
free(rtk->crashlog_buffer.buffer);
if (rtk->ioreport_buffer.buffer)
free(rtk->ioreport_buffer.buffer);
}
free(rtk);
}
@ -130,7 +137,7 @@ static int rtkit_handle_buf_req(struct apple_rtkit *rtk, int endpoint, struct ap
buf->dva = FIELD_GET(APPLE_RTKIT_BUFFER_REQUEST_IOVA, msg->msg0);
buf->size = num_4kpages << 12;
buf->is_mapped = false;
buf->is_mapped = !!buf->dva;
if (rtk->shmem_setup) {
ret = rtk->shmem_setup(rtk->cookie, buf);
@ -139,6 +146,12 @@ static int rtkit_handle_buf_req(struct apple_rtkit *rtk, int endpoint, struct ap
endpoint);
return ret;
}
} else if (!buf->is_mapped){
buf->buffer = memalign(SZ_16K, ALIGN(buf->size, SZ_16K));
if (!buf->buffer)
return -ENOMEM;
buf->dva = (u64)buf->buffer;
}
if (!buf->is_mapped) {