Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1587986pxu; Thu, 8 Oct 2020 15:52:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVaaHqO+cmLakxra2DWwpJJHWHu424H+mRs7Zsc4dlx5qztceYyr7WW9upyyZU7MOZEa16 X-Received: by 2002:a17:906:1c0f:: with SMTP id k15mr10871306ejg.343.1602197542499; Thu, 08 Oct 2020 15:52:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602197542; cv=none; d=google.com; s=arc-20160816; b=Jvz3VAkhZFBSAQG5xjqadixKpXD0mBFy29wMh7M12Qk6WzKl/pznFLy6bAI/ydIS95 cL3g1CgeFNZMsMMUWLjXqEnhPERTFY++3rMxoWwRC1jjkcMaRWtXL8m8ESKtS6kLNjXa 4l86WKbjYUqI64eydpGu3upng6LwkEZgLHN7bILp28FeZNxQaM/NHNXyQabnCTeBa7+h 0DAoAuuff9Jr3qH9B8ERNbfqx8ZKthB1TSn4dplYEdhd8hsKpKWQwyfYoCvAZt/qI8KO fV+kPlLpOQKGjlUECS/S6D947MSsFaKTJXnZcBaHxVy8fknNN82uNjX/8wTuDREszj/X uH8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=44Fps/ylLDjE0MQZwORtqNTquXcwD8X18rjyjtLmG7U=; b=qS99pHazJaIsIBgvONjdSpgWvSqye3skbdRgIKpvD4PWisYBvktVT9zjl0WjnUJipL AOT+hoA9BgxNoibIHu5oc1BshbmzHPTNHY0BTs2qCFA9vVnMWSqWvQxqhMi4+/3mRpX7 bHDQNzxHc/+hdBSYeu9AzHAOiL9AFWCnPnEYKARjPr5syoaYzxSVa6yl1yuxZhygFIWQ c5sHW3JXBaMDGnS7t9T5jgEncDrLKAiXjN6ARAuhxmRGSUhffmmEjEoCKn601KF3MzrB lyRkckGVIXBWaB1He1idKM6fpFMBlmrk2zlEvX0E2t0gQfoqwNLO+Fudkvf4KRKGsIN9 3SPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IgDpgsIS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si4408624ejh.159.2020.10.08.15.51.37; Thu, 08 Oct 2020 15:52:22 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=IgDpgsIS; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbgJHTnb (ORCPT + 99 others); Thu, 8 Oct 2020 15:43:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:34504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725616AbgJHTnb (ORCPT ); Thu, 8 Oct 2020 15:43:31 -0400 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 23BF622202; Thu, 8 Oct 2020 19:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602186210; bh=abWUHRGLWMGmX/Tv6KKz6D0f3Jzr7DwwCLBGA7BTaK8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IgDpgsISz/i/U6v23X6I0LY3rtH1P6r4x4kEd+A/bMj9jQK5p8HbFb8pktCVq8ZHq Y+AWR2mZYCgGiXPou9EwU1cXkNg8Jl/HBTvar4UnXrVth71btDMQb8i8Y4HlMopcKx m/T1/icTQfdMN6jfMNyvxig3wbmzxxgbffR6vWyE= Received: by mail-ot1-f41.google.com with SMTP id q21so6677681ota.8; Thu, 08 Oct 2020 12:43:30 -0700 (PDT) X-Gm-Message-State: AOAM532Ge1L6Df+qzRLWP1aFEbABsdBfI33eSOyVOXerpqB263I5cvd8 YaNwcfHFJe0Wn/eV+Q8SYEIWAhNiw68kn0ehazA= X-Received: by 2002:a9d:6a85:: with SMTP id l5mr6658185otq.77.1602186209247; Thu, 08 Oct 2020 12:43:29 -0700 (PDT) MIME-Version: 1.0 References: <20201001161740.29064-1-nsaenzjulienne@suse.de> <20201001161740.29064-2-nsaenzjulienne@suse.de> <20201001171500.GN21544@gaia> <20201001172320.GQ21544@gaia> <20201002115541.GC7034@gaia> <12f33d487eabd626db4c07ded5a1447795eed355.camel@suse.de> <20201008101353.GE7661@gaia> In-Reply-To: <20201008101353.GE7661@gaia> From: Ard Biesheuvel Date: Thu, 8 Oct 2020 21:43:18 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711 To: Catalin Marinas , Lorenzo Pieralisi Cc: Nicolas Saenz Julienne , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Frank Rowand , Linux Kernel Mailing List , Linux Memory Management List , iommu@lists.linux-foundation.org, Rob Herring , linux-rpi-kernel@lists.infradead.org, Will Deacon , Christoph Hellwig , Linux ARM , Robin Murphy Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (+ Lorenzo) On Thu, 8 Oct 2020 at 12:14, Catalin Marinas wrote: > > On Thu, Oct 08, 2020 at 12:05:25PM +0200, Nicolas Saenz Julienne wrote: > > On Fri, 2020-10-02 at 12:55 +0100, Catalin Marinas wrote: > > > On Thu, Oct 01, 2020 at 07:31:19PM +0200, Nicolas Saenz Julienne wrote: > > > > On Thu, 2020-10-01 at 18:23 +0100, Catalin Marinas wrote: > > > > > On Thu, Oct 01, 2020 at 06:15:01PM +0100, Catalin Marinas wrote: > > > > > > On Thu, Oct 01, 2020 at 06:17:37PM +0200, Nicolas Saenz Julienne wrote: > > > > > > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > > > > > > > index 4602e467ca8b..cd0d115ef329 100644 > > > > > > > --- a/drivers/of/fdt.c > > > > > > > +++ b/drivers/of/fdt.c > > > > > > > @@ -25,6 +25,7 @@ > > > > > > > #include > > > > > > > #include > > > > > > > #include > > > > > > > +#include /* for zone_dma_bits */ > > > > > > > > > > > > > > #include /* for COMMAND_LINE_SIZE */ > > > > > > > #include > > > > > > > @@ -1198,6 +1199,14 @@ void __init early_init_dt_scan_nodes(void) > > > > > > > of_scan_flat_dt(early_init_dt_scan_memory, NULL); > > > > > > > } > > > > > > > > > > > > > > +void __init early_init_dt_update_zone_dma_bits(void) > > > > > > > +{ > > > > > > > + unsigned long dt_root = of_get_flat_dt_root(); > > > > > > > + > > > > > > > + if (of_flat_dt_is_compatible(dt_root, "brcm,bcm2711")) > > > > > > > + zone_dma_bits = 30; > > > > > > > +} > > > > > > > > > > > > I think we could keep this entirely in the arm64 setup_machine_fdt() and > > > > > > not pollute the core code with RPi4-specific code. > > > > > > > > > > Actually, even better, could we not move the check to > > > > > arm64_memblock_init() when we initialise zone_dma_bits? > > > > > > > > I did it this way as I vaguely remembered Rob saying he wanted to centralise > > > > all early boot fdt code in one place. But I'll be happy to move it there. > > > > > > I can see Rob replied and I'm fine if that's his preference. However, > > > what I don't particularly like is that in the arm64 code, if > > > zone_dma_bits == 24, we set it to 32 assuming that it wasn't touched by > > > the early_init_dt_update_zone_dma_bits(). What if at some point we'll > > > get a platform that actually needs 24 here (I truly hope not, but just > > > the principle of relying on magic values)? > > > > > > So rather than guessing, I'd prefer if the arch code can override > > > ZONE_DMA_BITS_DEFAULT. Then, in arm64, we'll just set it to 32 and no > > > need to explicitly touch the zone_dma_bits variable. > > > > Yes, sonds like the way to go. TBH I wasn't happy with that solution either, > > but couldn't think of a nicer alternative. > > > > Sadly I just realised that the series is incomplete, we have RPi4 users that > > want to boot unsing ACPI, and this series would break things for them. I'll > > have a word with them to see what we can do for their use-case. > > Is there a way to get some SoC information from ACPI? > This is unfortunate. We used ACPI _DMA methods as they were designed to communicate the DMA limit of the XHCI controller to the OS. It shouldn't be too hard to match the OEM id field in the DSDT, and switch to the smaller mask. But it sucks to have to add a quirk like that.