From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71AA3C00528 for ; Tue, 1 Aug 2023 17:04:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQsmg-0005Lk-4j; Tue, 01 Aug 2023 13:03:46 -0400 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 1qQsmd-0005LW-SS; Tue, 01 Aug 2023 13:03:44 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQsmb-0000wW-W1; Tue, 01 Aug 2023 13:03:43 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1b8ad8383faso50295595ad.0; Tue, 01 Aug 2023 10:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690909419; x=1691514219; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:sender :from:to:cc:subject:date:message-id:reply-to; bh=nwjHOD/bDcTVCu/4XOe7iUE4KjdIb5EAC6hcQ6ZVkvk=; b=V5LHnRGwtJbcQnzA6DzLnYVF8fw2vvyrEO60yHsuIjcPqKn3d0OWdSUMEwGGBHDESh GGbkVBSYvXqRGYnGq16JUML9XvEogNijPmvXw2U/ReznwTxj5r5ljdYq6mUi5m9cdEVV FohzrAbrk2Diq8e+ouW/VoPV/hrj5WJKNkuZNnD+VaoZj9DWXNJGcWLI3KRtZjI11+ja chw22SW9JRyDbZzhXtKNckZUD7w4X3pSDXLatTeskAvUEOKKAk5EYVFesl6repnyGZMM y2v+O1TptgkkvopQ/HPwxWtoCy+scTdLfWOZe43DyEwCpuhL8IK2WgscSt1TyfXtbDrm TpQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690909419; x=1691514219; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nwjHOD/bDcTVCu/4XOe7iUE4KjdIb5EAC6hcQ6ZVkvk=; b=eAxmOhgJyt1H/eB/5sft5PIvSKNt0RaXIXSwFyriQDhZsfSTA0KkfF0HYHKsMnAbpp 4AeK5zegKhu8Uiw4THcZ5w6miswbMZ4j9COgksAHRgMvC9d3heIsXyuOjTNo/D+eQk5I oaoOXqcxrQkwQggOtJYu9OzN+G8bNWd8yR273BRUCc2bgk8ZfQMxE7K7obZLtABXqvqc 5RgLFci9HZmQkFQ12iXDP60Z+Se+bbYVa5eum9iB1W87MLS7VriYLL19sFbQP4NCrX0Z 96ZiuXUV512aVi4tdltg0ESb0mstA6lG+8QhCHwTZ/7GtiXVRNA4eNS4UDwhlb+20qu3 0hbQ== X-Gm-Message-State: ABy/qLbjhRsk9jKoReqWpV+dNdv2qo80Aj1ZPihr9QYU81sJMR/Zh4c+ O+VzPu8Vd8PACa2UEEjoIgU= X-Google-Smtp-Source: APBJJlFO3X8TXmLbq69bLnmVWkIIbRa4ypcX41UTW+s83odQ3Znqy36hirW83jf9vwfpvVWFycyeUg== X-Received: by 2002:a17:902:ce86:b0:1b6:797d:33fb with SMTP id f6-20020a170902ce8600b001b6797d33fbmr14716501plg.64.1690909418940; Tue, 01 Aug 2023 10:03:38 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id iw12-20020a170903044c00b001bbbc655ca1sm10740957plb.219.2023.08.01.10.03.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Aug 2023 10:03:38 -0700 (PDT) Message-ID: <33601690-df21-55ec-bc61-c720e8861aa4@roeck-us.net> Date: Tue, 1 Aug 2023 10:03:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Peter Maydell Cc: qianfanguijin@163.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org, Strahinja Jankovic , Beniamino Galvani , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Niek Linnenbank References: <20230523100508.32564-1-qianfanguijin@163.com> <20230523100508.32564-2-qianfanguijin@163.com> <41e71eae-72ad-410d-9cd8-cc495c06dac4@roeck-us.net> <2044dc69-93de-d855-fe44-ee6f3ab3576b@roeck-us.net> <01087628-44c0-2b15-61bc-8677b7d1b459@roeck-us.net> From: Guenter Roeck Subject: Re: [PATCH v5 01/11] hw: arm: Add bananapi M2-Ultra and allwinner-r40 support In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=groeck7@gmail.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.092, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 8/1/23 09:01, Peter Maydell wrote: > On Sat, 24 Jun 2023 at 16:02, Guenter Roeck wrote: >> >> On 6/24/23 07:23, Guenter Roeck wrote: >>> On 6/24/23 03:40, Peter Maydell wrote: >>>> On Fri, 23 Jun 2023 at 20:33, Guenter Roeck wrote: >>>>> >>>>> On 6/23/23 10:44, Peter Maydell wrote: >>>>>> On Sat, 17 Jun 2023 at 17:29, Guenter Roeck wrote: >>>>>>> Main problem is that the SD card gets instantiated randomly to >>>>>>> mmc0, mmc1, or mmc2, making it all but impossible to specify a >>>>>>> root file system device. The non-instantiated cards are always >>>>>>> reported as non-removable, including mmc0. Example: >>>>>>> >>>>>>> mmc0: Failed to initialize a non-removable card >>>>>> >>>>>> Do you mean that QEMU randomly connects the SD card to >>>>>> a different MMC controller each time, or that Linux is >>>>>> randomly assigning mmc0 to a different MMC controller each >>>>>> time ? >>>>>> >>>>> >>>>> Good question. Given the workaround (fix ?) I suggested is >>>>> in the devicetree file, I would assume it is the latter. I suspect >>>>> that Linux assigns drive names based on hardware detection order, >>>>> and that this is not deterministic for some reason. It is odd >>>>> because I have never experienced that with any other emulation. >>>> >>>> Yeah, I don't really understand why it would be non-deterministic. >>>> But it does make it sound like the right thing is for the >>>> device tree file to explicitly say which MMC controller is >>>> which -- presumably you might get unlucky with the timing >>>> on real hardware too. >>>> >>> >>> Agreed, only someone with real hardware would have to confirm >>> that this is the case. >>> >> >> Actually, the reason is quite simple. In the Linux kernel: >> >> static struct platform_driver sunxi_mmc_driver = { >> .driver = { >> .name = "sunxi-mmc", >> .probe_type = PROBE_PREFER_ASYNCHRONOUS, >> ^^^^^^^^^^^^^^^^^^^^^^^^^ >> .of_match_table = sunxi_mmc_of_match, >> .pm = &sunxi_mmc_pm_ops, >> }, >> .probe = sunxi_mmc_probe, >> .remove = sunxi_mmc_remove, >> }; >> >> All mmc devices instantiate at the same time, thus the >> device name association is random. If I drop the probe_type >> assignment, it becomes deterministic. >> >> On top of that, Linux does know which drives are removable >> from the devicetree file. However, since probe order is >> random, the assignment of the one removable drive to device >> names is random. Sometimes mmc0 shows up as removable, >> sometimes it is mmc1 or mmc2. >> >> So my conclusion is that qemu isn't doing anything wrong, >> it is all happening in the Linux kernel. > > Hi Guenter -- do you know if this "random MMC controller" > issue has been fixed in Linux ? If so, we might be able > to update our test case image to avoid the slightly ugly > "root=b300" workaround at some point. > No, it has not been fixed, or at least there is nothing in linux-next. I don't have real hardware, so I am not in a position to submit, much less test, a patch on it. Someone had mentioned that real hardware would handle the problem in initramfs. That seems wrong to me, but it is what it is. I changed my own test to use the "root=b300" hack. That seems highly kludgy, but at least it works. Guenter