Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2903606ybf; Mon, 2 Mar 2020 18:16:50 -0800 (PST) X-Google-Smtp-Source: ADFU+vvpYXXeKzThJ/2RUWm2PT19qwefjQ5UxrTzDeoERR4NiWYLYqpTwWC3q4RY7xTbrakEAy9w X-Received: by 2002:a9d:7305:: with SMTP id e5mr1672024otk.64.1583201810218; Mon, 02 Mar 2020 18:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583201810; cv=none; d=google.com; s=arc-20160816; b=Zj4bbALtEDY212FUGRgA0zd9QVyrJ4RNrwvFQx4zxPQdasMnkJW4jC8vDhVVtLP+L9 PE1vSvpFLokZY/cBRDY47ZKm45JHjQdcYk9uJGFbAmJgn/rh4Q3PKRCo7KXkmILB5Ll+ fPU11Fes5rcaaS1rp8OuOMjl9n8ujSVcgzQiddFtPhMEJLKjVradasYjQU0NyYLpYDFY 894Sm+yyIz+ZyjPLwyzxPALD28o12e8im2PbAJQfGI/H+MUmhxiaC8BqnpXeF2VIbPZF k4n7bKcxXV2QWP1vxUoxPlfo9eZZ2y6Zgnu+8nSAYb3Sq0zFtMrcs0G7e2gOXATiqxS1 GFcg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=aUF5jtZ/SW8FdVc2zTLhyQn8cAMjJbPgto8soT7qaPs=; b=wHX6Jk/rTdeOFPlMkiq+oGq4u9JhoyuxOH1D50cGlR0mO9LPNHuka4QDgwbX6Vohjj FKrloBJBxEtpF+OZpFK40Qg/GzZbKJEWTkvbbZJBwVNAWXoZI1fkjIIJVn/eiecp0yfs v8yq8ghq7Xm/YnKYv/y1gGtyLZkMraJcKWx+BIQ8ZzTqfrIsQix8dxCLXnVkYU3K0Vfn 8nP9UiO9ylsqWB++SKZLPUDseoDvLqKzuEaByUY6esc74g57FhfcNd5IiFrbmL4vqGwf t45cqdWhki8TxR2WS7+zV2vKwYHTrZ9f2CgUQWOEKcxzLUuTQaGhAkhhFTp0On83Al1d uB5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si6620064oix.12.2020.03.02.18.16.28; Mon, 02 Mar 2020 18:16:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726859AbgCCCQ1 (ORCPT + 99 others); Mon, 2 Mar 2020 21:16:27 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:35944 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726843AbgCCCQ1 (ORCPT ); Mon, 2 Mar 2020 21:16:27 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4B88112D0A4CDF39E881; Tue, 3 Mar 2020 10:16:23 +0800 (CST) Received: from [127.0.0.1] (10.74.191.121) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Tue, 3 Mar 2020 10:16:16 +0800 Subject: Re: [PATCH v2 3/5] crypto: hisilicon/sec2 - Add iommu status check To: Jonathan Cameron , Zaibo Xu CC: , , , , , , , , References: <1583129716-28382-1-git-send-email-xuzaibo@huawei.com> <1583129716-28382-4-git-send-email-xuzaibo@huawei.com> <20200302115409.0000685e@Huawei.com> From: Yunsheng Lin Message-ID: <3b8e3537-bd16-50ec-4635-4db1ac4dce38@huawei.com> Date: Tue, 3 Mar 2020 10:16:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20200302115409.0000685e@Huawei.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.191.121] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2020/3/2 19:54, Jonathan Cameron wrote: > On Mon, 2 Mar 2020 14:15:14 +0800 > Zaibo Xu wrote: > >> From: liulongfang >> >> In order to improve performance of small packets (<512Bytes) >> in SMMU translation scenario,We need to identify the type of IOMMU nit: space after ','. and We -> we for lower case? >> in the SEC probe to process small packets by a different method. >> >> Signed-off-by: liulongfang >> Reviewed-by: Zaibo Xu > > This looks like what we ended up with for the SECv1 driver. > > Reviewed-by: Jonathan Cameron >> --- >> drivers/crypto/hisilicon/sec2/sec.h | 1 + >> drivers/crypto/hisilicon/sec2/sec_main.c | 19 +++++++++++++++++++ >> 2 files changed, 20 insertions(+) >> >> diff --git a/drivers/crypto/hisilicon/sec2/sec.h b/drivers/crypto/hisilicon/sec2/sec.h >> index 13e2d8d..eab0d22 100644 >> --- a/drivers/crypto/hisilicon/sec2/sec.h >> +++ b/drivers/crypto/hisilicon/sec2/sec.h >> @@ -165,6 +165,7 @@ struct sec_dev { >> struct list_head list; >> struct sec_debug debug; >> u32 ctx_q_num; >> + bool iommu_used; >> u32 num_vfs; >> unsigned long status; >> }; >> diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c >> index ebafc1c..6466d90 100644 >> --- a/drivers/crypto/hisilicon/sec2/sec_main.c >> +++ b/drivers/crypto/hisilicon/sec2/sec_main.c >> @@ -7,6 +7,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -826,6 +827,23 @@ static void sec_probe_uninit(struct hisi_qm *qm) >> destroy_workqueue(qm->wq); >> } >> >> +static void sec_iommu_used_check(struct sec_dev *sec) >> +{ >> + struct iommu_domain *domain; >> + struct device *dev = &sec->qm.pdev->dev; >> + >> + domain = iommu_get_domain_for_dev(dev); >> + >> + /* Check if iommu is used */ >> + sec->iommu_used = false; >> + if (domain) { >> + if (domain->type & __IOMMU_DOMAIN_PAGING) >> + sec->iommu_used = true; >> + dev_info(dev, "SMMU Opened, the iommu type = %u\n", >> + domain->type); >> + } >> +} >> + >> static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id) >> { >> struct sec_dev *sec; >> @@ -839,6 +857,7 @@ static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id) >> pci_set_drvdata(pdev, sec); >> >> sec->ctx_q_num = ctx_q_num; >> + sec_iommu_used_check(sec); >> >> qm = &sec->qm; >> > > > _______________________________________________ > Linuxarm mailing list > Linuxarm@huawei.com > http://hulk.huawei.com/mailman/listinfo/linuxarm > > . >