Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp592713rdf; Tue, 21 Nov 2023 10:33:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe0k1z67aDRPk+dHogyDkOCIOGMq2fYbUlZyObLi8Af6cWnBu6rt7jwjUT+MvqtXtJzGrq X-Received: by 2002:a17:90b:3a82:b0:283:a0c2:b19 with SMTP id om2-20020a17090b3a8200b00283a0c20b19mr39940pjb.26.1700591627604; Tue, 21 Nov 2023 10:33:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700591627; cv=none; d=google.com; s=arc-20160816; b=bVwYUhW6cGjI+rBvDzDnXufkHm4DJwl9Dlk8wsJ0X609Uq/MWwZlEDoHQbeDTwCLbK wIitI7dZQlKouoEddMZFTzrP81vfmk4Ad1R6wHUxawaGoccfKJQIL0oGwYsAHdksf1hu CYw9ee5JCEm3ARBSQvIijNkCe3ImIwrkdOV8E66HEHELufgNKeQzYClmAdApxEG8p0s8 pnGLovn+4Z+0/e9ypx9NKZVeospj4AX/KkCfv99gHTzeDWaxrZLd0wBKySUvD503dzRQ K5QHoM1Zi0b5uFy3FUTC+MRc0HSqFm162c/NwJ1qEaitsiZPudL8OPv2lZocjO1fe++z qf4Q== 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 :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=nuXWSkr0ZyIsLCugqKNNY21HAlliCS4E2dntcvQyiAA=; fh=Cum1qOF0YrAzH/5yQjcCBfU63B+V0l01YtzsDBRUOAc=; b=atPwgEdhC+AN/8apf8DMaK0qvAOfqLjpGpUhNE2Wal4eGdMug9g4vk/upQz8Mf3vT7 wZlmQh7IFF8mHZI4VK1E3xK9Xj5aT9mvjUQ1icZ04Dkw40IEbed6sWlY9I6+8wRmIQtr xHVI9wNBY5v4O9PxG0jbFX+XwpbORghvjo+Fd+xLlh7OOIFfIqMnMFuQPNSU/8Raymcg pBAcfzBQe38qUASIB1v7kmgf+f/wQGOXXqsGV12dFQEJh9YVQmH2KZF5MpljJD5fLsr4 80bbiAB4TJgX+F44muvh+Zj5rtkdn5EazGi5eppWTFchkbzks4mBbA9+YK8Sz3alLtYv tEYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=si9CZElJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id my13-20020a17090b4c8d00b0027d54b9f379si11504880pjb.123.2023.11.21.10.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 10:33:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=si9CZElJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 977678028A64; Tue, 21 Nov 2023 10:30:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231236AbjKUSan (ORCPT + 99 others); Tue, 21 Nov 2023 13:30:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231178AbjKUSad (ORCPT ); Tue, 21 Nov 2023 13:30:33 -0500 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C88193; Tue, 21 Nov 2023 10:30:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From; bh=nuXWSkr0ZyIsLCugqKNNY21HAlliCS4E2dntcvQyiAA=; b=si9CZElJZwCF2DGs1y9Dgxfkcm Fm3N8P8qmVPS6fA47Ir8YQBVIG/V4kihJIgX+LQ4hVv0RR0dQU7hsG6KoF/qsL3cZ0vW6mKI3eQCH 3W3wANpemSfMY6oV1lcuYjwRy7tNjlfJd6tuEBD3ca/iv5VcmjvmsAVTzV0iAxqrxzfY=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5VVp-0000Be-Sz; Tue, 21 Nov 2023 18:30:17 +0000 Received: from 54-240-197-231.amazon.com ([54.240.197.231] helo=REM-PW02S00X.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r5V5o-0004Z3-S9; Tue, 21 Nov 2023 18:03:25 +0000 From: Paul Durrant To: David Woodhouse , Paul Durrant , Sean Christopherson , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 12/15] KVM: selftests / xen: re-map vcpu_info using HVA rather than GPA Date: Tue, 21 Nov 2023 18:02:20 +0000 Message-Id: <20231121180223.12484-13-paul@xen.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231121180223.12484-1-paul@xen.org> References: <20231121180223.12484-1-paul@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 10:30:54 -0800 (PST) From: Paul Durrant If the relevant capability (KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA) is present then re-map vcpu_info using the HVA part way through the tests to make sure then there is no functional change. Signed-off-by: Paul Durrant Reviewed-by: David Woodhouse --- Cc: Sean Christopherson Cc: Paolo Bonzini Cc: David Woodhouse v5: - New in this version. --- .../selftests/kvm/x86_64/xen_shinfo_test.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c index a61500ff0822..d2ea0435f4f7 100644 --- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c +++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c @@ -62,6 +62,7 @@ enum { TEST_POLL_TIMEOUT, TEST_POLL_MASKED, TEST_POLL_WAKE, + SET_VCPU_INFO, TEST_TIMER_PAST, TEST_LOCKING_SEND_RACE, TEST_LOCKING_POLL_RACE, @@ -321,6 +322,10 @@ static void guest_code(void) GUEST_SYNC(TEST_POLL_WAKE); + /* Set the vcpu_info to point at exactly the place it already is to + * make sure the attribute is functional. */ + GUEST_SYNC(SET_VCPU_INFO); + /* A timer wake an *unmasked* port which should wake us with an * actual interrupt, while we're polling on a different port. */ ports[0]++; @@ -888,6 +893,16 @@ int main(int argc, char *argv[]) alarm(1); break; + case SET_VCPU_INFO: + if (has_shinfo_hva) { + struct kvm_xen_vcpu_attr vih = { + .type = KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO_HVA, + .u.hva = (unsigned long)vinfo + }; + vcpu_ioctl(vcpu, KVM_XEN_VCPU_SET_ATTR, &vih); + } + break; + case TEST_TIMER_PAST: TEST_ASSERT(!evtchn_irq_expected, "Expected event channel IRQ but it didn't happen"); -- 2.39.2