From: Michael Ellerman <mpe@ellerman.id.au>
To: Jordan Niethe <jniethe5@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: mikey@neuling.org, sbhat@linux.ibm.com, kvm@vger.kernel.org,
amachhiw@linux.vnet.ibm.com, Jordan Niethe <jniethe5@gmail.com>,
gautam@linux.ibm.com, npiggin@gmail.com, kvm-ppc@vger.kernel.org,
vaibhav@linux.ibm.com, kconsul@linux.vnet.ibm.com
Subject: Re: [PATCH v3 4/6] KVM: PPC: Book3s HV: Hold LPIDs in an unsigned long
Date: Thu, 17 Aug 2023 12:21:08 +0000 [thread overview]
Message-ID: <87a5upeu6j.fsf@mail.lhotse> (raw)
In-Reply-To: <20230807014553.1168699-5-jniethe5@gmail.com>
Jordan Niethe <jniethe5@gmail.com> writes:
> The LPID register is 32 bits long. The host keeps the lpids for each
> guest in an unsigned word struct kvm_arch. Currently, LPIDs are already
> limited by mmu_lpid_bits and KVM_MAX_NESTED_GUESTS_SHIFT.
>
> The nestedv2 API returns a 64 bit "Guest ID" to be used be the L1 host
> for each L2 guest. This value is used as an lpid, e.g. it is the
> parameter used by H_RPT_INVALIDATE. To minimize needless special casing
> it makes sense to keep this "Guest ID" in struct kvm_arch::lpid.
>
> This means that struct kvm_arch::lpid is too small so prepare for this
> and make it an unsigned long. This is not a problem for the KVM-HV and
> nestedv1 cases as their lpid values are already limited to valid ranges
> so in those contexts the lpid can be used as an unsigned word safely as
> needed.
>
> In the PAPR, the H_RPT_INVALIDATE pid/lpid parameter is already
> specified as an unsigned long so change pseries_rpt_invalidate() to
> match that. Update the callers of pseries_rpt_invalidate() to also take
> an unsigned long if they take an lpid value.
>
> Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
> ---
This needs:
diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c
index 709ebd578394..08e32b44ee32 100644
--- a/arch/powerpc/kvm/book3s_hv_uvmem.c
+++ b/arch/powerpc/kvm/book3s_hv_uvmem.c
@@ -857,7 +857,7 @@ unsigned long kvmppc_h_svm_init_done(struct kvm *kvm)
}
kvm->arch.secure_guest |= KVMPPC_SECURE_INIT_DONE;
- pr_info("LPID %d went secure\n", kvm->arch.lpid);
+ pr_info("LPID %lu went secure\n", kvm->arch.lpid);
out:
srcu_read_unlock(&kvm->srcu, srcu_idx);
cheers
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Jordan Niethe <jniethe5@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: mikey@neuling.org, sbhat@linux.ibm.com, kvm@vger.kernel.org,
amachhiw@linux.vnet.ibm.com, Jordan Niethe <jniethe5@gmail.com>,
gautam@linux.ibm.com, npiggin@gmail.com, kvm-ppc@vger.kernel.org,
vaibhav@linux.ibm.com, kconsul@linux.vnet.ibm.com
Subject: Re: [PATCH v3 4/6] KVM: PPC: Book3s HV: Hold LPIDs in an unsigned long
Date: Thu, 17 Aug 2023 22:21:08 +1000 [thread overview]
Message-ID: <87a5upeu6j.fsf@mail.lhotse> (raw)
In-Reply-To: <20230807014553.1168699-5-jniethe5@gmail.com>
Jordan Niethe <jniethe5@gmail.com> writes:
> The LPID register is 32 bits long. The host keeps the lpids for each
> guest in an unsigned word struct kvm_arch. Currently, LPIDs are already
> limited by mmu_lpid_bits and KVM_MAX_NESTED_GUESTS_SHIFT.
>
> The nestedv2 API returns a 64 bit "Guest ID" to be used be the L1 host
> for each L2 guest. This value is used as an lpid, e.g. it is the
> parameter used by H_RPT_INVALIDATE. To minimize needless special casing
> it makes sense to keep this "Guest ID" in struct kvm_arch::lpid.
>
> This means that struct kvm_arch::lpid is too small so prepare for this
> and make it an unsigned long. This is not a problem for the KVM-HV and
> nestedv1 cases as their lpid values are already limited to valid ranges
> so in those contexts the lpid can be used as an unsigned word safely as
> needed.
>
> In the PAPR, the H_RPT_INVALIDATE pid/lpid parameter is already
> specified as an unsigned long so change pseries_rpt_invalidate() to
> match that. Update the callers of pseries_rpt_invalidate() to also take
> an unsigned long if they take an lpid value.
>
> Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
> ---
This needs:
diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c
index 709ebd578394..08e32b44ee32 100644
--- a/arch/powerpc/kvm/book3s_hv_uvmem.c
+++ b/arch/powerpc/kvm/book3s_hv_uvmem.c
@@ -857,7 +857,7 @@ unsigned long kvmppc_h_svm_init_done(struct kvm *kvm)
}
kvm->arch.secure_guest |= KVMPPC_SECURE_INIT_DONE;
- pr_info("LPID %d went secure\n", kvm->arch.lpid);
+ pr_info("LPID %lu went secure\n", kvm->arch.lpid);
out:
srcu_read_unlock(&kvm->srcu, srcu_idx);
cheers
WARNING: multiple messages have this Message-ID (diff)
From: Michael Ellerman <mpe@ellerman.id.au>
To: Jordan Niethe <jniethe5@gmail.com>, linuxppc-dev@lists.ozlabs.org
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, npiggin@gmail.com,
mikey@neuling.org, paulus@ozlabs.org, vaibhav@linux.ibm.com,
sbhat@linux.ibm.com, gautam@linux.ibm.com,
kconsul@linux.vnet.ibm.com, amachhiw@linux.vnet.ibm.com,
Jordan Niethe <jniethe5@gmail.com>
Subject: Re: [PATCH v3 4/6] KVM: PPC: Book3s HV: Hold LPIDs in an unsigned long
Date: Thu, 17 Aug 2023 22:21:08 +1000 [thread overview]
Message-ID: <87a5upeu6j.fsf@mail.lhotse> (raw)
In-Reply-To: <20230807014553.1168699-5-jniethe5@gmail.com>
Jordan Niethe <jniethe5@gmail.com> writes:
> The LPID register is 32 bits long. The host keeps the lpids for each
> guest in an unsigned word struct kvm_arch. Currently, LPIDs are already
> limited by mmu_lpid_bits and KVM_MAX_NESTED_GUESTS_SHIFT.
>
> The nestedv2 API returns a 64 bit "Guest ID" to be used be the L1 host
> for each L2 guest. This value is used as an lpid, e.g. it is the
> parameter used by H_RPT_INVALIDATE. To minimize needless special casing
> it makes sense to keep this "Guest ID" in struct kvm_arch::lpid.
>
> This means that struct kvm_arch::lpid is too small so prepare for this
> and make it an unsigned long. This is not a problem for the KVM-HV and
> nestedv1 cases as their lpid values are already limited to valid ranges
> so in those contexts the lpid can be used as an unsigned word safely as
> needed.
>
> In the PAPR, the H_RPT_INVALIDATE pid/lpid parameter is already
> specified as an unsigned long so change pseries_rpt_invalidate() to
> match that. Update the callers of pseries_rpt_invalidate() to also take
> an unsigned long if they take an lpid value.
>
> Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
> ---
This needs:
diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c
index 709ebd578394..08e32b44ee32 100644
--- a/arch/powerpc/kvm/book3s_hv_uvmem.c
+++ b/arch/powerpc/kvm/book3s_hv_uvmem.c
@@ -857,7 +857,7 @@ unsigned long kvmppc_h_svm_init_done(struct kvm *kvm)
}
kvm->arch.secure_guest |= KVMPPC_SECURE_INIT_DONE;
- pr_info("LPID %d went secure\n", kvm->arch.lpid);
+ pr_info("LPID %lu went secure\n", kvm->arch.lpid);
out:
srcu_read_unlock(&kvm->srcu, srcu_idx);
cheers
next prev parent reply other threads:[~2023-08-17 12:21 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 1:45 [PATCH v3 0/6] KVM: PPC: Nested APIv2 guest support Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` [PATCH v3 1/6] KVM: PPC: Use getters and setters for vcpu register state Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-14 8:08 ` Nicholas Piggin
2023-08-14 8:08 ` Nicholas Piggin
2023-08-14 8:08 ` Nicholas Piggin
2023-08-16 3:11 ` Jordan Niethe
2023-08-16 3:11 ` Jordan Niethe
2023-08-16 3:11 ` Jordan Niethe
2023-08-17 3:25 ` Michael Ellerman
2023-08-17 3:25 ` Michael Ellerman
2023-08-17 3:25 ` Michael Ellerman
2023-08-07 1:45 ` [PATCH v3 2/6] KVM: PPC: Rename accessor generator macros Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-14 8:27 ` Nicholas Piggin
2023-08-14 8:27 ` Nicholas Piggin
2023-08-14 8:27 ` Nicholas Piggin
2023-08-16 3:20 ` Jordan Niethe
2023-08-16 3:20 ` Jordan Niethe
2023-08-16 3:20 ` Jordan Niethe
2023-08-07 1:45 ` [PATCH v3 3/6] KVM: PPC: Add helper library for Guest State Buffers Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` [PATCH v3 4/6] KVM: PPC: Book3s HV: Hold LPIDs in an unsigned long Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-14 8:12 ` Nicholas Piggin
2023-08-14 8:12 ` Nicholas Piggin
2023-08-14 8:12 ` Nicholas Piggin
2023-08-15 10:45 ` Michael Ellerman
2023-08-15 10:45 ` Michael Ellerman
2023-08-15 10:45 ` Michael Ellerman
2023-08-16 3:21 ` Jordan Niethe
2023-08-16 3:21 ` Jordan Niethe
2023-08-16 3:21 ` Jordan Niethe
2023-08-16 3:14 ` Jordan Niethe
2023-08-16 3:14 ` Jordan Niethe
2023-08-16 3:14 ` Jordan Niethe
2023-08-14 8:15 ` David Laight
2023-08-16 3:19 ` Jordan Niethe
2023-08-16 3:19 ` Jordan Niethe
2023-08-17 12:21 ` Michael Ellerman [this message]
2023-08-17 12:21 ` Michael Ellerman
2023-08-17 12:21 ` Michael Ellerman
2023-08-07 1:45 ` [PATCH v3 5/6] KVM: PPC: Add support for nestedv2 guests Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-17 4:19 ` Michael Ellerman
2023-08-17 4:19 ` Michael Ellerman
2023-08-17 4:19 ` Michael Ellerman
2023-08-17 12:23 ` Michael Ellerman
2023-08-17 12:23 ` Michael Ellerman
2023-08-17 12:23 ` Michael Ellerman
2023-08-07 1:45 ` [PATCH v3 6/6] docs: powerpc: Document nested KVM on POWER Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
2023-08-07 1:45 ` Jordan Niethe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a5upeu6j.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=amachhiw@linux.vnet.ibm.com \
--cc=gautam@linux.ibm.com \
--cc=jniethe5@gmail.com \
--cc=kconsul@linux.vnet.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=npiggin@gmail.com \
--cc=sbhat@linux.ibm.com \
--cc=vaibhav@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.