From patchwork Thu Sep 14 01:55:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13384096 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88E54EE0217 for ; Thu, 14 Sep 2023 01:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID :References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=09Isw3jebV91dSMfpCmqR9ro8JtS6J1+NA6nek+VS8E=; b=GuN//uiLSejcIC o5lczQFulsIQghFmRX1CNRdBmTm4PorFdKQHLiU8gS4vlNp0KVTms3vb70QRILwpgRz9Wj4aeCPBM DolZocQTUi0VCoUdNqiqtTSUjfPDBbF3SaKxhPw59I+h2HvCnCuDsRZ3q8kJnBR1OUU9GP5g0ni2s 1fEQ1BPhYd7ulFM+4FtjzOl8a2LDlE1XYB622g73gUpU4pL4dt0ZRTBpMdlZJF5SEV86X6kUYHm9T JMzclftfujdrBEQ1VnSNAsEQxMbaXUN6rIRjPZqNqLMAtmCuJCKEMFcMEDJoVnam8CzF1hJza6agS cMpxTN727AIgOcpTpDkw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgbaV-0073FS-2i; Thu, 14 Sep 2023 01:56:11 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgba5-0072ko-0m for linux-arm-kernel@lists.infradead.org; Thu, 14 Sep 2023 01:55:49 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-58fc7afa4beso6729657b3.2 for ; Wed, 13 Sep 2023 18:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694656544; x=1695261344; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=5olfKKfAgOBEIWorNeGA6oMvbpwHV/k+KeYKQRUdq04=; b=xGgPdrApNNsYcbj3CG+T6beOVHOS8VkhZhCErrKC8Pv31bcB6pnu8sgWznYKJ4V31T KxpAULCIJZCWYds4kS4gnbOBGu1cTWSsumdg8sySCIIL0gA8IxV26Fdlf4GFwGt4ft94 V/lN7jfmMHmXUxNpqYXsMqy/27P798mZN3KNPWoyyBlUidRx/8+jvag2kfX5mb4bPTU3 xWTqptQs0t7ew1fPk53Jhw8DM4eNcXpZtrGbdPkEdkXbJIcyX2A2qUtuFOxkN3LfRkDA ToLfOhHU3mRqcxOzLJ/6FzgXxQ+70nJ5N+yrUyKNMr2F5e0Pi2AebaSxfu6qph5toeoX Zg4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694656544; x=1695261344; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5olfKKfAgOBEIWorNeGA6oMvbpwHV/k+KeYKQRUdq04=; b=AqlaaG+wZ8Tih5c+m/8KgdJzhh8Im/V+S20DOkrs7ykkZeE4g0LJTEMrqONXT21Y4s 2k591r1oQo2QtZXwX6XJFpx6QgBDSbTYCfOlB3uHtU4OrJMbpx+Pj7GocpRvE0Wf1yxw nOpcvadXi0atVUPTWkBBlSjqCfcu9wQUX75dlIPmFlR1P1IIhG4PkNWNCl79cG3IH/rY vwHwKmS9p8HTiskwy0AHBy68+ZuUc042pQRYvwSZd/os4fTAq/UKvtCEfHM4YqVSBXkF Wq0l3TWfiUBv5R/zr4bxAGlzEI3aM/JFS1hvnlY64vrrbdlEduSunUt/z7FXRvk+Eh4B amJQ== X-Gm-Message-State: AOJu0YyQdd2nmxUfebRIjwyJdp22lv29u/gFAD+mvrKacGS/qfJZa0Cu TaCozUcdaRAJlqGIzBcwCAUaSbR023U= X-Google-Smtp-Source: AGHT+IFAWDIKY3pID0CrDZgtjj2bXptPteu0k42w51y6Ps+oH46knUj2OnzhEQTEbd0IbAu5MzXei5K4JBI= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:684:b0:d81:8e4d:b681 with SMTP id i4-20020a056902068400b00d818e4db681mr15248ybt.12.1694656543919; Wed, 13 Sep 2023 18:55:43 -0700 (PDT) Date: Wed, 13 Sep 2023 18:55:02 -0700 In-Reply-To: <20230914015531.1419405-1-seanjc@google.com> Mime-Version: 1.0 References: <20230914015531.1419405-1-seanjc@google.com> X-Mailer: git-send-email 2.42.0.283.g2d96d420d3-goog Message-ID: <20230914015531.1419405-5-seanjc@google.com> Subject: [RFC PATCH v12 04/33] KVM: PPC: Return '1' unconditionally for KVM_CAP_SYNC_MMU From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Sean Christopherson , "Matthew Wilcox (Oracle)" , Andrew Morton , Paul Moore , James Morris , "Serge E. Hallyn" Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Fuad Tabba , Jarkko Sakkinen , Anish Moorthy , Yu Zhang , Isaku Yamahata , Xu Yilun , Vlastimil Babka , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_185545_312091_39EC8B51 X-CRM114-Status: GOOD ( 10.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Advertise that KVM's MMU is synchronized with the primary MMU for all flavors of PPC KVM support, i.e. advertise that the MMU is synchronized when CONFIG_KVM_BOOK3S_HV_POSSIBLE=y but the VM is not using hypervisor mode (a.k.a. PR VMs). PR VMs, via kvm_unmap_gfn_range_pr(), do the right thing for mmu_notifier invalidation events, and more tellingly, KVM returns '1' for KVM_CAP_SYNC_MMU when CONFIG_KVM_BOOK3S_HV_POSSIBLE=n and CONFIG_KVM_BOOK3S_PR_POSSIBLE=y, i.e. KVM already advertises a synchronized MMU for PR VMs, just not when CONFIG_KVM_BOOK3S_HV_POSSIBLE=y. Suggested-by: Paolo Bonzini Signed-off-by: Sean Christopherson --- arch/powerpc/kvm/powerpc.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index b0a512ede764..8d3ec483bc2b 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -635,11 +635,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) #if !defined(CONFIG_MMU_NOTIFIER) || !defined(KVM_ARCH_WANT_MMU_NOTIFIER) BUILD_BUG(); #endif -#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE - r = hv_enabled; -#else r = 1; -#endif break; #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE case KVM_CAP_PPC_HTAB_FD: