From patchwork Tue Aug 9 10:58:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijay Kilari X-Patchwork-Id: 73537 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp421606qga; Tue, 9 Aug 2016 04:01:04 -0700 (PDT) X-Received: by 10.66.219.105 with SMTP id pn9mr169598616pac.25.1470740464193; Tue, 09 Aug 2016 04:01:04 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id 9si42252636pfr.240.2016.08.09.04.01.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 04:01:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bX4lO-0006Cj-H3; Tue, 09 Aug 2016 11:00:02 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bX4l2-00063w-Eu for linux-arm-kernel@lists.infradead.org; Tue, 09 Aug 2016 10:59:42 +0000 Received: by mail-pf0-x244.google.com with SMTP id h186so714901pfg.2 for ; Tue, 09 Aug 2016 03:59:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0kYEcVIp1DlCm+dpzpKn5Y9Hm3qKmLNhJJfKVKEMB5g=; b=rhgODOuMDEV5rmk4W9T9bgsc7xLI/k4OhA3tTG3kTMNfOSdGrfpRC0DAW8MzNDxZhy nDXhqQ8RNJs5TBwQmUy5NbSG48SjkamuijCaPgHzzDlVef6JhHy3vn0IyKLpfq4+Yfp/ kC1eVKZELhFkrdBCZu4ksUgkCizFG6kar/1BCRy/zbPK70t6bcTK5ikhM8QZyROTktVR hIHrdyyUe+zUxNZgrG3xKTYqVVU39Ft01HbBNek04x/ffbHoHYg4rwMhf/C7ue/CXPq2 l2QPrLtij+Pa5jQ2N/ndft1oPdrRGBD6bvNpZ4KcTv61Q5ExlWAQO+g/kktaac3n59UL BwCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0kYEcVIp1DlCm+dpzpKn5Y9Hm3qKmLNhJJfKVKEMB5g=; b=X3RHVEV23/o88AkYg7eJhzZM45IKb5Yzw+irqsSB2iA1Dol8S8WziPjqLqOFDXzY5w S4WCty0UeWuu7s5FTY4TKZrhG744CRNNDyzAQzhiKS3BgqwEX0GYaMylOGBs9oA0Ldlv u5t6kOp4Km+vLlr7bFIrKeYShYugRnREiqfdw6G3na7JT+fSIb6S8a1sbAS2/VOdp6Oh ziRo2y6X4+z6sl3hs7H1PgioX3uITzsEmx9dmuQljULF3nqpqkHQ4M0JagtMaR0JRaQF M7iyUmMnyJBiSPfGC+C7LVUbcLDdLGOlky411T3lPU8SzMGJyOgkBZ22X6+KSIDVY+f0 S4Zg== X-Gm-Message-State: AEkooutpJhphyVdkkwSxEBCjsGAqZkPskhotcTl45ZoVm7zS8Lc2MbPDqYrvtWuVk6/X5g== X-Received: by 10.98.131.8 with SMTP id h8mr170814976pfe.124.1470740359690; Tue, 09 Aug 2016 03:59:19 -0700 (PDT) Received: from cavium-Vostro-2520.caveonetworks.com ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id o80sm55076202pfa.67.2016.08.09.03.59.16 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Aug 2016 03:59:19 -0700 (PDT) From: vijay.kilari@gmail.com To: marc.zyngier@arm.com, christoffer.dall@linaro.org Subject: [RFC PATCH v2 1/4] arm/arm64: vgic-new: Introduce 64-bit reg access support Date: Tue, 9 Aug 2016 16:28:43 +0530 Message-Id: <1470740326-27751-2-git-send-email-vijay.kilari@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1470740326-27751-1-git-send-email-vijay.kilari@gmail.com> References: <1470740326-27751-1-git-send-email-vijay.kilari@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160809_035940_582153_6D9D62F2 X-CRM114-Status: GOOD ( 12.50 ) X-Spam-Score: -0.6 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.8 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [111.93.218.67 listed in dnsbl.sorbs.net] 1.3 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c00:0:0:0:244 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (vijay.kilari[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Prasun.Kapoor@cavium.com, p.fedin@samsung.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Vijaya Kumar K MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org From: Vijaya Kumar K vgic_attr_regs_access() handles only 32-bit register value. Pass u64 as parameter and locally handle 32-bit reads and writes depending on attribute group. Signed-off-by: Vijaya Kumar K --- virt/kvm/arm/vgic/vgic-kvm-device.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/virt/kvm/arm/vgic/vgic-kvm-device.c b/virt/kvm/arm/vgic/vgic-kvm-device.c index 0130c4b..06de322 100644 --- a/virt/kvm/arm/vgic/vgic-kvm-device.c +++ b/virt/kvm/arm/vgic/vgic-kvm-device.c @@ -236,12 +236,13 @@ void kvm_register_vgic_device(unsigned long type) */ static int vgic_attr_regs_access(struct kvm_device *dev, struct kvm_device_attr *attr, - u32 *reg, bool is_write) + u64 *reg, bool is_write) { gpa_t addr; int cpuid, ret, c; struct kvm_vcpu *vcpu, *tmp_vcpu; int vcpu_lock_idx = -1; + u32 tmp32; cpuid = (attr->attr & KVM_DEV_ARM_VGIC_CPUID_MASK) >> KVM_DEV_ARM_VGIC_CPUID_SHIFT; @@ -272,12 +273,19 @@ static int vgic_attr_regs_access(struct kvm_device *dev, vcpu_lock_idx = c; } + if (is_write) + tmp32 = *reg; + switch (attr->group) { case KVM_DEV_ARM_VGIC_GRP_CPU_REGS: - ret = vgic_v2_cpuif_uaccess(vcpu, is_write, addr, reg); + ret = vgic_v2_cpuif_uaccess(vcpu, is_write, addr, &tmp32); + if (!is_write) + *reg = tmp32; break; case KVM_DEV_ARM_VGIC_GRP_DIST_REGS: - ret = vgic_v2_dist_uaccess(vcpu, is_write, addr, reg); + ret = vgic_v2_dist_uaccess(vcpu, is_write, addr, &tmp32); + if (!is_write) + *reg = tmp32; break; default: ret = -EINVAL; @@ -309,11 +317,13 @@ static int vgic_v2_set_attr(struct kvm_device *dev, case KVM_DEV_ARM_VGIC_GRP_DIST_REGS: case KVM_DEV_ARM_VGIC_GRP_CPU_REGS: { u32 __user *uaddr = (u32 __user *)(long)attr->addr; - u32 reg; + u32 tmp32; + u64 reg; - if (get_user(reg, uaddr)) + if (get_user(tmp32, uaddr)) return -EFAULT; + reg = tmp32; return vgic_attr_regs_access(dev, attr, ®, true); } } @@ -334,12 +344,14 @@ static int vgic_v2_get_attr(struct kvm_device *dev, case KVM_DEV_ARM_VGIC_GRP_DIST_REGS: case KVM_DEV_ARM_VGIC_GRP_CPU_REGS: { u32 __user *uaddr = (u32 __user *)(long)attr->addr; - u32 reg = 0; + u32 tmp32; + u64 reg; ret = vgic_attr_regs_access(dev, attr, ®, false); if (ret) return ret; - return put_user(reg, uaddr); + tmp32 = reg; + return put_user(tmp32, uaddr); } }