From patchwork Wed Nov 8 17:19:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 10048865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 32F1360247 for ; Wed, 8 Nov 2017 17:22:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14F1F2A71C for ; Wed, 8 Nov 2017 17:22:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0848122380; Wed, 8 Nov 2017 17:22:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9AE9022380 for ; Wed, 8 Nov 2017 17:22:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCU1S-00071C-P6; Wed, 08 Nov 2017 17:20:18 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eCU1R-000716-JP for xen-devel@lists.xenproject.org; Wed, 08 Nov 2017 17:20:17 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 79/16-30895-0DC330A5; Wed, 08 Nov 2017 17:20:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRWlGSWpSXmKPExsUyZ7p8oO4FG+Y og3VzpS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owNm+8xF/xlq3i8aSpzA+Mv1i5GLg4hgQlM Eo+69rFDOL8YJX696WKBcDYwSly60csM4TQySlx/d4qxi5GTg01AT6L1/GdmEFtEwFTi4IR7Y LOYBXqZJW5teckOkhAWcJRYdG4NUxcjBweLgKrEuf2iIGFeATuJ9Z+/MYHYEgLyErvaLrKC2J wC9hLN96+BzRcCqul7P4sZol5Q4uTMJywgY5gF1CXWzxMCCTMDtTZvnc0MMcZQ4vPGpcwTGAV nIemYhdAxC0nHAkbmVYzqxalFZalFuiZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5 mxiBYcsABDsYuy/7H2KU5GBSEuV98IopSogvKT+lMiOxOCO+qDQntfgQowwHh5IE7ylr5ighw aLU9NSKtMwcYATBpCU4eJREeM1A0rzFBYm5xZnpEKlTjJYcNx5e/8PE8Wzm6wZmjmlXW5uYhV jy8vNSpcR5p4M0CIA0ZJTmwY2DRfklRlkpYV5GoAOFeApSi3IzS1DlXzGKczAqCfPuApnCk5l XArf1FdBBTEAH7Q9hADmoJBEhJdXAyKvNs3tOT8/TvbreR8wmOFV2fTBzy5JcIzk3Qpl5Adfc +oxd97UzxGqrHC1q/jb7vTDRKnmvUZ+j8X5v/5SHxg08C1X+6jQJyZ6L0Y9/NCmRbVr72oVGp zZo6T3dOrn4XLq74cKwN6XsNbs3Hk5iO9E4P5q5qVms9t/2nS+Lt+nNt8ry/X5ZiaU4I9FQi7 moOBEAUSXXXO0CAAA= X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1510161614!56058242!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 46081 invoked from network); 8 Nov 2017 17:20:16 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-2.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Nov 2017 17:20:16 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vA8HKB6R019600 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Nov 2017 17:20:11 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id vA8HKBNf023186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Nov 2017 17:20:11 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vA8HKAHk021042; Wed, 8 Nov 2017 17:20:10 GMT Received: from paddy.lan (/94.61.137.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 08 Nov 2017 09:20:10 -0800 From: Joao Martins To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Date: Wed, 8 Nov 2017 17:19:54 +0000 Message-Id: <20171108171958.23921-2-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171108171958.23921-1-joao.m.martins@oracle.com> References: <20171108171958.23921-1-joao.m.martins@oracle.com> MIME-Version: 1.0 X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: Juergen Gross , Radim Krcmar , Richard Cochran , Marcelo Tosatti , Andy Lutomirski , xen-devel@lists.xenproject.org, Paolo Bonzini , Boris Ostrovsky , Joao Martins Subject: [Xen-devel] [PATCH v8 1/5] ptp_kvm: probe for kvm guest availability X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP In the event of moving pvclock_pvti_cpu0_va() definition to common pvclock code, this function would return a value on non KVM guests. Later on this would fail with a GPF on ptp_kvm_init when running on a Xen guest. Therefore, ptp_kvm_init() should check whether it is running in a KVM guest. Signed-off-by: Joao Martins Acked-by: Radim Krčmář --- Changes since v7: * Add Radim's Acked-by --- drivers/ptp/ptp_kvm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ptp/ptp_kvm.c b/drivers/ptp/ptp_kvm.c index 2b1b212c219e..e04d7b2ecb3a 100644 --- a/drivers/ptp/ptp_kvm.c +++ b/drivers/ptp/ptp_kvm.c @@ -178,6 +178,9 @@ static int __init ptp_kvm_init(void) { long ret; + if (!kvm_para_available()) + return -ENODEV; + clock_pair_gpa = slow_virt_to_phys(&clock_pair); hv_clock = pvclock_pvti_cpu0_va();