From mboxrd@z Thu Jan 1 00:00:00 1970
From: Pavel Fedin
Subject: RE: [PATCH 1/3] KVM: arm64: Implement vGICv3 distributor and
redistributor access from userspace
Date: Mon, 31 Aug 2015 10:35:05 +0300
Message-ID: <013f01d0e3bf$8ed1fed0$ac75fc70$@samsung.com>
References:
<20150830164237.GD24113@cbox>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
'Marc Zyngier'
To: 'Christoffer Dall'
Return-path:
Received: from mailout1.w1.samsung.com ([210.118.77.11]:17853 "EHLO
mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1752903AbbHaHfJ (ORCPT );
Mon, 31 Aug 2015 03:35:09 -0400
Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244])
by mailout1.w1.samsung.com
(Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014))
with ESMTP id <0NTX00A9IRQJ6690@mailout1.w1.samsung.com> for
kvm@vger.kernel.org; Mon, 31 Aug 2015 08:35:07 +0100 (BST)
In-reply-to: <20150830164237.GD24113@cbox>
Content-language: ru
Sender: kvm-owner@vger.kernel.org
List-ID:
Hello!
> > + len = vgic_v3_get_reg_size(attr);
> > + if (len < 0)
> > + return len;
> >
> > - return -ENXIO;
> > + ret = vgic_v3_attr_regs_access(dev, attr, (len == 8) ? (void *)®64 :
> > + (void *)®, len, false);
>
> this use of the ternary operator is terrible, but it should be solved if
> you always use a u64 for the reg parameter.
I also dislike this, but this is the best thing i could invent. This is dictated by put_user() and
get_user(), which rely on typeof() of their arguments. Well, i could do some castings, but they are
no less ugly, and would give more headache to bigendian systems.
However, what about doing the same thing as GET/SET_ONE_REG does by just assuming that everything is
64-bit wide? This would automatically resolve two other issues you have commented on. By the way,
handling it in userspace would also be simpler.
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia