mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
accel/amdxdna: Init AIE4 device partition
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> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Link: https://patch.msgid.link/20260505160936.3917732-3-lizhi.hou@amd.com
This commit is contained in:
parent
7b1a245b18
commit
ce9414d0c0
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ struct amdxdna_dev_hdl {
|
|||
void __iomem *rbuf_base;
|
||||
|
||||
struct mailbox *mbox;
|
||||
u32 partition_id;
|
||||
};
|
||||
|
||||
/* aie4_message.c */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user