Skip to content

Commit 8dd512d

Browse files
Wen Gudavem330
authored andcommitted
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 <[email protected]> Reviewed-and-tested-by: Wenjia Zhang <[email protected]> Reviewed-by: Alexandra Winter <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 00e006a commit 8dd512d

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)