Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5823095imm; Tue, 12 Jun 2018 14:02:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI76Eors081qUJBt3tEqebaPvaWCmZmFoxkfJOa/AN84YcNKvx1B38/WSFXDmuSox7Urt/a X-Received: by 2002:a17:902:bd93:: with SMTP id q19-v6mr2060218pls.342.1528837367849; Tue, 12 Jun 2018 14:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528837367; cv=none; d=google.com; s=arc-20160816; b=X7hLIqKsE2rDwXfodUwkR7JL6Z0+RBmMie8uP50MMQ6mtjtVOltdv+zacKSHhyEipP ETbtwWB7fZHym30XS2itYehdNdza5HcMZ5BoaApANsxW269cccOj8Ta/tI7mF6pOekzn veAkmto2c2a/5BSwpxaO8cItLNvQesDz+r0gU8mNIB27yCOjiIbgGwgqnrE+QywCnN93 frY5OGYrJc/iVkkQw7yANTz3xbOhflUAg5LhdtWbDKC5+wKzftacmVE+vFV7mwrKL0+X ztkX7JTMKzVWq1YGo0SuUEG8n8Y/5ZXoSMs5O5GMzXYcTcdrrMvqFz/5SCYBeUD5+Hcg n19g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=0F1GfjZPIl4k7H/vkwsKAphOOqwq532rc/1rL93kMSg=; b=sL8Mg/prmctbaNrn5+wq8XxNnsSf84O2L4k3yoMIGNgx3J+C6d9FQ2dLcYEYysy2qd 2ONAjBcX2nujh5l+XtEqmD2XKP8KzvQ2boJQAGJboueLBmK3kxv01D2yQ2H+7Qe50bFV 83vexgyKNGiKccUr3sGxhIwPuGEdhb2JDewSbkOGhHRkRHRsneLp0kRSKyJB7/S5UPFt UPYbXFN1LAGfkoXTAFx4CQVn1LRmfCSj3Kxhqe/a/70sAfzPb1IyH3KCCgoeUuYWScie jrLuiLE4HMW6f3iL3VDD/PBTWu7NIwWh1Wm+wEWZ6zrpECw1BCtuQK8nYaPIsRAyqHAS vExQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=p0+Os1tn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a35-v6si1078192pli.85.2018.06.12.14.02.22; Tue, 12 Jun 2018 14:02:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=p0+Os1tn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934196AbeFLU4i (ORCPT + 99 others); Tue, 12 Jun 2018 16:56:38 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:6029 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933685AbeFLU4f (ORCPT ); Tue, 12 Jun 2018 16:56:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1528836995; x=1560372995; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=0F1GfjZPIl4k7H/vkwsKAphOOqwq532rc/1rL93kMSg=; b=p0+Os1tnFnJSGqqvMjoccerrRGBaBNQdiuvTiXFKfe3Fek42U6N0adRI Ine32Q4uELpXO5qTJA3nrw8My1v3RJConGWWEMB+DSIyEX/a/hNY6b5q7 04mncv1byNXY4LaiNd7BcUqy81TEPELvK30csxb1YuNuAshQGbygu+ZFx k=; X-IronPort-AV: E=Sophos;i="5.51,216,1526342400"; d="scan'208";a="736713942" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2b-c7131dcf.us-west-2.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Jun 2018 20:56:32 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-c7131dcf.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w5CKuT1J117272 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 12 Jun 2018 20:56:32 GMT Received: from EX13D16UWB003.ant.amazon.com (10.43.161.194) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Jun 2018 20:56:28 +0000 Received: from EX13MTAUEE001.ant.amazon.com (10.43.62.200) by EX13D16UWB003.ant.amazon.com (10.43.161.194) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Jun 2018 20:56:27 +0000 Received: from localhost (10.25.15.63) by mail-relay.amazon.com (10.43.62.226) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 12 Jun 2018 20:56:27 +0000 From: Anchal Agarwal To: , , , CC: , , , , , , , , , , , , , , , , , Subject: [RFC PATCH 02/12] xen/manage: introduce helper function to know the on-going suspend mode Date: Tue, 12 Jun 2018 20:56:09 +0000 Message-ID: <20180612205619.28156-3-anchalag@amazon.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180612205619.28156-1-anchalag@amazon.com> References: <20180612205619.28156-1-anchalag@amazon.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Munehisa Kamata Introduce simple functions which help to know the on-going suspend mode so that other Xen-related code can behave differently according to the current suspend mode. Signed-off-by: Munehisa Kamata Signed-off-by: Anchal Agarwal Reviewed-by: Alakesh Haloi Reviewed-by: Sebastian Biemueller Reviewed-by: Munehisa Kamata Reviewed-by: Eduardo Valentin --- drivers/xen/manage.c | 15 +++++++++++++++ include/xen/xen-ops.h | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 8f9ea87..326631d 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -50,6 +50,21 @@ enum suspend_modes { /* Protected by pm_mutex */ static enum suspend_modes suspend_mode = NO_SUSPEND; +bool xen_suspend_mode_is_xen_suspend(void) +{ + return suspend_mode == XEN_SUSPEND; +} + +bool xen_suspend_mode_is_pm_suspend(void) +{ + return suspend_mode == PM_SUSPEND; +} + +bool xen_suspend_mode_is_pm_hibernation(void) +{ + return suspend_mode == PM_HIBERNATION; +} + struct suspend_info { int cancelled; }; diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index fd23e42..be78f6f 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h @@ -39,6 +39,10 @@ u64 xen_steal_clock(int cpu); int xen_setup_shutdown_event(void); +bool xen_suspend_mode_is_xen_suspend(void); +bool xen_suspend_mode_is_pm_suspend(void); +bool xen_suspend_mode_is_pm_hibernation(void); + extern unsigned long *xen_contiguous_bitmap; #ifdef CONFIG_XEN_PV -- 2.7.4