Commit 835fb5e4 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: enforce a buffer headroom maximum size

Define a maximum size that a host device can use for its private
area ahead of the payload space used by Greybus in a message buffer.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent dc779229
...@@ -127,6 +127,7 @@ static void hd_buffer_constraints(struct greybus_host_device *hd) ...@@ -127,6 +127,7 @@ static void hd_buffer_constraints(struct greybus_host_device *hd)
*/ */
hd->buffer_headroom = sizeof(u32); /* For cport id */ hd->buffer_headroom = sizeof(u32); /* For cport id */
hd->buffer_size_max = ES1_GBUF_MSG_SIZE_MAX; hd->buffer_size_max = ES1_GBUF_MSG_SIZE_MAX;
BUILD_BUG_ON(hd->buffer_headroom > GB_BUFFER_HEADROOM_MAX);
} }
#define ES1_TIMEOUT 500 /* 500 ms for the SVC to do something */ #define ES1_TIMEOUT 500 /* 500 ms for the SVC to do something */
......
...@@ -69,6 +69,14 @@ ...@@ -69,6 +69,14 @@
struct greybus_host_device; struct greybus_host_device;
struct svc_msg; struct svc_msg;
/*
* When the Greybus code allocates a buffer it sets aside bytes
* prior to the beginning of the payload area for the host device's
* exclusive use. The size is specified by hd->buffer_headroom, and
* which can't be greater than GB_BUFFER_HEADROOM_MAX.
*/
#define GB_BUFFER_HEADROOM_MAX sizeof(u64)
/* Buffers allocated from the host driver will be aligned to this multiple */ /* Buffers allocated from the host driver will be aligned to this multiple */
#define GB_BUFFER_ALIGN sizeof(u32) #define GB_BUFFER_ALIGN sizeof(u32)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment