From patchwork Mon Sep 11 21:13:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 721472 Delivered-To: patch@linaro.org Received: by 2002:adf:f64d:0:b0:31d:da82:a3b4 with SMTP id x13csp1314205wrp; Mon, 11 Sep 2023 14:14:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLSD3+nsT7VFCwe219g95K5AJVGBTRjVXUsfDKYcJIgXdJzsTEGsq/Pcbu+0yNtbS1cQmh X-Received: by 2002:a05:620a:46a9:b0:767:1b8e:811e with SMTP id bq41-20020a05620a46a900b007671b8e811emr13211435qkb.17.1694466883149; Mon, 11 Sep 2023 14:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694466883; cv=none; d=google.com; s=arc-20160816; b=iynFVUpSyNGIMC2sESGkIna4kpbSbEyRZEDAoS0ycqOc5YZ8g93YpuhZEtCiiro8eD DbHasCYAm46n8DYdbMkBAVDVjQLCb5wkK8z9iNYA9PqPJwJEiVCjtDfwYkW1OrX8yCqT 9EnSTbS5xZzrmtH8DORIkko8P7ZowyoXZbpFD/YrLK6oJfA2hnHfCOh12lbPIlL1iL+F 5vwtw/Zajf+zA4pzjqnYYznVEtwFSc2uJTcQg44j6XYC07+Vjfe497q4IlrH8S1SXakl QhLmu7/AYaSLgLXqDZ7bBKtwW11Cvwr/FVYmuACafwcT1P3HIzJ/+o9JZTYNes+qK7fh SxVA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+fItrFBqz4pCpmjDHSDhxOZeNtPLgdWkJxbwSRsqucM=; fh=fcdlpi58rfvXx0H4Wwhjis4yUZo2oB4+7NC4eFpZ0Zc=; b=lTpo0BUsvV6A6VLtFpqWNY2Hjip3QuszxMnnb6RDclOtacCLO3kxBD3ZJ0nb+j1+tW T6OIg9BahuFlM/cfDtvNOjuv2MXClSnIB7FrRw0XpAFAACzSWwFqrklH8BQP7a18CGQz 4bcttRyUzrbY6oC8rn5sTzvNptcXUGGqEeyhMvmRcT0I0qbcu3mfmBD1Jzcv4PA6ndky YG3y3M8DKAiqqTdZkdJ84nS3ZMpSGKYTjHtQbWKI6XBHBnzYzoT4pZJV5hTIBeAQhybY 6q3y1LHxsGF9r0Fqa0p9UBBbhn4Sxa7pqCwkjzXJPiC6QYL2YabzE4c9TLquSVKpGn3g CvSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="UKsqnR/n"; 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 a23-20020a05620a439700b0076daec99772si5578086qkp.36.2023.09.11.14.14.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Sep 2023 14:14:43 -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="UKsqnR/n"; 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 1qfoE5-0003fl-7o; Mon, 11 Sep 2023 17:13:45 -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 1qfoE4-0003eq-3t for qemu-devel@nongnu.org; Mon, 11 Sep 2023 17:13:44 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfoE1-0005Cy-TA for qemu-devel@nongnu.org; Mon, 11 Sep 2023 17:13:43 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-51e28cac164so12881617a12.1 for ; Mon, 11 Sep 2023 14:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694466819; x=1695071619; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+fItrFBqz4pCpmjDHSDhxOZeNtPLgdWkJxbwSRsqucM=; b=UKsqnR/nr+ZD4w7SdKYkNZDKI2dcOqQCU4FZ6i9sqw03G9LKmeIvVsWVHalud1fNw6 gfdMCEbPBdOb7+Aor06tLUEMyFe7SX09VdVNyNZ0I1q/KodCQZWSyXuYTdR0yGOgN7XL UhQYDKu4pjX3HBDgb+s0eKa6xGWBSgnmk5VFE/yZhBFLVAZ6dp1m4P/ZPMqsnbG73yeF 1BIqBm0aX+s7C9o+Qdxetl2Fw+QvlrN622qAFFXOXlqy8EAioGlrw4bnynqs2IfelqM6 7BYrYfQRTh6Z+G0uEbkPfyu8JzPmR67X85tCrUUmqCJF1J/EpZ8e0FxL4imgGLXnoSB5 xxpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694466819; x=1695071619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+fItrFBqz4pCpmjDHSDhxOZeNtPLgdWkJxbwSRsqucM=; b=PuSQwl7azhZAK8tpVLPQ5TgAdURjH/WMUSACikLAzipYw53upTdJhmYZ7drLpK6GR9 XOd2rK9p1aI2eYf4Dj6zaUsYyMy0veDEFbezt3OkOX0sfCbv44YuDCWqYjdYFiQtzMJu s9aocqU8W0oMPeG1MjLA9o6W2zcd4xpDHMLDpS8XW8lBK9/gRU/7U88zAmDykUxf4y7Q iFB0IkFuj1mtdyyNddS2deJRmvj/xL+i0H6rRivO5pcBa4oxwmZ65y13If38pCC/X+yh tznuC1vu+CC1GUtW/d75LQgvSM4t/VVuzPW7QxR/UOiACIntsu2NFzdQozjDXudR+8RK +WPQ== X-Gm-Message-State: AOJu0Yy+LFr9xJT17y9j3l004AHZaQxusuDeaNfszyrDKbLta9uDICaC aF/9y7hj+qrJojFhxHs0j2Qo7BYL1SYXCVRA8Vo= X-Received: by 2002:a50:ee89:0:b0:523:37f0:2d12 with SMTP id f9-20020a50ee89000000b0052337f02d12mr1117871edr.17.1694466819175; Mon, 11 Sep 2023 14:13:39 -0700 (PDT) Received: from m1x-phil.lan (tfy62-h01-176-171-221-76.dsl.sta.abo.bbox.fr. [176.171.221.76]) by smtp.gmail.com with ESMTPSA id c18-20020aa7d612000000b005254b41f507sm5126392edr.32.2023.09.11.14.13.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 11 Sep 2023 14:13:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Daniel Henrique Barboza , Paolo Bonzini , Stefan Hajnoczi , Michael Tokarev , Richard Henderson , Marcelo Tosatti , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , Kevin Wolf Subject: [PATCH v4 3/3] target/i386: Prohibit target specific KVM prototypes on user emulation Date: Mon, 11 Sep 2023 23:13:17 +0200 Message-ID: <20230911211317.28773-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911211317.28773-1-philmd@linaro.org> References: <20230911211317.28773-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 None of these target-specific prototypes should be used by user emulation. Remove their declaration there, so we get a compile failure if ever used (instead of having to deal with linker and its possible optimizations, such dead code removal). Suggested-by: Kevin Wolf Signed-off-by: Philippe Mathieu-Daudé --- target/i386/kvm/kvm_i386.h | 4 ++++ target/i386/cpu.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h index 55d4e68c34..5ef73f0a1c 100644 --- a/target/i386/kvm/kvm_i386.h +++ b/target/i386/kvm/kvm_i386.h @@ -13,6 +13,10 @@ #include "sysemu/kvm.h" +#ifdef CONFIG_USER_ONLY +#error Cannot include kvm_i386.h from user emulation +#endif + #ifdef CONFIG_KVM #define kvm_pit_in_kernel() \ diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 8b57708604..6be59c7b2b 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -26,7 +26,7 @@ #include "tcg/helper-tcg.h" #include "sysemu/reset.h" #include "sysemu/hvf.h" -#include "kvm/kvm_i386.h" +#include "sysemu/kvm.h" #include "sev.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -40,6 +40,7 @@ #include "exec/address-spaces.h" #include "hw/boards.h" #include "hw/i386/sgx-epc.h" +#include "kvm/kvm_i386.h" #endif #include "disas/capstone.h"