From nobody Mon Nov 25 02:53:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=flygoat.com ARC-Seal: i=1; a=rsa-sha256; t=1718299886; cv=none; d=zohomail.com; s=zohoarc; b=ByDRe1KY1STk9eInUrwIfW3z2eFAycwdkOIZsORADpZoXS7qtceEGH2YPSh/QDqokc4lvlX29x53Dy6tuoP79kSOquWVbFVG7b3uR9RZdjjQSdVL1xc1/wHNm1t62NhmVKe3/X8Q+H1CDz9K4PQmiWODPuDdOvdyb2iLdhAUG7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718299886; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dAn6RhZVBQ411UgnvLVvJtB4CrT4+mRlgv05oQIOfNw=; b=hRU15FbPNx5R5qFWcYM8GR36B241ks8ZeXCDw9PGIhl/uzUcA7HpRTUSDJTJaa3koE6tOotBIZvbAWjV+ozn9EGeIv3xLXb7bIYUgib89PWSDoip8jMiOleB9aaGfLvwt26xfozlMOUfGaRUkqo3HmFLUqUriNxyVjTo7yvzGFU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718299886860743.6889258553147; Thu, 13 Jun 2024 10:31:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHoHM-0004eO-Ov; Thu, 13 Jun 2024 13:30:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHoHL-0004df-ES for qemu-devel@nongnu.org; Thu, 13 Jun 2024 13:30:27 -0400 Received: from fhigh7-smtp.messagingengine.com ([103.168.172.158]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHoHJ-0007J2-Q8 for qemu-devel@nongnu.org; Thu, 13 Jun 2024 13:30:27 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 5631A11401D6; Thu, 13 Jun 2024 13:30:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 13 Jun 2024 13:30:25 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Jun 2024 13:30:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1718299825; x=1718386225; bh=dAn6RhZVBQ411UgnvLVvJtB4CrT4+mRlgv05oQIOfNw=; b= FyTzrtxLN6H8iNyN85boyM1JcsxEpzxbQw8GwtXT2p2wJJEj8CLhjaFL3F0hyquc wi7yN9OVEvzYTvUpwqTXzTyjV9yKFYf4lxfWIud38Kcxo5Qf/WGvxYdJ/cF/MXGw 2qstueL9y8cEX6NRUJjr04lwdwB9Fhy+oDvPRzc0dFr5lOgGeFpfSBwbtodTK+S5 DbCnXOfSHz3tpyH6wfynHO/BkhyFuY0JZzITx6MxIyWMLbyPVfQ+Tg886lUm6JSP FsMAs1beB1pR/z6ovTA4qj8XZiuwUfoOzr5fIhIxdOiHKAOaMHi26I8xtqUkrmnR khBYTMUkfvu6J97MrYC5MQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1718299825; x= 1718386225; bh=dAn6RhZVBQ411UgnvLVvJtB4CrT4+mRlgv05oQIOfNw=; b=G MCGZjPVOhR/36xPUW4nlLi0RCJEtm/x1x7vUfZ2bmeQF1H5w2ik941HmAibl0gRo yMKQWZpPBYJq+Tbmb1gixW+B0bYFqSBs133tcDp1ct8KeKBjcRM9JkHSWWJMZL7c yE1NrTSCRLoeWB9M9TcARaZB2Pn8plKZbEu+OqMbKKy2zNwU2TESOuugFEvd3iVL zCcXILMnEhCfMmXP2qmsOpn4Iv696KPp33d7j9wvKAH/susGvYTGwlWJV9/t8OTD QAvkWcZ2a0gi2CoZqMcwxchxv1/PqaR+59H5xvPbHiPuCnJTwsFokRWGV7XfjO4f ekXk+BdvN8ncVe1IVSYyg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedujedgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhi rgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqe enucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleffkeegudeghfdtuddugefh ueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail From: Jiaxun Yang Date: Thu, 13 Jun 2024 18:30:17 +0100 Subject: [PATCH 3/3] hw/i386/microvm: Wire up S3 and S4 sleep MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240613-loongarch64-sleep-v1-3-d2ef0aaa543a@flygoat.com> References: <20240613-loongarch64-sleep-v1-0-d2ef0aaa543a@flygoat.com> In-Reply-To: <20240613-loongarch64-sleep-v1-0-d2ef0aaa543a@flygoat.com> To: qemu-devel@nongnu.org, Ani Sinha Cc: "Michael S. Tsirkin" , Igor Mammedov , Song Gao , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , Sergio Lopez , Jiaxun Yang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2255; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=9KDYfgTpJCYj+JrfLXnzk6WDZ9WRBqry0iqBAZw11Ms=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhrRsnVV377SYNxgqmzY33PkVl75r5vfcbT5bNlds/xLh7 /Ta1sG2o5SFQYyLQVZMkSVEQKlvQ+PFBdcfZP2BmcPKBDKEgYtTACbSvInhn3p50SOt2b1T/i86 PFVapvP2wU439pLvAWJuK3VWvcoM/8Pwm/3+xmnv43n6fiwV8NKWl5y7o+m444Gtz6MXRnh2bP6 3gwcA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=103.168.172.158; envelope-from=jiaxun.yang@flygoat.com; helo=fhigh7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @flygoat.com) X-ZM-MESSAGEID: 1718299887298100001 Wire up S3 and S4 sleep by setting relevant slp-typs bits for GED and generate _S3 and _S4 methods in acpi table. Signed-off-by: Jiaxun Yang --- hw/i386/acpi-microvm.c | 18 ++++++++++++++++++ hw/i386/microvm.c | 3 +++ 2 files changed, 21 insertions(+) diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c index 279da6b4aa2f..7564de2b343b 100644 --- a/hw/i386/acpi-microvm.c +++ b/hw/i386/acpi-microvm.c @@ -129,6 +129,24 @@ build_dsdt_microvm(GArray *table_data, BIOSLinker *lin= ker, aml_append(dsdt, sb_scope); =20 /* ACPI 5.0: Table 7-209 System State Package */ + scope =3D aml_scope("\\"); + pkg =3D aml_package(4); + aml_append(pkg, aml_int(ACPI_GED_SLP_TYP_S3)); + aml_append(pkg, aml_int(0)); /* ignored */ + aml_append(pkg, aml_int(0)); /* reserved */ + aml_append(pkg, aml_int(0)); /* reserved */ + aml_append(scope, aml_name_decl("_S3", pkg)); + aml_append(dsdt, scope); + + scope =3D aml_scope("\\"); + pkg =3D aml_package(4); + aml_append(pkg, aml_int(ACPI_GED_SLP_TYP_S4)); + aml_append(pkg, aml_int(0)); /* ignored */ + aml_append(pkg, aml_int(0)); /* reserved */ + aml_append(pkg, aml_int(0)); /* reserved */ + aml_append(scope, aml_name_decl("_S4", pkg)); + aml_append(dsdt, scope); + scope =3D aml_scope("\\"); pkg =3D aml_package(4); aml_append(pkg, aml_int(ACPI_GED_SLP_TYP_S5)); diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index fec63cacfa88..b9fb2d28e570 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -206,6 +206,9 @@ static void microvm_devices_init(MicrovmMachineState *m= ms) if (x86_machine_is_acpi_enabled(x86ms)) { DeviceState *dev =3D qdev_new(TYPE_ACPI_GED); qdev_prop_set_uint32(dev, "ged-event", ACPI_GED_PWR_DOWN_EVT); + qdev_prop_set_uint32(dev, "slp-typs", (1 << ACPI_GED_SLP_TYP_S3) | + (1 << ACPI_GED_SLP_TYP_S4) | + (1 << ACPI_GED_SLP_TYP_S5)); sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, GED_MMIO_BASE); /* sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, GED_MMIO_BASE_MEMHP); */ --=20 2.43.0