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: 9938907 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 1490B602B6 for ; Tue, 5 Sep 2017 12:52:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 064F22891C for ; Tue, 5 Sep 2017 12:52:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF3EF2897B; Tue, 5 Sep 2017 12:52:51 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 835CE2891C for ; Tue, 5 Sep 2017 12:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LcsRvVyJVnYwuswstei+jpmp00W85PKD7zNIoQmWND0=; b=JUxHcQ1m0+BosO xDg+NzJGn9vQLAHTcBJZubwAOGkvc65RS31tvWSWPnw0voSPi7X9N5Cm8bD57a9v9UcL3+nvPsIwS iL4AOXIfNncDXNNqMoN5d+n50ra0HGjchZTgQQUkqyvQs68kpG/fRTYNgwd7dPsLzgIReCBz8RKyd aeZfDQN8ai1SYaXZa4C7r09/tlS+FH7UyNxWG8N2KSu0VlFxx3P8C+NKdFkAhfEFGMiFggIx0qIXK v8nzkFbah+i0a2jkGMvmm2nbxfXmBs8z+C4W+2MeB8OZ0tcXF3BuXhROViWm3BEUzTnY/8p91WCei 6RKb/GtB5tCzIDEgKR7g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dpDLT-0000wZ-Lh; Tue, 05 Sep 2017 12:52:47 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dpDKq-0005qa-2Y for linux-arm-kernel@lists.infradead.org; Tue, 05 Sep 2017 12:52:27 +0000 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> 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170905_055209_341137_E4E74925 X-CRM114-Status: GOOD ( 11.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux PCI , Alex Williamson , Will Deacon , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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,