[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZpZEjW1m2LypTHjF@google.com>
Date: Tue, 16 Jul 2024 10:59:41 +0100
From: Vincent Donnefort <vdonnefort@...gle.com>
To: Sebastian Ene <sebastianene@...gle.com>
Cc: akpm@...ux-foundation.org, alexghiti@...osinc.com, ankita@...dia.com,
ardb@...nel.org, catalin.marinas@....com,
christophe.leroy@...roup.eu, james.morse@....com,
mark.rutland@....com, maz@...nel.org, oliver.upton@...ux.dev,
rananta@...gle.com, ryan.roberts@....com, shahuang@...hat.com,
suzuki.poulose@....com, will@...nel.org, yuzenghui@...wei.com,
kvmarm@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v7 5/6] KVM: arm64: Initialize the ptdump parser with
stage-2 attributes
On Mon, Jul 01, 2024 at 02:18:39PM +0000, Sebastian Ene wrote:
> On Mon, Jul 01, 2024 at 09:42:43AM +0100, Vincent Donnefort wrote:
> > O Fri, Jun 21, 2024 at 12:32:29PM +0000, 'Sebastian Ene' via kernel-team wrote:
> > > Define a set of attributes used by the ptdump parser to display the
> > > properties of a guest memory region covered by a pagetable descriptor.
> > > Build a description of the pagetable levels and initialize the parser
> > > with this configuration.
> > >
> > > Signed-off-by: Sebastian Ene <sebastianene@...gle.com>
> > > ---
> > > arch/arm64/kvm/ptdump.c | 143 ++++++++++++++++++++++++++++++++++++++--
> > > 1 file changed, 137 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/arch/arm64/kvm/ptdump.c b/arch/arm64/kvm/ptdump.c
> > > index 36dc7662729f..cc1d4fdddc6e 100644
> > > --- a/arch/arm64/kvm/ptdump.c
> > > +++ b/arch/arm64/kvm/ptdump.c
> > > @@ -14,6 +14,61 @@
> > > #include <kvm_ptdump.h>
> > >
> > >
> > > +#define MARKERS_LEN (2)
> > > +#define KVM_PGTABLE_MAX_LEVELS (KVM_PGTABLE_LAST_LEVEL + 1)
> > > +
> > > +struct kvm_ptdump_guest_state {
> > > + struct kvm *kvm;
> > > + struct pg_state parser_state;
> > > + struct addr_marker ipa_marker[MARKERS_LEN];
> > > + struct pg_level level[KVM_PGTABLE_MAX_LEVELS];
> > > + struct ptdump_range range[MARKERS_LEN];
> > > +};
> > > +
> > > +static const struct prot_bits stage2_pte_bits[] = {
> > > + {
> > > + .mask = PTE_VALID,
> > > + .val = PTE_VALID,
> > > + .set = " ",
> > > + .clear = "F",
> > > + }, {
> > > + .mask = KVM_PTE_LEAF_ATTR_HI_S2_XN | PTE_VALID,
> > > + .val = KVM_PTE_LEAF_ATTR_HI_S2_XN | PTE_VALID,
KVM_PTE_LEAF_ATTR_HI_S2_XN is actually a mask covering
KVM_PTE_LEAF_ATTR_HI_S2_XN_XN, KVM_PTE_LEAF_ATTR_HI_S2_XN_PXN and
KVM_PTE_LEAF_ATTR_HI_S2_XN_UXN.
I believe here what we should do is something like?
.val = FIELD_PREP_CONST(KVM_PTE_LEAF_ATTR_HI_S2_XN,
KVM_PTE_LEAF_ATTR_HI_S2_XN_XN) | PTE_VALID
> > > + .set = "XN",
> > > + .clear = " ",
> > > + }, {
> > > + .mask = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_R | PTE_VALID,
> > > + .val = KVM_PTE_LEAF_ATTR_LO_S2_S2AP_R | PTE_VALID,
> > > + .set = "R",
> > > + .clear = " ",
> > > + }, {
[...]
Powered by blists - more mailing lists