From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 05DD423AE87 for ; Fri, 7 Aug 2026 04:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786077174; cv=none; b=kZaEQSmRJwpJ3p5VRotUpelRqbnnyUZc2PJLegPchQJDK9k9E7cErkTXdnOb1XaULMmq5c1CNGiq8PTUuulO0QkToR2yfDmILw9qNWSShZr3IQ1XiEfrDBqRG+uhgc3/7pQEM51s7gV0ED0hlE1hmB47RYcQWDtS8BuzODxCVqU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786077174; c=relaxed/simple; bh=M3Lxbp9rzrBW5TCqXW/t/Ptj2VwgFqJHT6weFnFcgEk=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:References; b=YdkWmwiZ4fsZG/TCcry6yPvFnRyNCAmh/rq9hAV6n42veAYO0ETyiA3Hwv23uE4jcQ9rYMergR8JqrgmMC/MWVm2HL85EMqIfIfC+ubAK0fN3REHNjPwC+WyG9bRFRPr7QR9j9UJ3iknp32BJdXDenpuRKcUnIg9jlIl1Fdzb0A= 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=IW9/78tN; arc=none smtp.client-ip=209.85.214.180 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="IW9/78tN" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2caed617615so40756345ad.3 for ; Thu, 06 Aug 2026 21:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786077171; x=1786681971; 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:content-type; bh=Vkqjg35/cvh8GomrXzxAYhQLuU0mAPIeu9aJpH6Zlvc=; b=IW9/78tN9BAiO31trfDNiSFhqIiAI2IxSE/U8vcPevtcygNJeSkHRnv4Ht/WpJPSEW BGl6jyWRJGyk2msDmjB/8IJu2Y4EF+Mjrdp9XddAm9Wbg3TPkdMW74GW4QCuvmOfnQhZ FJlKCT0dL3W05frwPqri+TvN/VQXnURVK2lFgQMT3O6W6dZ91FZO3atN/+zn/jVr2T/F GKM5rFxkxr/T6UhTrKJCWaUIDbyrwexubEz40q0kqtJyLHvuIx9bD9HeBWZihT4/0s8c ZqXsn0NlS49A4AsVwnz/SIMu+R2Glso1H5VVw94nf4kcAFfEwg6QIwSYhc47tYdkCmNu 0h7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786077171; x=1786681971; 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 :content-type; bh=Vkqjg35/cvh8GomrXzxAYhQLuU0mAPIeu9aJpH6Zlvc=; b=OEnWHuZnhQ5ejwxeONMSJ/2pw6k+s3awAHQSjWwT/ODRyR8WQzlH1zoFkZXFPg1iTz 14MxAnUKHvE9WyvfD3JY7SHBAOWsqkvFL+Z/yjLCA1fhYm7z9MN5cjXU5Gy7EhOc36ni n3z8uo4sMIxQe6BI0juvLd0PJ1Zg/A/OMkTJAOiJp/bLSAQA7kWTZD2jtFca+Ps8jFu7 xCXputbAvK4mdqwUkj5SgRF3nUdTFbk7N8GifH6MkzJtqbZpcf/L3YGc8i5I5r+YoVxU ies7RKDlw++QUQSpNwPFZJ9AmNCjwgQWi31K8iVX8K42xv2VUcSV66Y4veo1x9uSjtqT 4ntg== X-Forwarded-Encrypted: i=1; AHgh+RpiCiHkvIW0YTQpWDsly9B0FWhxCWL7vMpMiQL5Kowe4nGJ79m8aiq3zDwNUZJzWVAgSM96X4Mdkxm1Zhk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw0+CqcOi61+LBt3orYleuqpetd7CW/2DcmdKSGjVtw5fCQ72qi e+pkmJv8iDVYmRytUUXa77U7GohPRjmm7wTx+ZP9dLtV6HMOJqkp8s+W X-Gm-Gg: AR+sD10X29Q0gAPCxRS5QJbdQSY2JrHSQ3BdTYI/l3ilz/PZCBCjfN3/OkleH1OkP22 F8VZQhNR387v2xaIrTjO1Pt9g41V7TQ4uI+qU49682q64JWeDgwkf5to8i/hAgZCcadj8HepCEO PnMFJht8qrIljGt3byW9EhAT68fA9UnJtW3nylXBXMu+6fjTggIuQMkNHbYDDcWuBeIHHb8LR8M d5oFQMRd5FV9VpEvxzz5Nz9PWg7Tf3nkmSUoE3/St80oYIERqKBj46qhY1340uCJZUXAgTDr28R C0rb4uzLu02as1suBCKbeWBUJdP2MX7VPoTonjn48QTkuA6NJaT5p23cX6wduiSAL/ZvdAVTfIN VaG4J9erZO3YEnrqsyg1+3ylLQ4nIBcH8VWIE4abXnxda/tyCk7v2Zgd3Su+c3M+2TzgNzAHKr+ 84rZgvMHSmgpYAH2kFMdUDNl8cNeYGpurKJToP5/Bd7y40AsYNHAjWA+SZ4VmP7hRTgMNAbg== X-Received: by 2002:a05:6a21:685:b0:3b3:1b38:d9c3 with SMTP id adf61e73a8af0-3cb85e99243mr23742133637.4.1786077171329; Thu, 06 Aug 2026 21:32:51 -0700 (PDT) Received: from pve-server ([49.205.216.49]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-315bebde353sm2604158eec.23.2026.08.06.21.32.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 21:32:50 -0700 (PDT) From: Ritesh Harjani (IBM) To: Amit Machhiwal , linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan Cc: Vaibhav Jain , Amit Machhiwal , Anushree Mathur , Paolo Bonzini , Nicholas Piggin , Michael Ellerman , "Christophe Leroy (CS GROUP)" , Jonathan Corbet , Shuah Khan , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Gautam Menghani Subject: Re: [PATCH v7 2/4] KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVM In-Reply-To: <20260806170645.11892-3-amachhiw@linux.ibm.com> Date: Fri, 07 Aug 2026 10:01:58 +0530 Message-ID: References: <20260806170645.11892-1-amachhiw@linux.ibm.com> <20260806170645.11892-3-amachhiw@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Amit Machhiwal writes: > On POWER systems, the host CPU may run in a compatibility mode (e.g., a > Power11 processor operating in Power10 compatibility mode). In such > cases, the effective CPU level exposed to guests differs from the > physical processor generation. > > When running nested KVM guests, QEMU derives the host CPU type using > mfpvr(), which reflects the physical processor version. This can result > in a mismatch between the CPU model selected by QEMU and the > compatibility mode enforced by the host, leading to guest boot failures. > > For example, booting a nested guest on a Power11 LPAR configured in > Power10 compatibility mode fails with: > > KVM-NESTEDv2: couldn't set guest wide elements > [..KVM reg dump..] > > This occurs because QEMU selects a CPU model corresponding to the > physical processor (via mfpvr()), while the host operates in a lower > compatibility mode. As a result, KVM rejects the requested compatibility > level during guest initialization. > > On pseries nestedv2 systems, add support for retrieving host CPU > compatibility capabilities for nested guests on PowerVM. The capability > bitmap reflects the processor modes negotiated between the Power > hypervisor (L0) and the host partition (L1) via the > H_GUEST_GET_CAPABILITIES hcall, but is retrieved from the cached > nested_capabilities value populated during module initialization, > avoiding repeated hypervisor calls. A WARN_ON_ONCE() flags the > unexpected case where nested_capabilities is zero on a nestedv2 system. > The implementation defines KVM-specific capability constants > (KVM_PPC_COMPAT_CAP_POWER9/10/11), masks unsupported bits, and exposes > the result through the KVM_PPC_GET_COMPAT_CAPS ioctl. > > Hook the implementation into the Book3S HV kvmppc_ops so that it can be > invoked by the generic KVM ioctl handling code. > > Suggested-by: Vaibhav Jain > Tested-by: Gautam Menghani > Reviewed-by: Gautam Menghani > Tested-by: Anushree Mathur > Signed-off-by: Amit Machhiwal > --- > arch/powerpc/include/uapi/asm/kvm.h | 10 ++++++++++ > arch/powerpc/kvm/book3s_hv.c | 20 ++++++++++++++++++++ > 2 files changed, 30 insertions(+) Looks good to me. Please feel free to add: Reviewed-by: Ritesh Harjani (IBM)