From: Lizhi Hou <lizhi.hou@amd.com>
To: Carl Vanderlip <quic_carlv@quicinc.com>, <ogabbay@kernel.org>,
<dri-devel@lists.freedesktop.org>
Cc: <linux-kernel@vger.kernel.org>, <min.ma@amd.com>,
<max.zhen@amd.com>, <sonal.santan@amd.com>, <king.tam@amd.com>,
Narendra Gutta <VenkataNarendraKumar.Gutta@amd.com>,
George Yang <George.Yang@amd.com>
Subject: Re: [PATCH V2 01/10] accel/amdxdna: Add a new driver for AMD AI Engine
Date: Mon, 12 Aug 2024 08:58:04 -0700 [thread overview]
Message-ID: <f76e4427-bb7b-747a-fd5a-21ca9e388d4a@amd.com> (raw)
In-Reply-To: <9f017342-b686-4ba0-bb0a-6912b051c152@quicinc.com>
On 8/9/24 08:24, Carl Vanderlip wrote:
> On 8/5/2024 10:39 AM, Lizhi Hou wrote:
> > +static int aie2_init(struct amdxdna_dev *xdna)
> > +{
> > + struct pci_dev *pdev = to_pci_dev(xdna->ddev.dev);
> > + struct amdxdna_dev_hdl *ndev;
> > + struct psp_config psp_conf;
> > + const struct firmware *fw;
> > + void __iomem * const *tbl;
> > + int i, bars, nvec, ret;
> > +
> > + ndev = devm_kzalloc(&pdev->dev, sizeof(*ndev), GFP_KERNEL);
> > + if (!ndev)
> > + return -ENOMEM;
> > +
> > + ndev->priv = xdna->dev_info->dev_priv;
> > + ndev->xdna = xdna;
> > +
> > + ret = request_firmware(&fw, ndev->priv->fw_path, &pdev->dev);
> > + if (ret) {
> > + XDNA_ERR(xdna, "failed to request_firmware %s, ret %d",
> > + ndev->priv->fw_path, ret);
> > + return ret;
> > + }
> > +
> > + ret = pcim_enable_device(pdev);
>
>
> Does request_firmware need to be the first thing here? Its not used
> until the end of init. Likewise, fw image is copied in *_create, but
> then not released until after *_hw_start; could release_firmware more
> closely wrap where it is used? I could see it being checked first
> because if the fw isn't there, what's the point, but that could be
> said about any of the other resources here.
request_firmware() will failed if user forget to install the firmware
package. Other initialization calls (e.g. enable device, etc) are very
unlikely to happen. That is why request_firmware() is checked first.
This will only hold the memory before the function exits. I think it is
very short period and should be ok.
>
> On 8/5/2024 10:39 AM, Lizhi Hou wrote:
> > +enum aie2_smu_reg_idx {
> > + SMU_CMD_REG = 0,
> > + SMU_ARG_REG,
> > + SMU_INTR_REG,
> > + SMU_RESP_REG,
> > + SMU_OUT_REG,
> > + SMU_MAX_REGS /* Kepp this at the end */
> > +};
>
> *Keep
Thanks. I will fix this.
Lizhi
>
>
> -Carl V.
>
> PS Sorry for double email Lizhi, forgot to send to list.
next prev parent reply other threads:[~2024-08-12 15:58 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 17:39 [PATCH V2 00/10] AMD XDNA driver Lizhi Hou
2024-08-05 17:39 ` [PATCH V2 01/10] accel/amdxdna: Add a new driver for AMD AI Engine Lizhi Hou
2024-08-07 11:06 ` Markus Elfring
2024-08-07 16:07 ` Lizhi Hou
2024-08-09 15:24 ` Carl Vanderlip
2024-08-12 15:58 ` Lizhi Hou [this message]
2024-08-09 16:11 ` Jeffrey Hugo
2024-08-14 18:16 ` Lizhi Hou
2024-08-14 18:46 ` Jeffrey Hugo
2024-08-14 20:24 ` Lizhi Hou
2024-08-14 21:53 ` Jeffrey Hugo
2024-08-14 21:59 ` Lizhi Hou
2024-08-05 17:39 ` [PATCH V2 02/10] accel/amdxdna: Support hardware mailbox Lizhi Hou
2024-08-09 16:32 ` Jeffrey Hugo
2024-08-14 21:05 ` Lizhi Hou
2024-08-14 22:02 ` Jeffrey Hugo
2024-08-05 17:39 ` [PATCH V2 03/10] accel/amdxdna: Add hardware resource solver Lizhi Hou
2024-08-09 16:36 ` Jeffrey Hugo
2024-08-05 17:39 ` [PATCH V2 04/10] accel/amdxdna: Add hardware context Lizhi Hou
2024-08-08 21:34 ` Alex Deucher
2024-08-08 22:15 ` Lizhi Hou
2024-08-05 17:39 ` [PATCH V2 05/10] accel/amdxdna: Add GEM buffer object management Lizhi Hou
2024-08-09 16:39 ` Jeffrey Hugo
2024-08-05 17:39 ` [PATCH V2 06/10] accel/amdxdna: Add command execution Lizhi Hou
2024-08-05 17:39 ` [PATCH V2 07/10] accel/amdxdna: Add suspend and resume Lizhi Hou
2024-08-05 17:39 ` [PATCH V2 08/10] accel/amdxdna: Add error handling Lizhi Hou
2024-08-05 17:39 ` [PATCH V2 09/10] accel/amdxdna: Add query functions Lizhi Hou
2024-08-09 16:42 ` Jeffrey Hugo
2024-08-19 19:50 ` Lizhi Hou
2024-08-05 17:39 ` [PATCH V2 10/10] accel/amdxdna: Add firmware debug buffer support Lizhi Hou
2024-08-06 8:05 ` [PATCH V2 00/10] AMD XDNA driver Markus Elfring
2024-08-06 17:18 ` Lizhi Hou
2024-08-06 18:56 ` Markus Elfring
2024-08-09 15:21 ` Jeffrey Hugo
2024-08-12 18:16 ` Lizhi Hou
2024-08-14 18:49 ` Jeffrey Hugo
2024-08-14 20:06 ` Lizhi Hou
2024-09-03 17:50 ` Lizhi Hou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f76e4427-bb7b-747a-fd5a-21ca9e388d4a@amd.com \
--to=lizhi.hou@amd.com \
--cc=George.Yang@amd.com \
--cc=VenkataNarendraKumar.Gutta@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=king.tam@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=max.zhen@amd.com \
--cc=min.ma@amd.com \
--cc=ogabbay@kernel.org \
--cc=quic_carlv@quicinc.com \
--cc=sonal.santan@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox