Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2907647ybf; Mon, 2 Mar 2020 18:22:48 -0800 (PST) X-Google-Smtp-Source: ADFU+vuTnHdkdJrC1czdV8ccQzZxJD8RrHK2Tc/MzFaJOkaSFDQQqqCzT/NeagSdtBVM9bB26dgM X-Received: by 2002:a9d:2184:: with SMTP id s4mr1618740otb.121.1583202168803; Mon, 02 Mar 2020 18:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583202168; cv=none; d=google.com; s=arc-20160816; b=Ovbz7vfo2meoRDOAKp7d7a8hbQ+r1UAKoEFDBWfnMefdLiYZEIH18O00ttJDF9kaLc QeL1zFAuNPh6gX4GunJrlruz/bUJ5V2J7MG/CegKZP9vz8v+WHUijAMN67iO4AeFP+qs opiDHNRQy8XukUhJ5iLx3uiJwSqaiQXRJyNTKbZ3ge1HVfCSajYlDa+lfoENWw6LfYbV OmhRdKj7c2nVJty3gD1mfkqSUC4ok/A8tR84I/6E4VyTaCaPzBdbDrK0HeZDqn0Q2GiG a10xl/e62CAdEoc5g00y9b9ASFw1wHfNlKMAXWTd8Nh0rpC1TTBRL6w15bwAg1SRy95B G1Bw== 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=StplHTjlMRveoPlFr2ws1pb4ECYmHlXFI78W1aBGlBY=; b=g1JSPFRvHG6LL9lvaOnG6iB9HNj5n1otgKGjeoQcvJ8ZvPNAD3lL58eq6OYQFJU1R4 NrOyPW0KcuMnncFrZRIOGHrajNAQuU4CmEoOzsyJURsLhP2NeItX35l9G9bpzcgtiWeL pp/Peaai4CJssaKHRflDSqUqviaybQjgHFgWY4Y6GqnylvPB87EmWpvkIYbGAcembmox uTpw+/DmmuiOyM/QZ8PaPb/r2S7047lMABSdGpN3sLcHSaNEZBCns+B1hIzPSVwS0gqN a8rD0tSouF1qbMVrJhFj9+/Lc1Phdm921+B6s8ijOCl8YLbCpCWidLYPu/8crU9nMNa/ B7PA== 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 b22si2719188oib.160.2020.03.02.18.22.37; Mon, 02 Mar 2020 18:22:48 -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 S1726942AbgCCCWg (ORCPT + 99 others); Mon, 2 Mar 2020 21:22:36 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:10711 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726907AbgCCCWg (ORCPT ); Mon, 2 Mar 2020 21:22:36 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 30A7897852CB11E303F9; Tue, 3 Mar 2020 10:22:34 +0800 (CST) Received: from [127.0.0.1] (10.67.101.242) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Tue, 3 Mar 2020 10:22:27 +0800 Subject: Re: [PATCH v2 3/5] crypto: hisilicon/sec2 - Add iommu status check To: Yunsheng Lin , Jonathan Cameron References: <1583129716-28382-1-git-send-email-xuzaibo@huawei.com> <1583129716-28382-4-git-send-email-xuzaibo@huawei.com> <20200302115409.0000685e@Huawei.com> <3b8e3537-bd16-50ec-4635-4db1ac4dce38@huawei.com> CC: , , , , , , , , From: Xu Zaibo Message-ID: <446107e1-6f12-c141-b582-e76b78011128@huawei.com> Date: Tue, 3 Mar 2020 10:22:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <3b8e3537-bd16-50ec-4635-4db1ac4dce38@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.101.242] 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/3 10:16, Yunsheng Lin wrote: > 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? yes, indeed. Thanks, Zaibo . > >>> 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 >> >> . >> > . >