Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EA12C4338F for ; Mon, 2 Aug 2021 22:47:02 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5AEF60C3F for ; Mon, 2 Aug 2021 22:47:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A5AEF60C3F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7C7B182DDB; Tue, 3 Aug 2021 00:46:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="V8iolb+L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 35CE8833FB; Tue, 3 Aug 2021 00:46:57 +0200 (CEST) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 54A9882DDB for ; Tue, 3 Aug 2021 00:46:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x72f.google.com with SMTP id 184so18268217qkh.1 for ; Mon, 02 Aug 2021 15:46:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Bh0+E/KDSvJTkBdsAO4Aet1I7MwCEJmUYROKM4/CtjI=; b=V8iolb+LlgjdEjSW+BKP83xCVZqbPLB3Km/h6hMxZqvivgCuY8/r2qchTxnN45095W UFS5Sgt94mZVJUolapVy+C+DJf8f+p9h6/89130fXRmbANmEey0RiBpsBrF/yZk/IxG8 aQFDYzntbWhTHpTmm7vu8fkEF9LnDQXsBSTZ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Bh0+E/KDSvJTkBdsAO4Aet1I7MwCEJmUYROKM4/CtjI=; b=DGo7oNIpnU3n2ndIbtJjhmVxUPAUFkWudr6xhoqNpK7LsI1qoF6nqxp034HnpW1fDS moHMCV9bsM7xYnRnDZzgie9/UvataFp7t9b3D7D00LxtK+YPaU4srwOL9eSNB/yvYIWI FRgPx468fLwnPNgdUsGL/zHupeAq4FWfL8RWTG+Ub13WGCL4zXZDXnsN6+jn6w3yHvOr dCdPsMmVwlox72ZZzMH+oE8GBRVFZsTqcawpI0rPsQM/e2eBgWf0SzEBx91m5f6ND9Fd dl9C0YRZWv422s5kYJT2n7ysdyaEDSuW5akSFPn1H2SDwDXFd6MujJ/Fh0mCsc1g7tho iUrg== X-Gm-Message-State: AOAM530jhYn+5cjkS3h+qW3snCN3vZeEXoUAsm1miXG9Q22LqkRGPWdB CH3MfKI707sQHn9MVQHU3Noj1A== X-Google-Smtp-Source: ABdhPJwbuHiF8DS9BqpfGptNgYXreNFeXXgMPmHdDFcRkxGx9+HbhgZmvz1B8zsDO997ktpRUFb2kg== X-Received: by 2002:a37:847:: with SMTP id 68mr18193857qki.112.1627944411957; Mon, 02 Aug 2021 15:46:51 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-a0a3-ef76-0712-405d.res6.spectrum.com. [2603:6081:7b01:cbda:a0a3:ef76:712:405d]) by smtp.gmail.com with ESMTPSA id g11sm5234891qtk.91.2021.08.02.15.46.50 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Aug 2021 15:46:50 -0700 (PDT) Date: Mon, 2 Aug 2021 18:46:48 -0400 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Simon Glass , Stefan Roese , Masami Hiramatsu , Frank Wunderlich , Marek =?iso-8859-1?Q?Beh=FAn?= , U-Boot Mailing List Subject: Re: Broken CONFIG_SPL_SATA_SUPPORT=y Message-ID: <20210802224648.GO9379@bill-the-cat> References: <20210802210903.y4oufo37jidvt6qq@pali> <20210802211806.segctj325v5argwj@pali> <20210802212554.knnm6ndingwooz5k@pali> <20210802214322.GJ9379@bill-the-cat> <20210802215658.vcdxtx6u7tfsi3od@pali> <20210802221120.GM9379@bill-the-cat> <20210802223819.2xh6i6n5d7sxispl@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="iGvdQK0pHbYpJKBM" Content-Disposition: inline In-Reply-To: <20210802223819.2xh6i6n5d7sxispl@pali> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --iGvdQK0pHbYpJKBM Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 03, 2021 at 12:38:19AM +0200, Pali Roh=E1r wrote: > On Monday 02 August 2021 18:11:20 Tom Rini wrote: > > On Mon, Aug 02, 2021 at 11:56:58PM +0200, Pali Roh=E1r wrote: > > > On Monday 02 August 2021 17:43:22 Tom Rini wrote: > > > > On Mon, Aug 02, 2021 at 03:30:20PM -0600, Simon Glass wrote: > > > > > Hi Pali, > > > > >=20 > > > > > On Mon, 2 Aug 2021 at 15:26, Pali Roh=E1r wrote= :> > > > > > > On Monday 02 August 2021 15:23:22 Simon Glass wrote: > > > > > > > () Hi Pali, > > > > > > > > > > > > > > On Mon, 2 Aug 2021 at 15:18, Pali Roh=E1r w= rote: > > > > > > > > > > > > > > > > On Monday 02 August 2021 15:14:30 Simon Glass wrote: > > > > > > > > > Hi Pali, > > > > > > > > > > > > > > > > > > On Mon, 2 Aug 2021 at 15:09, Pali Roh=E1r wrote: > > > > > > > > > > > > > > > > > > > > On Monday 02 August 2021 16:55:34 Tom Rini wrote: > > > > > > > > > > > On Sun, Aug 01, 2021 at 02:25:16PM +0200, Pali Roh=E1= r wrote: > > > > > > > > > > > > > > > > > > > > > > > Hello! > > > > > > > > > > > > > > > > > > > > > > > > Option CONFIG_SPL_SATA_SUPPORT=3Dy is currently bro= ken in u-boot master > > > > > > > > > > > > branch. If I try to enable it for A38x platform I'm= getting following > > > > > > > > > > > > compiler error: > > > > > > > > > > > > > > > > > > > > > > > > LD spl/u-boot-spl > > > > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci.o: i= n function `ahci_probe_scsi_pci': > > > > > > > > > > > > drivers/ata/ahci.c:1205: undefined reference to `= dm_pci_map_bar' > > > > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci.c:12= 15: undefined reference to `dm_pci_read_config16' > > > > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci.c:12= 16: undefined reference to `dm_pci_read_config16' > > > > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci.c:12= 20: undefined reference to `dm_pci_map_bar' > > > > > > > > > > > > make[1]: *** [scripts/Makefile.spl:512: spl/u-boo= t-spl] Error 1 > > > > > > > > > > > > make: *** [Makefile:1977: spl/u-boot-spl] Error 2 > > > > > > > > > > > > > > > > > > > > > > > > You can reproduce it by running following commands: > > > > > > > > > > > > > > > > > > > > > > > > $ make turris_omnia_defconfig > > > > > > > > > > > > $ echo CONFIG_SPL_SATA_SUPPORT=3Dy >> .config > > > > > > > > > > > > $ make CROSS_COMPILE=3Darm-linux-gnueabihf- > > > > > > > > > > > > > > > > > > > > > > > > I workaround it by following patch: > > > > > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c > > > > > > > > > > > > index d4047c04f5d0..6bad72e4cfa4 100644 > > > > > > > > > > > > --- a/drivers/ata/ahci.c > > > > > > > > > > > > +++ b/drivers/ata/ahci.c > > > > > > > > > > > > @@ -1196,7 +1196,7 @@ int ahci_probe_scsi(struct ud= evice *ahci_dev, ulong base) > > > > > > > > > > > > return 0; > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > -#ifdef CONFIG_DM_PCI > > > > > > > > > > > > +#if CONFIG_IS_ENABLED(DM_PCI) > > > > > > > > > > > > int ahci_probe_scsi_pci(struct udevice *ahci_dev) > > > > > > > > > > > > { > > > > > > > > > > > > ulong base; > > > > > > > > > > > > > > > > > > > > > > > > It fixed this particular problem. So it looks like = that CONFIG_DM_PCI is > > > > > > > > > > > > defined also when building SPL even when it is not = enabled for SPL. > > > > > > > > > > > > Whole PCI is disabled in SPL. > > > > > > > > > > > > > > > > > > > > > > > > But then I got another compile error: > > > > > > > > > > > > > > > > > > > > > > > > LD spl/u-boot-spl > > > > > > > > > > > > arm-linux-gnueabihf-ld.bfd: drivers/ata/ahci-pci.= o: in function `ahci_pci_probe': > > > > > > > > > > > > drivers/ata/ahci-pci.c:21: undefined reference to= `ahci_probe_scsi_pci' > > > > > > > > > > > > make[1]: *** [scripts/Makefile.spl:512: spl/u-boo= t-spl] Error 1 > > > > > > > > > > > > make: *** [Makefile:1977: spl/u-boot-spl] Error 2 > > > > > > > > > > > > > > > > > > > > > > > > Seems that u-boot is trying to compile and link ahc= i-pci.o into SPL > > > > > > > > > > > > binary even when it is not enabled nor used. PCI is= completed disabled > > > > > > > > > > > > in SPL for this case. > > > > > > > > > > > > > > > > > > > > > > > > I workaround it by putting whole ahci-pci.c file in= to one big #idef: > > > > > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/ata/ahci-pci.c b/drivers/ata/a= hci-pci.c > > > > > > > > > > > > index b1d231e0f9e1..34afebd2f87f 100644 > > > > > > > > > > > > --- a/drivers/ata/ahci-pci.c > > > > > > > > > > > > +++ b/drivers/ata/ahci-pci.c > > > > > > > > > > > > @@ -9,6 +9,8 @@ > > > > > > > > > > > > #include > > > > > > > > > > > > #include > > > > > > > > > > > > > > > > > > > > > > > > +#if CONFIG_IS_ENABLED(DM_PCI) > > > > > > > > > > > > + > > > > > > > > > > > > static int ahci_pci_bind(struct udevice *dev) > > > > > > > > > > > > { > > > > > > > > > > > > struct udevice *scsi_dev; > > > > > > > > > > > > @@ -42,3 +44,5 @@ static struct pci_device_id ahci_= pci_supported[] =3D { > > > > > > > > > > > > }; > > > > > > > > > > > > > > > > > > > > > > > > U_BOOT_PCI_DEVICE(ahci_pci, ahci_pci_supported); > > > > > > > > > > > > + > > > > > > > > > > > > +#endif > > > > > > > > > > > > > > > > > > > > > > > > And then finally U-Boot produced final target image= u-boot-spl.kwb: > > > > > > > > > > > > > > > > > > > > > > > > LD spl/u-boot-spl > > > > > > > > > > > > OBJCOPY spl/u-boot-spl-nodtb.bin > > > > > > > > > > > > SYM spl/u-boot-spl.sym > > > > > > > > > > > > CAT spl/u-boot-spl-dtb.bin > > > > > > > > > > > > COPY spl/u-boot-spl.bin > > > > > > > > > > > > MKIMAGE u-boot-spl.kwb > > > > > > > > > > > > > > > > > > > > > > > > So this looks like a bug in Kconfig or Makefile dep= endences that build > > > > > > > > > > > > system is trying to compile and link also files whi= ch should not be > > > > > > > > > > > > linked at all. > > > > > > > > > > > > > > > > > > > > > > Yes, it's a missing dependency in Kconfig. You need = to enable SPL_DM > > > > > > > > > > > and then quite possibly SPL_OF_CONTROL (I forget if t= hat was a hard > > > > > > > > > > > dependency on the main conversion or not) on the plat= form. > > > > > > > > > > > > > > > > > > > > CONFIG_SPL_DM=3Dy is already enabled > > > > > > > > > > > > > > > > > > CONFIG_SPL_PCI ? > > > > > > > > > > > > > > > > > > It seems that pci-uclass.c is not being built for SPL. > > > > > > > > > > > > > > > > CONFIG_SPL_PCI is not enabled. > > > > > > > > > > > > > > > > But why should be CONFIG_SPL_PCI needed for SATA? As above = my patches > > > > > > > > show no PCI is required for SATA... > > > > > > > > > > > > > > I suggest investigating what is calling those functions you m= ention... > > > > > > > > > > > > > > If you look at ahci_probe_scsi_pci() it is bracketed by: > > > > > > > > > > > > > > #ifdef CONFIG_DM_PCI > > > > > > > > > > > > > > Perhaps it should be: > > > > > > > > > > > > > > #if CONFIG_IS_ENABLED(DM_PCI) > > > > > > > > > > > > > > so it takes account of SPL? > > > > > > > > > > > > And this is exactly what I did in first patch attempt. > > > > >=20 > > > > > Then how about changing the Makefile rule to: > > > > >=20 > > > > > obj-$(CONFIG_$(SPL_TPL_)AHCI_PCI) +=3D ahci-pci.o > > > >=20 > > > > But there is no SPL_AHCI_PCI nor TPL_AHCI_PCI. I really want to kn= ow in > > > > addition to how SATA is hooked up on this board what the expected t= ruth > > > > table of U-Boot and SPL CONFIG options is expected to be. > > >=20 > > > What do you mean by hooked? SATA support on A38x is provided by stand= ard > > > AHCI interface implemented by ahci_mvebu.c driver (CONFIG_AHCI_MVEBU). > > > No PCIe is involved. > >=20 > > OK, so why are you building drivers/ata/ahci-pci.c at all? >=20 > ahci-pci is enabled for proper U-Boot. It is driver for PCIe add-in > cards which speak AHCI protocol. You can e.g. insert SATA-based SSD disk > into e.g. mPCIe form-factor AHCI card and then this mPCIe card you can > insert into mPCIe slot on the board. >=20 > Obviously you cannot load U-Boot from this SSD disk (as bootrom does not > support it) but you can boot Linux kernel and whole Linux system from > this disk via proper U-Boot (not SPL), if you enable this driver in > U-Boot. >=20 > So for this kind of usage, it makes sense to enable also driver for > AHCI_PCI in proper U-Boot (not SPL). OK, thanks, that does help. > > Should you > > be enabling SCSI_AHCI_PLAT like the armada 37xx and 8k platforms are? >=20 > But this is something totally different, not? Not exactly, no. This shows one of the valid criticism of having both SPL and U-Boot (or TPL and SPL and U-Boot) build from a single config file. If you had that option enabled, none of the SPL build part would try and do PCI things. But if you had that enabled, full U-Boot would then fail to do PCI disks. > > > But I think this is not board neither platform specific, but general = SPL > > > U-Boot issue. As I mentioned in the first email, U-Boot build system = is > > > trying to compile and link files into SPL which should not and which = are > > > not enabled in config at all. More precisely, build system is trying = to > > > link into SPL binary functions from AHCI_PCI even when PCI is not > > > enabled in SPL. PCI is enabled only in proper U-Boot. > > >=20 > > > So this looks like a broken dependency either in Makefile or Kconfig, > > > but I really do not know where nor why it happens. > >=20 > > It's a combination of a lack combination testing really. > >=20 > > > AHCI_PCI depends on PCI and AHCI. AHCI_MVEBU depends only on AHCI. So > > > when PCI is not enabled in SPL then also AHCI_PCI must not be enabled= in > > > SPL. But AHCI still can be enabled in SPL even when AHCI_PCI is > > > disabled. Therefore also AHCI_MVEBU can be enabled in SPL when PCI is > > > disabled in SPL. > >=20 > > Why would you be enabling AHCI_PCI and not enabling PCI? Or, what > > functionality would you be using in that case? >=20 > Seems that there is some kind of misunderstanding. Yes, but I think I see it now. > Enabling AHCI_PCI without PCI should not be possible and should be > disallowed. I'm not trying to enable such combination, I'm trying to > show you that build system somehow enabled this nonsense combination. Or > for some unknown reason it is trying to use AHCI_PCI in SPL when PCI is > not enabled in SPL. And I really do not know what is happening here. >=20 > My guess is that there is some mix of SPL and non-SPL symbol > dependences. Build system sees that PCI is enabled for proper U-Boot and > this information somehow propagates into SPL and build system "force" > linking of AHCI_PCI into SPL even no PCI is enabled for SPL. And also > even when there is no AHCI_PCI config for SPL. Right, so as you guess, there's a mix of SPL and non-SPL symbols, because we don't have SPL symbols for everything, and haven't needed to duplicate any of them for PCI or SATA until now. > So what I need to achieve: > * enable AHCI_MVEBU in both proper U-Boot and SPL > * enable PCI and AHCI_PCI in proper U-Boot > * disable PCI and AHCI_PCI in SPL > * make dependences between these options and SPL combination correctly > defined, so it would not be possible to enable nonsense combination Can you not just enable PCI and AHCI_PCI within SPL too? Just because ROM doesn't support it doesn't mean SPL cannot. Or do you not have the room in the binary? If you don't then yes, a number of symbols need to be duplicated to have SPL_FOO options, and code updated to use CONFIG_IS_ENABLED(FOO). --=20 Tom --iGvdQK0pHbYpJKBM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmEIddIACgkQFHw5/5Y0 tywu3Av/fsLvLj+ukzovRS5ZxpBKRTUmV96s8Hzar7ZC5v3jiV4Eea+3zIAnb0Ea jp/aLd+C8Rvd2HGINWhLBTvW9XAOnNA3Y3cHzxUD+7BGtREEe5eqeIBhLP1weayw PZMC/lqJc1S/V/bLW44/OtK25rCMgwBcv6wnJJ5thnDtbIJKM8hxztneAPZIU+Il dXYwBYyak7uD6AktjBjF/nj6p7AcTQeq9nxOVy5+Qd2DRcaB7jeuSNWzEg0A1c+q GVOEyA/z1wG5Yu2TB6wm0dN4iyGqHtgT5aqMdD8Bxo3A4e7PYAvTGaSTLBX0gdp3 xORX9EzuWHhCxNRAuZhzR8FC9zrE/64pS563aApI4LsARpUj3BW30Zy0XO8ZTPN5 Q2VhSyiUfXcWl441hw3qlCjKsyNxbgCN8yGgePrcd+p+cP72/+FisBT/554zIJL5 aqRIcAhzAw2pDigiB8bKjm+HLmW7Aslzpwa+zglRVube+i1EIaOgFTYtpcgQe6Qo o+rkBoq3 =PyCu -----END PGP SIGNATURE----- --iGvdQK0pHbYpJKBM--