From patchwork Wed Aug 17 08:51:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Yang X-Patchwork-Id: 1667146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=tJA55OfO; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M71wx5t31z1ygF for ; Wed, 17 Aug 2022 18:52:16 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oOEmP-0000LF-Vg; Wed, 17 Aug 2022 08:52:02 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oOEmN-0000KL-Fq for kernel-team@lists.ubuntu.com; Wed, 17 Aug 2022 08:51:59 +0000 Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 38DC93FB94 for ; Wed, 17 Aug 2022 08:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1660726319; bh=Lt/XymlNNFC2O3d1WyGXiRgPAQl1HAsk+w/ki+M46R0=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tJA55OfOKGYeEBLPyH9QrlwnyL24taOTyqaFJJCAkX18HKAAbsXLKJdgfia3F++zm 59N8jbsTrITTyMh+5SuQkBjIOSh4QE3e1YnCdUZl+2dudIAbdukjiRW3ISVg2cK2x/ ZVMZ9vrKgaHqo8ZA33PZmCiqJ/gI4BQQ0UrOKfnn12IbpGuldFoqh3raQGGX3XJdj9 ExYKzF21UV80fU7kvq4aqESNWO/MHleqfiW2CFy9HOrx1Ad54QvmTr2+krS9veQa5V uCDEVi1BaAz+MJZoRVB0q5W3eBX38IFHl0z/ePUCRKKe4c4V6oP82wPc7Swv/NJt3V 7u2R8rKXeyEeg== Received: by mail-pj1-f69.google.com with SMTP id li17-20020a17090b48d100b001f516833f62so5205420pjb.9 for ; Wed, 17 Aug 2022 01:51:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=Lt/XymlNNFC2O3d1WyGXiRgPAQl1HAsk+w/ki+M46R0=; b=6yrShSmQgcTQTLebcyiZ2iWYK1+7VNGzEWr2cjBondlS5ckR5c9yHmCvF0PgMEBxuX L0zhUhqmtr58K5IIuzYh6RaqO5ZYnmYgDG2USHW9G7sVE9u54LB8qOOVwLQ5N3KFMLmf 6uyTDjIEO/zUjRgT6/tc+oX0y0JQF56hFVdD0FCltma1auYOyvguQQrZCkvdZFzOdpNf 3C215X+mgrfaDfSRKs+D4IpeDXODpYD168wt08xjwpTzEH4Fruo0+vfgMqOyPpqQvyWu ZkZPL9gDdaM3B6Uaw8Q9M25FLvBen/BKiIJn8UC3joGLWtTIoUy1J5DuTUJ8TM9gH9ud WIiA== X-Gm-Message-State: ACgBeo3OaW/8tciElEvLWFj7ILYA08Md55nrrr0z3tjpSSZ1ztSQNx5B V08AjrONI6L7d4qQg8CHojcRArYy8gaFsZOfmZULz7H2ikbdTnfarOgt/Lu113feCYFn1QMgtD0 YSYgrcDzwpvdT/nVDoiwRVrp8D4qGHbqTDJMoYL4f9A== X-Received: by 2002:a17:902:e94c:b0:171:3df0:c886 with SMTP id b12-20020a170902e94c00b001713df0c886mr26025096pll.39.1660726317653; Wed, 17 Aug 2022 01:51:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR6suCM6bXR5GJ2HnJkSTACnklwCXJ+8Twtn3pRLpImeskh50MviIWB4QF1FsJRa2O0RiBcmyA== X-Received: by 2002:a17:902:e94c:b0:171:3df0:c886 with SMTP id b12-20020a170902e94c00b001713df0c886mr26025080pll.39.1660726317298; Wed, 17 Aug 2022 01:51:57 -0700 (PDT) Received: from localhost.localdomain (220-135-31-21.hinet-ip.hinet.net. [220.135.31.21]) by smtp.gmail.com with ESMTPSA id s90-20020a17090a69e300b001f522180d46sm1001033pjj.8.2022.08.17.01.51.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 01:51:56 -0700 (PDT) From: Gerald Yang To: kernel-team@lists.ubuntu.com Subject: [SRU][jammy/linux-aws][PATCH 02/20] UBUNTU: SAUCE: xen/manage: introduce helper function to know the on-going suspend mode Date: Wed, 17 Aug 2022 16:51:28 +0800 Message-Id: <20220817085150.2078055-3-gerald.yang@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817085150.2078055-1-gerald.yang@canonical.com> References: <20220817085150.2078055-1-gerald.yang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Munehisa Kamata BugLink: https://bugs.launchpad.net/bugs/1968062 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 CR: https://cr.amazon.com/r/8273190/ (cherry picked from commit 7d04745f53231fcfc934cea2b5ef3cf4f80fb7d4 amazon-5.15.y/mainline) Signed-off-by: Gerald Yang Signed-off-by: Matthew Ruffell --- 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 63abb3ab09af..d1cfbbf56e6e 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -51,6 +51,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 a3584a357f35..8bfbc80d4b53 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h @@ -40,6 +40,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; #if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64)