Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp36091rdb; Tue, 19 Dec 2023 08:43:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBjg2Ku9a2Jc4WH69zYjxl7yEyYkTMOA7N1PGcUlF8Jh56idgqEIWub/hnePciBr5drG6/ X-Received: by 2002:a50:d502:0:b0:553:42de:f144 with SMTP id u2-20020a50d502000000b0055342def144mr1180704edi.141.1703004211358; Tue, 19 Dec 2023 08:43:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703004211; cv=none; d=google.com; s=arc-20160816; b=bLVOt1lxdBvOatwb75LhPG5JgB6gI9UzRAlvyCHJlAuyE5B+ipNZ05ZjKt+FXBzHRb QSrfyI7f0pJ1JKzSU3Kt3XKVTeC7U+Y0emZM0qTPkmHUilFgLVWFaOvYa0YNCUUKmVEf lRieJDNlGCZhMJlVQwCfT3SMRpwyI3538JnMM7lMjwllewenBVl3LQcNiFXPTmHuRvz6 S1+RnN6b0rFoTdUc8mH8JuowR3fAxsg2AerdeqydNnq0YylEl5ckqDYSd9hb71QhcmQO qo6yFSVVadU3k/xCIUw05NpU8EgJ8Yfq6aX4DjjEaigGGeBT+1SsX5OaZBtRmVJIF+7O 4ctQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=nuXWSkr0ZyIsLCugqKNNY21HAlliCS4E2dntcvQyiAA=; fh=aAPqvXm40pY9772UiBOljEePwtz/3Q0zIOpw238tj3M=; b=ZFxk9lcfnCQ70vxw29sQ9lhpX7nnPgg2upQuV/pKOPVc5tb8hISSOXLNEGMX+Zvmz5 47jGv5sy6XbL+IwA5QWSq64r2R32BJ4OcwvmrsUMvHdEQt3+7+/gACLCv8pexXPCtA12 0FiDaLkbv9bYkzgrepHZ7bzw/xjzCWtLw852OFzbUnqmAY9M41uM4WyOrFK6IqV1zjDC eqheKlVfehhWXIKXC+IClM29zwQ1VlOJCwFR94syb2Rn39zmrKJBrVNahBDiZbTzipJy oxKm/veQW0zd/3ouupJLwxIG3VqDzIh0PzMGAzge1LNKNQZWYQBaUgXVpYeNNFmc/oRE gYnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=oUVOIAFa; spf=pass (google.com: domain of linux-kernel+bounces-5581-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5581-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f12-20020a056402354c00b0054b2bc76084si11482508edd.130.2023.12.19.08.43.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 08:43:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5581-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=oUVOIAFa; spf=pass (google.com: domain of linux-kernel+bounces-5581-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5581-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1AC601F25802 for ; Tue, 19 Dec 2023 16:43:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F21C37148; Tue, 19 Dec 2023 16:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xen.org header.i=@xen.org header.b="oUVOIAFa" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.xenproject.org (mail.xenproject.org [104.130.215.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F152C20334; Tue, 19 Dec 2023 16:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xen.org 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=oUVOIAFaNHVexNTFXcA8x8MFdy vkkn0/ldOEiPIARqQ+uoPXqgGxbRTTY9nnLXBIM9mTjduq2/pFUuE4gis186Fuj80AKt56i50Euey FVru3Qk6uLqN/IBQnXEfvK/vwwpUeZRsVj5zhwmEXIHZKzPWN2PJe4vOq5G104Wg4Kqw=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFd9y-000653-7I; Tue, 19 Dec 2023 16:41:34 +0000 Received: from 54-240-197-226.amazon.com ([54.240.197.226] 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 1rFckI-0005h9-T5; Tue, 19 Dec 2023 16:15:03 +0000 From: Paul Durrant To: Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , David Woodhouse , Paul Durrant , Shuah Khan , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v11 14/19] KVM: selftests / xen: re-map vcpu_info using HVA rather than GPA Date: Tue, 19 Dec 2023 16:11:04 +0000 Message-Id: <20231219161109.1318-15-paul@xen.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219161109.1318-1-paul@xen.org> References: <20231219161109.1318-1-paul@xen.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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