Re: [PATCH v8 09/28] mailbox: Add Gunyah message queue mailbox

From: Elliot Berman
Date: Tue Jan 03 2023 - 19:34:01 EST




On 1/1/2023 10:13 PM, Srivatsa Vaddagiri wrote:
* Elliot Berman <quic_eberman@xxxxxxxxxxx> [2022-12-19 14:58:30]:

+static inline bool gh_msgq_has_tx(struct gh_msgq *msgq)
+{

Consider possibility that msgq->tx_ghrc can be NULL?

+ return msgq->tx_ghrsc->type == GUNYAH_RESOURCE_TYPE_MSGQ_TX;
+}
+
+static inline bool gh_msgq_has_rx(struct gh_msgq *msgq)
+{

Consider possibility that msgq->rx_ghrc can be NULL?

+ return msgq->rx_ghrsc->type == GUNYAH_RESOURCE_TYPE_MSGQ_RX;
+}
+
+static irqreturn_t gh_msgq_rx_irq_handler(int irq, void *data)
+{
+ struct gh_msgq *msgq = data;
+ struct gh_msgq_rx_data rx_data;
+ unsigned long gh_err;
+ ssize_t ret;
+ bool ready = false;
+
+ do {
+ gh_err = gh_hypercall_msgq_recv(msgq->rx_ghrsc->capid,
+ (uintptr_t)&rx_data.data, sizeof(rx_data.data),
+ &rx_data.length, &ready);
+ if (gh_err == GH_ERROR_OK) {
+ mbox_chan_received_data(gh_msgq_chan(msgq), &rx_data);
+ } else if (GH_ERROR_MSGQUEUE_EMPTY) {

gh_err == GH_ERROR_MSGQUEUE_EMPTY


Applied the 3 comments, thanks!