From patchwork Fri Aug 8 23:40:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 378704 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5E876140111 for ; Sat, 9 Aug 2014 09:44:16 +1000 (EST) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id 440EA1A0D93 for ; Sat, 9 Aug 2014 09:44:16 +1000 (EST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2lp0239.outbound.protection.outlook.com [207.46.163.239]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id E312E1A0AA4 for ; Sat, 9 Aug 2014 09:41:13 +1000 (EST) Received: from snotra.am.freescale.net (192.88.168.49) by BN1PR0301MB0723.namprd03.prod.outlook.com (25.160.78.142) with Microsoft SMTP Server (TLS) id 15.0.1005.10; Fri, 8 Aug 2014 23:40:59 +0000 From: Scott Wood To: Benjamin Herrenschmidt Subject: [PATCH 4/4] powerpc/fsl-pci: Limit ZONE_DMA32 to 2GiB on 64-bit platforms Date: Fri, 8 Aug 2014 18:40:45 -0500 Message-ID: <1407541245-27617-4-git-send-email-scottwood@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407541245-27617-1-git-send-email-scottwood@freescale.com> References: <1407541245-27617-1-git-send-email-scottwood@freescale.com> MIME-Version: 1.0 X-Originating-IP: [192.88.168.49] X-ClientProxiedBy: BLUPR05CA0049.namprd05.prod.outlook.com (10.141.20.19) To BN1PR0301MB0723.namprd03.prod.outlook.com (25.160.78.142) X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 02973C87BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(6009001)(199002)(189002)(50986999)(19580395003)(19580405001)(87286001)(83322001)(110136001)(66066001)(62966002)(74662001)(33646002)(76176999)(31966008)(74502001)(99396002)(85306004)(88136002)(89996001)(102836001)(46102001)(101416001)(104166001)(87976001)(76482001)(36756003)(79102001)(77982001)(77156001)(42186005)(86362001)(83072002)(92566001)(92726001)(85852003)(50466002)(48376002)(106356001)(81342001)(20776003)(81542001)(21056001)(4396001)(95666004)(64706001)(229853001)(47776003)(107046002)(80022001)(50226001)(105586002)(77096002)(93916002); DIR:OUT; SFP:; SCL:1; SRVR:BN1PR0301MB0723; H:snotra.am.freescale.net; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; LANG:en; X-OriginatorOrg: freescale.com Cc: Scott Wood , linuxppc-dev@lists.ozlabs.org, Shaohui Xie X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" FSL PCI cannot directly address the whole lower 4 GiB due to conflicts with PCICSRBAR and outbound windows. By the time max_direct_dma_addr is set to the precise limit, it will be too late to alter the zone limits, but we should always have at least 2 GiB mapped (unless RAM is smaller than that). Signed-off-by: Scott Wood Cc: Shaohui Xie --- arch/powerpc/platforms/85xx/corenet_generic.c | 11 +++++++++++ arch/powerpc/platforms/85xx/qemu_e500.c | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c index d22dd85..c2adb00 100644 --- a/arch/powerpc/platforms/85xx/corenet_generic.c +++ b/arch/powerpc/platforms/85xx/corenet_generic.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,16 @@ void __init corenet_gen_setup_arch(void) swiotlb_detect_4g(); +#if defined(CONFIG_FSL_PCI) && defined(CONFIG_ZONE_DMA32) + /* + * Inbound windows don't cover the full lower 4 GiB + * due to conflicts with PCICSRBAR and outbound windows, + * so limit the DMA32 zone to 2 GiB, to allow consistent + * allocations to succeed. + */ + limit_zone_pfn(ZONE_DMA32, 1UL << (31 - PAGE_SHIFT)); +#endif + pr_info("%s board\n", ppc_md.name); mpc85xx_qe_init(); diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c index 7f26732..8ad2fe6 100644 --- a/arch/powerpc/platforms/85xx/qemu_e500.c +++ b/arch/powerpc/platforms/85xx/qemu_e500.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,15 @@ static void __init qemu_e500_setup_arch(void) fsl_pci_assign_primary(); swiotlb_detect_4g(); +#if defined(CONFIG_FSL_PCI) && defined(CONFIG_ZONE_DMA32) + /* + * Inbound windows don't cover the full lower 4 GiB + * due to conflicts with PCICSRBAR and outbound windows, + * so limit the DMA32 zone to 2 GiB, to allow consistent + * allocations to succeed. + */ + limit_zone_pfn(ZONE_DMA32, 1UL << (31 - PAGE_SHIFT)); +#endif mpc85xx_smp_init(); }