From patchwork Tue Sep 5 12:47:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Wang X-Patchwork-Id: 9938855 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C9D8602B6 for ; Tue, 5 Sep 2017 12:47:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DED028972 for ; Tue, 5 Sep 2017 12:47:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32CFC2897B; Tue, 5 Sep 2017 12:47:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D7F228972 for ; Tue, 5 Sep 2017 12:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751808AbdIEMrl (ORCPT ); Tue, 5 Sep 2017 08:47:41 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5539 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751630AbdIEMri (ORCPT ); Tue, 5 Sep 2017 08:47:38 -0400 Received: from 172.30.72.60 (EHLO DGGEMS408-HUB.china.huawei.com) ([172.30.72.60]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DGQ35683; Tue, 05 Sep 2017 20:47:24 +0800 (CST) Received: from [127.0.0.1] (10.63.139.185) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.301.0; Tue, 5 Sep 2017 20:47:18 +0800 Subject: Re: [Question] PCI ACS is broken for ARM SMMU v3? To: Lorenzo Pieralisi References: <59A81B4C.3020402@hisilicon.com> <59AD4812.3020602@hisilicon.com> <20170904155948.GA20601@red-moon> CC: Alex Williamson , Will Deacon , , Linux PCI From: Zhou Wang Message-ID: <59AE9CD3.1020700@hisilicon.com> Date: Tue, 5 Sep 2017 20:47:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20170904155948.GA20601@red-moon> X-Originating-IP: [10.63.139.185] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.59AE9CDD.002A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 5d53b14a981aa1b3ada98d916f9fa454 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 2017/9/4 23:59, Lorenzo Pieralisi wrote: > On Mon, Sep 04, 2017 at 08:33:22PM +0800, Zhou Wang wrote: >> +to: Lorenzo >> >> On 2017/8/31 22:21, Zhou Wang wrote: >>> Hi Will and Alex, >>> >>> pci_request_acs is called in drivers/iommu/arm-smmu-v3.c to set pci_acs_enable. >>> >>> PCI subsystem tries to enable ACS as below: >>> >>> pci_device_add >>> --> pci_init_capabilities >>> --> pci_enable_acs >>> >>> in ACPI PCI driver. However, ACPI PCI driver will be called before SMMU v3 driver, >>> which will lead pci_enable_acs to return directly as pci_acs_enable is not set >>> before SMMU v3 driver loading. >>> >>> I think this is a bug, what do you think about this problem? > > I think that it is a bug that affects OF/ACPI alike. One way of solving Yes, DT also has this problem. > it is requesting ACS at IORT init following appropriate checks (ie > mappings PCI->IOMMU - that would not solve the OF path though). I can > put together a quick fix, the overall problem needs some thinking > though. I am not familiar with IORT init, but can we do it like: Best, Zhou > > Lorenzo > > . > diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index a3215ee..a6f1a21 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1131,6 +1131,7 @@ static void __init iort_init_platform_devices(void) acpi_free_fwnode_static(fwnode); return; } + pci_request_acs(); } iort_node = ACPI_ADD_PTR(struct acpi_iort_node, iort_node,