Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3727080imw; Thu, 7 Jul 2022 06:44:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uvqC19FX/nuq0PLD5f6JvvoIzXxOxy4sa/P/WZr6/nt5o6ZXSSfucTagDToZD9wIyJKeAW X-Received: by 2002:a17:902:e945:b0:16b:f802:1660 with SMTP id b5-20020a170902e94500b0016bf8021660mr12872261pll.7.1657201460583; Thu, 07 Jul 2022 06:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657201460; cv=none; d=google.com; s=arc-20160816; b=exOhepENcO62jsvajwVpzK2pnYXG1GHvcM180GXeK9GAa75CsLsYnP7n7eWu5F6XRt c3J0wIGXk4iL+b7jonBwqPA8Hd0vU/j0O7DuM1t6p9KyJ+Mb2NRylhbaF33e6DihVPOg TCRkYUhBVzLSK9kdqdDrAGa0sqIIAiQw4p2s9EqgKXq8tIRqAAS//Cc1Ubwu6yq6OL8y UGXLeryQYmPu59Okrq4OZgHpTIj2yHrgj5JF+r7VWJ7BI7oNWqPKlon0aAf7G8BYUbSj 5yxBJvkJpKsWdTCVaGS/vsGWjsMWVBF38OwHUtA1hxi/2uZ3Q81dBcWW/FeSe7nOr/KJ XyMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=H6677ejFNXKglyi/84+y7ULfVLWnlMQ6vEtVbRnv+vI=; b=nRzaDJ4mdcwxrMs8Ahc7+K/GV+c0qBS7EqXjO/51g/PaTYFdE5zEXhjYlTPlSnvHpz ZkI36nfs2yv8duQOEdINUP83MCoSVoSuKQ3VEUCAAHvT3y4j3bydzEz+/RJlo26bNO/o GCc0XHdwJXXvBCzQtvNEGNLu1Wm5ZtvbOrpKtk6NbGXrqdX2yWnYiI4gZfh5ZD7EDY+D KWJf0zH+WT6OGkepjtZ8ZNsvP/WPJetafyXGLqCYVewKXF2DSHJIgd0q5gX6OaSfUWuW 3KbII78HAh11VRclaGxFLUe/poTC8DglvD0n/16/aA12vyCuGKPTTo/4pW0C5R7Q3OBk O69A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=Mh7gtpR4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f21-20020aa78b15000000b00528a42a9b9asi6540232pfd.301.2022.07.07.06.44.07; Thu, 07 Jul 2022 06:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=Mh7gtpR4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235914AbiGGM5D (ORCPT + 99 others); Thu, 7 Jul 2022 08:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235056AbiGGM4s (ORCPT ); Thu, 7 Jul 2022 08:56:48 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFF313190B for ; Thu, 7 Jul 2022 05:56:15 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id t19so30327911lfl.5 for ; Thu, 07 Jul 2022 05:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H6677ejFNXKglyi/84+y7ULfVLWnlMQ6vEtVbRnv+vI=; b=Mh7gtpR4GcdX4WcgpOC+AbgtdPP6eO6z1dw11i6JBWeX1ULeCBz+lpRR3pORehirTa 86zxMqdsM7RuDU6w8EOL+0bNM0etAC2TTxfd4rjD2DVTQzvN0l2yN2NkcKW/SOItDMpU dFVvBoNMbXV0ILGAfklsAmdtRatKiwTaUIozP2JEbk7/qALXd9p+qfz20kNNYlYV1qWV WsTlyC+6KzVBm4GRcpUC6E5dhO3jWsgT93LvIVR6DWK6RLgMWU6M7UZiEttdlYL7cA14 1HDKQnyd1ly1tq5a3Tn/QJaBOUD1v1VUs2HOlRK7LDuaJp9FoGvesu5Aen5x1orm1k3l DQtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=H6677ejFNXKglyi/84+y7ULfVLWnlMQ6vEtVbRnv+vI=; b=xbQSQGY6IV5uPaxa+VYmMzkYNEVfdg65qWI+wD5Z+GyWM/v4z4tc1IIQuwjVjJNVpF 20TJiysyTIvIer39bCSmou7brV2+Lpcs828k1Wd2DCLfse1gHvfY02LU4NeQG1vT9F2b 3mu2eOSeeRek5BHDv31swWHF0grURyQZ5eKVPq0MyjFM8gUjMXpsz3awHKcKdyAt/Rt7 Vgz8iMm8ntB+ynyudyCaOoKMeGrp80dBrzyvCg5/YM/k0qGvrT1VEAH5MeUhjE0A4W97 i5WEkyngBX7afQs+nxtefbYpX8/zV03WBj9Kmfn3SkYBIplyi3aTWj+6WzUzu8rS3OGu 35Yw== X-Gm-Message-State: AJIora+GWfJ1WddCkJgD0icvjs+LgYHXp3URP7ylktMUuRLN/jLDFHPF HJwHzLx/84oWN65rZsQMPX6ty+SOn1PMiA== X-Received: by 2002:a05:6512:3d89:b0:47f:c089:1c7f with SMTP id k9-20020a0565123d8900b0047fc0891c7fmr31065785lfv.72.1657198573447; Thu, 07 Jul 2022 05:56:13 -0700 (PDT) Received: from jazctssd.c.googlers.com.com (138.58.228.35.bc.googleusercontent.com. [35.228.58.138]) by smtp.gmail.com with ESMTPSA id d7-20020a05651221c700b0047255d2111csm6810361lft.75.2022.07.07.05.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 05:56:12 -0700 (PDT) From: Grzegorz Jaszczyk To: linux-kernel@vger.kernel.org Cc: jaz@semihalf.com, dmy@semihalf.com, mario.limonciello@amd.com, seanjc@google.com, dbehr@google.com, upstream@semihalf.com, zide.chen@intel.corp-partner.google.com, "Rafael J. Wysocki" , Len Brown , Hans de Goede , Mark Gross , Pavel Machek , Mika Westerberg , Sachi King , linux-acpi@vger.kernel.org (open list:ACPI), platform-driver-x86@vger.kernel.org (open list:X86 PLATFORM DRIVERS), linux-pm@vger.kernel.org (open list:HIBERNATION (aka Software Suspend, aka swsusp)) Subject: [RFC PATCH 0/2] x86: allow to notify host about guest entering s2idle Date: Thu, 7 Jul 2022 12:53:22 +0000 Message-Id: <20220707125329.378277-1-jaz@semihalf.com> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the mailing list discussion [1] about the preferred approach for notifying hypervisor/VMM about guest entering s2idle state this RFC was implemented. Instead of original hypercall based approach, which involves KVM change [2] and makes it hypervisor specific, implement different mechanism, which takes advantage of MMIO/PIO trapping and makes it hypervisor independent. Patch #1 extends S2Idle ops by new notify handler which will be invoked as a very last command before system actually enters S2Idle states. It also allows to register and use driver specific notification hook which is used in patch #2. Patch #2 introduces new driver for virtual PMC, which registers acpi_s2idle_dev_ops's notify handler. Its implementation is based on an ACPI _DSM evaluation, which in turn can perform MMIO access and allow to trap and therefore notify the VMM about guest entering S2Idle state. Please see individual patches and commit logs for more verbose description. This patchset is marked as RFC since patch #2 implements driver for non existing device "HYPE0001", which ACPI ID was not registered yet. Furthermore the required registration process [3] will not be started before getting positive feedback about this patchset. [1] https://patchwork.kernel.org/project/linux-pm/patch/20220609110337.1238762-2-jaz@semihalf.com/ [2] https://patchwork.kernel.org/project/linux-pm/patch/20220609110337.1238762-3-jaz@semihalf.com/ [3] https://uefi.org/PNP_ACPI_Registry Grzegorz Jaszczyk (2): suspend: extend S2Idle ops by new notify handler platform/x86: Add virtual PMC driver used for S2Idle drivers/acpi/x86/s2idle.c | 11 +++++ drivers/platform/x86/Kconfig | 7 ++++ drivers/platform/x86/Makefile | 1 + drivers/platform/x86/virt_pmc.c | 73 +++++++++++++++++++++++++++++++++ include/linux/acpi.h | 1 + include/linux/suspend.h | 1 + kernel/power/suspend.c | 4 ++ 7 files changed, 98 insertions(+) create mode 100644 drivers/platform/x86/virt_pmc.c -- 2.37.0.rc0.161.g10f37bed90-goog