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=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,MSGID_FROM_MTA_HEADER,NICE_REPLY_A,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 9D210C433F5 for ; Mon, 13 Sep 2021 09:31:13 +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 F07CE60D42 for ; Mon, 13 Sep 2021 09:31:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F07CE60D42 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.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 846FE83A40; Mon, 13 Sep 2021 11:31:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=suse.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=suse.com header.i=@suse.com header.b="cmN/AsQY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A76AD83A42; Mon, 13 Sep 2021 11:31:08 +0200 (CEST) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.109.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6F1CF838FE for ; Mon, 13 Sep 2021 11:31:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mbrugger@suse.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1631525464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z4TvxaOi1ZZ2CHXtsRHwphvpsFvsvIMaXtwmLO4ONNM=; b=cmN/AsQYrmeg6pYS4qCSXvAQOzTlgfNL0dnxY+ItLwkYuYFAHg9nd2ArG3N9IqXa7jMi8k fcBjXePB/yuXe94RE2vKOg1+/aZRnThro1dwVDSvR2rlo4ABc34vwVeCyYKbsG585jYbE9 uq3CZm+OLx+pvi3TtFN7O0Yb4CHN/Cc= Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2177.outbound.protection.outlook.com [104.47.17.177]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-21-B1KkNYnyMm2OaMdG3Dmpkw-1; Mon, 13 Sep 2021 11:31:02 +0200 X-MC-Unique: B1KkNYnyMm2OaMdG3Dmpkw-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TtvWxlYZJI3mbrpJB7HyZXQj1rXL8XhLqa1Gak1KgP4co8b92JX6bv2bI0cbyr9uWwCnvJjLwNeAjAEJSRURAirNyhgJNmZz+jVrA1kwEf9x/xme5HF1o8jHdEwDDmRSby1b4VzkwArsWE93+zQvErjGxiXOi5bOKWJmLJvU3O5q1LtqFg7TBZ0DgwVHqK/eCUa3FEZj8EXijaejSrx9xzp6rbyDCmn9Ydfjly6Fcz5+8ZGtNwYc2mYptq15bXdZ3HmoePjPg7D3Elt7zt25yPq009hutFKxaMLGpvnJqT3xOU0ooM3nTmULChoG5196zvZCVOSmbDJqziY4t8liqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Z4TvxaOi1ZZ2CHXtsRHwphvpsFvsvIMaXtwmLO4ONNM=; b=KISXHgtaWhmp2MOQm5TKOquY1Mtv26De7mGVHEsLjD/WH+VBLSgOWQq9xIECtY0TsQCvMuNoh4wG6tSd/SrW4ZyP3pxLFF81St06h8bZrwUvV9GCPGLTccrcuqJUJVf5ukXdw0GB+ymPq9wQKU+QEwodhA79BaDoZDW13ARX1UmAUp/AclJHU2y2xc7aarA9/ruhSPVP7eR78f67rXWIR5gn5eqONZLn0ZjP18s9/uQrFg3ygJ39IHGokqVlbk2BOllokneLZ6HafY3j4JSzZrtCOrXgHA8+i55S6tZjG/FL4CYvH2PjJhpQ0GuLAV1MLDh3rEF40ONRXXxXUje41g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: ARM.com; dkim=none (message not signed) header.d=none;ARM.com; dmarc=none action=none header.from=suse.com; Received: from AM6PR04MB5366.eurprd04.prod.outlook.com (2603:10a6:20b:9d::19) by AS8PR04MB7685.eurprd04.prod.outlook.com (2603:10a6:20b:29c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 09:31:01 +0000 Received: from AM6PR04MB5366.eurprd04.prod.outlook.com ([fe80::e9ae:619b:1fe9:46ce]) by AM6PR04MB5366.eurprd04.prod.outlook.com ([fe80::e9ae:619b:1fe9:46ce%6]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 09:31:01 +0000 Message-ID: Date: Mon, 13 Sep 2021 11:30:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Subject: Re: Bug: qemu_arm64: Cannot access the second flash bank Content-Language: en-US To: Robin Randhawa , "u-boot@lists.denx.de" Cc: "tuomas.tynkkynen@iki.fi" , "sumit.garg@linaro.org" , "peter.maydell@linaro.org" , nd References: <0b369251d75f395bd95e30d4e603414a8ab1ebb3.camel@arm.com> From: Matthias Brugger In-Reply-To: <0b369251d75f395bd95e30d4e603414a8ab1ebb3.camel@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MR2P264CA0022.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1::34) To AM6PR04MB5366.eurprd04.prod.outlook.com (2603:10a6:20b:9d::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.2.177] (206.204.146.29) by MR2P264CA0022.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 09:31:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2dc6e9f-70e8-4260-01c3-08d976993333 X-MS-TrafficTypeDiagnostic: AS8PR04MB7685: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1443; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GARXv3PPWfwwKnfL5fX5Un3EH1AOn0FOS/qr25JWBGqdHl0s0vm1vmSaWUmgqtF3K9RiXL5F2S/UGJH2VJLH+J7wTlyMJWN3T8zWqR/rKgLHY6NfCmEgS2MPR8dvSMhNAN6k0JJUQD1jjvmjPfSGOROjaT7RHJYa3XnIR8bDTpWO+CoH1CxcQ7aVVnvjbi2qXV3VkVEKlDvZmxqo+s4ZMKwQ/OK0kvBAsNbdvTbBLkQTEaXJm07ZX/WO52yBENVxGb6fDidMrKMsY5VIRq1Z/5+kaisOdG44utccdH4XZII5vX0O406LkEbDSZddWVpbsbKXwlA2lOMXOo6AWVW0noM7xrdivH72k1bF82tHy/Jj2jP+fjpbMIAxXdAWFxrcE4gWBsmMPtHpc9FjsiBl9rONP5EJnZHV+g2ohr8VqTdCkTdaOrRhpwdg++mT3Gv+yL7U+QL4IxIOqrxqN7LDuSO22Wlqg0UBtDt8/I20KbQiUVU/LTEglo5qHznYhVSjqC1wX0zrv8n0vPUKJebYLEg5wog69z4XNHxBU8uIZg+MVPcjBRagyk8FcMPs0GeHOnTmpA7AbTzD6Qp63xTQj03vis9kvSnBjUgEsbiZhT7MDUd3rnnn77TE3etRWsD3dPq/7i6NrSSnume/HZB/tO5dUJzcV6UTBcnPxgf2g71eQG4H/24fh2v7B+pSCdT5rFexoLAkheJmleFB4Jr580oQvajUHH6yQ/JukI+D2Zj8kPUOAb/I1KR2V3CPi4IJvTlN3aYtEDz7FjXL1c46sghy9ZC6ivXhnXPzkWBLA+zgW4U8qapYydEYd6z3Uqfl X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5366.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(136003)(376002)(39860400002)(396003)(366004)(66556008)(8676002)(36756003)(8936002)(2906002)(31696002)(66946007)(186003)(66476007)(54906003)(31686004)(956004)(316002)(110136005)(2616005)(478600001)(15650500001)(6486002)(5660300002)(86362001)(16576012)(53546011)(38100700002)(4326008)(966005)(83380400001)(26005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Wkt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-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2dc6e9f-70e8-4260-01c3-08d976993333 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5366.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 09:31:01.2399 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 51FlnNvNrMNJRtooQhAAN+LtSNAWbaWfiLH4u9qhNr2W8DYOEocLCmnr0p2PSN55MXAccBiXb6ISndgOpcNCfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7685 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 Hi Robin, It's a long long time that you reported this issue. I prepared a fix in qemu for it. Would you mind to try it out? You can find a branch with the fix on top here: https://github.com/mbgg/qemu/tree/vrit-flash-dtb-bug Basically I fix the reg property to reflect the fact that the size-cell is one. Please let me know if that fixes the issue for you and I'll send the fix upstream. Regards, Matthias On 01/01/2020 19:20, Robin Randhawa wrote: > Hi folks. > > [CC'ing some hopefully relevant folks]. > > As of: > > commit 0ba41ce1b7816c229cc19e0621148b98f990cb68 > libfdt: return correct value if #size-cells property is not present > > .. accesses to the second flash bank on the qemu_arm64 virtual board > appear broken. > > To demonstrate, consider that the physical memory map for the 2 flash > banks is: > > Bank 1: 0x0000_0000 - 0x03FC_0000 > Bank 2: 0x0400_0000 - 0x7FC0_0000 > > Now, consider the abbreviated output of the flinfo command pre and post > the above commit: > > Pre: > === > > => flinfo > > Bank # 1: CFI conformant flash (32 x 16) Size: 64 MB in 256 Sectors > Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x0018 > Erase timeout: 16384 ms, write timeout: 3 ms > Buffer write timeout: 3 ms, buffer size: 2048 bytes > > Sector Start Addresses: > 00000000 RO 00040000 RO 00080000 RO 000C0000 00100000 > 00140000 00180000 001C0000 00200000 00240000 > . > . > 03E80000 03EC0000 03F00000 03F40000 03F80000 > 03FC0000 > > Bank # 2: CFI conformant flash (32 x 16) Size: 64 MB in 256 Sectors > Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x0018 > Erase timeout: 16384 ms, write timeout: 3 ms > Buffer write timeout: 3 ms, buffer size: 2048 bytes > > Sector Start Addresses: > 04000000 RO 04040000 04080000 040C0000 04100000 > 04140000 04180000 041C0000 04200000 04240000 > . > . > 07E80000 07EC0000 07F00000 07F40000 07F80000 > 07FC0000 > > Post: > ==== > > => flinfo > > Bank # 1: CFI conformant flash (32 x 16) Size: 64 MB in 256 Sectors > Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x0018 > Erase timeout: 16384 ms, write timeout: 3 ms > Buffer write timeout: 3 ms, buffer size: 2048 bytes > > Sector Start Addresses: > 00000000 RO 00040000 RO 00080000 RO 000C0000 00100000 > 00140000 00180000 001C0000 00200000 00240000 > . > . > 03E80000 03EC0000 03F00000 03F40000 03F80000 > 03FC0000 > > Bank # 2: CFI conformant flash (32 x 16) Size: 64 MB in 256 Sectors > Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x0018 > Erase timeout: 16384 ms, write timeout: 3 ms > Buffer write timeout: 3 ms, buffer size: 2048 bytes > > Sector Start Addresses: > 400000000000000 400000000040000 400000000080000 4000000000C0000 400000000100000 > 400000000140000 400000000180000 4000000001C0000 400000000200000 400000000240000 > . > . > > 400000003E80000 400000003EC0000 400000003F00000 40 > 0000003F40000 400000003F80000 > 400000003FC0000 > > As a result, the second bank is unusable for environment stores > (CONFIG_ENV_ADDR is 0x4000000): > > => saveenv > Saving Environment to Flash... Error: start and/or end address not on > sector boundary > Error: start and/or end address not on sector boundary > Failed (1) > > Rewinding the u-boot repo to before this commit fixes the problem. > > Manually (uncleanly) reverting the commit and it's dependent commits > fixes the problem. > > Here are the HEAD commits from the relevant repos that I used for the data above: > > qemu: commit dd5b0f95490883cd8bc7d070db8de70d5c979cbc > u-boot: commit 6cb87cbb1475f668689f95911d1521ee6ba7f55c > > Here is the qemu invocation I used: > > $ dd if=/dev/zero of=./flash0-with-uboot.img bs=1M count=64 && dd if=/path/to/u-boot.bin of=./flash0-with-uboot.img conv=notrunc > $ qemu-system-aarch64 -M virt -cpu cortex-a53 -m 1024M -nographic -drive if=pflash,format=raw,index=0,file=flash0-with-uboot.img -drive if=pflash,format=raw,index=1,file=flash1.img > > I'm happy to help test any fixes if and as needed. > > Cheers, > Robin >