From mboxrd@z Thu Jan 1 00:00:00 1970 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 CB6A2C2BD09 for ; Mon, 1 Jul 2024 14:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7Km1Ez8bnMs5MXCoo07hLRftaefO9zeRKQ+RQM7Ne4Q=; b=3Vc8p392BziaMDsnS0eJ8f8D2b 9NtKeM8/HTeOgIFe50OY11mBYw5okY8uwb7E5fssPdhJMI28FbhGc/qP885a851Ttf72qinokt0+V 0eT01x68o8uhqsoN08JZ5sGWOe1y9H41o0QXW8BQd16z10ZrybEMKtEpMPeTbCnnWD2fptdARFAXR V3j/1RMQKCCJimoHV8vpzJeJ+y1u7zRAyEAIYMTmrqgCi0Ww2oIRL6vGBMFfl/S2b+K4VTuzcLLvL fICz8UpeGqhGMdHm+IHgo/unnfuERzTCpGiZLTyhLGb4mUKLbWNtTvIB/T46ibIqCzxNoFApXJKcI n9qEWiHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOHkC-00000003f4t-3Pb1; Mon, 01 Jul 2024 14:11:00 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOHk0-00000003eyE-2eMs for linux-arm-kernel@lists.infradead.org; Mon, 01 Jul 2024 14:10:50 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-424a30255d3so88345e9.1 for ; Mon, 01 Jul 2024 07:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719843046; x=1720447846; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7Km1Ez8bnMs5MXCoo07hLRftaefO9zeRKQ+RQM7Ne4Q=; b=DbWjWvvNXccO7Xias/C7ehER/U9R7lN4YLnsu4t8Z7w2EBBKcM64iD40COAMPt7DO5 NAoboKIKKiVeQW1fzivOJTOFcysVEcG2l1xmKgV3JwVHZ0B8OI890ZyCAXQP/LGjkOlO StSOD4KU+TiaFcV1aPF8LuB/xEIJFXpVBbSn/sOsLv9PlaihPY3I9taHKMnI9d0Z8RLO NBsMyxV7u2ybwkXhysZ38QkNZGXYohwtx2DojsT6eEjUi8Qk7IUMTa5SYGxC+WRtvdut N7hIaeIMXxFvJLFuZfSzBhZyiCpsXQhQZnRo92on5LiQJRAvHNyqeDNUXHpzcLyhTZp4 gbdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719843046; x=1720447846; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7Km1Ez8bnMs5MXCoo07hLRftaefO9zeRKQ+RQM7Ne4Q=; b=W7dtc2ApLEw3J+y7R+vF/TqQw8SIJTtYWBQc27wuuZODrOfUU1iELWl/w1LA4N+xmb yamlYZTTSmty30rnOFP2DW849LK67GCl3d7eTfxynWkMJMOctJCDFj3e+jFWN9uPnmz1 W5LpETRr6ZHwvGfH36r/JysqRuvVc3lK1Hhrk3XjXZ5qX/yquStHI81ObeZr7SyJodCp LMr+zSvfIG27iK3RzPxqpSb/8Oj4vdTIFsHunjgDxsPYZGEQAM7KxLsBLKWM++Xsyaap Wc5dt5Vwl48VzOGeLQHQ30ub6kFCO23FyNmbm8jsiqcs3Kkyjz/rZh6kZ0UgKGaOGP6E 9x+w== X-Forwarded-Encrypted: i=1; AJvYcCW9YTPB+dZDfnkFFITxCaFOupu7FU3tf8B2seKrzbh6o9PTIYDEEcVS8m6tq+7XoafxKrph7jfTmiY/dv56qpzz14SI2jFo9IRoxemTXtv0zFn8mgs= X-Gm-Message-State: AOJu0YymU48SRGjOf9wZ2QJxHu7ZkjPmfEiN3uRq2RSm8ta3Yt7Z8oR2 vhmBKiOJqNx7tCayLwPT0ijKztsofHA+LsTyu1zNIdLiLQPaefEhgfQvjmpUyg== X-Google-Smtp-Source: AGHT+IFtjX/BZqS+uUZ8PF1mKp7f3Esb11KZRNUo9KxHrxIz4V1iA5bVnL0VunIlYUdBUZha4UJQBA== X-Received: by 2002:a05:600c:1c17:b0:422:ffac:f8c0 with SMTP id 5b1f17b1804b1-4257816691cmr3222955e9.7.1719843045852; Mon, 01 Jul 2024 07:10:45 -0700 (PDT) Received: from google.com (216.131.76.34.bc.googleusercontent.com. [34.76.131.216]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4256af55cccsm156205455e9.16.2024.07.01.07.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 07:10:45 -0700 (PDT) Date: Mon, 1 Jul 2024 14:10:43 +0000 From: Sebastian Ene To: Oliver Upton Cc: akpm@linux-foundation.org, alexghiti@rivosinc.com, ankita@nvidia.com, ardb@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, james.morse@arm.com, vdonnefort@google.com, mark.rutland@arm.com, maz@kernel.org, rananta@google.com, ryan.roberts@arm.com, shahuang@redhat.com, suzuki.poulose@arm.com, will@kernel.org, yuzenghui@huawei.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v7 6/6] KVM: arm64: Expose guest stage-2 pagetable config to debugfs Message-ID: References: <20240621123230.1085265-1-sebastianene@google.com> <20240621123230.1085265-7-sebastianene@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240701_071048_694641_D71EA257 X-CRM114-Status: GOOD ( 26.35 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jun 28, 2024 at 08:49:19PM +0000, Oliver Upton wrote: > On Fri, Jun 21, 2024 at 12:32:30PM +0000, Sebastian Ene wrote: > > Make the start level and the IPA bits properties available in the > > virtual machine debugfs directory. Make sure that the KVM structure > > doesn't disappear behind our back and keep a reference to the KVM struct > > while these files are opened. > > > > Signed-off-by: Sebastian Ene > > --- > > arch/arm64/kvm/ptdump.c | 50 +++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 50 insertions(+) > > > > diff --git a/arch/arm64/kvm/ptdump.c b/arch/arm64/kvm/ptdump.c > > index cc1d4fdddc6e..17649e3cbc8f 100644 > > --- a/arch/arm64/kvm/ptdump.c > > +++ b/arch/arm64/kvm/ptdump.c > > @@ -215,8 +215,58 @@ static const struct file_operations kvm_ptdump_guest_fops = { > > .release = kvm_ptdump_guest_close, > > }; > > > > +static int kvm_pgtable_debugfs_show(struct seq_file *m, void *unused) > > +{ > > + const struct file *file = m->file; > > + struct kvm_pgtable *pgtable = m->private; > > + > > + if (!strcmp(file_dentry(file)->d_iname, "ipa_range")) > > + seq_printf(m, "%2u\n", pgtable->ia_bits); > > + else if (!strcmp(file_dentry(file)->d_iname, "stage2_levels")) > > + seq_printf(m, "%1d\n", pgtable->start_level); > > The name of the file suggests sounds like this is the number of page > table levels instead of the starting level of the walk. > > So instead: > > seq_printf(m, "%1d\n", > KVM_PGTABLE_LAST_LEVEL - pgtable->start_level + 1); > Ack, I will rewrite this. > > + return 0; > > +} > > + > > +static int kvm_pgtable_debugfs_open(struct inode *m, struct file *file) > > +{ > > + struct kvm *kvm = m->i_private; > > + struct kvm_s2_mmu *mmu; > > + struct kvm_pgtable *pgtable; > > + int ret; > > + > > + if (!kvm_get_kvm_safe(kvm)) > > + return -ENOENT; > > + > > + mmu = &kvm->arch.mmu; > > + pgtable = mmu->pgt; > > nitpick: pgtable = &kvm->arch.mmu.pgt > Will fix this. Thanks, Seb > -- > Thanks, > Oliver > > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >