Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3091835rwb; Mon, 15 Aug 2022 17:55:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR51ajDNo5fCZFS88jdqhgmc9wFp59O2RdrmIaw7Zm+EKC5d7EvwLGD5J0SGSyfoXvrFeRgr X-Received: by 2002:a05:6402:d5d:b0:441:c3f8:cf96 with SMTP id ec29-20020a0564020d5d00b00441c3f8cf96mr16537622edb.238.1660611349812; Mon, 15 Aug 2022 17:55:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611349; cv=none; d=google.com; s=arc-20160816; b=j7SjM5LKCN9w5e6OiIgdyA9WLZfpBZUQ++RDzbz469EHote16g+/2CuiZl1BktRZT6 vQrx+VsnExHP/HoueR+k43cbhiaMwOwtgrqP8xm9AasKm/VdQlFGDSiyWVYp3QGk85uB woFkNRTI2kK9vZz9u3lnFwreV8g7HyRu2wk994c4hT5YFHuHuDKLv8+eyh96iLbR93o5 CKZbidKlmZb4Es62RIptzBoq7+e8k/U3ze0piKDX46RKNjOBY37EGqIAnWlI4Z2G6J11 lIU1fdUTFuNjPaJS6i7JNPB3Xvj3quyK4euAcIzDU/ehMNYtMbKhMDoERDcTfONkTV8S 2z1w== 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=Q0NIpxhCcdYMccDWkGk4o6N7oRC+wj6kLELDvuyJf8k=; b=o98UQlM1dxyekyzefsN6YigPwH0TcMfLmoZJ/on1vXIFtJVCIRQDBwMfZqcn+wQKRI AGQeR4Jg20mUCswMVFXwBMVeJ8ToM6a3Q5TK1JoZ1fUj+GjWrLg22dEwLTAdGDcZLMTA wuYvG80sIDu2o2rUSKDegbFui66igSTenfUEG617ece5XwzTW09aTxaI+blYQzds4HUl tHYlTr5rTQ9JPzyRTwgeBvN+ZWuALeWF2noZ18UpY7mjfgYDHJ+51orwETv1CdzwytFS HdqA3fBRXz105zE99X/TAddyR+pXlfsI4qFNH+XWaRUZwV0Cn4KXHxmEmbjiFG5gMaEi s7YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tnMRMwyE; 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 du20-20020a17090772d400b0072af6e1fff0si9929561ejc.330.2022.08.15.17.55.24; Mon, 15 Aug 2022 17:55:49 -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=tnMRMwyE; 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 S1345548AbiHPAek (ORCPT + 99 others); Mon, 15 Aug 2022 20:34:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354169AbiHPAbd (ORCPT ); Mon, 15 Aug 2022 20:31:33 -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 583B21863C2; Mon, 15 Aug 2022 13:36:18 -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 B53A2B8119A; Mon, 15 Aug 2022 20:36:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03DDAC433D6; Mon, 15 Aug 2022 20:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595775; bh=S7d4yGC4YTeNiuyO44KxFCfnQFLrUfkWQP1/fk0L3Wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnMRMwyEeWVxEAvU8gCyIapXc4M5RJ+niv3dhaRfFHecdrTVZG/8mbecn9c8Rw5C+ Cawnbckk2A4ifhrL8O2Ye7b7aZjAwk/CHd0AyMMiLnAy5l7jffOz+ir7Lru2bON49e +k+3wZVyvaJeoRqlZwsNd/s4pmpQ6P5yPWtLbnRM= 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.19 0872/1157] selftests: kvm: set rax before vmcall Date: Mon, 15 Aug 2022 20:03:48 +0200 Message-Id: <20220815180514.342264801@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 ead7011ee8f6..5d85e1c021da 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -1422,7 +1422,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