From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.29191.1673455763573166879 for ; Wed, 11 Jan 2023 08:49:23 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dsDj6xoR; spf=pass (domain: kernel.org, ip: 139.178.84.217, 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 dfw.source.kernel.org (Postfix) with ESMTPS id DD0AE61D84 for ; Wed, 11 Jan 2023 16:49:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8CAAC433A1 for ; Wed, 11 Jan 2023 16:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673455761; bh=saf2t/ARE9UVtiiP4+bPxxaE++IjVhJekvdTJrYhpJA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dsDj6xoR4ezfhR+0MKNpISD+wnXv3IP/0SEGQCEf5OLkwYbcNjyougCbyar/LSbey MfD63mRfYgdnvvgBV48CpixjorC5Pf52ku4lQlB2M65aWzu94yGfP5F7vW67/5bEEo od2njV1F5T8fgv+IQKqT86SMKu4B0rx2nFlNtvDnxH12dbshCAv8BBnqO7rTuUp9S2 jS+c2HaSzuIRhyUxJjKEhBwZ/ayyTAUIE52w0xOvjpoCx04Oozn6vXNEewxanMbttu yb+l69qdMaaOtPDgn7n9CVgshozXYLTO8gP1GjfPcor5gNeVSQW/LDCxH9r8zLwvo7 XsctWRPapuSrA== Received: by mail-lj1-f171.google.com with SMTP id y18so13077642ljk.11 for ; Wed, 11 Jan 2023 08:49:21 -0800 (PST) X-Gm-Message-State: AFqh2kr65/jgbGodSRkv/NFM5BucLcJjNzAQ98myPDwG7n79Xr2WX6of MuaJrM8c2tYrFMqnaDOsZttqOWyeQ0qvXY7DPik= X-Google-Smtp-Source: AMrXdXtgUj9Ci2pOmyHJC8L8DHGeUROw1qOE2vbA22uQBkY/jimcpAXR02s6lMzWUXmrjpZwH/yEhxPBF7r5jmiBb/o= X-Received: by 2002:a2e:a901:0:b0:27f:ef88:3ecb with SMTP id j1-20020a2ea901000000b0027fef883ecbmr1605470ljq.189.1673455759855; Wed, 11 Jan 2023 08:49:19 -0800 (PST) MIME-Version: 1.0 References: <20221110134738.3798618-1-ardb@kernel.org> <20221110134738.3798618-3-ardb@kernel.org> In-Reply-To: From: "Ard Biesheuvel" Date: Wed, 11 Jan 2023 17:49:08 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH 2/3] ArmVirtPkg/ArmVirtQemu: Expose TRNG hypercall via RngDxe if implemented To: devel@edk2.groups.io, pierre.gondois@arm.com Cc: Liming Gao , Rebecca Cran , Leif Lindholm , Sami Mujawar , Gerd Hoffmann , "Jason A . Donenfeld" Content-Type: text/plain; charset="UTF-8" On Fri, 18 Nov 2022 at 17:48, PierreGondois wrote: > > Hello Ard, > > On 11/10/22 14:47, Ard Biesheuvel wrote: > > Currently, we only expose the EFI_RNG_PROTOCOL in ArmVirtQemu if QEMU > > provides a virtio-rng device, and it doesn't do so by default. > > > > Given that KVM exposes the ARM architected TRNG service (and has done so > > for a while now), let's incorporate the RngDxe driver which has recently > > grown support for the ARM firmware/hypervisor service. > > > > If both the service and the virtio device are available, two > > implementations of the RNG protocol will be exposed, but this is fine: > > callers that don't care about the distinction will grab the first one > > available. > > > > Signed-off-by: Ard Biesheuvel > > --- > > ArmVirtPkg/ArmVirtQemu.dsc | 11 +++++++++++ > > ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 5 +++++ > > ArmVirtPkg/ArmVirtQemuKernel.dsc | 11 +++++++++++ > > 3 files changed, 27 insertions(+) > > > > diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc > > index f77443229e8e..1771ad562225 100644 > > --- a/ArmVirtPkg/ArmVirtQemu.dsc > > +++ b/ArmVirtPkg/ArmVirtQemu.dsc > > @@ -140,6 +140,8 @@ [PcdsFeatureFlag.common] > > > > gArmVirtTokenSpaceGuid.PcdTpm2SupportEnabled|$(TPM2_ENABLE) > > > > + gArmTokenSpaceGuid.PcdMonitorConduitHvc|TRUE > > + > > It seems that the PSCI conduit needs to be dynamically set. Why? And how is this different from PSCI for resetting the system? Note that ArmVIrtQemu was never intended to run at EL2, even if it seems to work to some extent. > The psci conduit that should be used is configured by qemu depending on the > virtualization=[on|off] parameter. When off, HVC must be used (SMC otherwise). > Cf: > https://github.com/qemu/qemu/blob/master/hw/arm/virt.c#L2052 > > If using the wrong conduit, qemu traps the instruction and stops. > For KvmTool, the conduit is always HVC. > > Command used: > [PATH_TO]/qemu/build/qemu-system-aarch64 \ > -serial stdio -M virt,highmem=on,virtualization=off \ > -cpu cortex-a57 -smp 4 -m 4096 \ > -drive file=pflash0.img,format=raw,if=pflash,readonly=on \ > -drive file=pflash1.img,format=raw,if=pflash > > Regards, > Pierre > > > > >