From patchwork Mon Dec 7 09:48:12 2015
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pavel Fedin
X-Patchwork-Id: 7781691
Return-Path:
X-Original-To: patchwork-kvm@patchwork.kernel.org
Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org
Received: from mail.kernel.org (mail.kernel.org [198.145.29.136])
by patchwork2.web.kernel.org (Postfix) with ESMTP id 024ECBEEE1
for ;
Mon, 7 Dec 2015 09:48:22 +0000 (UTC)
Received: from mail.kernel.org (localhost [127.0.0.1])
by mail.kernel.org (Postfix) with ESMTP id 1DD3F2041A
for ;
Mon, 7 Dec 2015 09:48:21 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.kernel.org (Postfix) with ESMTP id C9FB9203F1
for ;
Mon, 7 Dec 2015 09:48:19 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1755080AbbLGJsQ (ORCPT
);
Mon, 7 Dec 2015 04:48:16 -0500
Received: from mailout2.w1.samsung.com ([210.118.77.12]:15882 "EHLO
mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1754988AbbLGJsP (ORCPT );
Mon, 7 Dec 2015 04:48:15 -0500
Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244])
by mailout2.w1.samsung.com
(Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5
2014)) with ESMTP id <0NYZ00KV6F8DXL60@mailout2.w1.samsung.com> for
kvm@vger.kernel.org; Mon, 07 Dec 2015 09:48:13 +0000 (GMT)
X-AuditID: cbfec7f4-f79026d00000418a-3f-566555dc12df
Received: from eusync4.samsung.com ( [203.254.199.214])
by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 19.CF.16778.CD555665;
Mon, 7 Dec 2015 09:48:12 +0000 (GMT)
Received: from fedinw7x64 ([106.109.131.169])
by eusync4.samsung.com (Oracle Communications Messaging Server
7.0.5.31.0 64bit (built May 5 2014))
with ESMTPA id <0NYZ00BWRF8COI70@eusync4.samsung.com>; Mon,
07 Dec 2015 09:48:12 +0000 (GMT)
From: Pavel Fedin
To: 'Andrew Jones'
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
'Marc Zyngier'
References:
<20151205003334.GB3117@hawk.localdomain>
In-reply-to: <20151205003334.GB3117@hawk.localdomain>
Subject: RE: [PATCH v4 0/4] KVM: arm64: BUG FIX: Correctly handle zero
register transfers
Date: Mon, 07 Dec 2015 12:48:12 +0300
Message-id: <013501d130d4$635722f0$2a0568d0$@samsung.com>
MIME-version: 1.0
Content-type: text/plain; charset=us-ascii
Content-transfer-encoding: 7bit
X-Mailer: Microsoft Outlook 14.0
Thread-index: AQIoxFoIZtD+cRjeznY1TxBThPNsoAJZUfDYnf1SFlA=
Content-language: ru
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsVy+t/xa7p3QlPDDOZeNrN4cfI1q8WcqYUW
H08dZ7f4e+cfmwOLx5p5axg9zm9aw+zxft9VNo/Pm+QCWKK4bFJSczLLUov07RK4Mi5+Pc5W
cEWw4va5h6wNjDv5uhg5OCQETCSWzvTvYuQEMsUkLtxbzwZiCwksZZSYtjy3i5ELyP7OKPHk
+mpGkASbgLrE6a8fWEBsESD70YYWZhCbWSBO4uL2V+wQzYkSv5bcBhvEKWAqcfX4ZSYQW1gg
WmLCppWsIDaLgKrEmSWtYHFeAUuJD/1TmCFsQYkfk++xQMzUkli/8zgThC0vsXnNW2aIQxUk
dpx9zQhxg5XEg2c72CBqRCSm/bvHPIFRaBaSUbOQjJqFZNQsJC0LGFlWMYqmliYXFCel5xrq
FSfmFpfmpesl5+duYoREwJcdjIuPWR1iFOBgVOLhtUhPCRNiTSwrrsw9xCjBwawkwsvhlRom
xJuSWFmVWpQfX1Sak1p8iFGag0VJnHfurvchQgLpiSWp2ampBalFMFkmDk6pBkb1XKddYrOl
F4aYKU69dzN/2fvNNpzzz4tfO+q5uFvHfEHenxcip59OVohsmtPX9+hM/ym9aVLyTH0/8xZF
CtctNdZ4m7yVZf2X+re3rr1WyEubFL1A5YtroJGrwdqm31mOcdy8aaGCHw59FlwV6n0vY+mm
X3vms36ZuN09+Y7P2aWaZmv2f1irxFKckWioxVxUnAgAGe11OnwCAAA=
Sender: kvm-owner@vger.kernel.org
Precedence: bulk
List-ID:
X-Mailing-List: kvm@vger.kernel.org
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI,
T_RP_MATCHES_RCVD,
UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org
X-Virus-Scanned: ClamAV using ClamSMTP
Hello!
> FYI, I tried writing test cases for this issue with kvm-unit-tests. The
> issue didn't reproduce for me. It's quite possible my test cases are
> flawed
Indeed they are, a very little thing fell through again... :)
It's not just SP, it's SP_EL0. And you never initialize it to anything because your code always runs in kernel mode, so it's just
zero, so you get your zero.
But if you add a little thing in the beginning of your main():
asm volatile("msr sp_el0, %0" : : "r" (0xDEADC0DE0BADC0DE));
then you have it:
--- cut ---
[root@thunderx-2 kvm-unit-tests]# ./arm-run arm/xzr-test.flat -smp 2
qemu-system-aarch64 -machine virt,accel=kvm:tcg,gic-version=host -cpu host -device virtio-serial-device -device
virtconsole,chardev=ctd -chardev testdev,id=ctd -display none -serial stdio -kernel arm/xzr-test.flat -smp 2
PASS: mmio: sanity check: read 0x55555555
FAIL: mmio: 'str wzr' check: read 0x0badc0de
vm_setup_vq: virtqueue 0 already setup! base=0xa003e00
chr_testdev_init: chr-testdev: can't init virtqueues
--- cut ---
Here i run only MMIO test, because i could not compile sysreg one, so i simply commented it out.
P.S. Could you also apply something like the following to arm/run:
--- cut ---
arm/run | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Without it qemu does not work on GICv3-only hardware, like my board, because it defaults to gic-version=2. I don't post the patch
on the mailing lists, because in order to be able to post this 5-liner i'll need to go through the formal approval procedure at my
company, and i just don't want to bother for a single small fix. :) Will do as a "Reported-by:".
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia
---
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arm/run b/arm/run
index 662a856..3890c8c 100755
--- a/arm/run
+++ b/arm/run
@@ -33,7 +33,11 @@ if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \
exit 2
fi
-M='-machine virt,accel=kvm:tcg'
+if $qemu $M,? 2>&1 | grep gic-version > /dev/null; then
+ GIC='gic-version=host,'
+fi
+
+M="-machine virt,${GIC}accel=kvm:tcg"
chr_testdev='-device virtio-serial-device'
chr_testdev+=' -device virtconsole,chardev=ctd -chardev testdev,id=ctd'
--- cut ---