Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp560088rdb; Thu, 15 Feb 2024 08:15:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXSCPoNmvYCP11oiHcuKItTOFjbdXYiIts0wrAdBgJcWBG2wtbnT3DQJpFHHAFL2we4dVu3+wS8G1WBvdAA5mPOzqN5QfqlOTOXCwpbgg== X-Google-Smtp-Source: AGHT+IEVt2yM6zy3nU1+kS05nnsCmwY8hHOiwBs1xvYMVP2EPdezaCTQGSSi9Z6E+Fv5MJwB7RGd X-Received: by 2002:a05:6a00:d45:b0:6de:1cae:a4ed with SMTP id n5-20020a056a000d4500b006de1caea4edmr2035439pfv.3.1708013753024; Thu, 15 Feb 2024 08:15:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708013753; cv=pass; d=google.com; s=arc-20160816; b=LZ2xePqMD7G0gmgQoJAPxdJpvYJJnuU1BNOMsLOKhih5cokhG9KeUsUDFlenJxxrEt +y7dLyDxO6L2aJozUwwo7Vk0kbGwtDUa0Ykw+WjM23k7pu07QRcQUqKOxaagHFdyOO5k gfYmN0p0RHXz9Lzvq2zcqcbt3Lnt43hm0imtLftinWcatxBrL47laBeAU+MOHgzEWKhE 0dRx9bOur/DUxCtbwt/Nd+bF2PPbWriNiS3a7/JAh9CK0YRDFaNtqFf7Nl/Yl9tUTWtI j8G1rRA1riExKIpAOpNAGrjvOIA+DUOrG/iofBMqjRE0SnFE+RLX1NjaiSwcwHFGaMbS e8Mw== ARC-Message-Signature: i=2; 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=eGccA33nyFEKdgeK/g8u1BZPB0MRYMmxx5o4P3mI8s4=; fh=NrOggL3VZvuSFh5W9Wj2+kLgS4v0nogfnAWvBJoouXQ=; b=cYBEiEU/h8zGnnL+HFYfEt4XDE0oaMtxImJ1Wo3r+QcrfvRl8I0BRN2lZBUkfrOoBU cUEYPotJzCK7zTgZof1X673PYBpRa15bF30YZAxLHdQvdf620ZhBtlMOFpC9PRKfRcAd DPKyC6MI4+ElehBDVkPZZ9WvC+ft7V//jdgo9a8/QQqQpl67iFJGPIOUE0oND8Eg2JcY HKWVrte6McOKlbS7uKFfWRtUPlhYCByhqs6mWZuKFJ+4xToKh6ODIqHN738H85fRgrD8 ABwH07XgbC2Za94YO/L8cwadJzz0ssYQjmEJv/BKHP1v2Uc8HCN/bjRTnDaysgtqjUwn accg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=egrlIkVf; arc=pass (i=1 spf=pass spfdomain=xen.org dkim=pass dkdomain=xen.org); spf=pass (google.com: domain of linux-kernel+bounces-67231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67231-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f31-20020a056a000b1f00b006e08bc19c82si1328456pfu.82.2024.02.15.08.15.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:15:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@xen.org header.s=20200302mail header.b=egrlIkVf; arc=pass (i=1 spf=pass spfdomain=xen.org dkim=pass dkdomain=xen.org); spf=pass (google.com: domain of linux-kernel+bounces-67231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67231-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A928FB29BB8 for ; Thu, 15 Feb 2024 15:47:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB847136675; Thu, 15 Feb 2024 15:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xen.org header.i=@xen.org header.b="egrlIkVf" 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 E52FC134CFC; Thu, 15 Feb 2024 15:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.130.215.37 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011877; cv=none; b=gd7pvM4oCL4vv0c2lrmRJUSl9QmgZnbj2TzXLYSDTnEFdVJfr6CNHkVq+TbkLWWbqgjAvhkpacIdHmgbXpck71nHAXBnK75t8JOVqHcz0/1lA4KyV05zWRtxqFwo2PbPLyZ4EYwZ6V20+1BLBFZGc6d5Zl1qQJ4G3rvcLFoJsak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011877; c=relaxed/simple; bh=6njkDDjVH7BF5Vtv3rgURx4yvTEOIoCdz9lB2ougXog=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hWeZqoaYrzciH1QO+1u7DqcYBRwZS7HNijFOwp2e8H1u0QAf8/cOHTQsSKKhgomnaUSNyQZtOXadJE7SDwpAGUHanJXYBqM7EcryqMk7ozrdDtPYM365QE3P8Uf63ODZhjMFxqmE7STQI1ZZfCG2t7IZB0QimLyMZDWD/vxeE2w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org; spf=pass smtp.mailfrom=xen.org; dkim=pass (1024-bit key) header.d=xen.org header.i=@xen.org header.b=egrlIkVf; arc=none smtp.client-ip=104.130.215.37 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=eGccA33nyFEKdgeK/g8u1BZPB0MRYMmxx5o4P3mI8s4=; b=egrlIkVfX67JoHldpFJLL3GD0I eYtq30dEdsjEVCpuyXGLNG4LjQMl4eZSODnmvt8roh3JF24Gm7BIq+Hkcak8QRSOFt1YGtnQcE1Di Vzl7y+vGzT+N9DYmDNG7JCX1U+LYvwPtK2wTKo/jNMtYFQSkSPI5X8BGkMRji4bPxWbc=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raduL-0001WE-IS; Thu, 15 Feb 2024 15:44:17 +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 1radhN-00089r-D1; Thu, 15 Feb 2024 15:30:53 +0000 From: Paul Durrant To: Paolo Bonzini , Jonathan Corbet , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sven Schnelle , 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-s390@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v13 15/21] KVM: selftests: re-map Xen's vcpu_info using HVA rather than GPA Date: Thu, 15 Feb 2024 15:29:10 +0000 Message-Id: <20240215152916.1158-16-paul@xen.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215152916.1158-1-paul@xen.org> References: <20240215152916.1158-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 v13: - Patch title change. 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