Commit 6ed942ed authored by Marco Chiappero's avatar Marco Chiappero Committed by Herbert Xu

crypto: qat - make PFVF message construction direction agnostic

Currently PFVF messages are created upfront in the CSR format, that is
PF2VF messages starting from bit 0 and VF2PF from bit 16, and passed
along unmodified to the PFVF send function.

Refactor the code to allow the VF2PF messages to be built starting from
bit 0, as for the PF2VF messages. Shift the VF to PF messages just
before sending them, and refactor the send logic to handle messages
properly depending on the direction.

As a result all the messages are composed the same way regardless of
the direction.
Signed-off-by: default avatarMarco Chiappero <marco.chiappero@intel.com>
Reviewed-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: default avatarFiona Trahe <fiona.trahe@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 448588ad
...@@ -17,6 +17,14 @@ ...@@ -17,6 +17,14 @@
#define ADF_GEN2_PF_PF2VF_OFFSET(i) (0x3A000 + 0x280 + ((i) * 0x04)) #define ADF_GEN2_PF_PF2VF_OFFSET(i) (0x3A000 + 0x280 + ((i) * 0x04))
#define ADF_GEN2_VF_PF2VF_OFFSET 0x200 #define ADF_GEN2_VF_PF2VF_OFFSET 0x200
#define ADF_GEN2_CSR_IN_USE 0x6AC2
#define ADF_GEN2_CSR_IN_USE_MASK 0xFFFE
enum gen2_csr_pos {
ADF_GEN2_CSR_PF2VF_OFFSET = 0,
ADF_GEN2_CSR_VF2PF_OFFSET = 16,
};
#define ADF_PFVF_MSG_ACK_DELAY 2 #define ADF_PFVF_MSG_ACK_DELAY 2
#define ADF_PFVF_MSG_ACK_MAX_RETRY 100 #define ADF_PFVF_MSG_ACK_MAX_RETRY 100
...@@ -72,38 +80,81 @@ static void adf_gen2_disable_vf2pf_interrupts(void __iomem *pmisc_addr, ...@@ -72,38 +80,81 @@ static void adf_gen2_disable_vf2pf_interrupts(void __iomem *pmisc_addr,
} }
} }
static u32 gen2_csr_get_int_bit(enum gen2_csr_pos offset)
{
return ADF_PFVF_INT << offset;
}
static u32 gen2_csr_msg_to_position(u32 csr_msg, enum gen2_csr_pos offset)
{
return (csr_msg & 0xFFFF) << offset;
}
static u32 gen2_csr_msg_from_position(u32 csr_val, enum gen2_csr_pos offset)
{
return (csr_val >> offset) & 0xFFFF;
}
static bool gen2_csr_is_in_use(u32 msg, enum gen2_csr_pos offset)
{
return ((msg >> offset) & ADF_GEN2_CSR_IN_USE_MASK) == ADF_GEN2_CSR_IN_USE;
}
static void gen2_csr_clear_in_use(u32 *msg, enum gen2_csr_pos offset)
{
*msg &= ~(ADF_GEN2_CSR_IN_USE_MASK << offset);
}
static void gen2_csr_set_in_use(u32 *msg, enum gen2_csr_pos offset)
{
*msg |= (ADF_GEN2_CSR_IN_USE << offset);
}
static bool is_legacy_user_pfvf_message(u32 msg)
{
return !(msg & ADF_PFVF_MSGORIGIN_SYSTEM);
}
static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg, static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg,
u8 vf_nr) u8 vf_nr)
{ {
void __iomem *pmisc_addr = adf_get_pmisc_base(accel_dev); void __iomem *pmisc_addr = adf_get_pmisc_base(accel_dev);
unsigned int retries = ADF_PFVF_MSG_MAX_RETRIES; unsigned int retries = ADF_PFVF_MSG_MAX_RETRIES;
u32 remote_in_use_mask, remote_in_use_pattern; enum gen2_csr_pos remote_offset;
u32 local_in_use_mask, local_in_use_pattern; enum gen2_csr_pos local_offset;
u32 val, pfvf_offset, count = 0;
struct mutex *lock; /* lock preventing concurrent acces of CSR */ struct mutex *lock; /* lock preventing concurrent acces of CSR */
u32 pfvf_offset;
u32 count = 0;
u32 int_bit; u32 int_bit;
u32 csr_val;
int ret; int ret;
/* Gen2 messages, both PF->VF and VF->PF, are all 16 bits long. This
* allows us to build and read messages as if they where all 0 based.
* However, send and receive are in a single shared 32 bits register,
* so we need to shift and/or mask the message half before decoding
* it and after encoding it. Which one to shift depends on the
* direction.
*/
if (accel_dev->is_vf) { if (accel_dev->is_vf) {
pfvf_offset = GET_PFVF_OPS(accel_dev)->get_vf2pf_offset(0); pfvf_offset = GET_PFVF_OPS(accel_dev)->get_vf2pf_offset(0);
lock = &accel_dev->vf.vf2pf_lock; lock = &accel_dev->vf.vf2pf_lock;
local_in_use_mask = ADF_VF2PF_IN_USE_BY_VF_MASK; local_offset = ADF_GEN2_CSR_VF2PF_OFFSET;
local_in_use_pattern = ADF_VF2PF_IN_USE_BY_VF; remote_offset = ADF_GEN2_CSR_PF2VF_OFFSET;
remote_in_use_mask = ADF_PF2VF_IN_USE_BY_PF_MASK;
remote_in_use_pattern = ADF_PF2VF_IN_USE_BY_PF;
int_bit = ADF_VF2PF_INT;
} else { } else {
pfvf_offset = GET_PFVF_OPS(accel_dev)->get_pf2vf_offset(vf_nr); pfvf_offset = GET_PFVF_OPS(accel_dev)->get_pf2vf_offset(vf_nr);
lock = &accel_dev->pf.vf_info[vf_nr].pf2vf_lock; lock = &accel_dev->pf.vf_info[vf_nr].pf2vf_lock;
local_in_use_mask = ADF_PF2VF_IN_USE_BY_PF_MASK; local_offset = ADF_GEN2_CSR_PF2VF_OFFSET;
local_in_use_pattern = ADF_PF2VF_IN_USE_BY_PF; remote_offset = ADF_GEN2_CSR_VF2PF_OFFSET;
remote_in_use_mask = ADF_VF2PF_IN_USE_BY_VF_MASK;
remote_in_use_pattern = ADF_VF2PF_IN_USE_BY_VF;
int_bit = ADF_PF2VF_INT;
} }
msg &= ~local_in_use_mask; int_bit = gen2_csr_get_int_bit(local_offset);
msg |= local_in_use_pattern;
/* Pre-calculate message, shifting it in place and setting
* the in use pattern
*/
msg = gen2_csr_msg_to_position(msg, local_offset);
gen2_csr_set_in_use(&msg, remote_offset);
mutex_lock(lock); mutex_lock(lock);
...@@ -111,8 +162,8 @@ static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg, ...@@ -111,8 +162,8 @@ static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg,
ret = 0; ret = 0;
/* Check if the PFVF CSR is in use by remote function */ /* Check if the PFVF CSR is in use by remote function */
val = ADF_CSR_RD(pmisc_addr, pfvf_offset); csr_val = ADF_CSR_RD(pmisc_addr, pfvf_offset);
if ((val & remote_in_use_mask) == remote_in_use_pattern) { if (gen2_csr_is_in_use(csr_val, local_offset)) {
dev_dbg(&GET_DEV(accel_dev), dev_dbg(&GET_DEV(accel_dev),
"PFVF CSR in use by remote function\n"); "PFVF CSR in use by remote function\n");
goto retry; goto retry;
...@@ -124,23 +175,25 @@ static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg, ...@@ -124,23 +175,25 @@ static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg,
/* Wait for confirmation from remote func it received the message */ /* Wait for confirmation from remote func it received the message */
do { do {
msleep(ADF_PFVF_MSG_ACK_DELAY); msleep(ADF_PFVF_MSG_ACK_DELAY);
val = ADF_CSR_RD(pmisc_addr, pfvf_offset); csr_val = ADF_CSR_RD(pmisc_addr, pfvf_offset);
} while ((val & int_bit) && (count++ < ADF_PFVF_MSG_ACK_MAX_RETRY)); } while ((csr_val & int_bit) && (count++ < ADF_PFVF_MSG_ACK_MAX_RETRY));
if (val & int_bit) { if (csr_val & int_bit) {
dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n");
val &= ~int_bit; csr_val &= ~int_bit;
ret = -EIO; ret = -EIO;
} }
if (val != msg) { if (csr_val != msg) {
dev_dbg(&GET_DEV(accel_dev), dev_dbg(&GET_DEV(accel_dev),
"Collision - PFVF CSR overwritten by remote function\n"); "Collision - PFVF CSR overwritten by remote function\n");
goto retry; goto retry;
} }
/* Finished with the PFVF CSR; relinquish it and leave msg in CSR */ /* Finished with the PFVF CSR; relinquish it and leave msg in CSR */
ADF_CSR_WR(pmisc_addr, pfvf_offset, val & ~local_in_use_mask); gen2_csr_clear_in_use(&csr_val, remote_offset);
ADF_CSR_WR(pmisc_addr, pfvf_offset, csr_val);
out: out:
mutex_unlock(lock); mutex_unlock(lock);
return ret; return ret;
...@@ -158,39 +211,43 @@ static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg, ...@@ -158,39 +211,43 @@ static int adf_gen2_pfvf_send(struct adf_accel_dev *accel_dev, u32 msg,
static u32 adf_gen2_pfvf_recv(struct adf_accel_dev *accel_dev, u8 vf_nr) static u32 adf_gen2_pfvf_recv(struct adf_accel_dev *accel_dev, u8 vf_nr)
{ {
void __iomem *pmisc_addr = adf_get_pmisc_base(accel_dev); void __iomem *pmisc_addr = adf_get_pmisc_base(accel_dev);
enum gen2_csr_pos local_offset;
u32 pfvf_offset; u32 pfvf_offset;
u32 msg_origin;
u32 int_bit; u32 int_bit;
u32 csr_val;
u32 msg; u32 msg;
if (accel_dev->is_vf) { if (accel_dev->is_vf) {
pfvf_offset = GET_PFVF_OPS(accel_dev)->get_pf2vf_offset(0); pfvf_offset = GET_PFVF_OPS(accel_dev)->get_pf2vf_offset(0);
int_bit = ADF_PF2VF_INT; local_offset = ADF_GEN2_CSR_PF2VF_OFFSET;
msg_origin = ADF_PF2VF_MSGORIGIN_SYSTEM;
} else { } else {
pfvf_offset = GET_PFVF_OPS(accel_dev)->get_vf2pf_offset(vf_nr); pfvf_offset = GET_PFVF_OPS(accel_dev)->get_vf2pf_offset(vf_nr);
int_bit = ADF_VF2PF_INT; local_offset = ADF_GEN2_CSR_VF2PF_OFFSET;
msg_origin = ADF_VF2PF_MSGORIGIN_SYSTEM;
} }
int_bit = gen2_csr_get_int_bit(local_offset);
/* Read message */ /* Read message */
msg = ADF_CSR_RD(pmisc_addr, pfvf_offset); csr_val = ADF_CSR_RD(pmisc_addr, pfvf_offset);
if (!(msg & int_bit)) { if (!(csr_val & int_bit)) {
dev_info(&GET_DEV(accel_dev), dev_info(&GET_DEV(accel_dev),
"Spurious PFVF interrupt, msg 0x%.8x. Ignored\n", msg); "Spurious PFVF interrupt, msg 0x%.8x. Ignored\n", csr_val);
return 0; return 0;
} }
/* Ignore legacy non-system (non-kernel) VF2PF messages */ /* Extract the message from the CSR */
if (!(msg & msg_origin)) { msg = gen2_csr_msg_from_position(csr_val, local_offset);
/* Ignore legacy non-system (non-kernel) messages */
if (unlikely(is_legacy_user_pfvf_message(msg))) {
dev_dbg(&GET_DEV(accel_dev), dev_dbg(&GET_DEV(accel_dev),
"Ignored non-system message (0x%.8x);\n", msg); "Ignored non-system message (0x%.8x);\n", csr_val);
return 0; return 0;
} }
/* To ACK, clear the INT bit */ /* To ACK, clear the INT bit */
msg &= ~int_bit; csr_val &= ~int_bit;
ADF_CSR_WR(pmisc_addr, pfvf_offset, msg); ADF_CSR_WR(pmisc_addr, pfvf_offset, csr_val);
return msg; return msg;
} }
......
...@@ -53,27 +53,19 @@ ...@@ -53,27 +53,19 @@
* adf_gen2_pfvf_send() in adf_pf2vf_msg.c). * adf_gen2_pfvf_send() in adf_pf2vf_msg.c).
*/ */
/* PF->VF messages */ /* PFVF message common bits */
#define ADF_PF2VF_INT BIT(0) #define ADF_PFVF_INT BIT(0)
#define ADF_PF2VF_MSGORIGIN_SYSTEM BIT(1) #define ADF_PFVF_MSGORIGIN_SYSTEM BIT(1)
#define ADF_PF2VF_IN_USE_BY_PF 0x6AC20000 #define ADF_PFVF_MSGTYPE_SHIFT 2
#define ADF_PF2VF_IN_USE_BY_PF_MASK 0xFFFE0000 #define ADF_PFVF_MSGTYPE_MASK 0x0F
#define ADF_PF2VF_MSGTYPE_MASK 0x0000003C
#define ADF_PF2VF_MSGTYPE_SHIFT 2
/* PF->VF messages */
enum pf2vf_msgtype { enum pf2vf_msgtype {
ADF_PF2VF_MSGTYPE_RESTARTING = 0x01, ADF_PF2VF_MSGTYPE_RESTARTING = 0x01,
ADF_PF2VF_MSGTYPE_VERSION_RESP = 0x02, ADF_PF2VF_MSGTYPE_VERSION_RESP = 0x02,
}; };
/* VF->PF messages */ /* VF->PF messages */
#define ADF_VF2PF_INT BIT(16)
#define ADF_VF2PF_MSGORIGIN_SYSTEM BIT(17)
#define ADF_VF2PF_IN_USE_BY_VF 0x00006AC2
#define ADF_VF2PF_IN_USE_BY_VF_MASK 0x0000FFFE
#define ADF_VF2PF_MSGTYPE_MASK 0x003C0000
#define ADF_VF2PF_MSGTYPE_SHIFT 18
enum vf2pf_msgtype { enum vf2pf_msgtype {
ADF_VF2PF_MSGTYPE_INIT = 0x03, ADF_VF2PF_MSGTYPE_INIT = 0x03,
ADF_VF2PF_MSGTYPE_SHUTDOWN = 0x04, ADF_VF2PF_MSGTYPE_SHUTDOWN = 0x04,
...@@ -90,10 +82,10 @@ enum pfvf_compatibility_version { ...@@ -90,10 +82,10 @@ enum pfvf_compatibility_version {
/* PF->VF Version Response */ /* PF->VF Version Response */
#define ADF_PF2VF_MINORVERSION_SHIFT 6 #define ADF_PF2VF_MINORVERSION_SHIFT 6
#define ADF_PF2VF_MAJORVERSION_SHIFT 10 #define ADF_PF2VF_MAJORVERSION_SHIFT 10
#define ADF_PF2VF_VERSION_RESP_VERS_MASK 0x00003FC0
#define ADF_PF2VF_VERSION_RESP_VERS_SHIFT 6 #define ADF_PF2VF_VERSION_RESP_VERS_SHIFT 6
#define ADF_PF2VF_VERSION_RESP_RESULT_MASK 0x0000C000 #define ADF_PF2VF_VERSION_RESP_VERS_MASK 0xFF
#define ADF_PF2VF_VERSION_RESP_RESULT_SHIFT 14 #define ADF_PF2VF_VERSION_RESP_RESULT_SHIFT 14
#define ADF_PF2VF_VERSION_RESP_RESULT_MASK 0x03
enum pf2vf_compat_response { enum pf2vf_compat_response {
ADF_PF2VF_VF_COMPATIBLE = 0x01, ADF_PF2VF_VF_COMPATIBLE = 0x01,
...@@ -102,6 +94,6 @@ enum pf2vf_compat_response { ...@@ -102,6 +94,6 @@ enum pf2vf_compat_response {
}; };
/* VF->PF Compatible Version Request */ /* VF->PF Compatible Version Request */
#define ADF_VF2PF_COMPAT_VER_REQ_SHIFT 22 #define ADF_VF2PF_COMPAT_VER_REQ_SHIFT 6
#endif /* ADF_PFVF_MSG_H */ #endif /* ADF_PFVF_MSG_H */
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
void adf_pf2vf_notify_restarting(struct adf_accel_dev *accel_dev) void adf_pf2vf_notify_restarting(struct adf_accel_dev *accel_dev)
{ {
struct adf_accel_vf_info *vf; struct adf_accel_vf_info *vf;
u32 msg = (ADF_PF2VF_MSGORIGIN_SYSTEM | u32 msg = (ADF_PFVF_MSGORIGIN_SYSTEM |
(ADF_PF2VF_MSGTYPE_RESTARTING << ADF_PF2VF_MSGTYPE_SHIFT)); (ADF_PF2VF_MSGTYPE_RESTARTING << ADF_PFVF_MSGTYPE_SHIFT));
int i, num_vfs = pci_num_vf(accel_to_pci_dev(accel_dev)); int i, num_vfs = pci_num_vf(accel_to_pci_dev(accel_dev));
for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) { for (i = 0, vf = accel_dev->pf.vf_info; i < num_vfs; i++, vf++) {
......
...@@ -42,7 +42,7 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr, ...@@ -42,7 +42,7 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr,
struct adf_accel_vf_info *vf_info = &accel_dev->pf.vf_info[vf_nr]; struct adf_accel_vf_info *vf_info = &accel_dev->pf.vf_info[vf_nr];
u32 resp = 0; u32 resp = 0;
switch ((msg & ADF_VF2PF_MSGTYPE_MASK) >> ADF_VF2PF_MSGTYPE_SHIFT) { switch ((msg >> ADF_PFVF_MSGTYPE_SHIFT) & ADF_PFVF_MSGTYPE_MASK) {
case ADF_VF2PF_MSGTYPE_COMPAT_VER_REQ: case ADF_VF2PF_MSGTYPE_COMPAT_VER_REQ:
{ {
u8 vf_compat_ver = msg >> ADF_VF2PF_COMPAT_VER_REQ_SHIFT; u8 vf_compat_ver = msg >> ADF_VF2PF_COMPAT_VER_REQ_SHIFT;
...@@ -57,9 +57,9 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr, ...@@ -57,9 +57,9 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr,
else else
compat = ADF_PF2VF_VF_COMPAT_UNKNOWN; compat = ADF_PF2VF_VF_COMPAT_UNKNOWN;
resp = ADF_PF2VF_MSGORIGIN_SYSTEM; resp = ADF_PFVF_MSGORIGIN_SYSTEM;
resp |= ADF_PF2VF_MSGTYPE_VERSION_RESP << resp |= ADF_PF2VF_MSGTYPE_VERSION_RESP <<
ADF_PF2VF_MSGTYPE_SHIFT; ADF_PFVF_MSGTYPE_SHIFT;
resp |= ADF_PFVF_COMPAT_THIS_VERSION << resp |= ADF_PFVF_COMPAT_THIS_VERSION <<
ADF_PF2VF_VERSION_RESP_VERS_SHIFT; ADF_PF2VF_VERSION_RESP_VERS_SHIFT;
resp |= compat << ADF_PF2VF_VERSION_RESP_RESULT_SHIFT; resp |= compat << ADF_PF2VF_VERSION_RESP_RESULT_SHIFT;
...@@ -76,9 +76,9 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr, ...@@ -76,9 +76,9 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 vf_nr,
/* PF always newer than legacy VF */ /* PF always newer than legacy VF */
compat = ADF_PF2VF_VF_COMPATIBLE; compat = ADF_PF2VF_VF_COMPATIBLE;
resp = ADF_PF2VF_MSGORIGIN_SYSTEM; resp = ADF_PFVF_MSGORIGIN_SYSTEM;
resp |= ADF_PF2VF_MSGTYPE_VERSION_RESP << resp |= ADF_PF2VF_MSGTYPE_VERSION_RESP <<
ADF_PF2VF_MSGTYPE_SHIFT; ADF_PFVF_MSGTYPE_SHIFT;
/* Set legacy major and minor version num */ /* Set legacy major and minor version num */
resp |= 1 << ADF_PF2VF_MAJORVERSION_SHIFT | resp |= 1 << ADF_PF2VF_MAJORVERSION_SHIFT |
1 << ADF_PF2VF_MINORVERSION_SHIFT; 1 << ADF_PF2VF_MINORVERSION_SHIFT;
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
*/ */
int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev) int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev)
{ {
u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | u32 msg = (ADF_PFVF_MSGORIGIN_SYSTEM |
(ADF_VF2PF_MSGTYPE_INIT << ADF_VF2PF_MSGTYPE_SHIFT)); (ADF_VF2PF_MSGTYPE_INIT << ADF_PFVF_MSGTYPE_SHIFT));
if (adf_send_vf2pf_msg(accel_dev, msg)) { if (adf_send_vf2pf_msg(accel_dev, msg)) {
dev_err(&GET_DEV(accel_dev), dev_err(&GET_DEV(accel_dev),
...@@ -39,8 +39,8 @@ EXPORT_SYMBOL_GPL(adf_vf2pf_notify_init); ...@@ -39,8 +39,8 @@ EXPORT_SYMBOL_GPL(adf_vf2pf_notify_init);
*/ */
void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev) void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev)
{ {
u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | u32 msg = (ADF_PFVF_MSGORIGIN_SYSTEM |
(ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT)); (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_PFVF_MSGTYPE_SHIFT));
if (test_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status)) if (test_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status))
if (adf_send_vf2pf_msg(accel_dev, msg)) if (adf_send_vf2pf_msg(accel_dev, msg))
...@@ -57,8 +57,8 @@ int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev) ...@@ -57,8 +57,8 @@ int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
u32 resp; u32 resp;
int ret; int ret;
msg = ADF_VF2PF_MSGORIGIN_SYSTEM; msg = ADF_PFVF_MSGORIGIN_SYSTEM;
msg |= ADF_VF2PF_MSGTYPE_COMPAT_VER_REQ << ADF_VF2PF_MSGTYPE_SHIFT; msg |= ADF_VF2PF_MSGTYPE_COMPAT_VER_REQ << ADF_PFVF_MSGTYPE_SHIFT;
msg |= ADF_PFVF_COMPAT_THIS_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT; msg |= ADF_PFVF_COMPAT_THIS_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT;
BUILD_BUG_ON(ADF_PFVF_COMPAT_THIS_VERSION > 255); BUILD_BUG_ON(ADF_PFVF_COMPAT_THIS_VERSION > 255);
...@@ -69,10 +69,10 @@ int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev) ...@@ -69,10 +69,10 @@ int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
return ret; return ret;
} }
pf_version = (resp & ADF_PF2VF_VERSION_RESP_VERS_MASK) pf_version = (resp >> ADF_PF2VF_VERSION_RESP_VERS_SHIFT)
>> ADF_PF2VF_VERSION_RESP_VERS_SHIFT; & ADF_PF2VF_VERSION_RESP_VERS_MASK;
compat = (resp & ADF_PF2VF_VERSION_RESP_RESULT_MASK) compat = (resp >> ADF_PF2VF_VERSION_RESP_RESULT_SHIFT)
>> ADF_PF2VF_VERSION_RESP_RESULT_SHIFT; & ADF_PF2VF_VERSION_RESP_RESULT_MASK;
/* Response from PF received, check compatibility */ /* Response from PF received, check compatibility */
switch (compat) { switch (compat) {
......
...@@ -88,7 +88,7 @@ int adf_send_vf2pf_req(struct adf_accel_dev *accel_dev, u32 msg, u32 *resp) ...@@ -88,7 +88,7 @@ int adf_send_vf2pf_req(struct adf_accel_dev *accel_dev, u32 msg, u32 *resp)
static bool adf_handle_pf2vf_msg(struct adf_accel_dev *accel_dev, u32 msg) static bool adf_handle_pf2vf_msg(struct adf_accel_dev *accel_dev, u32 msg)
{ {
switch ((msg & ADF_PF2VF_MSGTYPE_MASK) >> ADF_PF2VF_MSGTYPE_SHIFT) { switch ((msg >> ADF_PFVF_MSGTYPE_SHIFT) & ADF_PFVF_MSGTYPE_MASK) {
case ADF_PF2VF_MSGTYPE_RESTARTING: case ADF_PF2VF_MSGTYPE_RESTARTING:
dev_dbg(&GET_DEV(accel_dev), "Restarting message received from PF\n"); dev_dbg(&GET_DEV(accel_dev), "Restarting message received from PF\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment