From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 C42113D522C for ; Wed, 3 Jun 2026 15:24:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780500261; cv=none; b=qnbeSi28HJ1kt901hOsT7ANm8pyLZNGvfuD2Ixb60oJikitfN3NjhziOEPMD2eZAKJoMEbC/RrSUKp/SSSKD/Ed6ZJaFnWgDpS34HWVGUWTVP9SaUkMzev6FtH4tYC6t/UAwwMlg4Z5TCiQkawYhnPgjcwNRK5ah0hD0Oe3k3Bo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780500261; c=relaxed/simple; bh=y2MzPoG0MBmV9/S2CGOi17yiKJyXbHXPrURfp3Atgkc=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:References; b=jUpsUZV0USyU1/yFoU3zLlCiafNeYX38Dv9GyfZbeljzEr8WL77H40+zZt2QTbZ509P8nb5KHFrBnXEKRczSdQgw/eG/Mketwq7HQtTQuypopD5elu6wldgQiwD8Y3nK9pk8CYjAeNQG7fREQtQc+3jfFKDCuCpVe7U03uL1t5s= 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=n+ZSKX4Z; arc=none smtp.client-ip=209.85.215.176 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="n+ZSKX4Z" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-c8584e80d59so1956275a12.2 for ; Wed, 03 Jun 2026 08:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780500259; x=1781105059; darn=vger.kernel.org; h=references:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=acwBnprFgwqGQFKcy6Zu5y1vKCe+2/zpivoZrYetfHk=; b=n+ZSKX4ZO6fXZWVJSLJCCrokYWO2iillfnIsrkhOqSFVlrdcKMjqoIe79+KCX+34bd 8CUXsh9ne1F7TyOtZ+mZocplQ+K+GEvo/N3CdkxOWe486ftFobP8i+ccQckIzlnpMmIM mWO1IkO7n89CKudClVO1Uxackh7QON0sX3F3BhiYc5eJvXx4eXLI3xMkG8UMwUgFw6Oc 8sfX8vJ4WqiXyz//Cy5iy/K4i/Ocgz+SB1Uske50mTjWHcW5NL8W0ZRJDVXPkk2y2FvN Y1gIfVWXa9MfHZnmWIbfHss0NFmIVo/TZpl4osk9azJhAjtlyAfdl38yJewkUI58rD2K 37uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780500259; x=1781105059; h=references:message-id:date:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=acwBnprFgwqGQFKcy6Zu5y1vKCe+2/zpivoZrYetfHk=; b=KUQwLgZUHCGQbDXuZH8xeqYdOmCIXep1h85IGN4g23F+cvhGwM5DfreDm7z4DYtLz3 E/6VLidgv+WKqwNvoaBbkDIqV829HCMhFNz84jTt/JKewlrg7fimcnSFb/NIJusqMXwj fyEDixsw2hCPHk8SwsDa+SiqeQEbPz1ODiq7EDlUOaX3DT5jjEyBCTpWDsytFXZCUBBB 1JEvpMI8Hs7+xDtdo+JNZgd6+ZRZU+xb3/lEKv8POKzQRAHab7I+CMHAdBlCBhR/PJtA Y2eWdNHgRu6ILl1Hzf34cpXQVWN5rRj+I5t44cF90DPkUo6nwc+iKTHvEy6BnWn21NCe pxEQ== X-Forwarded-Encrypted: i=1; AFNElJ+KIZvFi/oqp56wSXHttBZdu2WBa+ierB6htygABbjBgfs9vHlqgWvzPRaKRfHQohczdC++NOr7AaWn9eU=@vger.kernel.org X-Gm-Message-State: AOJu0YwOd+75Zk8kCWcZFRh0dd5MJTu+6rIynSjxcR/LNtU0CqMeP0f5 G5vU8FPm2hOmRakKB9MvdauuG+qcUMUK+nakxHPq/V4bkN+7imMoQmwIldF4mLdg X-Gm-Gg: Acq92OHdwjJcNbyhUL+KfmadAjziWpOBz7jrnDVG4aCYRk7OgwArFk5EJv00uMKYTeG Z4aqKpvZlKXAzPqyJWaZxNmpVxaTQRDmAtQqcDureoBFhuVDntZM+Jh2v65K0NjphflpDCd3aq+ qvo33VvI+Y84kr4tGwVcIfK0vorKEdIr1maPegE+hdmbz/OwWYU5I1SkrqTDqgQKYv4pc7JtU+D WfdRtxY9aKqbD6SHPzcNI0DadITsoZqMmkLgLwSH/4Bp47U1Oxp17jAxSDyD/jGlu5tTscoZ8s4 U0gfLn7VY2bbBAT+VoK0IHerxhzQ2e9XPSN27Ab2GG8UL0o0Tg+JR+sIEtpZUY0yjvmEPiZ2kLB wz1rYtQq84m5U8uMj18jZ6azwUtMzMv4TYfrPx9rcGCsiUfXgP6P8KJGYyKW7NnDkEHg6SizLXO oXi/PTcOHW76HbqoJy1jhaH3YHmctrMKCw X-Received: by 2002:a05:6a21:691:b0:3a2:d68d:9e78 with SMTP id adf61e73a8af0-3b49732971emr4778730637.4.1780500258903; Wed, 03 Jun 2026 08:24:18 -0700 (PDT) Received: from pve-server ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85df043ce0sm2671767a12.11.2026.06.03.08.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 08:24:18 -0700 (PDT) From: Ritesh Harjani (IBM) To: Amit Machhiwal , linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan Cc: Amit Machhiwal , Vaibhav Jain , Harsh Prateek Bora , Anushree Mathur , Nicholas Piggin , Michael Ellerman , "Christophe Leroy (CS GROUP)" , kvm@vger.kernel.org, stable@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: PPC: Book3S HV: Validate arch_compat against host compatibility mode In-Reply-To: <20260603141539.47620-1-amachhiw@linux.ibm.com> Date: Wed, 03 Jun 2026 20:41:15 +0530 Message-ID: References: <20260603141539.47620-1-amachhiw@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Amit Machhiwal writes: > On IBM POWER systems, newer processor generations can operate in > compatibility modes corresponding to earlier generations. This becomes > relevant for nested virtualization, where nested KVM guests may need to > run with a specific processor compatibility level. > > Currently, when running a nested KVM guest (L2) inside a Power11 pSeries > logical partition (L1) booted in Power10 compatibility mode, the guest > fails to boot while setting 'arch_compat'. This happens because the CPU > class is derived from the hardware PVR (via mfspr()), which reflects the > physical processor generation (Power11), rather than the effective > compatibility mode (Power10). > > As a result, userspace may request a Power11 arch_compat for the L2 > guest. However, the L1 partition, running in Power10 compatibility, has > only negotiated support up to Power10 with the Power Hypervisor (L0). > When H_GUEST_SET_STATE is invoked with a Power11 Logical PVR, the > hypervisor rejects the request, leading to a late guest boot failure: > > KVM-NESTEDv2: couldn't set guest wide elements > [..KVM reg dump..] > Thanks! It make sense to return a proper error code to the user (VMM) while the VM/VCPU are being initialized, rather then the guest failing to boot with a weird error like this, at the time when kernel makes this H_GUEST_SET_STATE hcall. > This situation should be detected earlier. Rejecting unsupported > 'arch_compat' values in 'kvmppc_set_arch_compat()' avoids issuing an > invalid H_GUEST_SET_STATE hcall and provides a clearer failure mode. > > Add a check to reject Power11 'arch_compat' requests when the host is > running in Power10 compatibility mode, returning -EINVAL early instead > of deferring the failure to the hypervisor. > > Suggested-by: Vaibhav Jain > Tested-by: Anushree Mathur > Cc: # v6.13+ Sure, v6.13 sounds fair as you pointed out. > Signed-off-by: Amit Machhiwal > --- > Changelog: > > * Moved this patch out of the v3 series [1] as discussed here [2] > * Addressed below review comments from Ritesh: > - Based the PVR validation on cpu features > - Fixed hcall name typo > - Stable backport The changes looks good to me. Please feel free to add: Reviewed-by: Ritesh Harjani (IBM)