From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.74]) (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 F41A13624A8 for ; Thu, 18 Jun 2026 09:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781773296; cv=none; b=Eo9ORjAGRobSn7tZJ1sOCYTyX+GE4R4rtLOkkZrhF90ilwVvI82rohxpNO8Gd0xIXN0dEOgytFtKxYCtIhKixomAJcRILcTuO8avqbkW1MibmECaRkUKzZRiwctOu7bjCLx60+mps5tc5CPTpShri31U8nXQ8Qgl1Xm77Sp/HJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781773296; c=relaxed/simple; bh=YCUIMNpaFUzUAEyV0dBpCjC+oTFCOiPvsCFjJzX+osw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=FLf7Si4J0xV1gP6wag8ExeEyl06oo9A6/5kjaowdROk4ifA4NNfJGTWrB9fR0XId8p3dwCjsfNtYHCCewFzCjGlTWxX8h3tN37lm4ptqFRaQ/QpE5+ulKRGGUGSzaK+soFkhzckO7sZaI7i4vYIv50RZiIgNVCU5q0/vMUwbDYE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--tabba.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CTO90Zik; arc=none smtp.client-ip=209.85.218.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--tabba.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CTO90Zik" Received: by mail-ej1-f74.google.com with SMTP id a640c23a62f3a-c081f1976d2so9839066b.2 for ; Thu, 18 Jun 2026 02:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781773293; x=1782378093; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Qac8FDS3yeT2+4VM8TKuhIc6uI5EZlyUNr1jGR9SzEs=; b=CTO90Zikn9ae6HYn1wbBg+zTVn9Yjm2HfMALrypvZW/paDM1IUhoJ3x9ASKyPdnr9J 6XAMJES2MA0heOL+fri+45aPFcu5F/qXFLmRjoithzQB0TWLN5SjwMdi9qGKemJy79aD eDEKLm9dNTpXeMXvWcqmRndEyaAV7CNG+XyXFjjnnCR/YXwtSFaPhFHWN+Q2iZLNvNSr Dbxb3hZjINA2PpRSje2uxSMad3g5iYPjVsJ/alt92LcFRh7J/DNQReMKEcGIk3LT+djy l0nNzFVwrAW7hN01IHWwbZG1E4sF+S9k6NNwCcWobAf04UO17Nt2W+ah3YcO26PUn3lc 4i/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781773293; x=1782378093; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Qac8FDS3yeT2+4VM8TKuhIc6uI5EZlyUNr1jGR9SzEs=; b=G8lp/L3SwDvYxA/77qybVtsowoIyM3IMusaP4+uxDhlbxnAIMP+2DqhTKmkFZ5hpck emlUbeV27OTDAaWsarzdCNBxMAfgGRcWenJCDlQ9k9nlIThKqNJaYCbtW/9gqI5XdV9N FOOFdrGkiAxpFszqeVA9i/aVne2JLjNSgIUNET6vvecr8Tb2/5c3jwoQrOVT8n7IeUNG xzCSVona3R770dGGj2r63cmActHdcNWZ/Q2CDyeqUoC28Deu5dlnvXMQ+icC+vu2qjjq yk92BbCjs646Dq5ZF033/oCvmYdvJobmqZfZ/UzGakPELDsjUE5mdFNSN7sp2UVE5ljB BelA== X-Forwarded-Encrypted: i=1; AFNElJ+KMYyqa80rrINmPGmtdjEWg7mDYZlWNLbsdn1xIHAtsCp2pLtjqUacXoqMh5wbVvDDsVwqRyP5oRKVrOA=@vger.kernel.org X-Gm-Message-State: AOJu0Yyh4Htl3rkydO22SwaAri0ShhfLHJpdlmuCsoB/Gq2plVW5rWz8 NNWErhthU3HC4SRU/8o8dm+FN690pqA1usnGfzD3XuTE/pw0venOmziqqF8xh4Rn99RI+BEynHN Gvw== X-Received: from wrbfu2.prod.google.com ([2002:a05:6000:25e2:b0:461:e741:9a7]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a17:907:26cb:b0:bd0:df77:98bb with SMTP id a640c23a62f3a-c05a1f461femr458002566b.9.1781773292698; Thu, 18 Jun 2026 02:01:32 -0700 (PDT) Date: Thu, 18 Jun 2026 10:01:27 +0100 In-Reply-To: <20260618090128.3913688-1-tabba@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260618090128.3913688-1-tabba@google.com> X-Mailer: git-send-email 2.54.0.1189.g8c84645362-goog Message-ID: <20260618090128.3913688-3-tabba@google.com> Subject: [PATCH 2/3] KVM: arm64: Remove unreachable early checks in pkvm_init_host_vm() From: Fuad Tabba To: Marc Zyngier , Oliver Upton , Catalin Marinas , Will Deacon Cc: Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Vincent Donnefort , Keir Fraser , Hyunwoo Kim , Fuad Tabba , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" pkvm_init_host_vm() runs once from kvm_arch_init_vm(), while the VM is still being allocated and is not yet reachable by another thread. Both early checks therefore test impossible state: is_created is still false (it is only set on first vCPU run) and the handle is still zero (this function is what reserves it). Neither branch can be taken. Remove them. Signed-off-by: Fuad Tabba --- arch/arm64/kvm/pkvm.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/arm64/kvm/pkvm.c b/arch/arm64/kvm/pkvm.c index 053e4f733e4b..67b90a58fbea 100644 --- a/arch/arm64/kvm/pkvm.c +++ b/arch/arm64/kvm/pkvm.c @@ -230,13 +230,6 @@ int pkvm_init_host_vm(struct kvm *kvm, unsigned long type) int ret; bool protected = type & KVM_VM_TYPE_ARM_PROTECTED; - if (pkvm_hyp_vm_is_created(kvm)) - return -EINVAL; - - /* VM is already reserved, no need to proceed. */ - if (kvm->arch.pkvm.handle) - return 0; - /* Reserve the VM in hyp and obtain a hyp handle for the VM. */ ret = kvm_call_hyp_nvhe(__pkvm_reserve_vm); if (ret < 0) -- 2.54.0.1189.g8c84645362-goog