From 5ca93f61494e90b890b7c5fa0d673235eb4965d5 Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Tue, 10 Mar 2020 12:18:17 -0700 Subject: [PATCH 1/3] haven: doorbell: Add IRQF_ONESHOT flag Use the IRQF_ONESHOT flag while requesting the threaded interrupt. This flag keeps the virtual interrupt line masked until the threaded handler has executed. Change-Id: I041823f8b30e4326d3b28635c80918e4b501432a Signed-off-by: Chris Lew --- drivers/virt/haven/hh_dbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virt/haven/hh_dbl.c b/drivers/virt/haven/hh_dbl.c index 1e2d55efe1a5..b3677f6c58bc 100644 --- a/drivers/virt/haven/hh_dbl.c +++ b/drivers/virt/haven/hh_dbl.c @@ -371,7 +371,7 @@ void *hh_dbl_rx_register(enum hh_dbl_label label, dbl_rx_cb_t rx_cb, void *priv) ret = request_threaded_irq(cap_table_entry->rx_irq, NULL, hh_dbl_rx_callback_thread, - 0, + IRQF_ONESHOT, cap_table_entry->rx_irq_name, priv); From c4684eeb0af44e5a22eae90beb5757cc1de71d1e Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Tue, 10 Mar 2020 12:21:24 -0700 Subject: [PATCH 2/3] haven: doorbell: Pass cap_table_entry as irq private The threaded interrupt handler needs access to the cap_table_entry structure and the clients passed in private data. All this information is store in the cap_table_entry struct. Pass this in as irq private data instead of the clients private pointer. Change-Id: If2455704236f3531724d5c007210559391e5cfd8 Signed-off-by: Chris Lew --- drivers/virt/haven/hh_dbl.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/virt/haven/hh_dbl.c b/drivers/virt/haven/hh_dbl.c index b3677f6c58bc..86afef1437fc 100644 --- a/drivers/virt/haven/hh_dbl.c +++ b/drivers/virt/haven/hh_dbl.c @@ -247,17 +247,14 @@ int hh_dbl_reset(void *dbl_client_desc) } EXPORT_SYMBOL(hh_dbl_reset); -static irqreturn_t hh_dbl_rx_callback_thread(int irq, void *rx_priv_data) +static irqreturn_t hh_dbl_rx_callback_thread(int irq, void *data) { - struct hh_dbl_cap_table *cap_table_entry; - - cap_table_entry = container_of(rx_priv_data, - struct hh_dbl_cap_table, rx_priv_data); + struct hh_dbl_cap_table *cap_table_entry = data; if (!cap_table_entry->rx_callback) return IRQ_HANDLED; - cap_table_entry->rx_callback(irq, rx_priv_data); + cap_table_entry->rx_callback(irq, cap_table_entry->rx_priv_data); return IRQ_HANDLED; } @@ -373,7 +370,7 @@ void *hh_dbl_rx_register(enum hh_dbl_label label, dbl_rx_cb_t rx_cb, void *priv) hh_dbl_rx_callback_thread, IRQF_ONESHOT, cap_table_entry->rx_irq_name, - priv); + cap_table_entry); if (ret < 0) { pr_err("%s: IRQ registration failed\n", __func__); From b07b4f073e16cd1682d8a4291996698c48bbd9df Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Tue, 17 Mar 2020 19:06:47 -0700 Subject: [PATCH 3/3] haven: doorbell: Fix hh_dbl_send error print Add the missing __func__ argument to the failed hypercall error print in hh_dbl_send(). Change-Id: If40a13db695822fb363ea870389e42ba8dbb9015 Signed-off-by: Chris Lew --- drivers/virt/haven/hh_dbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virt/haven/hh_dbl.c b/drivers/virt/haven/hh_dbl.c index 86afef1437fc..b24a2c5aec19 100644 --- a/drivers/virt/haven/hh_dbl.c +++ b/drivers/virt/haven/hh_dbl.c @@ -206,7 +206,7 @@ int hh_dbl_send(void *dbl_client_desc, hh_dbl_flags_t *newflags) ret = hh_remap_error(hh_ret); if (ret != 0) - pr_err("%s: Hypercall failed ret = %d\n", hh_ret); + pr_err("%s: Hypercall failed ret = %d\n", __func__, hh_ret); else *newflags = send_resp.old_flags;