From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pRw7m-0001q3-II for mharc-grub-devel@gnu.org; Tue, 14 Feb 2023 09:17:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRw7l-0001pG-38 for grub-devel@gnu.org; Tue, 14 Feb 2023 09:17:37 -0500 Received: from dibed.net-space.pl ([84.10.22.86]) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_3DES_EDE_CBC_SHA1:192) (Exim 4.90_1) (envelope-from ) id 1pRw7j-0005Ks-HA for grub-devel@gnu.org; Tue, 14 Feb 2023 09:17:36 -0500 Received: from router-fw.i.net-space.pl ([192.168.52.1]:40870 "EHLO tomti.i.net-space.pl") by router-fw-old.i.net-space.pl with ESMTP id S2176095AbjBNNtq (ORCPT ); Tue, 14 Feb 2023 14:49:46 +0100 X-Comment: RFC 2476 MSA function at dibed.net-space.pl logged sender identity as: dkiper Date: Tue, 14 Feb 2023 14:49:43 +0100 From: Daniel Kiper To: Benjamin Herrenschmidt Cc: Peter Zijlstra , grub-devel@gnu.org, development@efficientek.com Subject: Re: [PATCH v2 2/3] term/serial: Add support for PCI serial devices Message-ID: <20230214134943.dqqguutswpqhf2r5@tomti.i.net-space.pl> References: <20220826110142.966628595@alderlake.programming.kicks-ass.net> <20220826111358.334758397@alderlake.programming.kicks-ass.net> <20221221125902.jw5kjwmxupeozt3b@tomti.i.net-space.pl> <20230209145220.55gktnrf7oqxvewj@tomti.i.net-space.pl> <9fa9b340cbbe7fdd4911e994068f104cdaa7bf6a.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9fa9b340cbbe7fdd4911e994068f104cdaa7bf6a.camel@kernel.crashing.org> User-Agent: NeoMutt/20170113 (1.7.2) Received-SPF: pass client-ip=84.10.22.86; envelope-from=dkiper@net-space.pl; helo=dibed.net-space.pl X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Feb 2023 14:17:37 -0000 On Mon, Feb 13, 2023 at 08:23:39AM +1100, Benjamin Herrenschmidt wrote: > On Thu, 2023-02-09 at 15:52 +0100, Daniel Kiper wrote: > > Adding another Ben's address... > > Ah ! I saw the previous one before breakfast the other day, and forgot > to reply once properly caffeinated :-) > > > > Ben, you've lived a very long time in !x86 land, can you elucidate us on > > > this? My thinking is that if someone sticks a 16550 on a PCI board, this > > > driver should work on any PCI enabled platform, not just x86, rite? > > > > Ben, here ^^^ is the question for you... > > It's ... complicated :-) > > On most non-x86 platforms you don't have a 1:1 mapping between PCI BAR > value and the corresponding CPU address. Now I think with ACPI and UEFI > there are ways to convert but I don't remember them off the top of my > mind, there are similar ways with Open Firmware or flat device-trees. > But grub doesn't have the infrastructure for that. > > Also non-x86 don't have "IO ports" per se, they are mapped somewhere in > the MMIO address space, and how that is done is very platform specific. > > So at this point it makes sense to leave that x86 only. Once can add > support for other archs/platforms later with the appopriate address > conversion trickery. > > Another issue is that grub doesn't have any form of MMIO abstraction > layer providing things like ordering enforcement (memory barriers) > etc... so doing any kind of direct device access in grub on most non- > x86 is chancy at best. Ben, thank you for explanation. Taking into account above... > --- grub.orig/grub-core/Makefile.core.def > +++ grub/grub-core/Makefile.core.def > @@ -2047,6 +2047,7 @@ module = { > ieee1275 = term/ieee1275/serial.c; > mips_arc = term/arc/serial.c; > efi = term/efi/serial.c; > + pci = term/pci/serial.c; ... I still think this should be "x86 = term/pci/serial.c". Until you push me to leave it as "pci = term/pci/serial.c". However, if you want to do that please bring in good arguments... :-) Daniel