Skip to content

Commit 26c596e

Browse files
author
Mete Durlu
committed
net/smc: define a reserved CHID range for virtual ISM devices
JIRA: https://issues.redhat.com/browse/RHEL-73484 commit 8dd512d Author: Wen Gu <guwen@linux.alibaba.com> Date: Tue Dec 19 22:26:12 2023 +0800 net/smc: define a reserved CHID range for virtual ISM devices According to virtual ISM support feature defined by SMCv2.1, CHIDs in the range 0xFF00 to 0xFFFF are reserved for use by virtual ISM devices. And two helpers are introduced to distinguish virtual ISM devices from the existing platform firmware ISM devices. Signed-off-by: Wen Gu <guwen@linux.alibaba.com> Reviewed-and-tested-by: Wenjia Zhang <wenjia@linux.ibm.com> Reviewed-by: Alexandra Winter <wintera@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Mete Durlu <mdurlu@redhat.com>
1 parent eca5a91 commit 26c596e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

net/smc/smc_ism.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include "smc.h"
1717

18+
#define SMC_VIRTUAL_ISM_CHID_MASK 0xFF00
19+
1820
struct smcd_dev_list { /* List of SMCD devices */
1921
struct list_head list;
2022
struct mutex mutex; /* Protects list of devices */
@@ -56,4 +58,22 @@ static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok,
5658
return rc < 0 ? rc : 0;
5759
}
5860

61+
static inline bool __smc_ism_is_virtual(u16 chid)
62+
{
63+
/* CHIDs in range of 0xFF00 to 0xFFFF are reserved
64+
* for virtual ISM device.
65+
*
66+
* loopback-ism: 0xFFFF
67+
* virtio-ism: 0xFF00 ~ 0xFFFE
68+
*/
69+
return ((chid & 0xFF00) == 0xFF00);
70+
}
71+
72+
static inline bool smc_ism_is_virtual(struct smcd_dev *smcd)
73+
{
74+
u16 chid = smcd->ops->get_chid(smcd);
75+
76+
return __smc_ism_is_virtual(chid);
77+
}
78+
5979
#endif

0 commit comments

Comments
 (0)