From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.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 D02D545DF67 for ; Tue, 18 Aug 2026 11:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787052574; cv=none; b=pKPQKyQtYoHtYkWwKgd8mjiG3Fygydlx5rUQStn+0/IGtnQrMleuq+DHzblQt3d0MyRdJoATn+WHZGbuVvud/+kyi412Qw+hO0vNz8i0Gs+SqQVht+MtqutkxC2sn1mHNxnnMyKrE2M0gvcIjiefrxxz6QTP4uizyET3iyBVY/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787052574; c=relaxed/simple; bh=mqinjzXhUcoLMkqFncjy3awDJ9xmqF05YJhAD3a/vfg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nP558W+PhxWhnYqtKQyLyvjZaoiYiT85wFUy1GTAt2At50apQPtlT3jW4iyV/08W2H5Z4t3dFrlDwz1hS32l1UwEPOPnvNuzG/qSbRnPUhUNwu+BW40tHB7y7HFzYRiX2Dvx3fzBBL5Vjj8S0eJ9IcHDCKCIBkIs4Xgn1GZuKP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cuwREm69; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cuwREm69" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-38125cebfdaso6503542a91.1 for ; Tue, 18 Aug 2026 04:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787052572; x=1787657372; 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:content-type; bh=TgcDc4oA52oVFhPCIzepFvLDOjJcdq190pOOMughMV4=; b=cuwREm69rJGFqpr1qi+yBHSfPAEeGrax/0f/PliGaisIAu7P34cC9nb2hN5xhXgR0a Mk6BLcwmZtnsOqI5LO17kFITeL494tthEZWIdnSPCiSrs44kFRaVZdxWIqYud+UWkhcI Gy5H7BeaGqfXMs/E4Zu1Pq9asVOCX5S+pIS6oLgZ+1BTkSMNKbDxvf8rd7CtKXEdiKTp G0OdCg2YihddcltGdPqctJ1IdHD8zlVC0DCWWwa/NBuB3AIQOxizyYQzaSNnJDM7cIFk ZBaQKBDDkYYP3D+jxcxHNZAeJcl8EvSQeMp1FM/bSm9HbAkiovs56UGjvEi5B1whrkut K5hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787052572; x=1787657372; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=TgcDc4oA52oVFhPCIzepFvLDOjJcdq190pOOMughMV4=; b=qJlqwWb2BbTWEgyfNq1e9ruku+8qykb+4lNKfB7vFqctCyYMb9QlK0SYXcLDTYza1A qktCmhRpN+Q0EK3Kb8ZfUKHOvW+dC7QOH2AzQLh8pwvIScQ4UtJ4EJk6fk4r7xrxWk+L mAWuKj3Yke5fI4tzRTQwutyO8x4y6Nl363FWzUCjIFLSNq4XDQGvV1eK2MzOL7hFSJOi UannYVQKeMc8fbPj1Op+d6rVHbGR+8xTUjvCc227i2MFMmHHrz+T71Tjey2BMYggQ3dv HNuJJfaT3htXRFRa/NjTeWuFavivaK1GBilJTDLb9aY1rqbX45tKR0Mqa5DDPhDXAT1Q /H3w== X-Forwarded-Encrypted: i=1; AHgh+RqANzSJUz9yQbVHtJEhzZTN73MlHSlQVb0bBWkhCLgpjiSiA4a8TZagQqUvzWJ6j+z9XaP9nodp9VEtGiY=@vger.kernel.org X-Gm-Message-State: AOJu0YwfBSpeXzP17MG1Yz6Ex9Z0XC9NnQJGuFUAslvr58dYwdFci9bA nVWnqnOHCoQQ/LL9MU8OSKp5r//VqW+FsWzlgRDOmI2W0Bc4mu3sSSlz X-Gm-Gg: AR+sD10QP9/tRFhAVeZ8S/Gsjpt1enW0r7ORXEtGtjJtI98DNyoIDSGpUexyzRuSLSn C7cJDjuRHYO9JlEUvcNEEZCJXiPJyeHtW9K8zqLD0Pd8dZdIuhpwTL/J37+Iq/tDYu/jmeayfel uMT/QRAuVmzi+aXTj8EUqKaGcl3tYhgr9I3vGiq3sd5jGJj7onMHLrxCL128PrCYIO1iCkBiygb rFCht7pqZW+DAM78opSE1H6KtQ7n9JBClg6xFX8wCX9bzaBz4lS90Onf1XfT0wQTysdEnh14RLF /1pop1KoECr2sGQrmgnf/nla1mDem8vysorQJan2hMAUqxpUSt9e+JPnAEU1olbrQT46ZnmYJPq qEJ5kL8Y84UL30uqnQ5/Kk1aj2vPeXz0iX4ISYnyyKZLd0yI/XWzEWaB0xWp9ZQ0n5nWl2BeKYr 6j4Pk2EFkByMpsNLm3N5SVitUHshdEINJnF1DlUYznqL47kyvvYBkQmrmLKymZowH4gtCFqhEEY D46Vf+l6kn0Y5U= X-Received: by 2002:a17:90b:48ce:b0:390:b41a:b92b with SMTP id 98e67ed59e1d1-3933b6d05c3mr37501585a91.4.1787052572199; Tue, 18 Aug 2026 04:29:32 -0700 (PDT) Received: from LIKEXU-MC4 ([43.132.141.24]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39531e31a9dsm8423420a91.4.2026.08.18.04.29.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 18 Aug 2026 04:29:31 -0700 (PDT) From: Like Xu X-Google-Original-From: Like Xu To: Marc Zyngier , Oliver Upton Cc: jiaqiyan@google.com, kvmarm@lists.linux.dev, Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] KVM: selftests: arm64: Skip sea_to_user when EINJ places no poison Date: Tue, 18 Aug 2026 19:29:20 +0800 Message-ID: <20260818112920.26252-4-likexu@tencent.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260818112920.26252-1-likexu@tencent.com> References: <20260818112920.26252-1-likexu@tencent.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit sea_to_user injects a memory UER with EINJ notrigger=1 and expects the guest to consume it and trap to KVM as an SEA. On some firmware the test aborts instead: arm64/sea_to_user.c:223: exit_reason == (41) Wanted KVM exit reason: 41 (ARM_SEA), got: 6 (MMIO) notrigger=1 asks firmware to arm the poison without consuming it, but on these platforms the poison is only armed as part of the trigger step that notrigger skips, so nothing consumable is left in memory. The guest reads back the sentinel, no SEA occurs, and GUEST_FAIL fires. On arm64 a ucall is delivered as an MMIO write, which surfaces as the KVM_EXIT_MMIO above rather than a KVM bug. The file already documents that the test must be skipped when firmware cannot deliver a consumable error. Detect the guest abort that follows a missing SEA and skip, instead of failing on a firmware limitation the test cannot control. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Like Xu --- .../testing/selftests/kvm/arm64/sea_to_user.c | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/arm64/sea_to_user.c b/tools/testing/selftests/kvm/arm64/sea_to_user.c index 7cf95da8e594d..d4af6e0eed288 100644 --- a/tools/testing/selftests/kvm/arm64/sea_to_user.c +++ b/tools/testing/selftests/kvm/arm64/sea_to_user.c @@ -215,13 +215,33 @@ static void run_vm(struct kvm_vm *vm, struct kvm_vcpu *vcpu) ksft_print_msg("Dump kvm_run info about KVM_EXIT_%s\n", exit_reason_str(run->exit_reason)); + + /* + * The guest's read of the injected location is expected to trap to KVM + * as an SEA. If it does not, the injected error was never placed as + * consumable poison: some firmware honours EINJ's notrigger request by + * arming the poison only as part of the (now skipped) trigger step, so + * nothing is left in memory for the guest to consume. The guest then + * reads back the sentinel value and reports it via GUEST_FAIL, which + * arm64 delivers as a ucall over MMIO (hence a KVM_EXIT_MMIO here). + * Treat that as "this platform cannot host the test" and skip, matching + * the requirement documented at the top of this file, rather than + * failing on a hardware/firmware limitation the test cannot control. + */ + if (run->exit_reason != KVM_EXIT_ARM_SEA && + get_ucall(vcpu, &uc) == UCALL_ABORT) { + ksft_print_msg("Guest consumed no SEA: %s", uc.buffer); + ksft_exit_skip("EINJ notrigger placed no consumable poison on this platform\n"); + } + + TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_ARM_SEA); + + /* arm_sea holds valid data only for a KVM_EXIT_ARM_SEA exit. */ ksft_print_msg("kvm_run.arm_sea: esr=%#llx, flags=%#llx\n", run->arm_sea.esr, run->arm_sea.flags); ksft_print_msg("kvm_run.arm_sea: gva=%#llx, gpa=%#llx\n", run->arm_sea.gva, run->arm_sea.gpa); - TEST_ASSERT_KVM_EXIT_REASON(vcpu, KVM_EXIT_ARM_SEA); - esr = run->arm_sea.esr; TEST_ASSERT_EQ(ESR_ELx_EC(esr), ESR_ELx_EC_DABT_LOW); TEST_ASSERT_EQ(esr & ESR_ELx_FSC_TYPE, ESR_ELx_FSC_EXTABT); -- 2.50.1 (Apple Git-155)