Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp361957rdh; Tue, 19 Dec 2023 00:47:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUgmGQFFxKCj8VGmOwMcus7uiu0iEVUDh3BtC61Hc+TllQtwtyYVRcTp85Mnn+Uci2OGlz X-Received: by 2002:a50:a69a:0:b0:553:6eb3:e92 with SMTP id e26-20020a50a69a000000b005536eb30e92mr599849edc.35.1702975674938; Tue, 19 Dec 2023 00:47:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702975674; cv=none; d=google.com; s=arc-20160816; b=nk84Z4yfX+7FD+hobSf2PLG6mFO+Ov07YjFOGu94FTKeibvU6hrEzr/4HqghlYlE1S reDS9DO3dXpMtq6nqpFDit2Wz0tZiigL9Uzm5f8f2pb8iw3qMFJMKzIeWO9zs5am5TZ/ 554I/lEr7xrtxTZdZkLjDWu4r/FSkvydWsiLog4g0vIzD0X18nuWA0wBzh2eniHB151f xCZXS3LDl3fQ1sjYtDil4W9BH/Zu0RhqruQd14i9HwGfEuAXS9B+TxL/kUqsoQUXOcWN VA6kImUbASOFFUUK8KW4F79BTBNBlPGXy8haHDrQlra29I9B0QcM5a5UOJzOWRp5SUMB jOtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=elzMZ7F+T22F1jAz2kz0FkhKlnO/sbQtrVNZqjqZab4=; fh=uTJ0crBczByYIhxgrQpYUSGkMqtgvc9XI1pgPEVZjxY=; b=ifB+aTICQ3Sz4/XK5K9rya6A3XDOc/IRpt5/XSbDR1pr1r8rtQZOJzD82lDqJAyvVJ ZvDGseiWt3/xMFeKxl7TTEBbKwF2Uj+Mhq1v8Omkj0mf5PpBqL84o1IAQZggGLm8m019 x5H/XCvPduDbUsb22mWFnJjMir4LNtDXIKW2RDoGkUYvAOkaLtHvYeTMahkayxc+jt2c FOde9wQL4dSP9z6JjDgt1Tz0QWWVfyPlZ3TwfX7tgj5FNlOgLS5cyUngs2wAKl0MeXiN Xdvbod9Tfz55GOHPTEsLoUfQPYanKKxTJxmkXNuq1a/d959k0H1ZpYuIezme9+GHy1Bu 0Ycw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s27-20020a50ab1b000000b0055329894b9esi2137677edc.172.2023.12.19.00.47.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 00:47:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id ABDBE1F25058 for ; Tue, 19 Dec 2023 08:47:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E332C16407; Tue, 19 Dec 2023 08:46:04 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E266515AED; Tue, 19 Dec 2023 08:46:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=guwen@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0VyqKZvu_1702975551; Received: from localhost(mailfrom:guwen@linux.alibaba.com fp:SMTPD_---0VyqKZvu_1702975551) by smtp.aliyun-inc.com; Tue, 19 Dec 2023 16:45:53 +0800 From: Wen Gu To: wintera@linux.ibm.com, wenjia@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, kgraul@linux.ibm.com, jaka@linux.ibm.com Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com, alibuda@linux.alibaba.com, tonylu@linux.alibaba.com, guwen@linux.alibaba.com, raspl@linux.ibm.com, schnelle@linux.ibm.com, guangguan.wang@linux.alibaba.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v7 06/10] net/smc: define a reserved CHID range for virtual ISM devices Date: Tue, 19 Dec 2023 16:45:32 +0800 Message-Id: <20231219084536.8158-7-guwen@linux.alibaba.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f In-Reply-To: <20231219084536.8158-1-guwen@linux.alibaba.com> References: <20231219084536.8158-1-guwen@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Reviewed-and-tested-by: Wenjia Zhang Reviewed-by: Alexandra Winter --- net/smc/smc_ism.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h index 832b2f42d79f..d1228a615f23 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 -- 2.32.0.3.g01195cf9f