Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2877887rwb; Mon, 15 Aug 2022 13:08:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR5htcQMaWwJgNvN9xLGULw7M0X2VxZ4g68j+NFzZ2jS3y3cIw5HU7FWMyxEyVt4p8AHPCzZ X-Received: by 2002:a05:6402:5508:b0:43a:896e:8edd with SMTP id fi8-20020a056402550800b0043a896e8eddmr15590167edb.203.1660594131733; Mon, 15 Aug 2022 13:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594131; cv=none; d=google.com; s=arc-20160816; b=NQ0Wwet/4iqP/R3+IqFjZ9Dh6cfWRHvrNc0CN0GuCuD7t1SFQ1rVXwk4oKigG1mAFS rzrGKcqscIT/u0yUI17Qn8wblybsCZ+UycRRZpJevvFwrbBTqMwdRK4VKL4L+mPo+u5T tgUAQN0G6/k6G9DFl504b1r/SBNK/CxeTa4iLZFRF/V6wIH0pdFhJwo7QFwS4Pq+7QcC y3MX5BKappbt8vEGD82Kqb12YYV0y+e9Nea+j2jqCa9qhikE+PupyJbnnN2fPO2aUD72 aCwm9iyo157mJhuE8DtXkq1iYt7uBZ/14YA0QF+S695qJrk92xyMAibqazPC+K8kmMHJ wnSg== 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=CuMBVudltRTk7HsQms3xXPYmYrhDLUxWN37+HN5mPPo=; b=sY4IAwNVkKjBNxMoxd8bFqRhfbfLfjuD4b1YkPwP3E1tQBvOFGESU1P5QLjOBvQcdu ObrsrQi4OxeRy8KZ7pgAD+1dF+7+kFWRs3vF2NwzJVnPmdfvIZk7tkuu8Rl0hJbnplHm +YDZ8LkVMW1GYLf1JClngNAVLlt2wDnP4wfr9w/A81tzTJf7rqO2yWwIpDQnYldaSM91 01z91ISiS78JmU7+pOUMJNAh6LU7Ycgo/yt8BkWs7W2k9a4AH/dzZHyBaMFxq8EhPu3d Mhk1b7SQuZPkTAAiVV7NDvtnV2VzJ4TwAn8cEZ26aN0PQrIbb3sUA9rFpTOkjulC3g6h sxZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tfKp8uOr; 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 m7-20020a056402510700b0043c25d25046si9609260edd.249.2022.08.15.13.08.26; Mon, 15 Aug 2022 13:08:51 -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=tfKp8uOr; 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 S244634AbiHOT2s (ORCPT + 99 others); Mon, 15 Aug 2022 15:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244331AbiHOTZY (ORCPT ); Mon, 15 Aug 2022 15:25:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87FE3DF3F; Mon, 15 Aug 2022 11:41:10 -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 690AEB8108B; Mon, 15 Aug 2022 18:41:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7EBEC433D6; Mon, 15 Aug 2022 18:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588868; bh=5pWfrt/jeU3UzOemzTFrVOklI4sIZ1fhq+ClWMCfkK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tfKp8uOr8F05z9NyPZs/vlBnx0cecbIxM+OUhIi/fl3fU7wCuOx7acaai0Ljl85EN oIg82FeQ5rZyerd5PIx/iSnUEVno9TAs8D5bfJT09Y1PCZ/f5df3VvHlhOC4MpQQiF IKGzpVfIVz84BMkznr91z+Ran6ajYcFKNhMeYXw4= 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.15 541/779] selftests: kvm: set rax before vmcall Date: Mon, 15 Aug 2022 20:03:05 +0200 Message-Id: <20220815180400.445087721@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 46057079d8bb..4f1449fa9592 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -1326,7 +1326,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