From patchwork Tue Apr 16 13:52:38 2024 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: 13631870 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5114129A72 for ; Tue, 16 Apr 2024 13:53:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713275636; cv=none; b=pl/EK7Wx0IR3QhaxtUCI9XsB+S4n5az+f4m4kI+ekdXaFklHxFFuB+zpG6DAgvWF4l35YYevjNszTTjtiXy6YGYg3Dx+cfxhonM3d54zunZkhxe8kAyfuyBBSbvIYGQAuOMc81pwtnsEP2vZQrkTMerAJOw13zSML5FJEG/e0dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713275636; c=relaxed/simple; bh=a/lHiyqD0LuQef7tb+rKPgTHO0b7ylPmocM5y30krnE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JK+SRvvY+StkSfyhDwaaFG2U4gAazC0ooIGl5s5gIULbZoupOivtYoeRoOW6EyDrKHMMs1H2CYGinFaPPVincwFKMBRHR6TDXC37Ktq6UFMTWl7NzJBV/jJWta+w/llFB+RPbENc5ZQKdcsD/SXMmZPpm0oJn+iFBxBVoJEmo0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=eu3VTTZ+; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eu3VTTZ+" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-56e136cbcecso5341702a12.3 for ; Tue, 16 Apr 2024 06:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713275633; x=1713880433; darn=vger.kernel.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=WRu6gIdKkp2mUDaWmMaxQTExs6byim7bx/MfazoYUmc=; b=eu3VTTZ+Al1aFsfLwCDTaRqdcKGu+wSHCbEkvwaxNttRH8Le9vJNeq1/tgBJCOChB4 u3KNWkfLhZM2BmFWSK1dIgO6J9YSAzxosBL+WMcO96Mz2faONL+vHGb8pW1Zi8fvFsFT peCWyGu8y8ioPk1U0ghuSaAHcXVCIWfRujjdupOX+05woOPD2WyQympj9su4aVsGjO1r zpBPZmZMcmfJFaqjuUFxLBKZ1RUBLGvGladcoVToCMLXkNoM8Bl9l4s1y1VjXPllZwt3 9Ym22PT+eqSMO/RrrOSw8Q0YR3BN1swbYOrZcP3RCe3+MXh+IG5Tww9vtnuQs7Q1wkX0 1RFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713275633; x=1713880433; 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=WRu6gIdKkp2mUDaWmMaxQTExs6byim7bx/MfazoYUmc=; b=rN4gn0PUX4evHsdO+M+vg8rqhBG3KoXfc5YACqvx4BABqsOX1hDZsM3+p05f+hCgvt q6DxasjVYVvpogmurOlcQKgOuGRG/v0uHxEE7aDmgkBlrQHMpJN4GZNA8FO48Mv/bdhc ZQbfy28AEe/tKbQUv0k+P8fWEURoFKFmeRzFYMbRxfKzFesrj3R9j8XkrpeELJCGBiGb ih80wCHUD9RH1SpKXC/obpE9s/alCFpUksX85XOQgdAwa5q40DaxNEqej57rkLCws39p 7HBkJV7m35LZBQbSoyHRiJ87MXrjkdYBqEpMnds74PfwdW9AkA/X9X4//tGj/ZJx4hNe fKlw== X-Forwarded-Encrypted: i=1; AJvYcCU4Z4b9RUUkht0LWDMEjWRebmk0O8P7ij2OB2lcV9DLvUqvO7jWBn2ZMV8ww+bqXggF4VusMewClUqImPsm0l3WUrQL X-Gm-Message-State: AOJu0YxVKKdfs5IhcIJRUsBWDywrRWfv08t4Ehz+DgOOZZ+Sw3FFR+7B ZL4DszlaGSYQy23nKeK2GObOAyC8y0fDxIxS8TUEz07SN97785IyZaAPFeA37Bk= X-Google-Smtp-Source: AGHT+IGEkV4NtWFwS7smQ8etZfExDim57HWSMuEPad1Ashde9/8qRGKDeoK0TUptFcJYLEy24Oqhkg== X-Received: by 2002:a50:9545:0:b0:570:1de9:4cd7 with SMTP id v5-20020a509545000000b005701de94cd7mr6143993eda.15.1713275633197; Tue, 16 Apr 2024 06:53:53 -0700 (PDT) Received: from m1x-phil.lan ([176.176.155.61]) by smtp.gmail.com with ESMTPSA id n13-20020a05640206cd00b005704ae9272dsm240052edy.93.2024.04.16.06.53.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Apr 2024 06:53:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Thomas Huth Cc: Ani Sinha , qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, Zhao Liu , David Hildenbrand , Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcelo Tosatti , kvm@vger.kernel.org Subject: [PATCH v3 09/22] target/i386/kvm: Remove x86_cpu_change_kvm_default() and 'kvm-cpu.h' Date: Tue, 16 Apr 2024 15:52:38 +0200 Message-ID: <20240416135252.8384-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240416135252.8384-1-philmd@linaro.org> References: <20240416135252.8384-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 x86_cpu_change_kvm_default() was only used out of kvm-cpu.c by the pc-i440fx-2.1 machine, which got removed. Make it static, and remove its declaration. "kvm-cpu.h" is now empty, remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20240305134221.30924-8-philmd@linaro.org> Reviewed-by: Zhao Liu --- target/i386/kvm/kvm-cpu.h | 41 --------------------------------------- target/i386/kvm/kvm-cpu.c | 3 +-- 2 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 target/i386/kvm/kvm-cpu.h diff --git a/target/i386/kvm/kvm-cpu.h b/target/i386/kvm/kvm-cpu.h deleted file mode 100644 index e858ca21e5..0000000000 --- a/target/i386/kvm/kvm-cpu.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * i386 KVM CPU type and functions - * - * Copyright (c) 2003 Fabrice Bellard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef KVM_CPU_H -#define KVM_CPU_H - -#ifdef CONFIG_KVM -/* - * Change the value of a KVM-specific default - * - * If value is NULL, no default will be set and the original - * value from the CPU model table will be kept. - * - * It is valid to call this function only for properties that - * are already present in the kvm_default_props table. - */ -void x86_cpu_change_kvm_default(const char *prop, const char *value); - -#else /* !CONFIG_KVM */ - -#define x86_cpu_change_kvm_default(a, b) - -#endif /* CONFIG_KVM */ - -#endif /* KVM_CPU_H */ diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index 9c791b7b05..cb8c73d20c 100644 --- a/target/i386/kvm/kvm-cpu.c +++ b/target/i386/kvm/kvm-cpu.c @@ -10,7 +10,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "host-cpu.h" -#include "kvm-cpu.h" #include "qapi/error.h" #include "sysemu/sysemu.h" #include "hw/boards.h" @@ -144,7 +143,7 @@ static PropValue kvm_default_props[] = { /* * Only for builtin_x86_defs models initialized with x86_register_cpudef_types. */ -void x86_cpu_change_kvm_default(const char *prop, const char *value) +static void x86_cpu_change_kvm_default(const char *prop, const char *value) { PropValue *pv; for (pv = kvm_default_props; pv->prop; pv++) { From patchwork Tue Apr 16 13:52:50 2024 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: 13631871 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D47D1272AA for ; Tue, 16 Apr 2024 13:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713275712; cv=none; b=YDyc1h0iaavJiAffcPJvD5BlOafubc015ZTCi253gd+3l9yc73Zpc0achrDh1DVE0mRPTsUPuDRPzjs+gKIaXcFYjNNHVZyoZeXT2RGkN3ST6ZacSZt4VuCdmq9qpKvcEuN631rXaqiV0GLocNNTlnYR+sBdLIcF7I7of9p6Zbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713275712; c=relaxed/simple; bh=7gnNlQpmPTha3BrmsvmwHEikdOtnoTPEc28vlwcQwEE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P8yffm5nMUNc1jqQ0QE+OhDtIXZX5kohPEWlVIWofbnSFhb9qiuptHmk4QVBy6oVePcLL1V2BTOdCP2nJG1VXV2dGHjJM4wY12W2yWyQoI5QGmnNdvJNmhPY9QIbnpXjwvISMFFchirjWS6GuUe2gWML0ZM0vzWPQNpRTZtTuIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nM2kbBeN; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nM2kbBeN" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5700a9caee0so4086006a12.2 for ; Tue, 16 Apr 2024 06:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713275709; x=1713880509; darn=vger.kernel.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=h1653K/UfEWnXUTbr/YeJw2UmUosHHOUFfds+vppZrE=; b=nM2kbBeN/UIVspqTXT+yaIS98etFtqxG5iR/OOL8rnSI+p6hR64adbFDAYqKIUv3qi GRiAKSMDuTBlWAzDS/NUA6obLmYPyDFbkqyiZDk+2j3qgB2/EpqQAkv1xXCY2DtPY1xa TZkaf1DSCuAAEBZJC5iY5PIZ0xre5LEs2q4cmZsjM7DZC5c5F3FMQLyqoX+IYfOPY/Jx GpCf90RiENfUjoAKWkM8Kfx9wLhfNTUs+6dWLO/ej9VSIM9VnukDCxLvmyaB1iUpuh7i i75i6YXNqtunlYAHxhvMmueoWds1TYFBPpOOeWDAdWutDjTGJUFWmOkA7Fq825xynEMX TuQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713275709; x=1713880509; 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=h1653K/UfEWnXUTbr/YeJw2UmUosHHOUFfds+vppZrE=; b=hFaa7FxdE7Ha2O5ip0Wcq4Cgbga2BoMuyUMRzr71Jw86dXyuCcBMEslDsLlaA7bEiZ rGeS2bgTXmJNoEZqCEuP4ftjp29l4ZJtjru7pRGYxE4Pt8bJSoVvmGH6kdiz/qFz8QAw 2jWu27EwQFZveiLwbMzGhcl28dqqlaq4yKJHUyKvwgFFMJ5r+65mu1Hva1Pc4jw3+g/S 6YBYwoWYOAP5erTDd6EeOUm03isKjeSwKeqW1YDJQD1fxIZyQHv2UF+ZDVdvE1G4uSRv 87WKuwiGuHUaLJ/Vol21TpOUw9LTXxJPwQABRPsle0Ywy4VrqoUKm7buw0FkfPyY/NYg GtCg== X-Forwarded-Encrypted: i=1; AJvYcCUr+ccWT8ubUnSgHwPJyzkoygEgU2HFo0RNqnJkxnI9qDlnpAOFyMxKTfIXPvuMfsN0kvFG7AeNIsor5UZkerXwSMpZ X-Gm-Message-State: AOJu0Yz3wAnRSf1kgPeoQD7J6kL/OgH6CC8IXn1yboXSeq9X/HBAxBqe Q6JOZj49urP1fN08qf/LhpyqRGKaT8xDL+38Wx36SY3D7Ps0FgpqdDmON2x1VjA= X-Google-Smtp-Source: AGHT+IHkUMQgIFsx5SzP07ohbcv44kLEvoExY/YrMlXFyL1i8R4mcChXMZxYy0/mFxCZjbzS5CDwpg== X-Received: by 2002:a50:8ace:0:b0:568:d5e7:37a1 with SMTP id k14-20020a508ace000000b00568d5e737a1mr8273701edk.36.1713275708861; Tue, 16 Apr 2024 06:55:08 -0700 (PDT) Received: from m1x-phil.lan ([176.176.155.61]) by smtp.gmail.com with ESMTPSA id bl19-20020a056402211300b0056e064a6d2dsm6108679edb.2.2024.04.16.06.55.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Apr 2024 06:55:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Thomas Huth Cc: Ani Sinha , qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, Zhao Liu , David Hildenbrand , Paolo Bonzini , Igor Mammedov , "Michael S. Tsirkin" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcelo Tosatti , kvm@vger.kernel.org Subject: [PATCH v3 21/22] target/i386: Remove X86CPU::kvm_no_smi_migration field Date: Tue, 16 Apr 2024 15:52:50 +0200 Message-ID: <20240416135252.8384-22-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240416135252.8384-1-philmd@linaro.org> References: <20240416135252.8384-1-philmd@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X86CPU::kvm_no_smi_migration was only used by the pc-i440fx-2.3 machine, which got removed. Remove it and simplify kvm_put_vcpu_events(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Zhao Liu --- target/i386/cpu.h | 3 --- target/i386/cpu.c | 2 -- target/i386/kvm/kvm.c | 7 +------ 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 6b05738079..5b016d6667 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2018,9 +2018,6 @@ struct ArchCPU { /* if set, limit maximum value for phys_bits when host_phys_bits is true */ uint8_t host_phys_bits_limit; - /* Stop SMI delivery for migration compatibility with old machines */ - bool kvm_no_smi_migration; - /* Forcefully disable KVM PV features not exposed in guest CPUIDs */ bool kvm_pv_enforce_cpuid; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 33760a2ee1..f9991e7398 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7905,8 +7905,6 @@ static Property x86_cpu_properties[] = { DEFINE_PROP_BOOL("x-vendor-cpuid-only", X86CPU, vendor_cpuid_only, true), DEFINE_PROP_BOOL("lmce", X86CPU, enable_lmce, false), DEFINE_PROP_BOOL("l3-cache", X86CPU, enable_l3_cache, true), - DEFINE_PROP_BOOL("kvm-no-smi-migration", X86CPU, kvm_no_smi_migration, - false), DEFINE_PROP_BOOL("kvm-pv-enforce-cpuid", X86CPU, kvm_pv_enforce_cpuid, false), DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true), diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index e68cbe9293..88f4a7da33 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -4337,6 +4337,7 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) events.sipi_vector = env->sipi_vector; if (has_msr_smbase) { + events.flags |= KVM_VCPUEVENT_VALID_SMM; events.smi.smm = !!(env->hflags & HF_SMM_MASK); events.smi.smm_inside_nmi = !!(env->hflags2 & HF2_SMM_INSIDE_NMI_MASK); if (kvm_irqchip_in_kernel()) { @@ -4351,12 +4352,6 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level) events.smi.pending = 0; events.smi.latched_init = 0; } - /* Stop SMI delivery on old machine types to avoid a reboot - * on an inward migration of an old VM. - */ - if (!cpu->kvm_no_smi_migration) { - events.flags |= KVM_VCPUEVENT_VALID_SMM; - } } if (level >= KVM_PUT_RESET_STATE) {