[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240311053905.GN440762@quicinc.com>
Date: Mon, 11 Mar 2024 11:09:05 +0530
From: Srivatsa Vaddagiri <quic_svaddagi@...cinc.com>
To: Elliot Berman <quic_eberman@...cinc.com>
CC: Alex Elder <elder@...aro.org>,
Srinivas Kandagatla
<srinivas.kandagatla@...aro.org>,
Murali Nalajal <quic_mnalajal@...cinc.com>,
Trilok Soni <quic_tsoni@...cinc.com>,
Carl van Schaik
<quic_cvanscha@...cinc.com>,
Philip Derrin <quic_pderrin@...cinc.com>,
Prakruthi Deepak Heragu <quic_pheragu@...cinc.com>,
Jonathan Corbet
<corbet@....net>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Bjorn Andersson
<andersson@...nel.org>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
"Fuad
Tabba" <tabba@...gle.com>,
Sean Christopherson <seanjc@...gle.com>,
"Andrew
Morton" <akpm@...ux-foundation.org>,
<linux-arm-msm@...r.kernel.org>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-mm@...ck.org>
Subject: Re: [PATCH v17 11/35] virt: gunyah: Translate gh_rm_hyp_resource
into gunyah_resource
* Elliot Berman <quic_eberman@...cinc.com> [2024-02-22 15:16:34]:
> When booting a Gunyah virtual machine, the host VM may gain capabilities
> to interact with resources for the guest virtual machine. Examples of
> such resources are vCPUs or message queues. To use those resources, we
> need to translate the RM response into a gunyah_resource structure which
> are useful to Linux drivers. Presently, Linux drivers need only to know
> the type of resource, the capability ID, and an interrupt.
>
> On ARM64 systems, the interrupt reported by Gunyah is the GIC interrupt
> ID number and always a SPI or extended SPI.
>
> Signed-off-by: Elliot Berman <quic_eberman@...cinc.com>
Minor nit below. LGTM otherwise
Reviewed-by: Srivatsa Vaddagiri <quic_svaddagi@...cinc.com>
> +struct gunyah_resource *
> +gunyah_rm_alloc_resource(struct gunyah_rm *rm,
> + struct gunyah_rm_hyp_resource *hyp_resource)
> +{
> + struct gunyah_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 irq_fwspec fwspec;
> +
> +
> + fwspec.fwnode = rm->parent_fwnode;
> + ret = arch_gunyah_fill_irq_fwspec_params(le32_to_cpu(hyp_resource->virq), &fwspec);
> + if (ret) {
> + dev_err(rm->dev,
> + "Failed to translate interrupt for resource %d label: %d: %d\n",
> + ghrsc->type, ghrsc->rm_label, ret);
Not bailing on error here appears wrong. Can you check?
> + }
> +
> + ret = irq_create_fwspec_mapping(&fwspec);
> + 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;
> + }
> + ghrsc->irq = ret;
> + }
> +
> + return ghrsc;
> +}
Powered by blists - more mailing lists