From: Will Deacon <will@kernel.org>
To: Jianyong Wu <Jianyong.Wu@arm.com>
Cc: Mark Rutland <Mark.Rutland@arm.com>,
"maz@kernel.org" <maz@kernel.org>, Justin He <Justin.He@arm.com>,
Wei Chen <Wei.Chen@arm.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
Suzuki Poulose <Suzuki.Poulose@arm.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"richardcochran@gmail.com" <richardcochran@gmail.com>,
Steve Capper <Steve.Capper@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"sean.j.christopherson@intel.com"
<sean.j.christopherson@intel.com>,
Steven Price <Steven.Price@arm.com>, Kaly Xin <Kaly.Xin@arm.com>,
"john.stultz@linaro.org" <john.stultz@linaro.org>,
"yangbo.lu@nxp.com" <yangbo.lu@nxp.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"tglx@linutronix.de" <tglx@linutronix.de>, nd <nd@arm.com>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v13 2/9] arm/arm64: KVM: Advertise KVM UID to guests via SMCCC
Date: Mon, 27 Jul 2020 12:38:21 +0100 [thread overview]
Message-ID: <20200727113821.GB20437@willie-the-truck> (raw)
In-Reply-To: <HE1PR0802MB255577943C260898A6C686ABF4720@HE1PR0802MB2555.eurprd08.prod.outlook.com>
On Mon, Jul 27, 2020 at 03:45:37AM +0000, Jianyong Wu wrote:
> > From: Will Deacon <will@kernel.org>
> >
> > We can advertise ourselves to guests as KVM and provide a basic features
> > bitmap for discoverability of future hypervisor services.
> >
> > Cc: Marc Zyngier <maz@kernel.org>
> > Signed-off-by: Will Deacon <will@kernel.org>
> > Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> > ---
> > arch/arm64/kvm/hypercalls.c | 29 +++++++++++++++++++----------
> > 1 file changed, 19 insertions(+), 10 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c
> > index 550dfa3e53cd..db6dce3d0e23 100644
> > --- a/arch/arm64/kvm/hypercalls.c
> > +++ b/arch/arm64/kvm/hypercalls.c
> > @@ -12,13 +12,13 @@
> > int kvm_hvc_call_handler(struct kvm_vcpu *vcpu) {
> > u32 func_id = smccc_get_function(vcpu);
> > - long val = SMCCC_RET_NOT_SUPPORTED;
> > + u32 val[4] = {SMCCC_RET_NOT_SUPPORTED};
>
> There is a risk as this u32 value will return here and a u64 value will be
> obtained in guest. For example, The val[0] is initialized as -1 of
> 0xffffffff and the guest get 0xffffffff then it will be compared with -1
> of 0xffffffffffffffff Also this problem exists for the transfer of address
> in u64 type. So the following assignment to "val" should be split into two
> u32 value and assign to val[0] and val[1] respectively.
> WDYT?
Yes, I think you're right that this is a bug, but isn't the solution just
to make that an array of 'long'?
long val [4];
That will sign-extend the negative error codes as required, while leaving
the explicitly unsigned UID constants alone.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-07-27 11:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 13:01 [PATCH v13 0/9] Enable ptp_kvm for arm64 Jianyong Wu
2020-06-19 13:01 ` [PATCH v13 1/9] arm64: Probe for the presence of KVM hypervisor services during boot Jianyong Wu
2020-06-19 13:01 ` [PATCH v13 2/9] arm/arm64: KVM: Advertise KVM UID to guests via SMCCC Jianyong Wu
2020-07-27 3:45 ` Jianyong Wu
2020-07-27 11:38 ` Will Deacon [this message]
2020-07-28 1:07 ` Jianyong Wu
2020-08-20 9:43 ` Will Deacon
2020-06-19 13:01 ` [PATCH v13 3/9] smccc: Export smccc conduit get helper Jianyong Wu
2020-06-19 13:57 ` Christoph Hellwig
2020-06-19 13:01 ` [PATCH v13 4/9] ptp: Reorganize ptp_kvm module to make it arch-independent Jianyong Wu
2020-06-19 13:01 ` [PATCH v13 5/9] time: Add mechanism to recognize clocksource in time_get_snapshot Jianyong Wu
2020-06-19 13:01 ` [PATCH v13 6/9] clocksource: Add clocksource id for arm arch counter Jianyong Wu
2020-06-19 13:01 ` [PATCH v13 7/9] arm64/kvm: Add hypercall service for kvm ptp Jianyong Wu
2020-06-19 13:01 ` [PATCH v13 8/9] ptp: arm64: Enable ptp_kvm for arm64 Jianyong Wu
2020-06-19 13:01 ` [PATCH v13 9/9] arm64: Add kvm capability check extension for ptp_kvm Jianyong Wu
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=20200727113821.GB20437@willie-the-truck \
--to=will@kernel.org \
--cc=Jianyong.Wu@arm.com \
--cc=Justin.He@arm.com \
--cc=Kaly.Xin@arm.com \
--cc=Mark.Rutland@arm.com \
--cc=Steve.Capper@arm.com \
--cc=Steven.Price@arm.com \
--cc=Suzuki.Poulose@arm.com \
--cc=Wei.Chen@arm.com \
--cc=john.stultz@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=nd@arm.com \
--cc=netdev@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=richardcochran@gmail.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=yangbo.lu@nxp.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