From patchwork Sun Oct 29 08:00:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: guanjun X-Patchwork-Id: 159344 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1572068vqb; Sun, 29 Oct 2023 01:01:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmtrdAizyJ6/Rv33Uf2nq7rlJrcNsaauSj9+APwMdzjsolUwdVEaUHESoRv5w7BDmvDDdp X-Received: by 2002:a05:6358:785:b0:169:5d77:cd8f with SMTP id n5-20020a056358078500b001695d77cd8fmr4168937rwj.11.1698566482172; Sun, 29 Oct 2023 01:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698566482; cv=none; d=google.com; s=arc-20160816; b=Y1xC7Q6aCKd6Ri+2Q0fHziUwK0ugvahepn5JcmJXo4ic2uxbAbAScyNN/nEqkYz7Aw 65WhCfN+dxp21tY12hXv2tMGX9pzTsDifsfoKkxFqcFYWUnEMVuAc3qLm5E8BLhj0Y8k 7lhBkLRrDnysrHCkDuEMlk3VVWFM4/n84eggd08xi2PxzVnrho12upc0cfrIgpbgYISc o9w69PGnaeigzYFg411HOT3zA3x3QEeLhHFkS4VypPXFVbkh5Z4QYMLAIXu6TKxGVuDP CglhjSHSR3S2HNClqcFYg22dkrfISGlCRi2vhIdq3664ctgkhr2V7ZJtKgBlCLL43WZk +UhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gzc9iTTpvVjslsvB4sPMAForhnWUue9zFC+Klgiq8ls=; fh=QBHJhMFaY+lWbqr2wKEcOz8zsPIdmcjBYs3CtaAVoV4=; b=t27yHw9l8ruWKmIgr8/Y0m4kJErS1EoK4pwD5tHxtDeqj9P1SczlCluNQ4cy3DNfv2 ennp3qNc94fOJNRWwgwLzu9becPFRg9FqM4qO46EvSAIf4u0DZSNevnM07hEWtAmSmko mV/SnqXmQmyOY+DaM+cDOZ5MF5tJvy6m+87D/atltv9KgulUTIFOvA2BhQvnxnIB290q e54HtE/ghyj1eZR5xhZpXV7uhnvavTKkKtLSOZ7pBSdgyE6ybCWssRKUFzhvH+67A2vm FtndEBJFdiUI7qAHEi+T67SW/x9Kvdzl9uJ45MsU5uDDDC4wrVFOHRGTi7xGfrY/6wFX DUzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id rm6-20020a17090b3ec600b0027d29e618f7si3375582pjb.78.2023.10.29.01.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 01:01:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id C79EF805CCE4; Sun, 29 Oct 2023 01:01:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230088AbjJ2IBE (ORCPT + 30 others); Sun, 29 Oct 2023 04:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbjJ2IA7 (ORCPT ); Sun, 29 Oct 2023 04:00:59 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9E3BC9; Sun, 29 Oct 2023 01:00:56 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R881e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=guanjun@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0Vv31XWv_1698566451; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0Vv31XWv_1698566451) by smtp.aliyun-inc.com; Sun, 29 Oct 2023 16:00:52 +0800 From: 'Guanjun' To: dave.jiang@intel.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, tony.luck@intel.com, fenghua.yu@intel.com Cc: jing.lin@intel.com, ashok.raj@intel.com, sanjay.k.kumar@intel.com, megha.dey@intel.com, jacob.jun.pan@intel.com, yi.l.liu@intel.com, tglx@linutronix.de Subject: [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor Date: Sun, 29 Oct 2023 16:00:48 +0800 Message-Id: <20231029080049.1482701-2-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231029080049.1482701-1-guanjun@linux.alibaba.com> References: <20231029080049.1482701-1-guanjun@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 29 Oct 2023 01:01:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781076047388928727 X-GMAIL-MSGID: 1781076047388928727 From: Guanjun The int_handle field in hw descriptor should also be protected by wmb() before possibly triggering a DMA read. Signed-off-by: Guanjun Reviewed-by: Dave Jiang Reviewed-by: Fenghua Yu --- drivers/dma/idxd/submit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c index c01db23e3333..3f922518e3a5 100644 --- a/drivers/dma/idxd/submit.c +++ b/drivers/dma/idxd/submit.c @@ -182,13 +182,6 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) portal = idxd_wq_portal_addr(wq); - /* - * The wmb() flushes writes to coherent DMA data before - * possibly triggering a DMA read. The wmb() is necessary - * even on UP because the recipient is a device. - */ - wmb(); - /* * Pending the descriptor to the lockless list for the irq_entry * that we designated the descriptor to. @@ -199,6 +192,13 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) llist_add(&desc->llnode, &ie->pending_llist); } + /* + * The wmb() flushes writes to coherent DMA data before + * possibly triggering a DMA read. The wmb() is necessary + * even on UP because the recipient is a device. + */ + wmb(); + if (wq_dedicated(wq)) { iosubmit_cmds512(portal, desc->hw, 1); } else { From patchwork Sun Oct 29 08:00:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: guanjun X-Patchwork-Id: 159345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1572573vqb; Sun, 29 Oct 2023 01:02:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTaEjC+/CX8Ek3NgisFMIji1HRTWcKnBuaLtb/VEXOOZoq+Bj5dziKTMqdveZMovWZTm9R X-Received: by 2002:a17:90a:7547:b0:280:2609:6d47 with SMTP id q65-20020a17090a754700b0028026096d47mr1571606pjk.19.1698566543495; Sun, 29 Oct 2023 01:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698566543; cv=none; d=google.com; s=arc-20160816; b=zSrv7Zsi9k5LDk/nqXYEtgSKuCZi4nQgJV7icKuirfZDLlQB01IschAwDYfl5pd6pL 235mghb6pDhYlTW9u4dVkB6ZsaF94oP4Mw5P9sjgDqkuxbjio3JvN/SAsC4HjTqKFmuV C86Ug6hEGMiD6PLO/paDbEuINFs6LubO6NV7SPjYqV3G8TeG3kqTJ0chemiVLuE8/V6l uCIJ0wxJdO0RaaqURJ/D1HHIzcuH82fCsruu3SbW/DXqfGMt7gi9+NYBJuz6QHlkwJRW ibvcGWNPBemiD5XjjtCMKGX2JcI72zewRzyMqAZYqgZcHxwPyTy73HN2rLYXaWtECbpH qE9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kZYfVcmzC598f07t/L5LuJE8pLhRXXeA4ttNG2OT630=; fh=QBHJhMFaY+lWbqr2wKEcOz8zsPIdmcjBYs3CtaAVoV4=; b=wP0oC/J6PXf1h27FuacFmpXS44p70coMz9I2NfzCsOoQKXMqxo3WE+RohK1tjLuXhw tLCoADKxRsGey9knLPXkgUmQGCpP3+2IBmh0HHgzGCho6D1xrtoRclTL6NbeMDNqmxft PP0I/xzrqdC80WmKnmBzGC9RUm/uYTmvW6ajSPLO3TeoSCG9Xbz1MbbAG3jFsszz70hx 5/Bgc1uxLbtQ2a/v1RCM5cJVo/2Gr3o0vtX/B0Y3xRInFbr4SG78mrvNXSmpl3XoNH++ zcOFQ9E+d6tqRbuldwOp58jQkb3gGwS7Qnvz4dJFvEvDqvn8bDs6YlUuqV2hoS9wgpXL o4pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id g5-20020a17090a128500b0027ff8323f07si4609971pja.15.2023.10.29.01.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 01:02:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BECD080725FE; Sun, 29 Oct 2023 01:01:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230080AbjJ2IBJ (ORCPT + 30 others); Sun, 29 Oct 2023 04:01:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230045AbjJ2IBC (ORCPT ); Sun, 29 Oct 2023 04:01:02 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A772F3; Sun, 29 Oct 2023 01:00:58 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=guanjun@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0Vv31XX4_1698566453; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0Vv31XX4_1698566453) by smtp.aliyun-inc.com; Sun, 29 Oct 2023 16:00:53 +0800 From: 'Guanjun' To: dave.jiang@intel.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, tony.luck@intel.com, fenghua.yu@intel.com Cc: jing.lin@intel.com, ashok.raj@intel.com, sanjay.k.kumar@intel.com, megha.dey@intel.com, jacob.jun.pan@intel.com, yi.l.liu@intel.com, tglx@linutronix.de Subject: [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions Date: Sun, 29 Oct 2023 16:00:49 +0800 Message-Id: <20231029080049.1482701-3-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231029080049.1482701-1-guanjun@linux.alibaba.com> References: <20231029080049.1482701-1-guanjun@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 29 Oct 2023 01:01:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781076111967175742 X-GMAIL-MSGID: 1781076111967175742 From: Guanjun Fix the incorrect descriptions for the GRPCFG register. No functional changes Signed-off-by: Guanjun Reviewed-by: Dave Jiang --- drivers/dma/idxd/registers.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/dma/idxd/registers.h b/drivers/dma/idxd/registers.h index 7b54a3939ea1..385a162a55f2 100644 --- a/drivers/dma/idxd/registers.h +++ b/drivers/dma/idxd/registers.h @@ -440,12 +440,15 @@ union wqcfg { /* * This macro calculates the offset into the GRPCFG register * idxd - struct idxd * - * n - wq id - * ofs - the index of the 32b dword for the config register + * n - group id + * ofs - the index of the 64b qword for the config register * - * The WQCFG register block is divided into groups per each wq. The n index - * allows us to move to the register group that's for that particular wq. - * Each register is 32bits. The ofs gives us the number of register to access. + * The GRPCFG register block is divided into three different types, that + * includes GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index in each group + * allows us to move to the register group that's for that particular wq, + * engine or group flag. + * Each register is 64bits. And the ofs in GRPWQCFG gives us the number + * of register to access. */ #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\ (n) * GRPCFG_SIZE + sizeof(u64) * (ofs))