Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1712104pxa; Sun, 2 Aug 2020 18:17:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw04VFiD1Z88NVAhHjxgFkqOa7cjM569HlE7y8siOEzXPTxKJufD00JqUUESorsCQ3rqc0H X-Received: by 2002:aa7:ccd5:: with SMTP id y21mr13249130edt.91.1596417455446; Sun, 02 Aug 2020 18:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596417455; cv=none; d=google.com; s=arc-20160816; b=OwGjGSs/D6HX6+UGO5tFJCWiWswWxVLxNxJLV2ORO9meQFGDvDFPZx5uank77kmRwS VlOjJpepRpZTN4boq5AQqSrvNxG3bkv4PrOc1HUOr420AHrWD4aO2wS41LRMvH208h+k prnKsm48DfUxiqyLRK4BuITgQStyt/m7quE1fAMh2iVBD+N15kRxPKmxQDXtJ9mjI4mp 0xb5MAPKUAeEB4jkLGEpBPyJ+DeoXzQUlx3kT3XYpVqeMpRUUiOhRCGH68NJkfrEw9aG iIYgEUaMLB39WBP3xCl0hFv5uezJLClol2251kbesQFtRP1mlFrBwRq5J10/UaQ+UaBx LojA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=FyIXz9ITDIDnq3bBHg3UJjoboOBw59ipt7OsYN3QjdQ=; b=uxVNzi0vfvVwgAYkAjzeHAMep7q9FjMFl+VfIVRu+Up5fUvjwO3ZSosFO6OLgciBtv FECgCqsolDakkWJTZm6hiAUMAJU4doIL4khFgdcs2OMPAc/BaJWK7jwtJ56vngkmACat 8l3vrUVRYvlaAlSWBJ8cwM8eIAIGto8asy8v7CvdKBMV6OGbbYg2PrV5SE6OaDi4aTv2 bhFG+uNtIu609IYHmq+L++gJdFDCQh3cqJMUCMYSeE7CaBJyW5l+p04g90tkxr2h748X qMjFgEsspdhsfs/qUe2/nm8KzAj5+s9xdO4eFoNjtc9Oi1hrrAdoEi0+2Wb7hLFqPasQ kJaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de2si6512504edb.365.2020.08.02.18.17.13; Sun, 02 Aug 2020 18:17:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726644AbgHCBM4 (ORCPT + 99 others); Sun, 2 Aug 2020 21:12:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9316 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725820AbgHCBMz (ORCPT ); Sun, 2 Aug 2020 21:12:55 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 869567EE8D90D9FFC445; Mon, 3 Aug 2020 09:12:52 +0800 (CST) Received: from [10.63.139.185] (10.63.139.185) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Mon, 3 Aug 2020 09:12:49 +0800 Subject: Re: [BUG] crypto: hisilicon: accessing the data mapped to streaming DMA To: Jia-Ju Bai , , References: <361fa200-479c-e1ef-b7d6-e666a256660f@tsinghua.edu.cn> CC: , From: Zhou Wang Message-ID: <5F276491.8060409@hisilicon.com> Date: Mon, 3 Aug 2020 09:12:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <361fa200-479c-e1ef-b7d6-e666a256660f@tsinghua.edu.cn> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.63.139.185] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/8/2 22:52, Jia-Ju Bai wrote: > In qm_qp_ctx_cfg(), "sqc" and "aeqc" are mapped to streaming DMA: > eqc_dma = dma_map_single(..., eqc, ...); > ...... > aeqc_dma = dma_map_single(..., aeqc, ...); Only sqc, cqc will be configured in qm_qp_ctx_cfg. > > Then "sqc" and "aeqc" are accessed at many places, such as: > eqc->base_l = cpu_to_le32(lower_32_bits(qm->eqe_dma)); > eqc->base_h = cpu_to_le32(upper_32_bits(qm->eqe_dma)); > ...... > aeqc->base_l = cpu_to_le32(lower_32_bits(qm->aeqe_dma)); > aeqc->base_h = cpu_to_le32(upper_32_bits(qm->aeqe_dma)); There are sqc, cqc, eqc, aeqc, you seems misunderstand them. > > These accesses may cause data inconsistency between CPU cache and hardware. > > I am not sure how to properly fix this problem, and thus I only report it. In qm_qp_ctx_cfg, sqc/cqc memory will be allocated and related mailbox will be sent to hardware. In qm_eq_ctx_cfg, eqc/aeqc related operations will be done. So there is no problem here :) Thanks, Zhou > > > Best wishes, > Jia-Ju Bai > >