From patchwork Wed Jun 26 14:03:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 807508 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp319841wrn; Wed, 26 Jun 2024 07:04:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWeOK7aVUy5iZTpTzZ5vIK0l3JmtevPFHK7ksv67/FFeq8AhstPIzmGn/tLaEtjRMH2zBnEHaMJuIDNB1D8t/8m X-Google-Smtp-Source: AGHT+IEb2zboJ+w/91xawRBRt2yPIBs5yHktnbVKvKvE0QkswD5DoAUnfYsGAPrgcENmH6jUQVL+ X-Received: by 2002:ac5:ccb5:0:b0:4ef:5757:f91f with SMTP id 71dfb90a1353d-4ef6d893d14mr7276144e0c.10.1719410666739; Wed, 26 Jun 2024 07:04:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719410666; cv=none; d=google.com; s=arc-20160816; b=XbPYu1OfvjxAMpXQFyv4AW25/KGl1yhpj1Kq/ZpX6uloBvm/UHjG2Qbjm0acqexw8p 0zGwHQenXyW2ztzmhCCF4sq4rZPXUuLd8Yu/Tfqtlxpp/1Qo/K7YsMdcEHV7IAc2R2nW zY8BvWPN3jsLLEEP9gkYtlt5xsfAjF+MNpXKpnYB4II+XtkkXYf2/Z/81oNcDhd3ktZ5 DDyVJaLes56fdQ1bfQ7d/kjiXxz4Q+eYElcS36L2HGy/hIpkigKYtWpUs2KfHtKt5wUV 6/UT0HfUFIUryGVU60J1R/pnSiRsxK2YNHrmbcpteR+1IEP62R+LKAumsleHddquQfDO yVUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=hb6LcajEHMuf71XU0VM8Xn9J7SZV1K25f5gPBrNRxwY=; fh=6IF48/JsuLFKryk66t2qAZ/b7q6OxS9r+cru9bDbOoM=; b=0JmsHc62hSB/dkP+xSAhbK3QLJFRXJMJsZgjRj6O7vmmz0C6n8iRTtc9FSY7a7SaEq qV5jM1Jt6pErViOzxuefIH23haUlEZOpYffsP9+GEXtLmuvuhIjxt5lx/aZbh0ghF/fO rOCfQj81cE+5tGA1AZzJ54YS2ed/gYuY3yETDlCPrPztlojdH+pxkrXul6QT0o37ibcT Bkx+APXMCdr+5I6enEsetG0qXbIhDdT/6FioazFD1m6bnqKoJ0rZRQGXq350j1xs0vqi 6PqGyG5F/X5E501bsIqo8rsaxtjebOMiIUNyrK4IJvuM5ZMdIqwdmlKEFJpEtZ6JxbEu aN/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yGzwtLd9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-4ef84b1a9a4si787733e0c.77.2024.06.26.07.04.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jun 2024 07:04:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yGzwtLd9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMTFB-0001x9-9V; Wed, 26 Jun 2024 10:03:29 -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 1sMTF8-0001vv-Eu for qemu-devel@nongnu.org; Wed, 26 Jun 2024 10:03:27 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMTEw-0003CP-3K for qemu-devel@nongnu.org; Wed, 26 Jun 2024 10:03:26 -0400 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-57cb9efd8d1so506860a12.0 for ; Wed, 26 Jun 2024 07:03:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719410592; x=1720015392; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hb6LcajEHMuf71XU0VM8Xn9J7SZV1K25f5gPBrNRxwY=; b=yGzwtLd9LhUr8Ycfr+MuW2jjKy2gtYEiMG//dIwo88jcUHj8Shjxc+7P1q7iw2WNlO cy6gctnbBjQj8HfiNuC4sj/pyFHbhLWruvM4Bt4jASPpLYM9MGFBV202eLRcb77Y+pPp dyRG0CowB7Yhy6kkGd3mkuCgoCSukjLjjp9qyBRli2ZAiBti0Nr3by23WTNx5EQ1DoNm AwaxMOCxCdaSV/4wv74VfV0vRGSbcwCJCV+CiCVKNCOC8SVwg3OtJFvX2QxEXG2eCDq4 DMqOl6t7A3bVO7lETr7wduwBb8Wul3qIFHGJ6elt8MYE5gkRrex9JsW4hdiPtFUkPVNN 7BRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719410592; x=1720015392; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hb6LcajEHMuf71XU0VM8Xn9J7SZV1K25f5gPBrNRxwY=; b=pl9N3qxAig2XZVwfPp5C386qVHFqvbYL232D55828zf4/B/80shL5IZ7czhT2Jm4Q4 WSGW1bDeBZT5WmVCiWRI53OC5lkIJ9pa2+gV6tGBD3D6aDHhyn06PFbT36cGDQsULJUH I5CvLZReD/DQkhz75cnz4WfBhG4zDkDEOkqtCkdvM1415Rx38k5ZFNtK8SRXKDrtGFoS Gu7TCaj22A6NghEkiBSUllEtXMcX5o6RFUX7wCtEQQCTyZrDbzkrNbZtxAyisbuiFFGz c+hb3wJhdBs0Cko1/0ZvoovyU0Bg3TI9W0efFd5AiGDYFCXB8KDE/XV7M4NiF1FHU9iV 61Ng== X-Gm-Message-State: AOJu0Yw5scq7EztDo7ljFDTQQmMaQoMv1p6tJ8pbOdWjURpObXU35V9x NSNXILlMbNMUJ7W3gPsnbpOR3c/ggFiKFJHnxom7b49MZ4MoA0aVy5CsSh6TArc= X-Received: by 2002:a17:906:abd2:b0:a6f:e2f1:537b with SMTP id a640c23a62f3a-a700e706f07mr954361266b.28.1719410591717; Wed, 26 Jun 2024 07:03:11 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6fcf54923fsm617544466b.104.2024.06.26.07.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 07:03:11 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 5A06A5F8AA; Wed, 26 Jun 2024 15:03:10 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Paolo Bonzini , Marcelo Tosatti , kvm@vger.kernel.org (open list:X86 KVM CPUs) Subject: [RFC PATCH] target/i386: restrict SEV to 64 bit host builds Date: Wed, 26 Jun 2024 15:03:07 +0100 Message-Id: <20240626140307.1026816-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Re-enabling the 32 bit host build on i686 showed the recently merged SEV code doesn't take enough care over its types. While the format strings could use more portable types there isn't much we can do about casting uint64_t into a pointer. The easiest solution seems to be just to disable SEV for a 32 bit build. It's highly unlikely anyone would want this functionality anyway. Signed-off-by: Alex Bennée --- target/i386/sev.h | 2 +- target/i386/meson.build | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/i386/sev.h b/target/i386/sev.h index 858005a119..b0cb9dd7ed 100644 --- a/target/i386/sev.h +++ b/target/i386/sev.h @@ -45,7 +45,7 @@ typedef struct SevKernelLoaderContext { size_t cmdline_size; } SevKernelLoaderContext; -#ifdef CONFIG_SEV +#if defined(CONFIG_SEV) && defined(HOST_X86_64) bool sev_enabled(void); bool sev_es_enabled(void); bool sev_snp_enabled(void); diff --git a/target/i386/meson.build b/target/i386/meson.build index 075117989b..d2a008926c 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -6,7 +6,7 @@ i386_ss.add(files( 'xsave_helper.c', 'cpu-dump.c', )) -i386_ss.add(when: 'CONFIG_SEV', if_true: files('host-cpu.c', 'confidential-guest.c')) +i386_ss.add(when: ['CONFIG_SEV', 'HOST_X86_64'], if_true: files('host-cpu.c', 'confidential-guest.c')) # x86 cpu type i386_ss.add(when: 'CONFIG_KVM', if_true: files('host-cpu.c')) @@ -21,7 +21,7 @@ i386_system_ss.add(files( 'cpu-apic.c', 'cpu-sysemu.c', )) -i386_system_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'), if_false: files('sev-sysemu-stub.c')) +i386_system_ss.add(when: ['CONFIG_SEV', 'HOST_X86_64'], if_true: files('sev.c'), if_false: files('sev-sysemu-stub.c')) i386_user_ss = ss.source_set()