From patchwork Tue Oct 31 02:36:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: guanjun X-Patchwork-Id: 159932 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2634282vqb; Mon, 30 Oct 2023 19:37:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMUpyxsxEdGf++YPq6sDW2j/i26i6AxQ6qSnQ7FKxYJ0n3yAQUSCyyHzrl+VfEsopBN9m9 X-Received: by 2002:a05:6358:63a4:b0:169:4c8a:7eb3 with SMTP id k36-20020a05635863a400b001694c8a7eb3mr14867287rwh.9.1698719864171; Mon, 30 Oct 2023 19:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698719864; cv=none; d=google.com; s=arc-20160816; b=qHxEuIdQoX8tlj0qLvSQXL/CITBw2EKURUCRMT6TWDL6c0K5EIDmg+AhDNpoozYvIJ RTFsWnGzGn950wGGUu9HuwuG1hcqACmtMbUm6+mXEQkHpNs/XWYgkDBstTySBh1pjj0A Obr0gHHAaRZSlmPShobbPI/rigDgxnh0iDOwnoJhCvWuxrb5DYgwX1XmnbcfRXYtX3+H cOLnUxNdz/Cn/jXI9PcxTtqKH3hnNkXWO/DRfEfUFyNhvarGA0AZbQYVhUmB3qwEpPYn 4fcUgXp0yCoZa1Udga+MrlB5ddEYNTuJ/xKrNjFiMy8M5UTmbMWlZObCc1oRzH6b3/Cq UgYQ== 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=rlICba1d5yaGpOlfF5saSJEb6dAc8rwNGxCnnHkLUpoWOzmGv9+d/rwuA0iJoNOyHo 87o5bBy0eVaFDFRX1WKqqqm8uMs5M7c60MmAtp++XnQcyIDnI09DD28rSkDyUL4AfdDL UyZ9FbRVxrCu3TErE5gL3fhkifWHBobAq3x3KoeyJvXpRje3PZDspZhn5natyK1R1yNJ GBABryXpPRDRsgI8cPXeQIPlBWHjF/eUdq4/4TwjokxZEIaf5MKtts/jtIvyj+dk2yv/ 8kXkkYYCzzC95LSAoMKGhqYhRmK1zbzmZYt8YDfvCP03CkxrfS23aaZq06I0sUDrGHZj lBzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id y4-20020a634944000000b00585463c36fbsi348428pgk.44.2023.10.30.19.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 19:37:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 09D9C803B73E; Mon, 30 Oct 2023 19:37:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233405AbjJaChT (ORCPT + 33 others); Mon, 30 Oct 2023 22:37:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235192AbjJaChO (ORCPT ); Mon, 30 Oct 2023 22:37:14 -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 73A88C5; Mon, 30 Oct 2023 19:37:07 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=guanjun@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0VvFqPhN_1698719822; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0VvFqPhN_1698719822) by smtp.aliyun-inc.com; Tue, 31 Oct 2023 10:37:03 +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 v3 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor Date: Tue, 31 Oct 2023 10:36:59 +0800 Message-Id: <20231031023700.1515974-2-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231031023700.1515974-1-guanjun@linux.alibaba.com> References: <20231031023700.1515974-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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 30 Oct 2023 19:37:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781236880030242825 X-GMAIL-MSGID: 1781236880030242825 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 --- 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:37:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: guanjun X-Patchwork-Id: 159929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2634198vqb; Mon, 30 Oct 2023 19:37:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVMlKE4gv3RmqsuwGo1h6uPeMXkm0rzvJaOFJuYzJzOqPMlwhfjRuIysz51pKuOnHdTBKm X-Received: by 2002:a67:c882:0:b0:457:d103:4043 with SMTP id v2-20020a67c882000000b00457d1034043mr11955079vsk.11.1698719849637; Mon, 30 Oct 2023 19:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698719849; cv=none; d=google.com; s=arc-20160816; b=Yh/fLNRI57GJbFRhgpbFotUrMquQ/SZoJgsshA3hGzYweLR0Q84y+wg4OapieLv0gB 4kKPxmmB+cb5WgPXW1NtMZ9xBW+agqIhKQ9eW5deH/JyyI8AYwaAZbinbJF9Ux7EcPAL DyozynHISVuAGuQ3DDJKAED8lpi5NaekRiWCop3VUIWx0dMNmeZjbRdOF17/UQ1Dm57B HBwwuYW3BhLwbby3NZRnUp8eiNNCBNBMY/IuEQZLPE0XESEzhRkQLfnEz/19Ms2OqopI zHlW7hYB0Ris/ROVEe82m48sLKjOAxIWivQt/LH5IWQ/G3kTNp3YtwbgrGN7VY48aaF+ w9aQ== 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=nI4owjLNbwrPDaH36UNSNPdGJF9zPNW1aGc8bbfQXxc=; fh=QBHJhMFaY+lWbqr2wKEcOz8zsPIdmcjBYs3CtaAVoV4=; b=GjSyp/sLbpbtNdMdUoQkB/Smf+xBmumrdNjr1PUnEv4cjndC1CbW60ZL2GJ59AhCUJ f3+nHKpIKidjaal8DwjPU2MFPUotC0mCqxXj2UH9KuRRoLp1QkJE598KQAVwlJ+zZqSP HoeU4HrUFr1/CgeXx7yaCf8XZXEJxcxyVxJRtqXT3T4BO0ZqeNbcvs0uUPlrOGOG7+hz elYCRRrblsCj2Y89eXGL9zKHS0brpPvN36OIx0AB/mWYN9wa4LD0KJU3ndBM72c2wEZO d5YhJZxPA3QWuQfb3ykDEOJ5vksAAc5rFE0oJktL88zAFHIU/k+yADyL7Badz5IkU4Rg YWHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u124-20020a637982000000b005b8ee4c9237si343211pgc.236.2023.10.30.19.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 19:37:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id ADB7D802A6DC; Mon, 30 Oct 2023 19:37:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235387AbjJaChW (ORCPT + 33 others); Mon, 30 Oct 2023 22:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235390AbjJaChR (ORCPT ); Mon, 30 Oct 2023 22:37:17 -0400 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EFB712E; Mon, 30 Oct 2023 19:37:09 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=guanjun@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0VvFb6Hm_1698719824; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0VvFb6Hm_1698719824) by smtp.aliyun-inc.com; Tue, 31 Oct 2023 10:37:05 +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 v3 2/2] dmaengine: idxd: Fix incorrect descriptions for GRPCFG register Date: Tue, 31 Oct 2023 10:37:00 +0800 Message-Id: <20231031023700.1515974-3-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231031023700.1515974-1-guanjun@linux.alibaba.com> References: <20231031023700.1515974-1-guanjun@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 30 Oct 2023 19:37:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781236865277158524 X-GMAIL-MSGID: 1781236865277158524 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 --- 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))