From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: "Christoph Schlameuss" <schlameuss@linux.ibm.com>
Cc: <kvm@vger.kernel.org>, <linux-s390@vger.kernel.org>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Janosch Frank" <frankja@linux.ibm.com>,
"Nico Boehr" <nrb@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>,
"Sven Schnelle" <svens@linux.ibm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Shuah Khan" <shuah@kernel.org>
Subject: Re: [PATCH RFC v2 01/11] KVM: s390: Add SCAO read and write helpers
Date: Tue, 11 Nov 2025 15:55:40 +0100 [thread overview]
Message-ID: <20251111155540.1627fd3b@p-imbrenda> (raw)
In-Reply-To: <DE5XX691NDPL.23EQ56H2AP7CK@linux.ibm.com>
On Tue, 11 Nov 2025 15:37:44 +0100
"Christoph Schlameuss" <schlameuss@linux.ibm.com> wrote:
> On Tue Nov 11, 2025 at 2:45 PM CET, Claudio Imbrenda wrote:
> > On Mon, 10 Nov 2025 18:16:41 +0100
> > Christoph Schlameuss <schlameuss@linux.ibm.com> wrote:
> >
> >> Introduce some small helper functions to get and set the system control
> >> area origin address from the SIE control block.
> >>
> >> Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
> >> ---
> >> arch/s390/kvm/vsie.c | 29 +++++++++++++++++++++--------
> >> 1 file changed, 21 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> >> index 347268f89f2f186bea623a3adff7376cabc305b2..ced2ca4ce5b584403d900ed11cb064919feda8e9 100644
> >> --- a/arch/s390/kvm/vsie.c
> >> +++ b/arch/s390/kvm/vsie.c
> >> @@ -123,6 +123,23 @@ static int prefix_is_mapped(struct vsie_page *vsie_page)
> >> return !(atomic_read(&vsie_page->scb_s.prog20) & PROG_REQUEST);
> >> }
> >>
> >> +static gpa_t read_scao(struct kvm *kvm, struct kvm_s390_sie_block *scb)
> >> +{
> >> + gpa_t sca;
> >
> > is it, though?
> >
> >> +
> >> + sca = READ_ONCE(scb->scaol) & ~0xfUL;
> >> + if (test_kvm_cpu_feat(kvm, KVM_S390_VM_CPU_FEAT_64BSCAO))
> >> + sca |= (u64)READ_ONCE(scb->scaoh) << 32;
> >
> > this feels more like an hpa_t, which is what you also use in the
> > function below
> >
>
> It actually can be either. Without vsie sigp this is a gpa for reading and
> writing. With vsie sigp this is a gpa when reading and a hpa when writing
this is a little confusing, maybe add an explanation
> it. It might be best to not imply anything here but just use "unsigned long"
> for these functions.
yes
>
> >> +
> >> + return sca;
> >> +}
> >> +
> >> +static void write_scao(struct kvm_s390_sie_block *scb, hpa_t hpa)
> >> +{
> >> + scb->scaoh = (u32)((u64)hpa >> 32);
> >> + scb->scaol = (u32)(u64)hpa;
> >> +}
> >> +
> >> /* copy the updated intervention request bits into the shadow scb */
> >> static void update_intervention_requests(struct vsie_page *vsie_page)
> >> {
> >> @@ -714,12 +731,11 @@ static void unpin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> >> struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
> >> hpa_t hpa;
> >>
> >> - hpa = (u64) scb_s->scaoh << 32 | scb_s->scaol;
> >> + hpa = read_scao(vcpu->kvm, scb_s);
> >> if (hpa) {
> >> unpin_guest_page(vcpu->kvm, vsie_page->sca_gpa, hpa);
> >> vsie_page->sca_gpa = 0;
> >> - scb_s->scaol = 0;
> >> - scb_s->scaoh = 0;
> >> + write_scao(scb_s, 0);
> >> }
> >>
> >> hpa = scb_s->itdba;
> >> @@ -773,9 +789,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> >> gpa_t gpa;
> >> int rc = 0;
> >>
> >> - gpa = READ_ONCE(scb_o->scaol) & ~0xfUL;
> >> - if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_64BSCAO))
> >> - gpa |= (u64) READ_ONCE(scb_o->scaoh) << 32;
> >> + gpa = read_scao(vcpu->kvm, scb_o);
> >> if (gpa) {
> >> if (gpa < 2 * PAGE_SIZE)
> >> rc = set_validity_icpt(scb_s, 0x0038U);
> >> @@ -792,8 +806,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
> >> if (rc)
> >> goto unpin;
> >> vsie_page->sca_gpa = gpa;
> >> - scb_s->scaoh = (u32)((u64)hpa >> 32);
> >> - scb_s->scaol = (u32)(u64)hpa;
> >> + write_scao(scb_s, hpa);
> >> }
> >>
> >> gpa = READ_ONCE(scb_o->itdba) & ~0xffUL;
> >>
>
next prev parent reply other threads:[~2025-11-11 14:56 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 17:16 [PATCH RFC v2 00/11] KVM: s390: Add VSIE SIGP Interpretation (vsie_sigpif) Christoph Schlameuss
2025-11-10 17:16 ` [PATCH RFC v2 01/11] KVM: s390: Add SCAO read and write helpers Christoph Schlameuss
2025-11-11 13:45 ` Claudio Imbrenda
2025-11-11 14:37 ` Christoph Schlameuss
2025-11-11 14:55 ` Claudio Imbrenda [this message]
2025-11-10 17:16 ` [PATCH RFC v2 02/11] KVM: s390: Remove double 64bscao feature check Christoph Schlameuss
2025-11-10 21:32 ` Eric Farman
2025-11-11 8:13 ` Hendrik Brueckner
2025-11-11 13:20 ` Janosch Frank
2025-11-10 17:16 ` [PATCH RFC v2 03/11] KVM: s390: Move scao validation into a function Christoph Schlameuss
2025-11-10 21:30 ` Eric Farman
2025-11-11 8:48 ` Christoph Schlameuss
2025-11-10 17:16 ` [PATCH RFC v2 04/11] KVM: s390: Add vsie_sigpif detection Christoph Schlameuss
2025-11-10 17:16 ` [PATCH RFC v2 05/11] KVM: s390: Add ssca_block and ssca_entry structs for vsie_ie Christoph Schlameuss
2025-11-10 17:16 ` [PATCH RFC v2 06/11] KVM: s390: Add helper to pin multiple guest pages Christoph Schlameuss
2025-11-13 15:24 ` Janosch Frank
2025-11-10 17:16 ` [PATCH RFC v2 07/11] KVM: s390: Shadow VSIE SCA in guest-1 Christoph Schlameuss
2025-11-14 14:09 ` Janosch Frank
2025-11-17 15:39 ` Christoph Schlameuss
2025-11-17 15:22 ` Janosch Frank
2025-11-18 9:27 ` Christoph Schlameuss
2025-11-18 16:04 ` Janosch Frank
2025-11-21 15:10 ` Christoph Schlameuss
2025-11-20 11:15 ` Janosch Frank
2025-11-10 17:16 ` [PATCH RFC v2 08/11] KVM: s390: Allow guest-3 cpu add and remove with vsie sigpif Christoph Schlameuss
2025-11-11 15:47 ` Janosch Frank
2025-11-11 16:34 ` Christoph Schlameuss
2025-11-10 17:16 ` [PATCH RFC v2 09/11] KVM: s390: Allow guest-3 switch to extended sca " Christoph Schlameuss
2025-11-11 14:18 ` Janosch Frank
2025-11-10 17:16 ` [PATCH RFC v2 10/11] KVM: s390: Add VSIE shadow configuration Christoph Schlameuss
2025-11-20 11:02 ` Janosch Frank
2025-11-24 10:57 ` Christoph Schlameuss
2025-11-10 17:16 ` [PATCH RFC v2 11/11] KVM: s390: Add VSIE shadow stat counters Christoph Schlameuss
2025-11-20 11:07 ` Janosch Frank
2025-11-24 10:59 ` Christoph Schlameuss
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=20251111155540.1627fd3b@p-imbrenda \
--to=imbrenda@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=schlameuss@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=svens@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox