From: sashiko-bot@kernel.org
To: "Steffen Eiden" <seiden@linux.ibm.com>
Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org,
linux-s390@vger.kernel.org, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH 07/12] KVM: s390: arm64: Enable full smccc support
Date: Wed, 02 Dec 2026 14:35:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-245966@kernel.org> (raw)
In-Reply-To: <20261202-smccc-v1-7-48340e2737b6@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] KVM: s390: arm64: unclamped kvm->max_vcpus in
kvm_arch_init_vm()
- [Low] KVM: s390: arm64: misplaced case blocks in kvm_arch_vm_ioctl()
--
commit 531ac05785ece0e3573d8628fd57758de85eef37
Author: Steffen Eiden <seiden@linux.ibm.com>
KVM: s390: arm64: Enable full smccc support
This commit enables SMCCC, PSCI, PV time, and TRNG support for arm64
guests on s390 by wiring up the shared arm64 hypercall handling code.
> diff --git a/arch/s390/kvm/arm64/arm.c b/arch/s390/kvm/arm64/arm.c
> index 483f29665524f..7212ea1fc1419 100644
> --- a/arch/s390/kvm/arm64/arm.c
> +++ b/arch/s390/kvm/arm64/arm.c
> @@ -44,7 +46,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
> case KVM_CAP_NR_VCPUS:
> case KVM_CAP_MAX_VCPUS:
> case KVM_CAP_MAX_VCPU_ID:
> - ret = KVM_MAX_VCPUS;
> + ret = min(kvm_sae_max_vcpus(), KVM_MAX_VCPUS);
> break;
[ ... ]
> @@ -154,6 +161,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
>
> kvm->arch.epd = ptff_qagto(0);
>
> + kvm_arm_init_hypercalls(kvm);
> +
> VM_EVENT(kvm, 3, "vm created with type %lu", type);
> return 0;
>
> @@ -180,6 +189,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
> kvm_destroy_vcpus(kvm);
> debug_unregister(kvm->arch.dbf);
> kvm->arch.gmap = gmap_put(kvm->arch.gmap);
> + kvm_arm_teardown_hypercalls(kvm);
> }
>
> u32 get_kvm_ipa_limit(void)
> @@ -189,6 +199,9 @@ u32 get_kvm_ipa_limit(void)
>
> int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
> {
> + if (id >= kvm->max_vcpus)
> + return -EINVAL;
> +
> return 0;
> }
[Severity: Medium]
Should kvm_arch_init_vm() clamp kvm->max_vcpus to
min(kvm_sae_max_vcpus(), KVM_MAX_VCPUS)?
kvm_create_vm() initializes kvm->max_vcpus to KVM_MAX_VCPUS (now 8) before
calling kvm_arch_init_vm(). Because kvm_arch_init_vm() never updates
kvm->max_vcpus, both kvm_vm_ioctl_create_vcpu() and
kvm_arch_vcpu_precreate() check against 8 instead of the hardware limit
reported by kvm_sae_max_vcpus(), allowing userspace to create vCPUs past
the hardware limit on systems where kvm_sae_max_vcpus() < 8.
[ ... ]
> @@ -799,6 +856,19 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
> return -EFAULT;
>
> return 0;
> + case KVM_HAS_DEVICE_ATTR: {
> + if (copy_from_user(&attr, argp, sizeof(attr)))
> + return -EFAULT;
> +
> + return kvm_vm_has_attr(kvm, &attr);
> + }
> + case KVM_SET_DEVICE_ATTR: {
> + if (copy_from_user(&attr, argp, sizeof(attr)))
> + return -EFAULT;
> +
> + return kvm_vm_set_attr(kvm, &attr);
> + }
> +
> }
>
> default:
[Severity: Low]
This isn't a bug, but case KVM_HAS_DEVICE_ATTR and case KVM_SET_DEVICE_ATTR
are placed inside the compound block opened by case
KVM_ARM_PREFERRED_TARGET, jumping into the scope of init rather than after
the closing brace of KVM_ARM_PREFERRED_TARGET.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-smccc-v1-0-48340e2737b6@linux.ibm.com?part=7
next prev parent reply other threads:[~2026-12-02 14:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 14:11 [PATCH 00/12] KVM: s390: arm64: SMCCC, timers and IRQ line Steffen Eiden
2026-12-02 14:11 ` [PATCH 01/12] arm64: Prepare for sharing with s390 Steffen Eiden
2026-12-02 14:11 ` [PATCH 02/12] arm64: Share timer and smccc functionality " Steffen Eiden
2026-12-02 14:11 ` [PATCH 03/12] KVM: arm64: Share timer and smccc code " Steffen Eiden
2026-12-02 14:11 ` [PATCH 04/12] KVM: s390: arm64: Use register shadow helper Steffen Eiden
2026-12-02 14:11 ` [PATCH 05/12] KVM: s390: arm64: Shadow the guest timer CVAL registers Steffen Eiden
2026-12-02 14:11 ` [PATCH 06/12] KVM: s390: arm64: Use mpstate for guests Steffen Eiden
2026-12-02 14:11 ` [PATCH 07/12] KVM: s390: arm64: Enable full smccc support Steffen Eiden
2026-12-02 14:35 ` sashiko-bot [this message]
2026-12-02 14:11 ` [PATCH 08/12] KVM: s390: arm64: Report fwregs to userspace Steffen Eiden
2026-12-02 14:11 ` [PATCH 09/12] KVM: s390: arm64: Provide timer infrastructure Steffen Eiden
2026-12-02 14:26 ` sashiko-bot
2026-12-02 14:11 ` [PATCH 10/12] KVM: s390: arm64: Integrate guest timer Steffen Eiden
2026-12-02 14:34 ` sashiko-bot
2026-12-02 14:11 ` [PATCH 11/12] KVM: s390: arm64: Trap WFx Steffen Eiden
2026-12-02 14:11 ` [PATCH 12/12] KVM: s390: arm64: Add IRQ line Steffen Eiden
2026-12-02 14:54 ` sashiko-bot
2026-12-02 14:54 ` [PATCH 00/12] KVM: s390: arm64: SMCCC, timers and " sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-245966@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-s390@vger.kernel.org \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=seiden@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.