From patchwork Mon Oct 2 09:57:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 147411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1603386vqb; Mon, 2 Oct 2023 11:09:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaMZclCkPfi7KYFIIhW2BBOmw+qk5xHgNwssinlcg2rZpuCJk5ZW0aqE4TuZ8jhpdqwCFZ X-Received: by 2002:a17:90a:eb03:b0:274:24e2:ae6d with SMTP id j3-20020a17090aeb0300b0027424e2ae6dmr9829107pjz.0.1696270193044; Mon, 02 Oct 2023 11:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696270193; cv=none; d=google.com; s=arc-20160816; b=qP3zJZzT6PtHIKV4TIqsOWcBg7WhKYasI9tgRkQQtkPIYeNLsS5+cWzk79Tkinzh62 ykF+PbqgcIp9+2w2b0ofZWOUGgQH8+vBX2fe3XqZSFjB8VOVKYjkgk54fAwSR5qsaRVf NaNoZ4Tb9S0UsqBXUYZCOEx+nRgee0xG49r0YeKNE9Lkxr+nGMSYuAapK7mCeoB3Ajbs hYtwO+flld0T2u15VhcMABd4bVhorQ6DKQq4osUO5adjEjugmCh8+wMSU0pkqBUqhrns FxuiZ5z7/NP0EWZg4o95eoS90vq+TIOkm5y5tg2HHUf3mbSWpHDjMS7DDQttI/Dqq1HD YC8A== 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:cc:to:from :dkim-signature; bh=GVRP7ZhX9y66fV8la0Z0phq4YOuv61LMjBgGZkw2zl4=; fh=lKhNn3P8ZvksS1fElybz1iP8zlw6JVVQ9gjuN2JwMdc=; b=FcI5e4u/PMh6OqD1yDjiXA/mxFJ9cvtXMFb1dSlwOJrg1Ew6tyqVzGGvh6OO981klr dajrxkzLvU+w7LUfBS+rYLRXRB8sEOj68jKrluYmWW/DXqT7iRIUzgaz0gQX+pj+f64H 3tTV6+N78fcjOP6Ek/MKGrdM7k/meOnW22Q8it/WzI7EQ3Q8xr85bFoJujUGvqXfo1JR Qb9YF+Tj8bH/JsGq+wWfLv78TaLDSeSPIGhQF1CcCI06PW0OHGw8JmKR2Igau+A9iKmd 4O+kbAtQS7Vw6ixZG2t60b1iSqfLifN/QWHvDlqw3cW4z7D2dc6ftLwqs/DGQZF2hjtd 0A8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=MYIyM3Rc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id a1-20020a17090a854100b0026b698fdda6si7587279pjw.98.2023.10.02.11.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 11:09:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=MYIyM3Rc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 8AC0D807C5C1; Mon, 2 Oct 2023 02:59:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236387AbjJBJ62 (ORCPT + 16 others); Mon, 2 Oct 2023 05:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236352AbjJBJ6F (ORCPT ); Mon, 2 Oct 2023 05:58:05 -0400 Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6E67C4; Mon, 2 Oct 2023 02:58:01 -0700 (PDT) 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:Cc:To:From; bh=GVRP7ZhX9y66fV8la0Z0phq4YOuv61LMjBgGZkw2zl4=; b=MYIyM3RcvwaRbDjAKvQUPqHPe/ Kd8oc2UrJTmvAwD+3Wpo+MPjaVZUzMiCqO8h9YAsOk1WGNkzLlv1MdtrUhbrFhs0QAUU4FcrVT7uA wULosAIqVySsd/JKEL6DW49cwlpyRvGRyH8t3r/hlBADE+j3KiA7kqCpWXoErqm+C5Ew=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qnFge-0000ww-PZ; Mon, 02 Oct 2023 09:58:00 +0000 Received: from ec2-63-33-11-17.eu-west-1.compute.amazonaws.com ([63.33.11.17] 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 1qnFge-0000Ft-I8; Mon, 02 Oct 2023 09:58:00 +0000 From: Paul Durrant To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Paul Durrant , David Woodhouse , Sean Christopherson , Paolo Bonzini , David Woodhouse Subject: [PATCH v7 09/11] KVM: selftests / xen: re-map vcpu_info using HVA rather than GPA Date: Mon, 2 Oct 2023 09:57:38 +0000 Message-Id: <20231002095740.1472907-10-paul@xen.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002095740.1472907-1-paul@xen.org> References: <20231002095740.1472907-1-paul@xen.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 02 Oct 2023 02:59:54 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778668214004192077 X-GMAIL-MSGID: 1778668214004192077 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 e6672ae1d9de..a5d3aea8fd95 100644 --- a/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c +++ b/tools/testing/selftests/kvm/x86_64/xen_shinfo_test.c @@ -66,6 +66,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, @@ -325,6 +326,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]++; @@ -892,6 +897,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");