From patchwork Tue Oct 31 02:55:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: guanjun X-Patchwork-Id: 159935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2639156vqb; Mon, 30 Oct 2023 19:56:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGx4udQd3ZDDviIrzUOrNhegWYJhaWYLFSYFGYsQzTX/uRc2IgfxL4yVRhEcRFz1Lgm1uRX X-Received: by 2002:a05:6358:6f14:b0:168:e637:9dfc with SMTP id r20-20020a0563586f1400b00168e6379dfcmr14580124rwn.0.1698720991647; Mon, 30 Oct 2023 19:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698720991; cv=none; d=google.com; s=arc-20160816; b=sjSAe+bTE6E4T85ofyUYL4zOvXU4fJRtEFGiBEMzEYb5o6jgTMOxX5WettwYYEKZeu +rkw5BwJMHeDJjyNXGvLHWHA54rLphoCIAeUGvWXVvoLmM6RtdYSVnPDTRzqfLkrYWyh tRvcyPNczHM3M0bOZIHqnMtgl4re9fjcRGu8+XUVq8SKZd/CxoNdUswo1BYwz5YaMEEU bauBTKXi12b0CxYxMnaBiZCuO9kx7LYO+7elWuTvCUtUbbXu08Croz5v7o8JpWesXm7g vIqGwkLT6NWMgAIGi+JXo2tf2L0tftf7ePPN8M5vrJBTA5jI0iIpY9ux+OdpsVKPagsu KRwg== 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=2+ZCd2Ukl3tdwspiNdzftO/ZiqT8EGhicvhl00o1cfk=; fh=QBHJhMFaY+lWbqr2wKEcOz8zsPIdmcjBYs3CtaAVoV4=; b=S69/Oz1nlg8VV3kcFztJ4LwAcTDJhsS/qLHX4uPC/pMgrvuODavpRYn3b/R+CQ5Mrw TIdNDd9QbmU9+4kpPVTBXii+Y+uzKwmaENR0gVA6fpaXEEM6Cl0mLeQhNDmpAEBFldMY 5Tky5b1AMiSyYnxqPhkRy1yCD35BNIfJTi5ZkXX1c+UPvV6GRx1mD5n3RzI7wrH68Tym gjTNAVCzVuG7HOYf5fsXE7eC2dd31QcC9HbXBbw/nfshE9zFq2GgmNF6BVLDh1bHH1ZE 513OzExIM3c6lN9G+yKv3GK+3GfXckE/5FaTev4ma323/WXk1Vwc3amsq3Kr9xf0Otnc ZU0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id v10-20020a63610a000000b005b9b68adda4si355048pgb.75.2023.10.30.19.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 19:56:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 1145E807749C; Mon, 30 Oct 2023 19:55:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234101AbjJaCzX (ORCPT + 33 others); Mon, 30 Oct 2023 22:55:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbjJaCzV (ORCPT ); Mon, 30 Oct 2023 22:55:21 -0400 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AD69CC; Mon, 30 Oct 2023 19:55:17 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R251e4;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_---0VvFgpU9_1698720913; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0VvFgpU9_1698720913) by smtp.aliyun-inc.com; Tue, 31 Oct 2023 10:55:14 +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 v4 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor Date: Tue, 31 Oct 2023 10:55:10 +0800 Message-Id: <20231031025511.1516342-2-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231031025511.1516342-1-guanjun@linux.alibaba.com> References: <20231031025511.1516342-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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 30 Oct 2023 19:55:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781238062449710469 X-GMAIL-MSGID: 1781238062449710469 From: Guanjun The int_handle field in hw descriptor should also be protected by wmb() before possibly triggering a DMA read. Fixes: ec0d64231615 (dmaengine: idxd: embed irq_entry in idxd_wq struct) Signed-off-by: Guanjun Reviewed-by: Dave Jiang Reviewed-by: Fenghua Yu Reviewed-by: Lijun Pan --- 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 Tue Oct 31 02:55:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: guanjun X-Patchwork-Id: 159936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2639197vqb; Mon, 30 Oct 2023 19:56:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEESR8OyQwrSZtbSAJhHIgqJn65vyuJ0m3B8FX48hSck8wwi8t4JriPnTTu+wzj69RJ08s X-Received: by 2002:a17:902:dac4:b0:1cc:51b8:8100 with SMTP id q4-20020a170902dac400b001cc51b88100mr3332039plx.7.1698721001545; Mon, 30 Oct 2023 19:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698721001; cv=none; d=google.com; s=arc-20160816; b=qUU9XJaUwq9EGKkgvJANCgQ6NsavmuTVfvzqxuZvvUpqLjnNFuGDNcW4rbFvn2cIMK AO3ouAg/0HsuVcElpT8+qlf9tcPjTJiNF8WKa4AAWkIVrxpNioWqIaBfVwM10riQWGTJ j4G77iSO+I1l5lGJpFeInC/DGR3qwqilfKoG8iWee2n5c9ahitfk6FhCUkDfkHa5aE2P EGRYFMl632tDCpQymxoEsp6WCx0lKibUSQodLrm2Vl8WAzdk/4hGDQjbFxqsUFQrHL8n 5YjnCcMkf933LpT9Yxn3IbS0l8YJBHZF+t0lwziyse0IO8jKOztkevTMTXFtq8gNGDlZ Arbw== 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=9IHWGdm0XYBO+tueU8aqbF1MmmQC3C8I+zJhP/zxaOU=; fh=QBHJhMFaY+lWbqr2wKEcOz8zsPIdmcjBYs3CtaAVoV4=; b=V7PuxWfR58INRHcGv9ZLmtoD4sf/EMNz3vLFnwp2JhMIbldSgRpYcUgO2ULwDfFe0H 4CfzQpHiQp669xwPTAj2jNyPyKC/5bvURnGMABJwmYbvu0q36HhLUJsSqegbYeLavyqy xrPsuFVAoZrlu2XKRvyUsFCG3z+4pM79M+/bJBmpL+KnBotDuyPuB00/WBwv/Yfefi0T 2zoId5VPTrCrE2Kuwx6q361/DADSCTvx7MFFd7Lq+vgVoMUwvQ7PjLwj1B9gV/5fots1 11/NDgtMNUTzO9zSLLWC4MFbVhLPamY/wUnvy2pC0sk4Zh6StWrsEAu/qwxdUeTBLWIq zAmw== 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 kg5-20020a170903060500b001c3fa95ca03si327309plb.9.2023.10.30.19.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 19:56:41 -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 4DE4E80784D5; Mon, 30 Oct 2023 19:55:48 -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 S234804AbjJaCzZ (ORCPT + 33 others); Mon, 30 Oct 2023 22:55:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231825AbjJaCzV (ORCPT ); Mon, 30 Oct 2023 22:55:21 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 090A3DA; Mon, 30 Oct 2023 19:55:18 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R691e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=guanjun@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0VvFgpUV_1698720914; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0VvFgpUV_1698720914) by smtp.aliyun-inc.com; Tue, 31 Oct 2023 10:55:15 +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 v4 2/2] dmaengine: idxd: Fix incorrect descriptions for GRPCFG register Date: Tue, 31 Oct 2023 10:55:11 +0800 Message-Id: <20231031025511.1516342-3-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231031025511.1516342-1-guanjun@linux.alibaba.com> References: <20231031025511.1516342-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]); Mon, 30 Oct 2023 19:55:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781238073067915578 X-GMAIL-MSGID: 1781238073067915578 From: Guanjun Fix incorrect descriptions for the GRPCFG register which has three sub-registers (GRPWQCFG, GRPENGCFG and GRPFLGCFG). No functional changes Signed-off-by: Guanjun Reviewed-by: Dave Jiang Reviewed-by: Fenghua Yu Acked-by: Lijun Pan --- drivers/dma/idxd/registers.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/dma/idxd/registers.h b/drivers/dma/idxd/registers.h index 7b54a3939ea1..315c004f58e4 100644 --- a/drivers/dma/idxd/registers.h +++ b/drivers/dma/idxd/registers.h @@ -440,12 +440,14 @@ 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 sub-registers, which + * are GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index allows us to move + * to the register block that contains the three sub-registers. + * Each register block is 64bits. And the ofs gives us the offset + * within the GRPWQCFG register to access. */ #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\ (n) * GRPCFG_SIZE + sizeof(u64) * (ofs))