From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web10.10872.1674031725196809341 for ; Wed, 18 Jan 2023 00:48:45 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cpUvI57K; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 550A1B81BB6 for ; Wed, 18 Jan 2023 08:48:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 143F1C433EF for ; Wed, 18 Jan 2023 08:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674031722; bh=ql8kHxb2hVXSJ7N4x6jEinBL1wkL2JdwcByk7Z474gY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=cpUvI57KD6Ene3hgPQxOQk9CposUTH0Umtuxts7FSq/3sM7SELzloTLx3vPl4ZcDD //tAv5zX+SCRom/JWGdszFbnRE5UnwmcdJrs96ZkWOYo8qY5+t5sW3JmVDRfdKVDN+ 3hOPI7nykRA8W8bHgr/BVufhmj8NVYSTHgNirvBJF20GB2MuZHnkb2iOWKs2afKHte r8JERXK/Y4kLT7Nwspx6ISH1/KJWyCJgJDeN7QJN29njrsPkuiNQdRxPN94OmxUmHX 4u4Nggo3muWU3XUzNjX7KNPCe/bG2pT0j1mPfvq3eaEDPx/LWTtgCermA77JuxxOzh /YmGIBqCTvHsg== Received: by mail-lj1-f178.google.com with SMTP id o7so35497044ljj.8 for ; Wed, 18 Jan 2023 00:48:41 -0800 (PST) X-Gm-Message-State: AFqh2ko6HGAlblA7T9EIyOS3dh4jowLKAdW7sC/H+GX2driRcAvYmtZz 5ZNEqCQjvJE5SuB3mRIpHvQb3aPXDB0ZdRUiBXc= X-Google-Smtp-Source: AMrXdXuc1SELgryVNHNka2haLaERef60ZUuYsntAc2410gkPspB/kN4qHxTI8gReFTe+si1/I8PZyvLIhw6xoyVuTBw= X-Received: by 2002:a2e:9449:0:b0:28b:9755:77a with SMTP id o9-20020a2e9449000000b0028b9755077amr609203ljh.152.1674031720014; Wed, 18 Jan 2023 00:48:40 -0800 (PST) MIME-Version: 1.0 References: <20230105162528.1430368-1-ardb@kernel.org> <20230105162528.1430368-2-ardb@kernel.org> In-Reply-To: From: "Ard Biesheuvel" Date: Wed, 18 Jan 2023 09:48:28 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v2 2/2] ArmVirtPkg/ArmVirtQemu: Avoid early ID map on ThunderX To: Oliver Steffen Cc: devel@edk2.groups.io, dann.frazier@canonical.com Content-Type: text/plain; charset="UTF-8" On Wed, 18 Jan 2023 at 09:28, Oliver Steffen wrote: > > Quoting Ard Biesheuvel (2023-01-18 08:34:32) > > On Wed, 18 Jan 2023 at 07:37, Oliver Steffen wrote: > > > > > > On Tue, Jan 17, 2023 at 3:57 PM Ard Biesheuvel wrote: > > >> > > >> On Tue, 17 Jan 2023 at 13:48, Oliver Steffen wrote: > > >> > > > >> > Hi Ard, Hi everyone, > > >> > > > >> > Thanks for the work! > > >> > > > >> > But somehow this patch (as it was merged into master branch) does not > > >> > work for me on the ThunderX box we have. > > >> > > > >> > Any idea what could be wrong? > > >> > > >> I'm not sure I understand the question. The patch targets ThunderX, > > >> and you are using a ThunderX2. > > >> > > >> What were you expecting to happen, and what is happening instead? > > > > > > > > > Firmware does not start at all when using KVM. > > > > > > Please excuse my limited knowledge of Arm processor variants. > > > I assumed that ThunderX and ThunderX2 are very similar and hoped > > > the fix would also work for this case. > > > > > > The issue was introduced by the same commit that Dann > > > reported (07be1d34d95460a238fcd0f6693efb747c28b329): > > > "ArmVirtPkg/ArmVirtQemu: enable initial ID map at early boot". > > > > > > > Can you share the QEMU command line that you are using? I use a > > ThunderX2 basically 24/7 to do all my Linux and EDK2 development, so > > this change was developed on ThunderX2 and so I'm surprised you are > > seeing this issue. > > > > Did you try the DEBUG build as well? > Yes, debug is on. > > Here is what I have, trying with the master branch from just now > (998ebe5ca0ae5c449e83ede533bee872f97d63af): > > # make -C BaseTools && \ > . ./edksetup.sh && \ > build -t GCC5 -a AARCH64 \ > -p ArmVirtPkg/ArmVirtQemu.dsc \ > -DCAVIUM_ERRATUM_27456 \ > -b DEBUG > > # /usr/libexec/qemu-kvm \ > -machine accel=kvm -m 1G -boot menu=on \ > -blockdev node-name=code,driver=file,filename="${FW_CODE_RESIZED}",read-only=on > \ > -blockdev node-name=vars,driver=file,filename="${FW_VARS}" \ > -machine pflash0=code \ > -machine pflash1=vars \ > -cpu max \ > -net none \ > -serial stdio > My distro does not have qemu-kvm, and using the command line above results in the following if i try it with qemu-system-aarch64 """ qemu-system-aarch64: No machine specified, and there is no default Use -machine help to list supported machines """ unless i change it to qemu-system-aarch64 -machine virt,accel=kvm -m 1G -boot menu=on \ -blockdev node-name=code,driver=file,filename=$HOME/bin/flash0.img,read-only=on \ -blockdev node-name=vars,driver=file,filename=$HOME/bin/flash1.img \ -machine pflash0=code \ -machine pflash1=vars \ -cpu max \ -net none \ -nographic and that works fine with my firmware build. > # /usr/libexec/qemu-kvm --version > QEMU emulator version 7.2.0 (qemu-kvm-7.2.0-3.el9) > > # uname -r > 5.14.0-234.el9.aarch64 > Yeah, that is quite old. One potential issue that comes to mind here is the one address by the patch below > > > Since you have the same CPU... Might this be a bug in KVM? > Indeed. Could you try applying this patch? commit 406504c7b0405d74d74c15a667cd4c4620c3e7a9 Author: Marc Zyngier Date: Tue Dec 20 14:03:52 2022 +0000 KVM: arm64: Fix S1PTW handling on RO memslots Or check whether this is generally reproducible with newer kernels?