From patchwork Thu Mar 20 22:29:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 875007 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp576483wrb; Thu, 20 Mar 2025 15:41:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXWjCstmf0ea2/LVGYkN9OWtpzLJ5OEg0qeUa9s6NnSZSbfIjjrAxlrNPGQFcmjiaSwMXqwUQ==@linaro.org X-Google-Smtp-Source: AGHT+IG85dLs78ENKj34QIxO0TOKd2d3mzQzPe3awChTFaH3DeIZ1Z55xTG3b6WloeTdXKCB+PNG X-Received: by 2002:a05:620a:390a:b0:7c5:464b:671a with SMTP id af79cd13be357-7c5ba1ea62fmr121873185a.42.1742510494121; Thu, 20 Mar 2025 15:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742510494; cv=none; d=google.com; s=arc-20240605; b=YK0hW4twwFnoHi3j+X/lxdp9F35mU1rMdYBLFX8hDYe1Ggjw77j2KHiSTG8DrNEt02 sZw7Hd2ffHG9no1MtfzW9SJ2sBs4x2XUz9ZkFI8zSOkwC2NsSrPOXQkV/tbHGVByl2XO oXolUyqqP/TuHCgTajJgwfVjLLPIzA/b9bqJepbsyMzJE1KAdEsj7WtUUtAJtbWUZLtz SShvQLNr8ORzJxcDMkWmmS/ZnQ7kTpAm7+jy4LCnnJwXLt16uGihMqwusn8Gsn/Xw2ld 3bFEMRrRQEd3mwGxZlTPyZodi1he2mRso/JRFefjMhe4qW6cjfuBBxiEv1jCp6LRGnGp 3Fjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=UwN1XbujsuD3V7J/Bz3fRu7KgVCb0BPWWPB+rJlSEhI=; fh=nOkKbActdBXNisDSrdwXLE2FHRvxbNZxRZo5bVBICcQ=; b=ldyTATAvVbQymyET6JJEyqtsF0xOkOYsmgzdkgDJgALq9Cg5ekuq4z7RWj776lhA7a eCHFSjcuecEYEa/QOT2+UtM7kan8cfhn8C1IVAf6mpT7KY/owXl+PMN2Lp+oZ/eVUJ7I KeLX2UJA1pQx1HstWd+BHmosFceWEDq8SrhQbzeOPdHKtryJLSORIZH7cBPCsfM/JC92 0TyFXY2nsyQoYq+PmCBBFiZXiEsTITzF5x9GGw3NjuDjVa8WatzP90qL92+erYjE7PA6 CoRJCH4n1n/v0t0DjNlfnjPm1efkBCsUk8ar5zKNeh1mTkVG5nl4+R7Igr7Q6dk0PrVJ pJsw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OEiMvc7I; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c5b9383dfasi73955185a.650.2025.03.20.15.41.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Mar 2025 15:41:34 -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=OEiMvc7I; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvOSM-0006jl-Sb; Thu, 20 Mar 2025 18:33:43 -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 1tvOPm-0002ai-GD for qemu-devel@nongnu.org; Thu, 20 Mar 2025 18:31:04 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvOPO-0007As-DD for qemu-devel@nongnu.org; Thu, 20 Mar 2025 18:30:58 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-223fb0f619dso27817535ad.1 for ; Thu, 20 Mar 2025 15:30:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742509830; x=1743114630; 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=UwN1XbujsuD3V7J/Bz3fRu7KgVCb0BPWWPB+rJlSEhI=; b=OEiMvc7IrWRWrSY0f04OAh7n6KzBKET3jTcw8R7/fcDHywVLqmZ8ZrnRVNYTr5q7rB 4gZOs14E3X4+5Ni+8KiuQ6NEMsyCWFYnzSVyRTAUNJW986vZD6rnG5RbrBkqP1nfLyWd kdVNIOPrc7cjq2n4t96vQP5x+jNUbJ2bxZtLOlMLaEnqLzJvcX2g/+wfMsuVMSES1+N6 X4ZglLtVxBNxVIb+/g+Hi9NUhpH+ZKRr9d334udXMXS0nRYpJsLube8OEyYXCmeiQLux fX0u75zlqq5IfXdvwXYEx6bC0hDgTD1XyCCZKXCl2JJmkPQCKQZamLaNvJ197t6RZlYi aXaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742509830; x=1743114630; 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=UwN1XbujsuD3V7J/Bz3fRu7KgVCb0BPWWPB+rJlSEhI=; b=tNKpgnMj9sMEgbof91BqleowsnWSEtFWf4L8G94IHRSyiYnhl0BN6nD7rgs2QsZsB1 zEHVqzm8DsFJvTYqiPkgmJAUyeNxyuKrVL/DuHA9LeWy5pt0/pnM2kBbLi1pC839teo9 +2P+10EYfZdMjCVpuDxnhaUVroCXh+HBLpn03YVJPRBp6jCoR0OpYErJnwtEreVVN2Qw I//FHzFEpj5XYXj0rE7BuoK2uIeP51rBr9nKbgZXYpFB4eJ/RYaViUhy7Ma2jTqhbZPk j6QcMXcjSUsN+Dcp82APzLO9uLNwLmKrwNt3xRs8XswgcTVcGdL48XCpH5Wi84rDm4LT 45gw== X-Gm-Message-State: AOJu0YzL+0ziE0traE+AuLI7E/+3JEybjGX8m9orspelMSQu9GYwxBnP BOFHPiByiTcTIK4UdL1htzcs+9A7VFq7ag/aCyEiAKCVu91CbgDO3dnvdLGD+wjLj1M6MpA8qAk x X-Gm-Gg: ASbGncv7OHTqxefguFNj6vDiXsZokE+NKYru0liipmqVc9HhdkiUysEZ5utuZY2Edzg F0qQoC0AQIuyGtLo2Hdueub4ZmoDCuCfWJGCN4zeHaJlq2L2ELvhiGUuG34N4fmcMlbHRYTElOi E5WqLJYasT0OIazhmahRamceG/Qzwv2JH+lDrWOmZm/w2TKYeWfLGIkVXWiQ4TPjR4jTrdcR8gl dAEFpRCM7fHo+4ThqLCK3tCkSLM6Kp4o1BfTyaGr6BVBUR0oKnfyBjILfZJrfWnDAzeqIFGQomT XmWtz74r68MyGykADkxLj+VbO3NkJb3NXnHvcB+Sgh6u X-Received: by 2002:a17:902:f687:b0:216:3466:7414 with SMTP id d9443c01a7336-22780e25bd4mr13499905ad.44.1742509830242; Thu, 20 Mar 2025 15:30:30 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22780f4581csm3370145ad.59.2025.03.20.15.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 15:30:29 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Pierrick Bouvier Subject: [PATCH v2 18/30] accel/kvm: move KVM_HAVE_MCE_INJECTION define to kvm-all.c Date: Thu, 20 Mar 2025 15:29:50 -0700 Message-Id: <20250320223002.2915728-19-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250320223002.2915728-1-pierrick.bouvier@linaro.org> References: <20250320223002.2915728-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x635.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=unavailable 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 This define is used only in accel/kvm/kvm-all.c, so we push directly the definition there. Add more visibility to kvm_arch_on_sigbus_vcpu() to allow removing this define from any header. The architectures defining KVM_HAVE_MCE_INJECTION are i386, x86_64 and aarch64. Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- include/system/kvm.h | 2 -- target/arm/cpu.h | 4 ---- target/i386/cpu.h | 2 -- accel/kvm/kvm-all.c | 5 +++++ 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/system/kvm.h b/include/system/kvm.h index 716c7dcdf6b..b690dda1370 100644 --- a/include/system/kvm.h +++ b/include/system/kvm.h @@ -392,9 +392,7 @@ bool kvm_vcpu_id_is_valid(int vcpu_id); /* Returns VCPU ID to be used on KVM_CREATE_VCPU ioctl() */ unsigned long kvm_arch_vcpu_id(CPUState *cpu); -#ifdef KVM_HAVE_MCE_INJECTION void kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); -#endif void kvm_arch_init_irq_routing(KVMState *s); diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ea9956395ca..a8a1a8faf6b 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -33,10 +33,6 @@ #include "target/arm/multiprocessing.h" #include "target/arm/gtimer.h" -#ifdef TARGET_AARCH64 -#define KVM_HAVE_MCE_INJECTION 1 -#endif - #define EXCP_UDEF 1 /* undefined instruction */ #define EXCP_SWI 2 /* software interrupt */ #define EXCP_PREFETCH_ABORT 3 diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 049bdd1a893..44ee263d8f1 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -35,8 +35,6 @@ #define XEN_NR_VIRQS 24 -#define KVM_HAVE_MCE_INJECTION 1 - /* support for self modifying code even if the modified instruction is close to the modifying instruction */ #define TARGET_HAS_PRECISE_SMC diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 0723a3933bb..7c5d1a98bc4 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -57,6 +57,11 @@ #include #endif +#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) +# define KVM_HAVE_MCE_INJECTION 1 +#endif + + /* KVM uses PAGE_SIZE in its definition of KVM_COALESCED_MMIO_MAX. We * need to use the real host PAGE_SIZE, as that's what KVM will use. */