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 A6AD0C7EE32 for ; Tue, 24 Jun 2025 15:23:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uU5Tr-00035C-OX; Tue, 24 Jun 2025 11:22:39 -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 1uU5Tp-000352-Q6 for qemu-devel@nongnu.org; Tue, 24 Jun 2025 11:22:37 -0400 Received: from gandalf.ozlabs.org ([150.107.74.76] helo=mail.ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uU5Tj-0005Cq-70 for qemu-devel@nongnu.org; Tue, 24 Jun 2025 11:22:37 -0400 Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4bRTG90bBsz4x4m; Wed, 25 Jun 2025 01:22:25 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.ozlabs.org (Postfix) with ESMTPSA id 4bRTG23Fmnz4x3p; Wed, 25 Jun 2025 01:22:18 +1000 (AEST) Message-ID: <0923da7f-90d4-4bd8-9a16-652fd5455dbf@kaod.org> Date: Tue, 24 Jun 2025 17:22:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PULL 24/24] i386/tdx: handle TDG.VP.VMCALL To: =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= , Stefan Hajnoczi Cc: Xiaoyao Li , Paolo Bonzini , qemu-devel@nongnu.org, Isaku Yamahata , Chenyi Qiang References: <20250620164053.579416-1-pbonzini@redhat.com> <20250620164053.579416-25-pbonzini@redhat.com> <4ffdb62b-8fe4-4b34-9efa-aecff7f8e77b@intel.com> <32c86014-8e28-4100-bb87-9072acdc01cb@kaod.org> Content-Language: en-US, fr From: =?UTF-8?Q?C=C3=A9dric_Le_Goater?= Autocrypt: addr=clg@kaod.org; keydata= xsFNBFu8o3UBEADP+oJVJaWm5vzZa/iLgpBAuzxSmNYhURZH+guITvSySk30YWfLYGBWQgeo 8NzNXBY3cH7JX3/a0jzmhDc0U61qFxVgrPqs1PQOjp7yRSFuDAnjtRqNvWkvlnRWLFq4+U5t yzYe4SFMjFb6Oc0xkQmaK2flmiJNnnxPttYwKBPd98WfXMmjwAv7QfwW+OL3VlTPADgzkcqj 53bfZ4VblAQrq6Ctbtu7JuUGAxSIL3XqeQlAwwLTfFGrmpY7MroE7n9Rl+hy/kuIrb/TO8n0 ZxYXvvhT7OmRKvbYuc5Jze6o7op/bJHlufY+AquYQ4dPxjPPVUT/DLiUYJ3oVBWFYNbzfOrV RxEwNuRbycttMiZWxgflsQoHF06q/2l4ttS3zsV4TDZudMq0TbCH/uJFPFsbHUN91qwwaN/+ gy1j7o6aWMz+Ib3O9dK2M/j/O/Ube95mdCqN4N/uSnDlca3YDEWrV9jO1mUS/ndOkjxa34ia 70FjwiSQAsyIwqbRO3CGmiOJqDa9qNvd2TJgAaS2WCw/TlBALjVQ7AyoPEoBPj31K74Wc4GS Rm+FSch32ei61yFu6ACdZ12i5Edt+To+hkElzjt6db/UgRUeKfzlMB7PodK7o8NBD8outJGS tsL2GRX24QvvBuusJdMiLGpNz3uqyqwzC5w0Fd34E6G94806fwARAQABzSBD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i927SG2DwWDVzZlt KrCMD1aMPvb3NU8FOYRhNmIFR3fcalYr+9gDuVKe8BVz4atMOoktmt0GWTOC8P4= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=150.107.74.76; envelope-from=SRS0=CPSq=ZH=kaod.org=clg@ozlabs.org; helo=mail.ozlabs.org X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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 6/24/25 17:08, Daniel P. Berrangé wrote: > On Tue, Jun 24, 2025 at 11:03:19AM -0400, Stefan Hajnoczi wrote: >> On Mon, Jun 23, 2025 at 4:37 PM Cédric Le Goater wrote: >>> >>> On 6/23/25 20:57, Stefan Hajnoczi wrote: >>>> On Mon, Jun 23, 2025 at 9:09 AM Daniel P. Berrangé wrote: >>>>> >>>>> On Mon, Jun 23, 2025 at 09:04:33AM -0400, Stefan Hajnoczi wrote: >>>>>> On Mon, Jun 23, 2025 at 4:04 AM Daniel P. Berrangé wrote: >>>>>>> >>>>>>> On Mon, Jun 23, 2025 at 03:03:19PM +0800, Xiaoyao Li wrote: >>>>>>>> On 6/23/2025 2:43 PM, Cédric Le Goater wrote: >>>>>>>>> Hello, >>>>>>>>> >>>>>>>>> On 6/20/25 18:40, Paolo Bonzini wrote: >>>>>>>>>> From: Isaku Yamahata >>>>>>>>>> >>>>>>>>>> Add property "quote-generation-socket" to tdx-guest, which is a property >>>>>>>>>> of type SocketAddress to specify Quote Generation Service(QGS). >>>>>>>>>> >>>>>>>>>> On request of GetQuote, it connects to the QGS socket, read request >>>>>>>>>> data from shared guest memory, send the request data to the QGS, >>>>>>>>>> and store the response into shared guest memory, at last notify >>>>>>>>>> TD guest by interrupt. >>>>>>>>>> >>>>>>>>>> command line example: >>>>>>>>>> qemu-system-x86_64 \ >>>>>>>>>> -object '{"qom-type":"tdx-guest","id":"tdx0","quote-generation- >>>>>>>>>> socket":{"type":"unix", "path":"/var/run/tdx-qgs/qgs.socket"}}' \ >>>>>>>>>> -machine confidential-guest-support=tdx0 >>>>>>>>>> >>>>>>>>>> Note, above example uses the unix socket. It can be other types, >>>>>>>>>> like vsock, >>>>>>>>>> which depends on the implementation of QGS. >>>>>>>>>> >>>>>>>>>> To avoid no response from QGS server, setup a timer for the transaction. >>>>>>>>>> If timeout, make it an error and interrupt guest. Define the threshold of >>>>>>>>>> time to 30s at present, maybe change to other value if not appropriate. >>>>>>>>>> >>>>>>>>>> Signed-off-by: Isaku Yamahata >>>>>>>>>> Co-developed-by: Chenyi Qiang >>>>>>>>>> Signed-off-by: Chenyi Qiang >>>>>>>>>> Co-developed-by: Xiaoyao Li >>>>>>>>>> Signed-off-by: Xiaoyao Li >>>>>>>>>> Tested-by: Xiaoyao Li >>>>>>>>>> Signed-off-by: Paolo Bonzini >>>>>>>>>> --- >>>>>>>>>> qapi/qom.json | 8 +- >>>>>>>>>> target/i386/kvm/tdx-quote-generator.h | 82 +++++++ >>>>>>>>>> target/i386/kvm/tdx.h | 10 + >>>>>>>>>> target/i386/kvm/kvm.c | 3 + >>>>>>>>>> target/i386/kvm/tdx-quote-generator.c | 300 ++++++++++++++++++++++++++ >>>>>>>>>> target/i386/kvm/tdx-stub.c | 4 + >>>>>>>>>> target/i386/kvm/tdx.c | 176 ++++++++++++++- >>>>>>>>>> target/i386/kvm/meson.build | 2 +- >>>>>>>>>> 8 files changed, 582 insertions(+), 3 deletions(-) >>>>>>>>>> create mode 100644 target/i386/kvm/tdx-quote-generator.h >>>>>>>>>> create mode 100644 target/i386/kvm/tdx-quote-generator.c >>>>>>>>> >>>>>>>>> These changes broke the build on 32-bit host. >>>>>>>>> >>>>>>>>> Could you please send a patch to avoid compiling TDX in such environment ? >>>>>>>> >>>>>>>> Paolo is on vacation. >>>>>>>> >>>>>>>> I would like to help, but I don't have 32-bit host environment on hand. Do >>>>>>>> you know how to set up such environment quickly? (I tried to set up within a >>>>>>>> 32-bit VM but the 32-bit OS is too old and I didn't get it work to install >>>>>>>> the required package for building QEMU) >>>>>>> >>>>>>> You should be able to use QEMU's docker containers to get yourself a >>>>>>> Debian i386 container, on a x86_64 host. >>>>>> >>>>>> The cross-i686-system (Debian) build CI job succeeded: >>>>>> https://gitlab.com/qemu-project/qemu/-/jobs/10423776600 >>>>>> >>>>>> I wonder why the CI didn't catch the issue? >>>>> >>>>> It didn't build the x86_64 target: >>>>> >>>>> --target-list-exclude="arm-softmmu i386-softmmu microblaze-softmmu mips-softmmu mipsel-softmmu mips64-softmmu ppc-softmmu riscv32-softmmu sh4-softmmu sparc-softmmu xtensa-softmmu $CROSS_SKIP_TARGETS" >>>>> >>>>> so in turn didn't build any TDX code >>>> >>>> Here are the targets that were built by the CI job: >>>> >>>> target list : avr-softmmu m68k-softmmu microblazeel-softmmu >>>> or1k-softmmu rx-softmmu sh4eb-softmmu tricore-softmmu xtensaeb-softmmu >>>> >>>> 64-bit targets are not supported on 32-bit hosts since commit >>>> acce728cbc6c ("meson: Disallow 64-bit on 32-bit emulation"). I don't >>>> think the x86_64 target can be built on 32-bit hosts. >>>> >>>> But notice that i386-softmmu is missing from the target list. That >>>> could be why the CI job succeeded. >>>> >>>> Cédric: What were your ./configure options? >>> >>> Just : >>> >>> --target-list=arm-softmmu,ppc-softmmu,i386-softmmu >> >> cross-i686-tci builds i386-softmmu on debian-i686-cross with >> --disable-kvm, but the TDX code isn't compiled: >> https://gitlab.com/qemu-project/qemu/-/jobs/10440424393 >> >> A new CI job could be added to cover TDX on 32-bit hosts if you think >> it's worthwhile. Maybe it's a corner case and not worth spending CI >> cycles on? > > We should not set any expectation of support for TDX on 32-bit host > or guest emulator. IMHO the only right answer here is to disable > build of TDX for anything other than x86_64-softmmu w/ KVM. yes. This is what I was reminding the developers. Thanks, C.