This is a note to let you know that I've just added the patch titled net/smc: define a reserved CHID range for virtual ISM devices to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-smc-define-a-reserved-chid-range-for-virtual-ism.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit f199d60614fb7bbaba78492728b5b7a8b4e2dbd5 Author: Wen Gu <guwen@xxxxxxxxxxxxxxxxx> Date: Tue Dec 19 22:26:12 2023 +0800 net/smc: define a reserved CHID range for virtual ISM devices [ Upstream commit 8dd512df3c98ce8081e3541990bf849157675723 ] 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@xxxxxxxxxxxxxxxxx> Reviewed-and-tested-by: Wenjia Zhang <wenjia@xxxxxxxxxxxxx> Reviewed-by: Alexandra Winter <wintera@xxxxxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Stable-dep-of: 0541db8ee32c ("net/smc: initialize close_work early to avoid warning") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h index 832b2f42d79f3..d1228a615f23c 100644 --- a/net/smc/smc_ism.h +++ b/net/smc/smc_ism.h @@ -15,6 +15,8 @@ #include "smc.h" +#define SMC_VIRTUAL_ISM_CHID_MASK 0xFF00 + struct smcd_dev_list { /* List of SMCD devices */ struct list_head list; struct mutex mutex; /* Protects list of devices */ @@ -56,4 +58,22 @@ static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok, return rc < 0 ? rc : 0; } +static inline bool __smc_ism_is_virtual(u16 chid) +{ + /* CHIDs in range of 0xFF00 to 0xFFFF are reserved + * for virtual ISM device. + * + * loopback-ism: 0xFFFF + * virtio-ism: 0xFF00 ~ 0xFFFE + */ + return ((chid & 0xFF00) == 0xFF00); +} + +static inline bool smc_ism_is_virtual(struct smcd_dev *smcd) +{ + u16 chid = smcd->ops->get_chid(smcd); + + return __smc_ism_is_virtual(chid); +} + #endif