From: Heiko Carstens <hca@linux.ibm.com>
To: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: KVM <kvm@vger.kernel.org>, Janosch Frank <frankja@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
linux-s390 <linux-s390@vger.kernel.org>,
Thomas Huth <thuth@redhat.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Marc Hartmayer <mhartmay@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>
Subject: Re: [PATCH 1/1] KVM: s390: fix LPSWEY handling
Date: Fri, 28 Jun 2024 17:02:41 +0200 [thread overview]
Message-ID: <20240628150241.14360-H-hca@linux.ibm.com> (raw)
In-Reply-To: <23e861e2-d184-4367-acc9-3e72c48c3282@linux.ibm.com>
On Fri, Jun 28, 2024 at 04:53:20PM +0200, Christian Borntraeger wrote:
> > > +static inline u64 kvm_s390_get_base_disp_siy(struct kvm_vcpu *vcpu, u8 *ar)
> > > +{
> > > + u32 base1 = vcpu->arch.sie_block->ipb >> 28;
> > > + u32 disp1 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) +
> > > + ((vcpu->arch.sie_block->ipb & 0xff00) << 4);
> > > +
> > > + /* The displacement is a 20bit _SIGNED_ value */
> > > + if (disp1 & 0x80000)
> > > + disp1+=0xfff00000;
> > > +
> > > + if (ar)
> > > + *ar = base1;
> > > +
> > > + return (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + (long)(int)disp1;
> > > +}
> >
> > You may want to use sign_extend32() or sign_extend64() instead of open-coding.
>
> Something like sign_extend64(disp1, 31)
> I actually find that harder to read, but I am open for other opinions.
Feel free to ignore my suggestion. It was just a comment that this
helper exists. If you prefer the open-coded variant then that's fine
too of course.
next prev parent reply other threads:[~2024-06-28 15:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-27 9:05 [PATCH 1/1] KVM: s390: fix LPSWEY handling Christian Borntraeger
2024-06-27 9:23 ` Claudio Imbrenda
2024-06-27 9:40 ` Christian Borntraeger
2024-06-27 9:44 ` Thomas Huth
2024-06-27 9:49 ` Christian Borntraeger
2024-06-27 9:57 ` Heiko Carstens
2024-06-28 14:53 ` Christian Borntraeger
2024-06-28 15:02 ` Heiko Carstens [this message]
2024-06-28 15:22 ` Claudio Imbrenda
2024-06-28 15:50 ` Christian Borntraeger
2024-06-28 16:55 ` Christian Borntraeger
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=20240628150241.14360-H-hca@linux.ibm.com \
--to=hca@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=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mhartmay@linux.ibm.com \
--cc=svens@linux.ibm.com \
--cc=thuth@redhat.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