Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp191138ybm; Wed, 27 May 2020 23:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPCyMwGK3RgVWhf4/gEeLAhEaJmjR9FmD/1JPssEPKiCTcC3pUBX1L1ji+cuyartTZcKCO X-Received: by 2002:aa7:d284:: with SMTP id w4mr1529628edq.223.1590648469170; Wed, 27 May 2020 23:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590648469; cv=none; d=google.com; s=arc-20160816; b=RUAFJZz6gH3Ulkkt4xODAp1VCswRz+bZjEMGvl7fw55biDQZuV2vH2ReQ0R0KBwaHI ANMy3ck8yH/HZjadFBYBIIpQBP08Vx9Is0xUF4UAFabbvBEJuW5Y3OSjE8QO65u7Cfsp Wk2AkKQJ+v9tbZXx2uUX/CSNNnlXQgDzUStti0OJqyOQ1tx8jR8GnXOy7eIOj3L7i+1R 0Z9cdbHlretYKLAl7ZaP7iqYBDz49PthwhQbdeXXQoxtRKpSgPmGrzNinAPLl+ox0+JR dganz+4FZuHlukH5YnKkbLtccD0ihNRfFjg7X3exdAjdDTW1bOamXLRC/IUCSNaxvqwZ loxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=bofUGbEFbdnCpZWFs8DHvdOjPGm9ZoW5dSffBdf+/48=; b=Vka2OVaM2lHboqglm340RROdYDSIK9SNTcHV0kEoL8XanmJ7BKTVxdWp5zk3ITzVv3 ty6QaClqOKqhG7P4lO9UGzBlHPjnusWVOfIL6r77RBJQy4GKuD/3cCD8KbQjVzOUI/2G fa8H2cDz9XVTeALTFjoLNJ2cTg8MGxy9gXzU2ly21oNuXbvw+msX35Bjwm67pgUO5V24 tPObvyAucLJYhNV+9eZRNeX8s28i3fn38kyiajf4CrXaVmkNt4+NdHeLyoHVGre//k5Y E6bdLbcypqjPp7veLt11ycg42+AuvhEffdLYVP+1bPqXB/TnWlblMCNTLbavVfYo9Z0P PB9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i9zZJ+TN; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l22si2573961ejg.740.2020.05.27.23.47.18; Wed, 27 May 2020 23:47:49 -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=@linaro.org header.s=google header.b=i9zZJ+TN; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725819AbgE1GrM (ORCPT + 99 others); Thu, 28 May 2020 02:47:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgE1GrL (ORCPT ); Thu, 28 May 2020 02:47:11 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60908C08C5C3 for ; Wed, 27 May 2020 23:47:10 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id i17so2620513pli.13 for ; Wed, 27 May 2020 23:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=bofUGbEFbdnCpZWFs8DHvdOjPGm9ZoW5dSffBdf+/48=; b=i9zZJ+TNeNvRcNidmG6piUlVvLM12Ql3gwyE+1zs9+dJy5yzwRheejuryIIdaoZ4Oy PpqV4KZbIEBAopt3QeSB7kIlzfJ/gbWqRtjQdJUqsTEvr+QSDb1MpiutTS4mt27VJCUT wGolKhdBUMCO/4xP7K+wFV4wv+9gh0GtSNTZB22oVGKXEuXTwgUf3S6zOwCFXqSedPwS YFXT5ssn5iSuHWecgXg/mm3uDYHzC4v6XDBneViordfQVzOqzgDXeZa++mqrl38Mj+tu hrnxug4U/nOg29Qjc/NWFC05jy+tQ7In0/wAskn4wZvpS2yEdT1qW9PePMneSuSNMFTS bNdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=bofUGbEFbdnCpZWFs8DHvdOjPGm9ZoW5dSffBdf+/48=; b=BGgTplvXW4ckEYIhR3NYltYCeiqiBWui8Gj+zJlu7LzOHpvDU/JLzPJytvY1TqrOyH LUcrzXG5lDeqinVCh8ibAEi85rB4+bmgy2crjhu5mnYBXsF1QkUF0IzoG/XaV6L5nZdo RqbpQCFYOxxoIgD8sNLU3jGeM+PO+fEs1jg6dB/Pi+ZyDfc4dtwzlgpzaXzb0tQWc5Mb LtNaMGKIatM+Cv/O/mewxWJ49sRvt7w5qdWKwQQvTAi7GiWIHdjpqwYueWWY5i7Lk5+G NaMOLeGRty+VoxYnOnQxZCMaxh3ibbWuCdVLDm1xGZtepyPn4S5OgIHGMQ8B1eH+5XjZ k5ww== X-Gm-Message-State: AOAM531I392ZU4FUQiAnorJ2rO33odDADLdGq1XUbkWzG5AbWJ6PHU/1 M0Y72AvwcZ3gPfvyp+JmKoGH3w== X-Received: by 2002:a17:90a:de8b:: with SMTP id n11mr2312350pjv.87.1590648429749; Wed, 27 May 2020 23:47:09 -0700 (PDT) Received: from [10.140.6.42] ([45.135.186.12]) by smtp.gmail.com with ESMTPSA id 188sm3707241pfu.165.2020.05.27.23.46.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 May 2020 23:47:09 -0700 (PDT) Subject: Re: [PATCH 0/2] Introduce PCI_FIXUP_IOMMU To: Bjorn Helgaas 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 References: <20200527181842.GA256680@bjorn-Precision-5520> From: Zhangfei Gao Message-ID: <83bd3d72-3a0c-d9b6-54ad-5bc0dbc5be7d@linaro.org> Date: Thu, 28 May 2020 14:46:54 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200527181842.GA256680@bjorn-Precision-5520> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi, Bjorn On 2020/5/28 上午2:18, Bjorn Helgaas wrote: > 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. I do not notice the difference when compared fixup_iommu and fixup_final via get_jiffies_64, since in our platform no other pci fixup is registered. Here the plan is adding pci_fixup_device in iommu_fwspec_init, so if using fixup_final the iteration will be done again here. > >> 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. Got it, thanks Bjorn.