Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp767179pxp; Fri, 11 Mar 2022 14:35:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwaDP786ImtmhrzOh6bkZawTWqxnh8rSN6cqSgOeXif+acuT5vTgsJoauwq36K06rTKBfJJ X-Received: by 2002:a17:902:8492:b0:14d:5ddc:9df6 with SMTP id c18-20020a170902849200b0014d5ddc9df6mr12325355plo.15.1647038109218; Fri, 11 Mar 2022 14:35:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647038109; cv=none; d=google.com; s=arc-20160816; b=O4U6yfthPog5AyLvolLChDChJjEeFIU83MWxTI9yQ6Q8yJJGHC3iVVbrZSjFeFWMKJ lPNmzo1tju9sVBMwNzM/Fnut8iii/8P9N4m4AsUuRDazO2Zw8elihX4a0B7bylof0F7M 2KBASNDf6N3cUIaV5mJq1S9QpYnfMRSfzXluNCn17RsURTOJ3e5ek8PxOCr1DyXVBE3z zZy/DE9gRm0WVwVVQSY1GFVCAPIpUlg/C0e7Y9BU/DVudWX7vznyQok/34IWSKrzHetQ vrnKncbcfQ6zu4zTp04pAnmF3W0AhFq3Luy/+nxTM+FDWugHVyAsMEdn7Q0cnSue+tzo icnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=iIBhN5Mi10hFy564OrpHcVzpcEjglGY6xQpWoPtRpuI=; b=KPyZx6Q8GPxmA5pj8ZuR3lsH564Q6qojZHgFy4LoinxiBdKKsEFBYAazg+JOHZBOoU o7N/k5jxjX4eId8DoRti2QSKv4aJhnQlcwRRA33jtWWgPxs9QnycSPVLR6ehy98ICVwW bqZol8cigYzAB+qQF4O5XSocGuqGE57vRBRgbMxVCk62jmUNVRRoEcZmcmImO9hPocKG UjVVkR/2wd9QjEvPq5SoYbTQ+C4atsIQCSF2viiNlodIBGi92MnBAnYiu8nLCzvUsmhZ jLUsn/JxYtdnme8NWSjfwxIYPlNybn+BCKVd9HCrRbwtM9tCYvRIG6D/XyN4SH7hKaK4 NG+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m14-20020a170902f64e00b0014f66f6d7a3si9121501plg.536.2022.03.11.14.35.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:35:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9ACA531BD80; Fri, 11 Mar 2022 13:41:14 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350765AbiCKR2x (ORCPT + 99 others); Fri, 11 Mar 2022 12:28:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344114AbiCKR2v (ORCPT ); Fri, 11 Mar 2022 12:28:51 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 174BA31DD3; Fri, 11 Mar 2022 09:27:46 -0800 (PST) Received: from fraeml712-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KFXsB6JVmz684TK; Sat, 12 Mar 2022 01:26:06 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml712-chm.china.huawei.com (10.206.15.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 11 Mar 2022 18:27:43 +0100 Received: from [10.47.87.13] (10.47.87.13) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.21; Fri, 11 Mar 2022 17:27:42 +0000 Message-ID: <162a116a-4b0f-c58b-6760-86d10ecf543f@huawei.com> Date: Fri, 11 Mar 2022 17:27:41 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v5 1/8] iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity To: Yicong Yang , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , References: <20220308084930.5142-1-yangyicong@hisilicon.com> <20220308084930.5142-2-yangyicong@hisilicon.com> From: John Garry In-Reply-To: <20220308084930.5142-2-yangyicong@hisilicon.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.87.13] X-ClientProxiedBy: lhreml707-chm.china.huawei.com (10.201.108.56) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 08/03/2022 08:49, Yicong Yang wrote: > The DMA of HiSilicon PTT device can only work with identical mapping. nit: I'd have "DMA operations of the HiSilicon PTT device can only work properly with identity mappings". > So add a quirk for the device to force the domain passthrough. ".. domain as passthrough." > > Signed-off-by: Yicong Yang > --- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > index 6dc6d8b6b368..6f67a2b1dd27 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -2838,6 +2838,21 @@ static int arm_smmu_dev_disable_feature(struct device *dev, > } > } > > +#define IS_HISI_PTT_DEVICE(pdev) ((pdev)->vendor == PCI_VENDOR_ID_HUAWEI && \ > + (pdev)->device == 0xa12e) > + > +static int arm_smmu_def_domain_type(struct device *dev) > +{ > + if (dev_is_pci(dev)) { > + struct pci_dev *pdev = to_pci_dev(dev); > + > + if (IS_HISI_PTT_DEVICE(pdev)) > + return IOMMU_DOMAIN_IDENTITY; > + } > + > + return 0; > +} > + > static struct iommu_ops arm_smmu_ops = { > .capable = arm_smmu_capable, > .domain_alloc = arm_smmu_domain_alloc, > @@ -2863,6 +2878,7 @@ static struct iommu_ops arm_smmu_ops = { > .sva_unbind = arm_smmu_sva_unbind, > .sva_get_pasid = arm_smmu_sva_get_pasid, > .page_response = arm_smmu_page_response, > + .def_domain_type = arm_smmu_def_domain_type, > .pgsize_bitmap = -1UL, /* Restricted during device attach */ > .owner = THIS_MODULE, > };