Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3014363rwb; Mon, 15 Aug 2022 16:10:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR5BHAkpogaYpqkw8a+XVwyReLoc7eBeiKxIv+Ppe1A12XU2j3MwdQtUkbDDCtPd1nT8w6tm X-Received: by 2002:a17:907:72d1:b0:730:a0c4:2aaa with SMTP id du17-20020a17090772d100b00730a0c42aaamr11385478ejc.560.1660605020482; Mon, 15 Aug 2022 16:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605020; cv=none; d=google.com; s=arc-20160816; b=0BJMpqb2XnGaBgnd+3aQgkGbBT7oIMkmPh/NKwsRz/ceKD+qgF80AKC4PfrC7jMP+u MCU0DCKfxYHru+vKpXf3JfauwQBav/zF2n2nDrMtnO6hxSekqBAHr2dhjGifV5sJQ+05 7+VL1xnU5NKqYXx+uNwZhGQrfNdYrjxI4vlEwuU3Wyd4qZtepAFq2laZ8YWpMqk6ZL5x p6gTPOTW9bDpKQK9QXNiQLlwLibiSdLvx7KT4S2x708+gp3jFMFjhzvemO7frVFdFTK5 5j4U70RfjFhudp+IzuD5wvKd+0ypwm+1Rd5zxP2UDVltafqNjGEx67zETwx3e6Cruo/y pTXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mU0G5+SOsQ+zSryYlyoVyZC9ACxONlrGWV30ouyLyVo=; b=kuMP63WfHBk1EUEPcEZmi+Aj8kW+2hT8mUlA9V2obZgoU26JjOQE6nIPYaU6PdRH9C AMJSPDh+/Mr1nnXxPebxuYAYgKh5bsdC9Th4ka1tH3S9ccLKxSMh4O2pHoLMd21aG4Bi 4Q+pzCvyklC5p3ZwYAdne/6r3F27ymOhHbSJSJ0grQXzhSYb08WkMfPWDH++yRAwnjkZ m5+lo0okWsU7S63C02/dakeI3EYgW43CK2qO1l1IPMINjdSgwRj1kBf3CjL7by7ZIyyq qJgw02bENDsZShDYtm4leTWFuXz9/095hibQD8S/rXM1P3k9id5r5BLAAalOMry29vPb QZNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p65Jf5to; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd28-20020a056402207c00b0043f2c588d55si7774106edb.339.2022.08.15.16.09.55; Mon, 15 Aug 2022 16:10:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p65Jf5to; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350490AbiHOW0y (ORCPT + 99 others); Mon, 15 Aug 2022 18:26:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350922AbiHOWSw (ORCPT ); Mon, 15 Aug 2022 18:18:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5477D66A74; Mon, 15 Aug 2022 12:43:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72878B80EA7; Mon, 15 Aug 2022 19:43:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB31EC433D7; Mon, 15 Aug 2022 19:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592580; bh=siPGSWciJGt6lgMgSJxzauggUweP0sClQaAVfp+eYbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p65Jf5toj+x/aneJLFAxgs/CtN/cWlH3ED+oMn+Ejk1yDSq8HhxZU9JPnLPRyeexh 7EFlO3CS0lvvldxs5hTNU0jh7rKLAxWoTf+5MzO7doKUgtx4c6047ohkO4VlRqcnye o+izL8+af9zQUpB+WrIrLvNSngWkRi3C57BM/AlA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrei Vagin , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.18 0811/1095] selftests: kvm: set rax before vmcall Date: Mon, 15 Aug 2022 20:03:30 +0200 Message-Id: <20220815180502.809034018@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrei Vagin [ Upstream commit 281106f938d3daaea6f8b6723a8217a2a1ef6936 ] kvm_hypercall has to place the hypercall number in rax. Trace events show that kvm_pv_test doesn't work properly: kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 With this change, it starts working as expected: kvm_pv_test-54285: kvm_hypercall: nr 0x5 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-54285: kvm_hypercall: nr 0xa a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-54285: kvm_hypercall: nr 0xb a0 0x0 a1 0x0 a2 0x0 a3 0x0 Signed-off-by: Andrei Vagin Message-Id: <20220722230241.1944655-5-avagin@google.com> Fixes: ac4a4d6de22e ("selftests: kvm: test enforcement of paravirtual cpuid features") Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c index 33ea5e9955d9..b9984124a294 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -1423,7 +1423,7 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2, asm volatile("vmcall" : "=a"(r) - : "b"(a0), "c"(a1), "d"(a2), "S"(a3)); + : "a"(nr), "b"(a0), "c"(a1), "d"(a2), "S"(a3)); return r; } -- 2.35.1