Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp194457ybm; Wed, 27 May 2020 23:54:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7zqNQAIzxUnALOMECqoEffhsipShES0rkRNdV0JU2iZWhubiY8mg04FJxYfVqoMI5X/eg X-Received: by 2002:aa7:d28d:: with SMTP id w13mr551341edq.336.1590648873289; Wed, 27 May 2020 23:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590648873; cv=none; d=google.com; s=arc-20160816; b=hcuUBOLlC601nLoqU6fo2EgZmGeAzJy7nKMnZnAs1h2sVrCtlupxfYxr0K/ZJiGFXh MEe3cFXGlH2XoU9hHiuAGQu0uw0WULeXrYWSs8uHIS1bnHAtbPcNvJ2wQjcSspUJudSF cB0dI3SSAv/M771Vt89rSzoWn0k9vmsiny4JFKdm7DTM1QKsMMEcfIwlhflTG6XPT5Bx lgKTiRvh3lNj1xL5Uxeqgk1AoBjYEBWM5alWZpJH0JuLb7qOauGXRO3NRcThAnKBHvye 12teKBUX+SgCx4nx/+VG34nzme3EmIavsVSxgBYKidOQ6B/yfqInWgnAzKaFgjg4Ii4K WZhA== 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=zbKuT3nrBchNOXLtoqggayeJJOXuYIPFyuAneEl5VZE=; b=X58enFRxe5VTkD5anyOyeOPqKcL7JbYrFRzQnNlSkQYPqvS1pLdi0Ny8HEBJElv7bF 7gWEO1mIE0bfDGXRtlf+347jAIy64B9nqgBcVYDog0bRSXf9vaeS+Q4e8jS+UJrpXaHj EopDb+yo7eLZisgl2hkNMW8esPd+R5XzfAKnekJmIvyTdZh4rGSA9sWDqy2H7EjTR0ht Xsy6gTo3Mlb3OKiOBybXiquX1M5uLAtCJvF9MhoSZQ28XE4wQy+nXnqG4Q19X87Aa6cM H+6l5myVyfpuTNofiG8YaW4Ivi0Zwr6y+ooWGxY+OfseygZMvMy2UyMFFFOBR2Gv5rcg lkVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WeIYDG9i; 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 s9si570054ejq.422.2020.05.27.23.54.08; Wed, 27 May 2020 23:54:33 -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=WeIYDG9i; 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 S1726330AbgE1Gxf (ORCPT + 99 others); Thu, 28 May 2020 02:53:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgE1Gxe (ORCPT ); Thu, 28 May 2020 02:53:34 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52F38C08C5C3 for ; Wed, 27 May 2020 23:53:34 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id bh7so4215388plb.11 for ; Wed, 27 May 2020 23:53:34 -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=zbKuT3nrBchNOXLtoqggayeJJOXuYIPFyuAneEl5VZE=; b=WeIYDG9i+HPcpC+T7wLyd72laBytTR0RvEwehEj45sRWw4OKQzXYNNFynXnVehee4d Xz6/jjgw409iODdX8f+4nfB4ksOmJlLeRUjPatyd73dc4YdD/O6i/XN42ATrsS/CHqC2 Hj1KqTS/6K1rdwTjZSmW73Clu5pi1g+wvul9mqCnXjpkHb3po6GXlCny3fXX4LNkVWWh +Rf0+FfG/tiIkuRFgH2XUOnYBAJUB98HYAgq5RhcSvah+qLAhflgOXk0g/sakA7NLXbh qEjIntovK2YBpTUr74m+FL9V9Iy1pdy/deZKUseiSeBwZTjQlJikyz4UUCdSr+OwEHgX 9Dug== 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=zbKuT3nrBchNOXLtoqggayeJJOXuYIPFyuAneEl5VZE=; b=a3jXULvZ0pMcwIBdz/nmlhCdd/cnE3D9524NljfASwON3yr01CaqNKhY6gkK0wtqSX 6tUB59fxXR2ejwxDI/4hd0n4OdNlkiEwoc/a9Ivir8yQ87hpsbEltnbz6nqEdJUHuJEd BExqmhncd7Ii/5wowqIwL6Wszit0i/6nFoDZG702H9dswQ6WVVeCBUwIWJPgRQKFrj/0 Ow5hDnG17BUwtBf3msLERN/oIddRgXHKnb6YvIh1xbFJM30djCWhuJPHNQ2ot7LU2ivr 00DYtAKGzFfQIzTM2QKNPD2xB6BTESbixobgJk1kutnvFTnoW/RCHTpYFPkA+L1Ryo5i ZMEw== X-Gm-Message-State: AOAM533bbg/19TFqUoujBtjOVdZwCTNQvh/V2pTePhvycRGQiKOlfnsX 8tkvnvWKbKLWKdZtxIQlDq2tPw== X-Received: by 2002:a17:90a:d317:: with SMTP id p23mr2285917pju.107.1590648813784; Wed, 27 May 2020 23:53:33 -0700 (PDT) Received: from [10.140.6.42] ([45.135.186.12]) by smtp.gmail.com with ESMTPSA id g18sm3799582pfq.146.2020.05.27.23.53.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 May 2020 23:53:33 -0700 (PDT) Subject: Re: [PATCH 2/2] iommu: calling pci_fixup_iommu in iommu_fwspec_init To: Greg Kroah-Hartman Cc: Joerg Roedel , Bjorn Helgaas , Arnd Bergmann , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , jean-philippe , 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: <1590493749-13823-1-git-send-email-zhangfei.gao@linaro.org> <1590493749-13823-3-git-send-email-zhangfei.gao@linaro.org> <20200527090115.GB179718@kroah.com> From: Zhangfei Gao Message-ID: Date: Thu, 28 May 2020 14:53:20 +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: <20200527090115.GB179718@kroah.com> 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 On 2020/5/27 下午5:01, Greg Kroah-Hartman wrote: > On Tue, May 26, 2020 at 07:49:09PM +0800, Zhangfei Gao wrote: >> Calling pci_fixup_iommu in iommu_fwspec_init, which alloc >> iommu_fwnode. 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. >> So calling pci_fixup_iommu after iommu_fwnode is allocated. >> >> Signed-off-by: Zhangfei Gao >> --- >> drivers/iommu/iommu.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c >> index 7b37542..fb84c42 100644 >> --- a/drivers/iommu/iommu.c >> +++ b/drivers/iommu/iommu.c >> @@ -2418,6 +2418,10 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode, >> fwspec->iommu_fwnode = iommu_fwnode; >> fwspec->ops = ops; >> dev_iommu_fwspec_set(dev, fwspec); >> + >> + if (dev_is_pci(dev)) >> + pci_fixup_device(pci_fixup_iommu, to_pci_dev(dev)); > Why can't the caller do this as it "knows" it is a PCI device at that > point in time, right? Putting fixup here is because 1. iommu_fwspec has been allocated 2. iommu_fwspec_init will be called by of_pci_iommu_init and iort_pci_iommu_init, covering both acpi and dt Thanks