From nobody Mon Nov 25 02:33:49 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=1718299874; cv=none; d=zohomail.com; s=zohoarc; b=VoelpqRxQhgbJENmglYU3ukIh9kpvOct1EE+TZJYUhXg6Mvf+u5j66pI9KpHPeb13D+V7Iun69OPIC9wD9TCZwK4oDIHVPNId2/PQc4wxm3C3wjDsBdTC9wTv20RI5yiDzpECHAkRkf+Z/amkpVas0Bo/nP2BWtqJczOVZwSfyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718299874; 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=eJFYh3g5LXsFX6s95/TGJ8b79IiBsljmwa9yyqrsIss=; b=GC9TRCqKf/VtMcUyCLwYU5hVVa8bN/l0fjAYc9Pl3g+0s5u76nvCdBQuxfmOth7lBwaJI0/vAz4WLLIGZzFjydB3HAqt6hOaVkur4kTAnmY3S7qUzNzdahp4sB6cYNPw74aclMszxAILQzbeqDv0Z/ZukM/HpzC+N+EMJzQM80I= 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 171829987429323.825760411495366; Thu, 13 Jun 2024 10:31:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHoHL-0004dY-NS; Thu, 13 Jun 2024 13:30:27 -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 1sHoHJ-0004cC-Km for qemu-devel@nongnu.org; Thu, 13 Jun 2024 13:30:25 -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 1sHoHH-0007HN-UC for qemu-devel@nongnu.org; Thu, 13 Jun 2024 13:30:25 -0400 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 51E5111401DE; Thu, 13 Jun 2024 13:30:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 13 Jun 2024 13:30:23 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Jun 2024 13:30:21 -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=1718299823; x=1718386223; bh=eJFYh3g5LXsFX6s95/TGJ8b79IiBsljmwa9yyqrsIss=; b= X6rbJm0MnkFOJC8ltm3x9AT4tclSKBEOR4fJZ5hBe4LphMMoMig2/ajzfDtuDuwY AuteCMpCGkVcal3l79cFPp7f9AA15Kcl6/8vIZvLDPbdpJqwWaZ3+a9dHXKb7nzs jTMg1ovZHmm5xCx01uBfXSP27PAz0ggNWBcKDQ3gRKmHuIoRj+8/gqIjbJUoURKs S1//DWqW03rC74rCFbA+iFQUOuGVsXsikfnO2NvV9mGZBY0JV4n+i9lC0qgSu3KX U07Tfl6/ddb5m8jTQTP5zg19kkR/hdotaTlfLKfSSR8e9jZ0CsOHtWZjq59pNhlu m9d+aVcTzb6jZW886wjbcA== 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=1718299823; x= 1718386223; bh=eJFYh3g5LXsFX6s95/TGJ8b79IiBsljmwa9yyqrsIss=; b=Z 0YyQDGFf0Rkn0UoceplKD33SDiedDiwGf/Al1zmppc2uyOqUYU+4oEKcUV6aZcZe 8YRXrdcfNcAw6W1n7iB+44OYOvxATzlq8KHb0mxl2dtq36yzTwJMQ/JmsrPmxPjy 1HCV+X3vhZBHb9WQpQ60Ww5DFL+NC8i2KK8XILthIq/u88ODygXyvp350wnHPwC3 z6+5vhcexSt9RGaTuFcrY4RYEiQD0/7IsDWjimljWvd2nDqxBNhCNzjczYTxsS+A ZbBlZ8/krOAr3U3JN+mjsn3r+BHiwUymEQUGKQ7exM7BLgWH0uTi9hoDGi9TMxBL sBRLd6nrdM1HQIoK3WNWw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedujedgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhi rgiguhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqe enucggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleffkeegudeghfdtuddugefh ueevgeffgedukeejleenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrih hlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail From: Jiaxun Yang Date: Thu, 13 Jun 2024 18:30:16 +0100 Subject: [PATCH 2/3] hw/loongarch/virt: 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-2-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=2080; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=BXyEMcPmd5AgUUDVaen/Z+sU7QeqymhAaoVVivRctUo=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhrRsnVXJSi92fl+2b/6r2XeuNt1MVNokntR/kH1m484pV mLB7EtPdZSyMIhxMciKKbKECCj1bWi8uOD6g6w/MHNYmUCGMHBxCsBEmP0Z/oc25UR9KVv17Ef/ nOVNKvWfXzFpNVW8PBZVeP/426mP3LYzMmyveuL8VeJfg0RrqVC7LoPS6qWP/iSub668t32NieX KlXwA 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: 1718299875269100003 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/loongarch/acpi-build.c | 18 ++++++++++++++++++ hw/loongarch/virt.c | 3 +++ 2 files changed, 21 insertions(+) diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index af45ce526d6e..2cb1696b579b 100644 --- a/hw/loongarch/acpi-build.c +++ b/hw/loongarch/acpi-build.c @@ -416,6 +416,24 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Mac= hineState *machine) acpi_dsdt_add_tpm(dsdt, lvms); #endif /* 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/loongarch/virt.c b/hw/loongarch/virt.c index 66cef201abe0..a4b55f00a32b 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -615,6 +615,9 @@ static DeviceState *create_acpi_ged(DeviceState *pch_pi= c, } dev =3D qdev_new(TYPE_ACPI_GED); qdev_prop_set_uint32(dev, "ged-event", event); + 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_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 /* ged event */ --=20 2.43.0