From: Mario Limonciello <mario.limonciello@amd.com>
To: Lizhi Hou <lizhi.hou@amd.com>,
ogabbay@kernel.org, quic_jhugo@quicinc.com,
dri-devel@lists.freedesktop.org, karol.wachowski@linux.intel.com
Cc: David Zhang <yidong.zhang@amd.com>,
linux-kernel@vger.kernel.org, max.zhen@amd.com,
sonal.santan@amd.com, Hayden Laccabue <Hayden.Laccabue@amd.com>
Subject: Re: [PATCH V1 2/6] accel/amdxdna: Init AIE4 device partition
Date: Tue, 5 May 2026 14:53:31 -0500 [thread overview]
Message-ID: <0941b2ef-adab-49ed-a9ab-9be0ac188c52@amd.com> (raw)
In-Reply-To: <20260505160936.3917732-3-lizhi.hou@amd.com>
On 5/5/26 11:09, Lizhi Hou wrote:
> From: David Zhang <yidong.zhang@amd.com>
>
> Send partition creation command to firmware during VF initialization.
>
> Co-developed-by: Hayden Laccabue <Hayden.Laccabue@amd.com>
> Signed-off-by: Hayden Laccabue <Hayden.Laccabue@amd.com>
> Signed-off-by: David Zhang <yidong.zhang@amd.com>
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> ---
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> drivers/accel/amdxdna/aie4_msg_priv.h | 21 +++++++++++
> drivers/accel/amdxdna/aie4_pci.c | 52 ++++++++++++++++++++++++++-
> drivers/accel/amdxdna/aie4_pci.h | 1 +
> 3 files changed, 73 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/accel/amdxdna/aie4_msg_priv.h b/drivers/accel/amdxdna/aie4_msg_priv.h
> index 88463cc3a98a..cada53257921 100644
> --- a/drivers/accel/amdxdna/aie4_msg_priv.h
> +++ b/drivers/accel/amdxdna/aie4_msg_priv.h
> @@ -13,6 +13,9 @@ enum aie4_msg_opcode {
>
> AIE4_MSG_OP_CREATE_VFS = 0x20001,
> AIE4_MSG_OP_DESTROY_VFS = 0x20002,
> +
> + AIE4_MSG_OP_CREATE_PARTITION = 0x30001,
> + AIE4_MSG_OP_DESTROY_PARTITION = 0x30002,
> };
>
> enum aie4_msg_status {
> @@ -46,4 +49,22 @@ struct aie4_msg_destroy_vfs_resp {
> enum aie4_msg_status status;
> } __packed;
>
> +struct aie4_msg_create_partition_req {
> + __u32 partition_col_start;
> + __u32 partition_col_count;
> +} __packed;
> +
> +struct aie4_msg_create_partition_resp {
> + enum aie4_msg_status status;
> + __u32 partition_id;
> +} __packed;
> +
> +struct aie4_msg_destroy_partition_req {
> + __u32 partition_id;
> +} __packed;
> +
> +struct aie4_msg_destroy_partition_resp {
> + enum aie4_msg_status status;
> +} __packed;
> +
> #endif /* _AIE4_MSG_PRIV_H_ */
> diff --git a/drivers/accel/amdxdna/aie4_pci.c b/drivers/accel/amdxdna/aie4_pci.c
> index a967e2db7ebd..13f5d45e388d 100644
> --- a/drivers/accel/amdxdna/aie4_pci.c
> +++ b/drivers/accel/amdxdna/aie4_pci.c
> @@ -9,11 +9,16 @@
> #include <linux/firmware.h>
> #include <linux/sizes.h>
>
> +#include "aie.h"
> +#include "aie4_msg_priv.h"
> #include "aie4_pci.h"
> +#include "amdxdna_mailbox.h"
> +#include "amdxdna_mailbox_helper.h"
> #include "amdxdna_pci_drv.h"
>
> #define NO_IOHUB 0
> #define PSP_NOTIFY_INTR 0xD007BE11
> +#define AIE4_TOTAL_COLUMN 3
>
> /*
> * The management mailbox channel is allocated by firmware.
> @@ -234,6 +239,36 @@ static int aie4_fw_start(struct amdxdna_dev_hdl *ndev)
> return ret;
> }
>
> +static int aie4_partition_init(struct amdxdna_dev_hdl *ndev)
> +{
> + DECLARE_AIE_MSG(aie4_msg_create_partition, AIE4_MSG_OP_CREATE_PARTITION);
> + struct amdxdna_dev *xdna = ndev->aie.xdna;
> + int ret;
> +
> + req.partition_col_start = 0;
> + req.partition_col_count = AIE4_TOTAL_COLUMN;
> + ret = aie_send_mgmt_msg_wait(&ndev->aie, &msg);
> + if (ret) {
> + XDNA_ERR(xdna, "partition init failed: %d", ret);
> + return ret;
> + }
> +
> + ndev->partition_id = resp.partition_id;
> + return 0;
> +}
> +
> +static void aie4_partition_fini(struct amdxdna_dev_hdl *ndev)
> +{
> + DECLARE_AIE_MSG(aie4_msg_destroy_partition, AIE4_MSG_OP_DESTROY_PARTITION);
> + struct amdxdna_dev *xdna = ndev->aie.xdna;
> + int ret;
> +
> + req.partition_id = ndev->partition_id;
> + ret = aie_send_mgmt_msg_wait(&ndev->aie, &msg);
> + if (ret)
> + XDNA_ERR(xdna, "partition fini failed: %d", ret);
> +}
> +
> static int aie4_pf_hw_start(struct amdxdna_dev_hdl *ndev)
> {
> int ret;
> @@ -267,7 +302,21 @@ static void aie4_pf_hw_stop(struct amdxdna_dev_hdl *ndev)
>
> static int aie4_vf_hw_start(struct amdxdna_dev_hdl *ndev)
> {
> - return aie4_mailbox_init(ndev);
> + int ret;
> +
> + ret = aie4_mailbox_init(ndev);
> + if (ret)
> + return ret;
> +
> + ret = aie4_partition_init(ndev);
> + if (ret)
> + goto mailbox_fini;
> +
> + return 0;
> +
> +mailbox_fini:
> + aie4_mailbox_fini(ndev);
> + return ret;
> }
>
> static void aie4_vf_hw_stop(struct amdxdna_dev_hdl *ndev)
> @@ -276,6 +325,7 @@ static void aie4_vf_hw_stop(struct amdxdna_dev_hdl *ndev)
>
> drm_WARN_ON(&xdna->ddev, !mutex_is_locked(&xdna->dev_lock));
>
> + aie4_partition_fini(ndev);
> aie4_mailbox_fini(ndev);
> }
>
> diff --git a/drivers/accel/amdxdna/aie4_pci.h b/drivers/accel/amdxdna/aie4_pci.h
> index cbf3424a4341..620fb5bd23e4 100644
> --- a/drivers/accel/amdxdna/aie4_pci.h
> +++ b/drivers/accel/amdxdna/aie4_pci.h
> @@ -31,6 +31,7 @@ struct amdxdna_dev_hdl {
> void __iomem *rbuf_base;
>
> struct mailbox *mbox;
> + u32 partition_id;
> };
>
> /* aie4_message.c */
next prev parent reply other threads:[~2026-05-05 19:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-05 16:09 [PATCH V1 0/6] SR-IOV Virtual Function support for AIE4 platform Lizhi Hou
2026-05-05 16:09 ` [PATCH V1 1/6] accel/amdxdna: Add initial support for AIE4 VF Lizhi Hou
2026-05-05 19:37 ` Mario Limonciello
2026-05-05 16:09 ` [PATCH V1 2/6] accel/amdxdna: Init AIE4 device partition Lizhi Hou
2026-05-05 19:53 ` Mario Limonciello [this message]
2026-05-05 16:09 ` [PATCH V1 3/6] accel/amdxdna: Add AIE4 VF hardware context create and destroy Lizhi Hou
2026-05-05 20:28 ` Mario Limonciello
2026-05-05 16:09 ` [PATCH V1 4/6] accel/amdxdna: Add command doorbell and wait support Lizhi Hou
2026-05-05 20:31 ` Mario Limonciello
2026-05-06 16:11 ` Lizhi Hou
2026-05-06 16:33 ` Mario Limonciello
2026-05-05 16:09 ` [PATCH V1 5/6] accel/amdxdna: Add AIE4 metadata query support Lizhi Hou
2026-05-05 17:14 ` Mario Limonciello
2026-05-05 18:03 ` Lizhi Hou
2026-05-05 16:09 ` [PATCH V1 6/6] accel/amdxdna: Add AIE4 work buffer initialization Lizhi Hou
2026-05-05 20:36 ` Mario Limonciello
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=0941b2ef-adab-49ed-a9ab-9be0ac188c52@amd.com \
--to=mario.limonciello@amd.com \
--cc=Hayden.Laccabue@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=max.zhen@amd.com \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@quicinc.com \
--cc=sonal.santan@amd.com \
--cc=yidong.zhang@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