Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1199446pxu; Thu, 17 Dec 2020 04:46:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSC7uKsuNEAKDTvb3KpMWeXxNRETyO22xAOVrzRNE5qA5K3BThBLADZnUm8Pwegy0k3LGh X-Received: by 2002:a17:906:94cf:: with SMTP id d15mr7163182ejy.271.1608209170375; Thu, 17 Dec 2020 04:46:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608209170; cv=none; d=google.com; s=arc-20160816; b=ERjA1Ckewrr+ga7Y2gCKPFLaVNyVdtB3tq+tp+eSy58qVlXN9YWffcPbl2tpJnyHus l+w4TMRjcu1jQNhzHlYPnHwV6UeJuu55HQpKF4UGJYn+Sy9DS3drslAHT3RD0J93xukJ HXbeHEZB4V7fQmypv3gOI5UNW98DgneOPCkM2cC8DUFhTTAQBYhy6sLXbHZehkeW30YP CSqI33Zl873J7g2/Z20jnAY33uTRPdw8mkpx5aq6qmrAFsGICuAasg8Kxj2fmJXyJzMi Ydt1U+IsDZxQpD1VMY/XKeQw1f+A4eKx8KWqoc7A3BxTlWlHuSvwAcweUhn/agUIkRwo An9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=/0BO9/+iX+oeezcJ5Pt/8quRa/8uFWA/ECFPyl3U7ho=; b=LbFcpjQNu4IjtQlr0EPDCE5vnkxvIfgQJt0cFhFuEDH/Sjh13oS6LO0svNzFmhzeHH aGFClRm3k6yiAlRf0Psh/FeT9cuAuhyVSxatV+pxK7LR4tisGRcjxxDWzdgFlQvTWYLG x3VEgEXsM1q9oJaaCwHsJI+oP9FV3nWOvw6RGiDWIqze2hpR6oytqefv38pKR6765fE/ lgrPL5i844S+k4ws0xoEdXdG+EIGeVvGyHkb4/iedwNIWqObIzB1KXSPSMMEgNITzYKR 0M6dYsbC1zf85ZDSu/A4byi8Xrq0i7/CCoB2Yh+nklLMxbjUmY3BppYrWJu4yV3LSU46 QUXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si2335888ejj.549.2020.12.17.04.45.47; Thu, 17 Dec 2020 04:46:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728081AbgLQMoI (ORCPT + 99 others); Thu, 17 Dec 2020 07:44:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:40834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbgLQMoI (ORCPT ); Thu, 17 Dec 2020 07:44:08 -0500 Date: Thu, 17 Dec 2020 12:43:23 +0000 From: Catalin Marinas To: Nicolas Saenz Julienne Cc: "Peng Fan (OSS)" , will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: Re: [PATCH] arm64: Kconfig: select ZONE_DMA Message-ID: <20201217124323.GB15336@gaia> References: <20201217080802.29023-1-peng.fan@oss.nxp.com> <93832374535cb46419e921f5ee02ecabfe2cc83d.camel@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <93832374535cb46419e921f5ee02ecabfe2cc83d.camel@suse.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 17, 2020 at 09:44:31AM +0100, Nicolas Saenz Julienne wrote: > On Thu, 2020-12-17 at 16:08 +0800, Peng Fan (OSS) wrote: > > From: Peng Fan > > > > ZONE_DMA should not be disabled, otherwise arm64_dma_phys_limit is > > left uninitialized and cause swiotlb have IO TLB above 4GB which > > might crash some platforms Actually, arm64_dma_phys_limit would be zero-initialised. The ARCH_LOW_ADDRESS_LIMIT becomes ~0UL, hence it covers the whole address space. > > Signed-off-by: Peng Fan > > --- > > > > Not sure whether need to address code to initialize the variables or > > force select ZONE_DMA > > What is the cause for the swiotlb related crashes? I assume it's DMA into an > address too high for the bus, but it might be something else. I think that's the case, swiotlb is not within the low 32-bit of the address space. > I figure you have a setup with ZONE_DMA32, ZONE_NORMAL and !ZONE_DMA. > > First of all, I'd suggest you try arm64's defaults (all zones enabled), the > series I mention above should fix most of the issues we've had with > ZONE_DMA/ZONE_DMA32 in the past. We now parse DT/ACPI and only create two > distinct DMA zones if really needed. Otherwise ZONE_DMA spans the whole 32 bit > address space. > > That said, IMO we're not doing the right thing in the !ZONE_DMA && ZONE_DMA32 > case, and this should fix it (I didn't test it): > > - #define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit - 1) > + #define ARCH_LOW_ADDRESS_LIMIT (arm64_dma_phys_limit ? : arm64_dma32_phys_limit) Does this limit need to be inclusive? -- Catalin