Thread (51 messages) 51 messages, 4 authors, 2023-08-05

Re: [PATCH v14 17/25] virt: gunyah: Translate gh_rm_hyp_resource into gunyah_resource

From: Bjorn Andersson <andersson@kernel.org>
Date: 2023-08-05 18:13:05
Also in: linux-arm-msm, linux-devicetree, linux-doc, lkml

On Tue, Jun 13, 2023 at 10:20:45AM -0700, Elliot Berman wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/virt/gunyah/rsc_mgr.c b/drivers/virt/gunyah/rsc_mgr.c
[..]
+struct gh_resource *gh_rm_alloc_resource(struct gh_rm *rm, struct gh_rm_hyp_resource *hyp_resource)
+{
+	struct gh_resource *ghrsc;
+	int ret;
+
+	ghrsc = kzalloc(sizeof(*ghrsc), GFP_KERNEL);
+	if (!ghrsc)
+		return NULL;
+
+	ghrsc->type = hyp_resource->type;
+	ghrsc->capid = le64_to_cpu(hyp_resource->cap_id);
+	ghrsc->irq = IRQ_NOTCONNECTED;
+	ghrsc->rm_label = le32_to_cpu(hyp_resource->resource_label);
+	if (hyp_resource->virq) {
+		struct gh_irq_chip_data irq_data = {
+			.gh_virq = le32_to_cpu(hyp_resource->virq),
+		};
+
+		ret = irq_domain_alloc_irqs(rm->irq_domain, 1, NUMA_NO_NODE, &irq_data);
+		if (ret < 0) {
+			dev_err(rm->dev,
+				"Failed to allocate interrupt for resource %d label: %d: %d\n",
+				ghrsc->type, ghrsc->rm_label, ret);
+			kfree(ghrsc);
+			return NULL;
+		} else {
No need for the else here, the failure case has already returned.
+			ghrsc->irq = ret;
+		}
+	}
+
+	return ghrsc;
+}
[..]
quoted hunk ↗ jump to hunk
diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h
index 982e27d10d57f..4b398b59c2c5a 100644
--- a/include/linux/gunyah.h
+++ b/include/linux/gunyah.h
@@ -27,6 +27,9 @@ struct gh_resource {
 	enum gh_resource_type type;
 	u64 capid;
 	unsigned int irq;
+
+	struct list_head list;
This is unused.

Regards,
Bjorn

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help