From patchwork Tue Feb 4 15:37:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11364885 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63EF392A for ; Tue, 4 Feb 2020 15:38:44 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4075F20674 for ; Tue, 4 Feb 2020 15:38:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bmMq8d43" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4075F20674 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iz0Gp-0001an-2D; Tue, 04 Feb 2020 15:37:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iz0Gn-0001ZS-Ag for xen-devel@lists.xenproject.org; Tue, 04 Feb 2020 15:37:45 +0000 X-Inumbo-ID: 3927529c-4764-11ea-a933-bc764e2007e4 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 3927529c-4764-11ea-a933-bc764e2007e4; Tue, 04 Feb 2020 15:37:17 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id q9so3777314wmj.5 for ; Tue, 04 Feb 2020 07:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lx6aI7LGswDmSt31XBjw6y0ZT47SzYKNZSKQP2MOBpk=; b=bmMq8d43p8nkqHb75gLI5GH2BjLUPh8jv8scZjvRSt8vqcgX1myWTJ7fZLoRqo2HI5 A3g1zBJhkPsIkOV22xBRoXRojXZ8f0IHTEvihoLPCWbRjbE8A63lNd6G3fh12pnLZD3A LSFO1rKz1Sjz3hnqoEGvE3lgJU6MZCQBVDlh7tSai6rPNK/DTvOXgpJ3qEQIP7Bl+tOj 3cArvOeuBnbkGVkWDfSIRMfWVly8uHPEEYhoAq75pFO47UHwS5qev2YvZDtsO+xDgu3H X+3taVF6Z86PntbZAeDKP1ynX85ov6EJVqmks3DwjTI2QQ/arB69b8DO0y+wsXmkBn5L IKDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=lx6aI7LGswDmSt31XBjw6y0ZT47SzYKNZSKQP2MOBpk=; b=XVFEAh5kA+ZlnmQt8U1y3gU9cGe4Ia7RKgxZXOoapqdwPZY8QGCZICBEWC+97gHIRv FFQQRPnAb6HI6yKWameEJRFRlDQL7rC6QpOQzk2/MH1rWvJNO6v1Dh3uPtcro7JmCJ4J t0JLa+7tp0SP8nKW5u41miPTihXuydv3Ta1bW9Uh10mGRrjh8uWTaLpLZnC+TDlsClDo 6kwzPVi9v6pPNtYRiJwzVPbVnfN4redYGm4QChfPunNKPWEkqKjRdduw91JmqwTBIDDC fqsjRAZmGtsKAupabbiv8Q32hEhKJLDiCdOZPSaPq4U+6Ul2CgHBmadfcMkTsVGRZAH8 h7BQ== X-Gm-Message-State: APjAAAVk5yPRFhoK4hheq7tZlbU0i3gyccChPRXpSRxOA9SlFieNRUA9 rDwABz6H2lWka998Y1TD+YMXUYd/Hq4= X-Google-Smtp-Source: APXvYqy7P9iOFGDC0ujXcqu3X880lt6G3RIgwcwBd7XtZW81RuvWrvtMm3boEfX+Rkd/hGx1QfiNRA== X-Received: by 2002:a05:600c:2551:: with SMTP id e17mr6571784wma.187.1580830636248; Tue, 04 Feb 2020 07:37:16 -0800 (PST) Received: from localhost.localdomain (41.142.6.51.dyn.plus.net. [51.6.142.41]) by smtp.gmail.com with ESMTPSA id p26sm4067143wmc.24.2020.02.04.07.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2020 07:37:15 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Tue, 4 Feb 2020 15:37:01 +0000 Message-Id: <20200204153704.15934-8-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200204153704.15934-1-liuwe@microsoft.com> References: <20200204153704.15934-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v7 07/10] DO NOT APPLY: x86/hyperv: issue an hypercall X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Wei Liu , Andrew Cooper , Paul Durrant , Michael Kelley , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Test if the infrastructure works. Signed-off-by: Wei Liu --- xen/arch/x86/guest/hyperv/hyperv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xen/arch/x86/guest/hyperv/hyperv.c b/xen/arch/x86/guest/hyperv/hyperv.c index 888bda25b0..2a2afcb363 100644 --- a/xen/arch/x86/guest/hyperv/hyperv.c +++ b/xen/arch/x86/guest/hyperv/hyperv.c @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -114,6 +115,19 @@ static void __init setup_hypercall_page(void) BUG_ON(!hypercall_msr.enable); set_fixmap_x(FIX_X_HYPERV_HCALL, mfn << PAGE_SHIFT); + + /* XXX Wei: Issue an hypercall here to make sure things are set up + * correctly. When there is actual use of the hypercall facility, + * this can be removed. + */ + { + uint16_t r = hv_do_hypercall(0xffff, 0, 0); + BUG_ON(r != HV_STATUS_INVALID_HYPERCALL_CODE); + r = hv_do_fast_hypercall(0xffff, 0, 0); + BUG_ON(r != HV_STATUS_INVALID_HYPERCALL_CODE); + + printk("Successfully issued Hyper-V hypercalls\n"); + } } static void __init setup(void)