Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp965813ybm; Wed, 27 May 2020 12:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRY9bjaxJvs4g5+6n+hzIh1mulGVO2nz4J6zpsdggY/fQD7Ev//0F0B9r5ZiNMYzE4Kmwr X-Received: by 2002:a17:906:b57:: with SMTP id v23mr5323495ejg.481.1590607325797; Wed, 27 May 2020 12:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590607325; cv=none; d=google.com; s=arc-20160816; b=AjEEoELYLaw2D4L1B5QiD73E5r7gXLijLHyf9lXuK4rE3jge+gSLbk+6aHalF63IAJ jNp5TyL5jUh+s58p8Q1j16D0pMAY0wAk5Plll/o67ktdZmJciMHSwL98eMfyXfmfX7vc sgn06aYV7Ewne4nauATktFpagc8a0sbaP/FOIo1P5PIN9VfTpxiGYhCtxCzkIHMYsd3z bHMAvdj8uKQNKT4iy73XCXzKvjZJF71mKsPDSEOWIXgm+y8tRTlyVnbwHR35fQ2JJ4MM hlIVhYfXL5ZZxIUp1+TkLLH3B2sYSjAf49qxb9FZzuXrn5eVASTGXTH07QcOUEcSxwKA m46Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=Ge1Jus5joKQT0lKP1cIm3xQVhLc+o/fjS/a/7BwfxVQ=; b=qWPy9YRv22Dpzo8CixvMD9AYLFBmU9/EjPh4r4X5cHUiqfZRQCiAdG2IU3dAUPJhC9 JI6duyTRxNLYFyF6DBNds2semMIxSV5JE+7TAzFmH1DdEc4Ynf/txMUzWZ8HIgT2kK9Q LgtSx/7b4UY/ZUNix0s4QrxTbybUeZ6drq1sfmD5Z3zPSz8VIw12vTDzsBAHzuNNE8j7 lDMcPzr334L+UzrO732GcFsDlaT2a61LsODUZMm12tlQaDJ7JcYGUoPsCfn8jBJrIWJN RfnTEpURaQvkgtADLlb66kWeyCuWOph5KHf8m/uAzkhrIEFx3MbqJwzTwbix/ZZT8Vqu in6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nIx2hX8l; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu21si2122941edb.485.2020.05.27.12.21.42; Wed, 27 May 2020 12:22:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nIx2hX8l; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391935AbgE0SSp (ORCPT + 99 others); Wed, 27 May 2020 14:18:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:54726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391932AbgE0SSp (ORCPT ); Wed, 27 May 2020 14:18:45 -0400 Received: from localhost (mobile-166-175-190-200.mycingular.net [166.175.190.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3CF692075A; Wed, 27 May 2020 18:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590603524; bh=IlJRE+s/Xn0kFANnhdpCDcIhPKRLpygy8ad6xlPlHjQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=nIx2hX8lM30uXBDTL7TuhND9kQ3G+qZ++mUq5WECUp59CfqdUpYK43QoUK7AXlVPf KxTUevqFBycL9TlKq7SmWveEDn1K/rg1pDaaEGJos75PWipKFqulr3bGwuDJBHuVi1 7/+Jn7myhnHFa+KsZWLZ+HqvliJJB2ISAncHJDyU= Date: Wed, 27 May 2020 13:18:42 -0500 From: Bjorn Helgaas To: Zhangfei Gao Cc: Joerg Roedel , Bjorn Helgaas , Arnd Bergmann , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , jean-philippe , Greg Kroah-Hartman , Herbert Xu , kenneth-lee-2012@foxmail.com, Wangzhou , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, iommu@lists.linux-foundation.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org Subject: Re: [PATCH 0/2] Introduce PCI_FIXUP_IOMMU Message-ID: <20200527181842.GA256680@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1590493749-13823-1-git-send-email-zhangfei.gao@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, May 26, 2020 at 07:49:07PM +0800, Zhangfei Gao wrote: > Some platform devices appear as PCI but are actually on the AMBA bus, > and they need fixup in drivers/pci/quirks.c handling iommu_fwnode. > Here introducing PCI_FIXUP_IOMMU, which is called after iommu_fwnode > is allocated, instead of reusing PCI_FIXUP_FINAL since it will slow > down iommu probing as all devices in fixup final list will be > reprocessed, suggested by Joerg, [1] Is this slowdown significant? We already iterate over every device when applying PCI_FIXUP_FINAL quirks, so if we used the existing PCI_FIXUP_FINAL, we wouldn't be adding a new loop. We would only be adding two more iterations to the loop in pci_do_fixups() that tries to match quirks against the current device. I doubt that would be a measurable slowdown. > For example: > Hisilicon platform device need fixup in > drivers/pci/quirks.c handling fwspec->can_stall, which is introduced in [2] > > +static void quirk_huawei_pcie_sva(struct pci_dev *pdev) > +{ > + struct iommu_fwspec *fwspec; > + > + pdev->eetlp_prefix_path = 1; > + fwspec = dev_iommu_fwspec_get(&pdev->dev); > + if (fwspec) > + fwspec->can_stall = 1; > +} > + > +DECLARE_PCI_FIXUP_IOMMU(PCI_VENDOR_ID_HUAWEI, 0xa250, quirk_huawei_pcie_sva); > +DECLARE_PCI_iFIXUP_IOMMU(PCI_VENDOR_ID_HUAWEI, 0xa251, quirk_huawei_pcie_sva); > > [1] https://www.spinics.net/lists/iommu/msg44591.html > [2] https://www.spinics.net/lists/linux-pci/msg94559.html If you reference these in the commit logs, please use lore.kernel.org links instead of spinics. > Zhangfei Gao (2): > PCI: Introduce PCI_FIXUP_IOMMU > iommu: calling pci_fixup_iommu in iommu_fwspec_init > > drivers/iommu/iommu.c | 4 ++++ > drivers/pci/quirks.c | 7 +++++++ > include/asm-generic/vmlinux.lds.h | 3 +++ > include/linux/pci.h | 8 ++++++++ > 4 files changed, 22 insertions(+) > > -- > 2.7.4 >