From patchwork Tue Mar 25 04:59:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 875983 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp2476762wrb; Mon, 24 Mar 2025 22:08:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUNjLFrbBRYFjiMeRwyVhlh+rFZrL8jGCZzLyBFZVjGse8tY7xat643VoXzGksYFdS0EwM5Gw==@linaro.org X-Google-Smtp-Source: AGHT+IG+i5FpirYp9eXM/9sig48a04ICXynWeOpJmTYMn8T6J9DxvuwIak99j6pfZtEP/wEXEXbp X-Received: by 2002:ad4:5beb:0:b0:6e8:ffb6:2f90 with SMTP id 6a1803df08f44-6eb3f2c84a7mr231634896d6.11.1742879294515; Mon, 24 Mar 2025 22:08:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742879294; cv=none; d=google.com; s=arc-20240605; b=gvGA1ySQMqzUvuGJeC8CbfmN3rC5k9UbIELyshO8CiExPxa9S3r9YsVXR3hzd62APg /sxzuvc1GHFpdUBpAoXfNhirjyL6dqYG+tM/7YjfmONJd8klAxYd4EBV/kB08ZZU1zJs mZQ8EA2sD7vg4QEG029sTt5EinGAkYg2pnfTrQvzDfP+/ZeGGozfMmqaDwBoGbnhgyh1 SrMXj2Cwxh7uO2WGoYAKgUp8nLnl+UHJYZU4DgwXBgNNMXErJigcyv6mWdJPWYw9nCx7 Tq80K5klrj7ZU8D/Sk2KQMnNxZDAGux+573i3xSWlXw31ajSmMOmS+MQ9W7DCYE26gRf mHHg== 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=pS3gEZRMWOaWak1qsS38oc8ZE/M7wQ+w6QdzWBH2Aio=; fh=4u/c2NXRKQFGmORD9593hqU0qV4lyoIHSldniogVCFE=; b=JhT1DDno+AxynVnD4WXSQZ+bw+u9CaeoZtciy0okhtWsaGlDweb6CV05Pvr5lCoNV8 fgXVIG9AlOJxGoN9hM230GwCI671ACwQoMtGV8pqU4GFme+Ce43gZo5hLsj2+t2WRWAa 7lE7ZA3CD7W401AyBkqk13XIo34HPF6Ip4VfQKm7H6PLYh3PxCVmc2iDGC5+nhzKFD4I wFhK2B4aIOAHHYBlaeISRPQIqiPIfcI75+VMvJ75WWoTDky9mD+dnmwEp/q2U6bUgdC5 EbiFEu1IqKDKD7NHcBBvwUiemlqMuMrc3w23+gou6y7djGZeKZYyFpY1gP1CY+vxaatB Opvw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pJT0Cn3G; 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 6a1803df08f44-6eb3eff3834si89719316d6.215.2025.03.24.22.08.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Mar 2025 22:08:14 -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=pJT0Cn3G; 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 1twwPN-0004wP-6H; Tue, 25 Mar 2025 01:01:08 -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 1twwO5-0003ys-Kw for qemu-devel@nongnu.org; Tue, 25 Mar 2025 00:59:42 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1twwO3-0005vM-OF for qemu-devel@nongnu.org; Tue, 25 Mar 2025 00:59:41 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-2243803b776so28232315ad.0 for ; Mon, 24 Mar 2025 21:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742878778; x=1743483578; 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=pS3gEZRMWOaWak1qsS38oc8ZE/M7wQ+w6QdzWBH2Aio=; b=pJT0Cn3GcOQjBJcfNXqq8dZaHUNzt2eWdx8i2HefCFVACg8MHGwls2cYDz0ChVVJZ7 S7jEscajIhYiPc+iUxhSCDZR6w8AnHTobEMPHaLv02iBcYy4IRPEUafJjtcytd8v+bTA mHMiek7xHtmyFmG991H/JuwP+FFbOKXC7HkyVQKpyMBfSm2EWT7FrcR/rsmPVrR5z7Sx oTsE008ZnzZyrkX698wbfk0z05UnDg1uG6ttVpBMICFWUqW4vm75KOJIvoPT0srk9qwg znzTErjLOLll3xIeIqWSf+Zj+fNCF4Z9CZwZo92ovsVoadQ1BCrzMYkrZH3twqY2q1ih 0IzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742878778; x=1743483578; 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=pS3gEZRMWOaWak1qsS38oc8ZE/M7wQ+w6QdzWBH2Aio=; b=EwPDePBYOKygF0Ja27lGhX5H5VqPpzC5vEZZNN8AUko2m2H7pyQbnJwjjvSSkkOFYl Facbn9Kv7GyAih1V2ekc/gBL3UDxm6GY/wWXQWAuL2bVd4NC5YFwZrSrzPwiYXIqODrN /Z6fRxp2JtqIfgh5kWfHthzBnClAenMwLiNdQcjK5Xf7Xkk+j1/i3lmUcblU0jhxPJOI P0aJMv5czv8Omi11d668EmfadR/sJCvzJySoJshGvDLE4v8Bn2Nz7poQUulLirmFDDzB xVTSdLkxeqzOHcJJ57fRgKnkmKjVVjyB73RpCKTxCCMOxNoNF98/S7dEqtamyQ2viV44 zLMQ== X-Gm-Message-State: AOJu0YyO2NNNpasrqcfoACSACWfuX2wcARlZsyCQ5v9U7tLfEtwiDN3W h3L7d80LJ5FdB1BZFibSbKhV2w1Ba+UT20NzAilL+4CWoXL/5spQgTMUmjTEwjEErekTRG8w7MN c X-Gm-Gg: ASbGncvvkM26AkTdpct2xvHEnBwp/cE3GX2agjg71DJLpiCcRE69AZTsBSrreQ4+lCw vY5KTJOvhPdVD7j8fv6dkHjLU4c5TRyARjewnARgmjSDFY7+bndXPGhYDxRItlsVq7PyLBaedIR tQ3CRbkpyyCgCQniy/oaQbL+r3XX5WOp8rdTcQuEhvRPKNOzetPXxOQN+fkrzev5bPH/WG9Wjm5 yqROl74V/KAIzb/+IEEXn6WW8kDJ5V6PLQMZpkwXh8CeDVUzjW3WEb9wDcCSOrY9L8m5tCVnOvN 0FRZCrYdFQ/AimBMFAnZPMGiOc3bj2F9INfjx0whupEQ X-Received: by 2002:a17:902:f64e:b0:220:c067:7be0 with SMTP id d9443c01a7336-22780c50a94mr237157895ad.6.1742878777836; Mon, 24 Mar 2025 21:59:37 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-301bf58b413sm14595120a91.13.2025.03.24.21.59.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Mar 2025 21:59:37 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier Subject: [PATCH v3 17/29] accel/kvm: move KVM_HAVE_MCE_INJECTION define to kvm-all.c Date: Mon, 24 Mar 2025 21:59:02 -0700 Message-Id: <20250325045915.994760-18-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250325045915.994760-1-pierrick.bouvier@linaro.org> References: <20250325045915.994760-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62b.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. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- 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. */