From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165976; cv=none; d=zohomail.com; s=zohoarc; b=jPKqOgoo3Dz9IzReV3b+b5vfVV/lNUBRHwWzAIuwte/l8s/9VNTfUmdOJAreCm531oiWgO158YAUbsAZ1gBiyJ4gcL/08trM/pJMuuSGTkZ+caxmAti5NstfrqOWPYVgCfDFt3Gx+O6soxriqb9sdnrEfLwbTHSa9mLyZSEThno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165976; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T4XeS6zSJeG9q0Ti33wawxAjOhOjZ//siv8AXi1AOtk=; b=V19BsPg9OH99JNk5IFUun/HC4JP1yFwoo0Bh4s3Gz1bG+3MjNZeHimZ9KDCi+SPWry0ZtpVoVbLyNeqh/wxWgtcYBHFk9rL5eo6JgWooauqoDZfxzGCyMNszd8WgqppDR3K/Mn7FT6srmncg1J6y/WkImv8P4i3bMZOptv2itAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165976659255.9135864069956; Wed, 5 Mar 2025 01:12:56 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901865.1309787 (Exim 4.92) (envelope-from ) id 1tpknH-0006fJ-DS; Wed, 05 Mar 2025 09:11:59 +0000 Received: by outflank-mailman (output) from mailman id 901865.1309787; Wed, 05 Mar 2025 09:11:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknH-0006fC-AC; Wed, 05 Mar 2025 09:11:59 +0000 Received: by outflank-mailman (input) for mailman id 901865; Wed, 05 Mar 2025 09:11:58 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknG-0006ev-3k for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:11:58 +0000 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [2a00:1450:4864:20::12d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e332cbbe-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:11:56 +0100 (CET) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-5439a6179a7so699978e87.1 for ; Wed, 05 Mar 2025 01:11:56 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:11:55 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e332cbbe-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165916; x=1741770716; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T4XeS6zSJeG9q0Ti33wawxAjOhOjZ//siv8AXi1AOtk=; b=Z8vLOxk0alHGLFrHOvC37xN7nbmefMIoy5VBD1VsFQ0ZW+0c5g/hLZeZ4KqGHvrODa 7Idymw9++kxCYSaXg9gL6M6bD1c8Nait3O4LgeNTckmiNwY+z38gl8MIX76Bi7EYjENj HkPc8Qq41/+QIPd+EBtzP3Xe2Ic+dYcsXKZygX20RzPbNF7gO4XyHfLZ2zcepKDkNyZP SdAgOXkVHY+co4pDqvgwl/klSDOld17favVvm6/uM8Ny0q1rJjncC+7SB5Q8hB7acug4 JNTkunHtOkCN4H5erizeJozS5mtPZjibzcxgwWZSRZoreNRaqzLPWDtk3G7GQ2KnCfEP lLqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165916; x=1741770716; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T4XeS6zSJeG9q0Ti33wawxAjOhOjZ//siv8AXi1AOtk=; b=SDk7Mf/C8RbkUpjsL96BKRuhixJQA2tptjvfCzrw+6yX4EfoOmv5lCyo6H1PVUHmq5 +7gl5rI1jJIKw0rgOf0dmtYJcVQpz8LBfyXEPxtdWd+3yIGd36Coqc7c+4IgIWF46mKp BnKHCGQhqaz/S9BoEMbDYXOkF1TO6sUlcKOnjuLtRGvYrh8Og7aDPhxPe1dA5b8MX652 AyXHpoa4//yiNQPQlEiy1ipUrA8eQEcQjlEEahjt5nWTMZS5iYLpSav4Qg4hKs+k1Ez4 hj85Osatqnm8I1EKd0jd/seWG3JAYXk09fRbtN6xMoeHwRSgWTkxnYuP65MmMVAL5V2n kSDg== X-Gm-Message-State: AOJu0YzvtqQuWXuOJM6FRtD/TNmhpqIgZmUSP/tZE3eTT73nTD9NH/bh pciTVBjFNCyoZSMakmwTSCSDcOFVDnWSYjaQT1aH1uOlNnGrwM9qmBnLEi14 X-Gm-Gg: ASbGncvoWE5N+9WdPwSgTr2+u5CfL5hRpARPTEjDmEWCNCzGoJNdZzdRVyfKvhdFXu2 QC/G51cZnHZABGEOjkyOdkHb93cyreTH89f6OwmZvzbnV9SKipNhsJUxf/wHTmPN6ANdTZCOlVV iTezDqhU/rYUIcvKb8gwK6eitQWfGhjYfcVv9B+oymDBPlkkAhCoRjyQEzQ2Lu/wJUe+P6DFGYs 1Ik3pEQVLeKq8Ka/rpWvS6AKJjz8UMgmUs90xMGpvf+1bLl1JCZ8DYV7vPh9DtnJTi5TcisXvnh 2QZ/oUPcAaxYnHVNLMHRvAgTWeIEUy5a/uYiX1ctVE1dSThcAA== X-Google-Smtp-Source: AGHT+IEzx2tmF8LmO96xz1ViG48Q/RJ5BOIdUTEsOdaxihp23QmKd6/iDjkSj80OOC0AXdfcpBahIQ== X-Received: by 2002:a05:6512:1248:b0:545:81b:1516 with SMTP id 2adb3069b0e04-5497d375b4amr794923e87.15.1741165915541; Wed, 05 Mar 2025 01:11:55 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mykyta Poturai , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Mykola Kvach Subject: [PATCH 01/16] iommu: Add checks before calling iommu suspend/resume Date: Wed, 5 Mar 2025 11:11:09 +0200 Message-ID: <5694f2b73e808ebdc5d5b60a31cfad2b24f0e9d8.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165978371019000 Content-Type: text/plain; charset="utf-8" From: Mykyta Poturai These functions may be unimplemented, so check that they exist before calling to prevent crashes. Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- Introduced in patch series V3. --- xen/drivers/passthrough/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iomm= u.c index 16aad86973..55b33c9719 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -613,7 +613,7 @@ int __init iommu_setup(void) =20 int iommu_suspend(void) { - if ( iommu_enabled ) + if ( iommu_enabled && iommu_get_ops() && iommu_get_ops()->suspend ) return iommu_call(iommu_get_ops(), suspend); =20 return 0; @@ -621,7 +621,7 @@ int iommu_suspend(void) =20 void iommu_resume(void) { - if ( iommu_enabled ) + if ( iommu_enabled && iommu_get_ops() && iommu_get_ops()->resume ) iommu_vcall(iommu_get_ops(), resume); } =20 --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165984; cv=none; d=zohomail.com; s=zohoarc; b=j9xtj55dB2sDZPNqBiKh1EyPddgIIvZTaB67dYA5w3xraCcgbjZEj3IfZYrlpH3Do7u4hSV54hrGn/aaVHeUvEcenhAFqW19rkvs8pklZJfJ8YDrar39sRbhnsGBCqiNdpIl7RgIn/HLuUXb4+cjxcUsve6NjUdmkrU6GdqdX54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165984; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SeyrgEDHRHxvQYsPkfBfSFyIZ78yoXvWfRs5EkLqURM=; b=ElFJvUmRPUmJsDhu7/An80xxJ25LHPQKFSEa2/ZOZMHHJ7VdKpg2wygt21r+EJLl8DlbwSb6xG7u2tvo6T+aGv6BZ1Xr0Xoe717T/y7rTZLiVGQKZXRozjqZ7eCvnj2Tr7eh1zOacAEUzRazt1dRL+66xW+sJVy4+DZC3utNxD8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 174116598415379.48926349441138; Wed, 5 Mar 2025 01:13:04 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901867.1309807 (Exim 4.92) (envelope-from ) id 1tpknI-000776-TE; Wed, 05 Mar 2025 09:12:00 +0000 Received: by outflank-mailman (output) from mailman id 901867.1309807; Wed, 05 Mar 2025 09:12:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknI-00076z-PG; Wed, 05 Mar 2025 09:12:00 +0000 Received: by outflank-mailman (input) for mailman id 901867; Wed, 05 Mar 2025 09:11:58 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknG-0006ev-UY for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:11:58 +0000 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [2a00:1450:4864:20::129]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e4071e56-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:11:58 +0100 (CET) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5496301c6afso692307e87.0 for ; Wed, 05 Mar 2025 01:11:58 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:11:56 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e4071e56-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165918; x=1741770718; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SeyrgEDHRHxvQYsPkfBfSFyIZ78yoXvWfRs5EkLqURM=; b=Sn334OhbYUrgo0A969YYozXZZ9eBBs0StMkSroY/Icp6nDvKPpLKP439FuQrOk2457 pykaCpD+p1aW1Wc1MjBENpiLrz3/PAM6pQIZz8zvoORCJh+krXyOQtmJt6aO6ApfuIaW gKg/haNgoAuogXCzKKrRnPmvpJM2qwUlR3/soD6BQCcqZgRB9UT69/ksofqig3mBGavu U15zPs516+AIAfx1EgRTwb3tULWJb/GlHbz1VTuIiDCAuhVesOn9ugOie+B6xiDPEviO bz7RL1qL+6W5uiFD2XRh9i2xTF4T/bNHt+zgcvLP+nAbmaeizJzCWgzt69x7lfFsppUv XElg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165918; x=1741770718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SeyrgEDHRHxvQYsPkfBfSFyIZ78yoXvWfRs5EkLqURM=; b=EojDuyOQXp4uGritzUbQvrfRZaeNNgy1EEIlduC1zvsXUQiOqNIvQaMLwkN7cIufyO NBUlSGtwqKJHExoboKg7qitaY2pk6dHGOsEo9Vz25zIigiiU9eR31FIPJJ1wDiaa6IZq vkwD/5FvT1V1t5nJBg3EoTkf/iAK+7anGbbsUG0x9V9aZ18UdT9ZinQ8p7i38ITQ2S0g LN0eay3raCY7/psizUOOaJ4iRorgVoI1/TJb6okjsnv557JnHz4lcIUYzsB+Erz+/7Z9 i3bCHQQceM/dvUycLkvtdSJzOdbWuiHTcLWZqRBVcyv4VHkvgRKdxlZjhC4nnry+me/d FC6Q== X-Gm-Message-State: AOJu0YyaY/vYRly9Snb8INclG59BE7tO+zKKRL0bvc40Y2UDRU1KG/uQ 8S7tPYAqf3nFkpmmkAF3pHevAs4TRjPAFHDwznD6UMORRWIX75oxVPzsyJPR X-Gm-Gg: ASbGncsq3bXdNMk9Ag+lWGdqa/1Yq/CEKFMV4U8gJ4zRXYP5iGujDlalCuIeP/3yKxp kPrj7Xg4gFFhQfR/nFBbVvl65f7krL2LdwG9xxV00BxC/fv/f8ZbDbqj6U4cbI/PcshhauNaVL/ /A/5GVaTCnUJ1yYtir+Fsk9VaSLqUVPgBzADlMAstVBMPpPY+r3rq4i0Jyvj3VsYQeQs7DaMZyq /WIm4f0ICFW6yqnW8/Nio/3nFjBDOrFzBeQWpT3yIRMe6DMw7CTMrN/MYO9HV6BsFlKRWL4K6ZW hQGgR1g4yf+acit15iOkFJiAS2uwFRmpvcq7JJPUiFYI8lIb1Q== X-Google-Smtp-Source: AGHT+IHfyzIHEXBqG57sKaZHYffwmfm18XEj4b/MBT2LV4QYLxOmDVeIU5+H0RVLwtUVwkS9nfd6yA== X-Received: by 2002:a05:6512:1252:b0:545:550:83e6 with SMTP id 2adb3069b0e04-5497d360c7cmr771143e87.5.1741165917298; Wed, 05 Mar 2025 01:11:57 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , Julien Grall , Stefano Stabellini , Saeed Nowshadi , Mykyta Poturai , Mykola Kvach Subject: [PATCH 02/16] xen/x86: Move freeze/thaw_domains into common files Date: Wed, 5 Mar 2025 11:11:10 +0200 Message-ID: <82d394363821b74fb1617e81e6e726a7a25b4028.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165984439019000 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic These functions will be reused by suspend/resume support for ARM. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- xen/arch/x86/acpi/power.c | 29 ----------------------------- xen/common/domain.c | 30 ++++++++++++++++++++++++++++++ xen/include/xen/sched.h | 3 +++ 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c index d0b67614d5..f38398827e 100644 --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -137,35 +137,6 @@ static void device_power_up(enum dev_power_saved saved) } } =20 -static void freeze_domains(void) -{ - struct domain *d; - - rcu_read_lock(&domlist_read_lock); - /* - * Note that we iterate in order of domain-id. Hence we will pause dom0 - * first which is required for correctness (as only dom0 can add domai= ns to - * the domain list). Otherwise we could miss concurrently-created doma= ins. - */ - for_each_domain ( d ) - domain_pause(d); - rcu_read_unlock(&domlist_read_lock); - - scheduler_disable(); -} - -static void thaw_domains(void) -{ - struct domain *d; - - scheduler_enable(); - - rcu_read_lock(&domlist_read_lock); - for_each_domain ( d ) - domain_unpause(d); - rcu_read_unlock(&domlist_read_lock); -} - static void acpi_sleep_prepare(u32 state) { void *wakeup_vector_va; diff --git a/xen/common/domain.c b/xen/common/domain.c index 0c4cc77111..49ff84d2f5 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -2259,6 +2259,36 @@ int continue_hypercall_on_cpu( return 0; } =20 + +void freeze_domains(void) +{ + struct domain *d; + + rcu_read_lock(&domlist_read_lock); + /* + * Note that we iterate in order of domain-id. Hence we will pause dom0 + * first which is required for correctness (as only dom0 can add domai= ns to + * the domain list). Otherwise we could miss concurrently-created doma= ins. + */ + for_each_domain ( d ) + domain_pause(d); + rcu_read_unlock(&domlist_read_lock); + + scheduler_disable(); +} + +void thaw_domains(void) +{ + struct domain *d; + + scheduler_enable(); + + rcu_read_lock(&domlist_read_lock); + for_each_domain ( d ) + domain_unpause(d); + rcu_read_unlock(&domlist_read_lock); +} + /* * Local variables: * mode: C diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 037c83fda2..177784e6da 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -1059,6 +1059,9 @@ static inline struct vcpu *domain_vcpu(const struct d= omain *d, return vcpu_id >=3D d->max_vcpus ? NULL : d->vcpu[idx]; } =20 +void freeze_domains(void); +void thaw_domains(void); + void cpu_init(void); =20 /* --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165967; cv=none; d=zohomail.com; s=zohoarc; b=Vy9NzMUj1mj4b0AJZsmTwM3+PrFKcjTFMoSyGLzM7M9Ybx4InBtZyJIozSSMfocBnz3dlGidqsOeJopx+137Dt75GmF2fmAMnKPAgUemgn3oyoNGUMFMg7xRCynKo8bdWUEqq6sm70sREObloPe+54X89ZHIBpYR1T8PcUlWlYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165967; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=K0i36R5cWws/2lOrIDQReaU+v/4wYZErXE99/wpMnig=; b=Q0cIwDM9kwMDhdhbKh1YziCTG3UhuUBfV8G3veo7M1Nd/JVDFuEbXMEA4BZsfvcECk7UASawHTedAYXjgy/AnZT37pkn1kiuEnAh7rHMtd5tY0n0AaYDn+8WSeRVCnBASGQGDh9K7MnC8jLPYtgQwNg6D9QxNNCjWSwQY+xe9kM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165967683539.2547099702133; Wed, 5 Mar 2025 01:12:47 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901868.1309813 (Exim 4.92) (envelope-from ) id 1tpknJ-0007AL-8H; Wed, 05 Mar 2025 09:12:01 +0000 Received: by outflank-mailman (output) from mailman id 901868.1309813; Wed, 05 Mar 2025 09:12:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknJ-0007A6-32; Wed, 05 Mar 2025 09:12:01 +0000 Received: by outflank-mailman (input) for mailman id 901868; Wed, 05 Mar 2025 09:11:59 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknH-0006ev-Td for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:11:59 +0000 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [2a00:1450:4864:20::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e49dcbe1-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:11:59 +0100 (CET) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-548430564d9so6960513e87.2 for ; Wed, 05 Mar 2025 01:11:59 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:11:58 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e49dcbe1-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165919; x=1741770719; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K0i36R5cWws/2lOrIDQReaU+v/4wYZErXE99/wpMnig=; b=c3BEZCxglptYUUQL7OUVEVI3kHQzI7rkVLm2w1Z/4RftqeeGgiINYYvcjdMthQLqcL jPoCSoFstRKWIVHmGgv6aRqX7PGbiX8o9YY3YDkpwT72rIO9Oq6BOfQ9WhG8N0CwWKGs sD7ZqEA9A1/Eq5EvetUww+lf8tKzemCm9Gj8uxi7LlqXGrl8Z6A/k70J6Bmp5bWuEG6m Xv2SmtUn9JldglUnTrPu41ZZGZG5psEQ3G/eWwA/lJq3MxsPnlEP9YZNSmCcnfupp7NG FFmauiNHfeFvCGM+/mfWOQFNKmLdj1TgctWw0cMLfeU/IIznMd9M2C+Yo0L7ze35sjm9 O2yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165919; x=1741770719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K0i36R5cWws/2lOrIDQReaU+v/4wYZErXE99/wpMnig=; b=d+XTLcv0kPOCIxrvIzk1AyDD9SaG7kBLDCb+Ombk1KiQ6BJ0D8gPar4URPgmDdTffV +kakfZje9pHRazDd2PHVtL5EC7lfzx0ABiE7llY9TJycemFEwR9hTeqQQRoqbQXPFGYt UJqG3f1olSTzUouyYJK7jhWunz3Ynl+LDe5lUIcN80kEC6vDp+XnRSkf9Y3tyrKGAI9D OHZZqKdZMr6khjvffvxedUpk+Cn0VK+BUQylH8ZKA3mlFqEuTuPfKqK8UAU5nwwjSEs0 M+p/dX+lZ8Tzrf9oAIwNRXogRNpxNgP8VI72rvrJpmycCztQxtM4oiJmQcz66OVxd6Y/ jMCw== X-Gm-Message-State: AOJu0Yxs7QFDlECQKdO87H/nPSs1SZ21+D+17MGz37qJTioytoyMK6o5 Skwws9Xo4W6UNa/iNBgC3R+mGiaGzP7dwdKFVSRQwU6occHIRx2dO/yj8E7H X-Gm-Gg: ASbGncuQTeGfbVrF0V0U5dQy43Y71o5z9r5iXbKOfpwmPxhyZ9QZEiTWfDRwr01Fllo g66OPoN+iuiK8hVUX8KZtGElYzBzCRWC+mL0bNdRZM1qQk9rgYGw8NaQ6SPvi2TlZ6F9UsW7sB1 eLotp7Ce8RF+UnADeqb/JGU/GMeu4Vm0K2OVOT+s+thukwUz4peYVggfEEJ6EHp2qmaC9WZfsz1 ZjMgSIxdy/araj6oQQl6bfw3C3vc7zZ+bi0C925DYOc3unQ9hrJXASlW/6wKnCEiQqbdN/aBPm7 0wF6mBjurC5+BuJXwlQlICjgqlFIvwiB8JljB058a72AF529qQ== X-Google-Smtp-Source: AGHT+IExoH/RJzkC8dxnobznYYQVv0p6BHKawuJcd+lkQWm/DcNhF5mR3Pb2XpOal6svcBwUD15cDw== X-Received: by 2002:a05:6512:3984:b0:545:2300:924d with SMTP id 2adb3069b0e04-5497d336c84mr720527e87.22.1741165918440; Wed, 05 Mar 2025 01:11:58 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Dario Faggioli , Juergen Gross , George Dunlap , Mykyta Poturai , Mykola Kvach Subject: [PATCH 03/16] xen/arm: introduce a separate struct for watchdog timers Date: Wed, 5 Mar 2025 11:11:11 +0200 Message-ID: <18a8a86ca0c1b884278d635fb18b3b53e062f10e.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165969407019100 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic Introduce a separate struct for watchdog timers. It is needed to properly implement the suspend/resume actions for the watchdog timers. To be able to restart watchdog timer after suspend we need to remember their frequency somewhere. To not bloat the struct timer a new struct watchdog_timer is introduced, containing the original timer and the last set timeout. Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- This commit was introduced in patch series V2. --- xen/common/keyhandler.c | 2 +- xen/common/sched/core.c | 11 ++++++----- xen/include/xen/sched.h | 3 ++- xen/include/xen/watchdog.h | 6 ++++++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 0bb842ec00..caf614c0c2 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -305,7 +305,7 @@ static void cf_check dump_domains(unsigned char key) for ( i =3D 0 ; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ ) if ( test_bit(i, &d->watchdog_inuse_map) ) printk(" watchdog %d expires in %d seconds\n", - i, (u32)((d->watchdog_timer[i].expires - NOW()) >> = 30)); + i, (u32)((d->watchdog_timer[i].timer.expires - NOW(= )) >> 30)); =20 arch_dump_domain_info(d); =20 diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index d6296d99fd..b1c6b6b9fa 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -1556,7 +1556,8 @@ static long domain_watchdog(struct domain *d, uint32_= t id, uint32_t timeout) { if ( test_and_set_bit(id, &d->watchdog_inuse_map) ) continue; - set_timer(&d->watchdog_timer[id], NOW() + SECONDS(timeout)); + d->watchdog_timer[id].timeout =3D timeout; + set_timer(&d->watchdog_timer[id].timer, NOW() + SECONDS(timeou= t)); break; } spin_unlock(&d->watchdog_lock); @@ -1572,12 +1573,12 @@ static long domain_watchdog(struct domain *d, uint3= 2_t id, uint32_t timeout) =20 if ( timeout =3D=3D 0 ) { - stop_timer(&d->watchdog_timer[id]); + stop_timer(&d->watchdog_timer[id].timer); clear_bit(id, &d->watchdog_inuse_map); } else { - set_timer(&d->watchdog_timer[id], NOW() + SECONDS(timeout)); + set_timer(&d->watchdog_timer[id].timer, NOW() + SECONDS(timeout)); } =20 spin_unlock(&d->watchdog_lock); @@ -1593,7 +1594,7 @@ void watchdog_domain_init(struct domain *d) d->watchdog_inuse_map =3D 0; =20 for ( i =3D 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ ) - init_timer(&d->watchdog_timer[i], domain_watchdog_timeout, d, 0); + init_timer(&d->watchdog_timer[i].timer, domain_watchdog_timeout, d= , 0); } =20 void watchdog_domain_destroy(struct domain *d) @@ -1601,7 +1602,7 @@ void watchdog_domain_destroy(struct domain *d) unsigned int i; =20 for ( i =3D 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ ) - kill_timer(&d->watchdog_timer[i]); + kill_timer(&d->watchdog_timer[i].timer); } =20 /* diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 177784e6da..d0d10612ce 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -569,7 +570,7 @@ struct domain #define NR_DOMAIN_WATCHDOG_TIMERS 2 spinlock_t watchdog_lock; uint32_t watchdog_inuse_map; - struct timer watchdog_timer[NR_DOMAIN_WATCHDOG_TIMERS]; + struct watchdog_timer watchdog_timer[NR_DOMAIN_WATCHDOG_TIMERS]; =20 struct rcu_head rcu; =20 diff --git a/xen/include/xen/watchdog.h b/xen/include/xen/watchdog.h index 4c2840bd91..2b7169632d 100644 --- a/xen/include/xen/watchdog.h +++ b/xen/include/xen/watchdog.h @@ -8,6 +8,12 @@ #define __XEN_WATCHDOG_H__ =20 #include +#include + +struct watchdog_timer { + struct timer timer; + uint32_t timeout; +}; =20 #ifdef CONFIG_WATCHDOG =20 --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165962; cv=none; d=zohomail.com; s=zohoarc; b=jGq4VBL8LSv1Mkk14XIbuameFxoK0wc5ruajvpYiYCsWUqf4p1BdOHxbUzhfv5Qk23DaMXSzuT09DP0U8CHd8EcmBlRy6XSCgvlysxln5U1ZvUxBz5k+lvU6jib8J9T5Gl+jHeyqt8df8cwYY/tt7494FV7iMNDntSytYxNIabU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165962; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wRks+rWb+OIlYB2/kwqZs9XahqYYzmw08LLO1JIt0RI=; b=oHh/ETzNt3krJ5bdqfuY6qo87ErC3UHrk6x+dSSl2/JYD3U7jSvWjeUIA3+7dGkAUO6M7okhCzEZneF4TV4CVGFkp5PnXLdAZ8LZNuWWvhruWF14Y7IfTwHpB6bUpwfGTmqguFKxEZiNMi/tQHrJaXE/WBqLcyHgZi2hUA95C50= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165962319273.37735520747003; Wed, 5 Mar 2025 01:12:42 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901869.1309826 (Exim 4.92) (envelope-from ) id 1tpknL-0007bd-JS; Wed, 05 Mar 2025 09:12:03 +0000 Received: by outflank-mailman (output) from mailman id 901869.1309826; Wed, 05 Mar 2025 09:12:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknL-0007bR-G8; Wed, 05 Mar 2025 09:12:03 +0000 Received: by outflank-mailman (input) for mailman id 901869; Wed, 05 Mar 2025 09:12:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknK-0006ew-1n for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:02 +0000 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [2a00:1450:4864:20::136]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e54738f8-f9a1-11ef-9898-31a8f345e629; Wed, 05 Mar 2025 10:12:00 +0100 (CET) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5496301c6afso692341e87.0 for ; Wed, 05 Mar 2025 01:12:00 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:11:59 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e54738f8-f9a1-11ef-9898-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165920; x=1741770720; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wRks+rWb+OIlYB2/kwqZs9XahqYYzmw08LLO1JIt0RI=; b=WMyptCCFjqVPIuWB/xIruCHKPgSbX71PCVBIDyabxTmopwHQycsh4L2nMG603GrHAA QcvBQwmftH3Ti6INQVhV7nW/gHwivU9eCao8KJTqLBQ7PDIbWIhxUABIBIlPl/Q3BfoP t7GvbJuFZcwaRHpwoGFt3AiOjbXD0LMJE3y4bKmZAY2x1BTlcFMgpr9c4LIDEoJFLjC9 fx6rIt1jBMA1WSQ3joNcxmQZegrAvcCu0fXGptYRgxgZUaa8O7jkfKdYCY6ve9O3nawg WCw8Ug6cwYLZYKMPJZdlIv0ZD2Xq4anDR/B6QGsx4s73yvT/AQ2Oe1i7/swPSPQMh8QT WSog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165920; x=1741770720; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wRks+rWb+OIlYB2/kwqZs9XahqYYzmw08LLO1JIt0RI=; b=ufDX2NvZOcUEmOHlNJsJyzU0SF3jhqidqTfG2cqiBKCT8J1cyNQddUN/2r86wDEryo 7X5EbCA0Tm6bVcJn/ohpLgHQ0gGbBtCpdCJEp27s889pSUiO16tBA6dV56nPbaiQbzYb axrXfZdIlNq1ETmJF2jk2KaAt5/rM6fAI1zSQHZqgmJoOUXYeomEknHjdFTl2VV0CGoH pK72RB2KMKbj4RJXwW+UbhZheTlZMzwgDX+LIu0XlfU4EMu3+G9sD+ZoAH3sm9Ucp0AP jQ1Q0S72omgmfhel0FaF/PsPiu0m+8J1L4DxfLGfE306838nV3PhbHG5zgi9dUYeFdNm apcg== X-Gm-Message-State: AOJu0YxKrKWeSXbudYjwNpyXIXsokAbHIeSBh6PV2okN2ch62ly6BjXL ZVJYs810NZKDwS3bGFf233jb368VMZ1fk0J1du3WeKApF/f1IopMgORCL+AI X-Gm-Gg: ASbGnctgkqp59TxQL/dy+Se9vbC9yYtR+0IWzE1QF4QtHsJJLA0xQC7QmT2qgGuVj/6 FOGN03IvgGiS4HB1gsjjHyEgrVqFY15dHrCma3egIA2aBfyUXuIqDxDBsv/20PWFwEmcAK1Gt/d r+9uTFj87B0X/e6JmGV8a/ztTn0qFXAEPAv4w05itrMEGqSp9eMTkBWEyTC22DRmoihDmYK2p6E r2mZd02BQWBVJSH1nx3GNCotDvdNZ+RxZW3LTJEd5ZPe4s9ZjSRzp21dvoUNzh3cMqAb5IUgoxR hJYX3QRtZnUSpFUHK4WlxkCHcGwvj6AS4y1ZkdG5vP+E9xqIaA== X-Google-Smtp-Source: AGHT+IEcZGdsEAbkUwhCCTEVH6cqDWPFh5mffdCfKlFAQCELmtoZxqoKEfiRPyfvNPZRr9np5hHkIw== X-Received: by 2002:a05:6512:10c9:b0:549:7394:2ccc with SMTP id 2adb3069b0e04-5497d590109mr680411e87.26.1741165919444; Wed, 05 Mar 2025 01:11:59 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Mykola Kvach Subject: [PATCH 04/16] xen/cpu: prevent disable_nonboot_cpus crash on ARM64 Date: Wed, 5 Mar 2025 11:11:12 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165964458019000 Content-Type: text/plain; charset="utf-8" If we call disable_nonboot_cpus on ARM64 with system_state set to SYS_STATE_suspend, the following assertion will be triggered: ``` (XEN) [ 25.582712] Disabling non-boot CPUs ... (XEN) [ 25.587032] Assertion '!in_irq() && (local_irq_is_enabled() || num= _online_cpus() <=3D 1)' failed at common/xmalloc_tlsf.c:714 [...] (XEN) [ 25.975069] Xen call trace: (XEN) [ 25.978353] [<00000a000022e098>] xfree+0x130/0x1a4 (PC) (XEN) [ 25.984314] [<00000a000022e08c>] xfree+0x124/0x1a4 (LR) (XEN) [ 25.990276] [<00000a00002747d4>] release_irq+0xe4/0xe8 (XEN) [ 25.996152] [<00000a0000278588>] time.c#cpu_time_callback+0x44/= 0x60 (XEN) [ 26.003150] [<00000a000021d678>] notifier_call_chain+0x7c/0xa0 (XEN) [ 26.009717] [<00000a00002018e0>] cpu.c#cpu_notifier_call_chain+= 0x24/0x48 (XEN) [ 26.017148] [<00000a000020192c>] cpu.c#_take_cpu_down+0x28/0x34 (XEN) [ 26.023801] [<00000a0000201944>] cpu.c#take_cpu_down+0xc/0x18 (XEN) [ 26.030281] [<00000a0000225c5c>] stop_machine.c#stopmachine_act= ion+0xbc/0xe4 (XEN) [ 26.038057] [<00000a00002264bc>] tasklet.c#do_tasklet_work+0xb8= /0x100 (XEN) [ 26.045229] [<00000a00002268a4>] do_tasklet+0x68/0xb0 (XEN) [ 26.051018] [<00000a000026e120>] domain.c#idle_loop+0x7c/0x194 (XEN) [ 26.057585] [<00000a0000277e30>] start_secondary+0x21c/0x220 (XEN) [ 26.063978] [<00000a0000361258>] 00000a0000361258 ``` This happens because before invoking take_cpu_down via the stop_machine_run function on the target CPU, stop_machine_run requests the STOPMACHINE_DISABLE_IRQ state on that CPU. Releasing memory in the release_irq function then triggers the assertion: /* * Heap allocations may need TLB flushes which may require IRQs to be * enabled (except when only 1 PCPU is online). */ #define ASSERT_ALLOC_CONTEXT() This patch introduces a new tasklet to perform the CPU_DYING call chain for a particular CPU. However, we cannot call take_cpu_down from the tasklet because the __cpu_disable function disables local IRQs, causing the system to crash inside spin_lock_irq, which is called after the tasklet function invocation inside do_tasklet_work: void _spin_lock_irq(spinlock_t *lock) { ASSERT(local_irq_is_enabled()); To resolve this, take_cpu_down is split into two parts. The first part trig= gers the CPU_DYING call chain, while the second part, __cpu_disable, is invoked = from stop_machine_run. Signed-off-by: Mykola Kvach --- This patch was introduced in patch series V3. --- xen/common/cpu.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/xen/common/cpu.c b/xen/common/cpu.c index f09af0444b..99d4c0c579 100644 --- a/xen/common/cpu.c +++ b/xen/common/cpu.c @@ -48,6 +48,10 @@ const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS= _TO_LONGS(NR_CPUS)] =3D { =20 static DEFINE_RWLOCK(cpu_add_remove_lock); =20 +#ifdef CONFIG_ARM_64 +static DEFINE_PER_CPU(struct tasklet, cpu_down_tasklet); +#endif + bool get_cpu_maps(void) { return read_trylock(&cpu_add_remove_lock); @@ -101,6 +105,14 @@ static void cf_check _take_cpu_down(void *unused) __cpu_disable(); } =20 +#ifdef CONFIG_ARM_64 +static int cf_check cpu_disable_stop_machine(void *unused) +{ + __cpu_disable(); + return 0; +} +#endif + static int cf_check take_cpu_down(void *arg) { _take_cpu_down(arg); @@ -128,6 +140,14 @@ int cpu_down(unsigned int cpu) =20 if ( system_state < SYS_STATE_active || system_state =3D=3D SYS_STATE_= resume ) on_selected_cpus(cpumask_of(cpu), _take_cpu_down, NULL, true); +#ifdef CONFIG_ARM_64 + else if ( system_state =3D=3D SYS_STATE_suspend ) + { + tasklet_schedule_on_cpu(&per_cpu(cpu_down_tasklet, cpu), cpu); + if ( (err =3D stop_machine_run(cpu_disable_stop_machine, NULL, cpu= )) < 0 ) + goto fail; + } +#endif else if ( (err =3D stop_machine_run(take_cpu_down, NULL, cpu)) < 0 ) goto fail; =20 @@ -247,3 +267,26 @@ void enable_nonboot_cpus(void) =20 cpumask_clear(&frozen_cpus); } + +#ifdef CONFIG_ARM_64 + +static void cf_check cpu_down_t_action(void *unused) +{ + cpu_notifier_call_chain(smp_processor_id(), CPU_DYING, NULL, true); +} + +static int __init init_cpu_down_tasklet(void) +{ + unsigned int cpu; + + for_each_possible_cpu(cpu) { + struct tasklet *t =3D &per_cpu(cpu_down_tasklet, cpu); + + tasklet_init(t, cpu_down_t_action, NULL); + } + + return 0; +} +__initcall(init_cpu_down_tasklet); + +#endif /* CONFIG_ARM_64 */ --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165956; cv=none; d=zohomail.com; s=zohoarc; b=Di6I3zxe5e7x2nQDGbvKLocJm3vJLmRdriaWnGNMYaMAw2wxldvmDFdpM4D8ZvxsUtr1yni/Mz1OsyFGAVRtecha+3BQBF7C+kDshl1Lsj2C0ya4JU37Qs7ojIAZb2it2ro4PsfN10DUZwj3HzZSUxzU4GddRaoHZ3Uz+eswoZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165956; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rsEkc5UwQaeOfpAVVoIStpjI7WoGyW7huU1aUhighTY=; b=EExNwje1YLcw/vWdLRE1F+r9efv+Lhx1jmcH57ooDsDkKaTdEC4AXbjC46uA/XMNTtoCzlqXiZecJXY/xwZdBT+y2SKUf3Z5+DdHwpYLV3anQ438p8BqWp692MQidy/aHt9WC+13NkhCUonYLQ4XDzXcUV9hpG1blKo0n3Twlzw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165956223471.06505325484807; Wed, 5 Mar 2025 01:12:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901870.1309837 (Exim 4.92) (envelope-from ) id 1tpknM-0007qw-TR; Wed, 05 Mar 2025 09:12:04 +0000 Received: by outflank-mailman (output) from mailman id 901870.1309837; Wed, 05 Mar 2025 09:12:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknM-0007qj-OA; Wed, 05 Mar 2025 09:12:04 +0000 Received: by outflank-mailman (input) for mailman id 901870; Wed, 05 Mar 2025 09:12:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknL-0006ew-CY for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:03 +0000 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [2a00:1450:4864:20::12f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e629023a-f9a1-11ef-9898-31a8f345e629; Wed, 05 Mar 2025 10:12:01 +0100 (CET) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5493b5bc6e8so7720351e87.2 for ; Wed, 05 Mar 2025 01:12:01 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:00 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e629023a-f9a1-11ef-9898-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165921; x=1741770721; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rsEkc5UwQaeOfpAVVoIStpjI7WoGyW7huU1aUhighTY=; b=mhLCdYPEKIPEa7IUE65yvIB4MlhGGRKCB50I3aS2H5qXTgqDhn0SE7b/FTqOx85+uM R2Kc1G2mgKHKPTWh3NdthK41d3tzqIR+1Gjs/2JPV0Za61Sc/NXSdmPa+Ku0kpTJ8erZ lLwPAkw8sl7z8VJd6TdO/002Hki5dsHkIIeyuLLugjCHnGkzbj8aaIoxEQXEMNSaIiaE /FES9PRKP5R3eoVHPRtPHNLvXJBhoJS7Ivq8KSXeDtUGckyPP7GLEDB78ctPTfFHFbpC c2k2ZfrW+9x0uIva5taQG+dgS7tWTJhUgDhfHtCyhdnv6uPBIt4gBG9GuGAFFqsy1oVT s2IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165921; x=1741770721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rsEkc5UwQaeOfpAVVoIStpjI7WoGyW7huU1aUhighTY=; b=MEqYez3sOQRzZnPW3dIaTIuJwyYHo/UCDcn806qumlff+zdjeuAEwkpbV8G/xiHJpA 2LVlIxWEVaoEN0k6B6WhUCczflBog04Vn/uR1l1FhiBVKtN5ACxMWrYTeqTvDMke5TpJ 4JKI8jhk9CAqumpdxdPj0AIJ9TR/BERgWYbWVzgDt03epRsSpPzoed0vLYaGYrMiD18s BciyvB8/Tw2vCc/fgW16rt9TcHktqCEX6f/98frl15pe945hRhMNeZnWaQW3REUnXGIb lDSJuxueP3vlFy5zcmOE/JLUfForHadxFgjgtYLZie9L3U/yq7+hqarvQZAXkohh4zmY jzpA== X-Gm-Message-State: AOJu0YzzsuM4nAqj2TrjFXGKS56A9hsZSFaLmgTIKpggNWvQ2RmnQ/OB dtMw2I0zpEoFCeNQ9WTjj+WfkLJVg3ib+QSfM3ByGBhQ1FeawfLNzqQnAqWe X-Gm-Gg: ASbGncttQ7WYR4Ez0fqjyy9YyyJc6i+JJJdwiRFiv3YCCYZMvu6q+M5R51tRC1hVaxn Jz7nK/4eEU+FY0HdqfaZ9prmGDVExGsaFwlf6iDmQ9siqeNCrarRYaMlUPhN9L2ApU2va6QZtG9 iZm6YMoqbpq/KDUTinh4oDneKqRVV0Ml3upMUiS7vaBMjrC8XHKHaolq0xzFgx17Dv5JuKLhgDx p+VEUxxYGa1y5htGYEU+4FvyJwxCtxIKX2M/969+k3MuRZ0WWfUyTZS/09X/0ACOEIVFgcbyTEG JWGdkrnJaok1ziNUg5JgIVLQojU7TI3YaoYwcPLlmqEg2NyUgw== X-Google-Smtp-Source: AGHT+IG3M+jnZ7dDUzYucmBB1qdaR5sNzVG4SVPMlLekJ0Z4w6Owt27xZGew4IedbsbYDvHnxaVsNQ== X-Received: by 2002:a05:6512:2308:b0:545:bf4:4bd4 with SMTP id 2adb3069b0e04-5497d332250mr783696e87.7.1741165920491; Wed, 05 Mar 2025 01:12:00 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Mykyta Poturai , Mykola Kvach Subject: [PATCH 05/16] xen/percpu: don't initialize percpu on resume Date: Wed, 5 Mar 2025 11:11:13 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165959605019100 Content-Type: text/plain; charset="utf-8" Invocation of the CPU_UP_PREPARE notification on ARM64 during resume causes a crash: (XEN) [ 315.807606] Error bringing CPU1 up: -16 (XEN) [ 315.811926] Xen BUG at common/cpu.c:258 [...] (XEN) [ 316.142765] Xen call trace: (XEN) [ 316.146048] [<00000a0000202264>] enable_nonboot_cpus+0x128/0x1a= c (PC) (XEN) [ 316.153219] [<00000a000020225c>] enable_nonboot_cpus+0x120/0x1a= c (LR) (XEN) [ 316.160391] [<00000a0000278180>] suspend.c#system_suspend+0x4c/= 0x1a0 (XEN) [ 316.167476] [<00000a0000206b70>] domain.c#continue_hypercall_ta= sklet_handler+0x54/0xd0 (XEN) [ 316.176117] [<00000a0000226538>] tasklet.c#do_tasklet_work+0xb8= /0x100 (XEN) [ 316.183288] [<00000a0000226920>] do_tasklet+0x68/0xb0 (XEN) [ 316.189077] [<00000a000026e120>] domain.c#idle_loop+0x7c/0x194 (XEN) [ 316.195644] [<00000a0000277638>] shutdown.c#halt_this_cpu+0/0x14 (XEN) [ 316.202383] [<0000000000000008>] 0000000000000008 Freeing per-CPU areas and setting __per_cpu_offset to INVALID_PERCPU_AREA only occur when !park_offline_cpus and system_state is not SYS_STATE_suspen= d. On ARM64, park_offline_cpus is always false, so setting __per_cpu_offset to INVALID_PERCPU_AREA depends solely on the system state. If the system is suspended, this area is not freed, and during resume, an e= rror occurs in init_percpu_area, causing a crash because INVALID_PERCPU_AREA is = not set and park_offline_cpus remains 0: if ( __per_cpu_offset[cpu] !=3D INVALID_PERCPU_AREA ) return park_offline_cpus ? 0 : -EBUSY; It appears that the same crash can occur on x86 if park_offline_cpus is set to 0 during Xen suspend. Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- These changes were introduced in V2 inside "xen: don't free percpu areas during suspend" patch. --- xen/common/percpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/common/percpu.c b/xen/common/percpu.c index e4e8b7bcab..83dca7edd6 100644 --- a/xen/common/percpu.c +++ b/xen/common/percpu.c @@ -74,7 +74,8 @@ static int cf_check cpu_percpu_callback( switch ( action ) { case CPU_UP_PREPARE: - rc =3D init_percpu_area(cpu); + if ( system_state !=3D SYS_STATE_resume ) + rc =3D init_percpu_area(cpu); break; =20 case CPU_UP_CANCELED: --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165988; cv=none; d=zohomail.com; s=zohoarc; b=gLN7y8lSBqxiYnsbDvrE5dtkpQrcxQxpDLYJqMpQ5bnFG9LP+UW+udVNRYsHoyVjlNDN38eWMwV0mCiAnzV5Ag/drANiAlLCA4UyZjIfWKxB70MolzI5880vNm8rVc2iD/cZV7eRvG/TfbjK4zHGhaBFD2pfQ9Yjb6IaGdKmG8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165988; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BlmWvs068DR9gr1c4VC9H2ZHK0FU95Y+mqhPj+voaTw=; b=KaYi1xE0hGSwaPB0AaNYWa8/ZpWbK9/Y9ucYskBHISRj711fCxMfUxiDJYShs7AKqNXQLMwCPioSrhAYL17ad7Ev+KXe8ypKQcPeJ4cx43BoJIV0YOdzy3MagYltPCEr6YAOXJZw4f+AbQQ2cBQzogULcC8v6Jn0EYHXzI4bZzo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165988145600.8894475632044; Wed, 5 Mar 2025 01:13:08 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901872.1309847 (Exim 4.92) (envelope-from ) id 1tpknP-0008Ax-3V; Wed, 05 Mar 2025 09:12:07 +0000 Received: by outflank-mailman (output) from mailman id 901872.1309847; Wed, 05 Mar 2025 09:12:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknO-0008Ag-W9; Wed, 05 Mar 2025 09:12:06 +0000 Received: by outflank-mailman (input) for mailman id 901872; Wed, 05 Mar 2025 09:12:05 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknN-0006ew-7d for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:05 +0000 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [2a00:1450:4864:20::130]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e740e5c3-f9a1-11ef-9898-31a8f345e629; Wed, 05 Mar 2025 10:12:03 +0100 (CET) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-54298ec925bso9809906e87.3 for ; Wed, 05 Mar 2025 01:12:03 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:01 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e740e5c3-f9a1-11ef-9898-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165922; x=1741770722; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BlmWvs068DR9gr1c4VC9H2ZHK0FU95Y+mqhPj+voaTw=; b=EXwQTDhQHZpL71VsIS0o1NNdYQwKrrFb2S6WUAQEMp9P7vonkV0E3ZIVaUPbglvQGW 3YK9z8XKC9yjtjGUmtEUz613frhT62nZjwX6l7mNNcH/wSxcmpqB7JkklnJFahJ/d5U9 bIFBhw18MZyZ7uY7I2ytDAIDiOkLR+3FkgXWQVxP3ZzJsNbsZBMdFF3AQh8CD6qw7PF8 MLKN2tTxJbgpKg9IRZ58V1LEfcJMfCgs1Rhf/990As9331VqQSdXnSLqJbD6Sdk/K/tb oOLy0RYhEavuxkVCBGWdZ50YKL0wYMwQJtZwfsWOfX5g8afcyBrkkVcCl4CeBTOMChTX gkRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165922; x=1741770722; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BlmWvs068DR9gr1c4VC9H2ZHK0FU95Y+mqhPj+voaTw=; b=n6vycXXrSOqS5eBB6v3u3RdrsrOvnNvvNWsY3hoRuHqXQ92xK/viX+tsI3EaZstDfT jmnLSMMobH4qg8qA3EgybH9E5+QGbgZ9+kOh7QYMDkc3Rh++cb+d1DwX+TjYrR5UAbDt beGsAp9842JxRmMHrqPBrJgg98Awdqt2pjDMbEbkBm/+BANt8QB2IIT6gS7uCMpUwDRq +WBLWdWh9KdXWkq0SJwHI3S8OjlsTr9rFgff8UwyyYM/riDrp/Puo/2OEg+sX4ZSeMTo cogFXVGeUog6kV0K+wuuZ2rraU9KCdFYeOeuasvsJh1gwvATIyLW5mF/gcXijTCAGzuI oqRA== X-Gm-Message-State: AOJu0Yzvi/4wR8U/9hqLYhpEyvp+q+DY+9RvzRXbfSnzAgdv631Nu2kv WZItM4E8zqKTiazFNg7Rh+bTn0w49lVA8SkxAN40UUZw4Yv6VNmKDBXMTbp9 X-Gm-Gg: ASbGncvUSsmMdoRKk9xLNmcv7+vWFOan6Tl7Gyf6E9dXm1ByQSqH9MSuB4qLt1A3vVZ J3lFu1qL/8GkJLdXatck1eujDDZytLGCtUk053k6dLdfpkqKfwoY6fLdvGp2FpBV9drjCXmGso+ ASfumNUYJdLdDMEAsWI/czUkkSQJ6+BXSaooFIVPE1VWUbAJ8puqP/kGMQzvbyLOqcirqVRICqZ VIDNxzPJAFlrF1gwJgcfgUUcfT+BoCC+oKMxE0GM09RjNAD4kHPChmNp5FuIrEUS9X33kJTYgoR g/Raa68f0hBtWpGDXIShFaUCD4vedYxhk/OGvkOdPyv5lg1Fjg== X-Google-Smtp-Source: AGHT+IFGQjD0nLcMig8xjCScahU4JtmgGc/wo+bPny8YpKreUoEaLv+Q7fgItxamnLGhjdgBLPivWg== X-Received: by 2002:a05:6512:b11:b0:549:4e80:6dc0 with SMTP id 2adb3069b0e04-5497d18de0dmr968133e87.0.1741165922301; Wed, 05 Mar 2025 01:12:02 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mykola Kvach , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Mykyta Poturai Subject: [PATCH 06/16] xen/arm: Introduce system suspend config option Date: Wed, 5 Mar 2025 11:11:14 +0200 Message-ID: <28da91c2859e0226585951ea3d6e7017b402ec0b.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165989412019100 Content-Type: text/plain; charset="utf-8" From: Mykola Kvach This option enables the system suspend support. This is the mechanism that allows the system to be suspended to RAM and later resumed. Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- xen/arch/arm/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index a26d3e1182..5834af16ab 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -475,6 +475,17 @@ config ARM64_HARDEN_BRANCH_PREDICTOR config ARM32_HARDEN_BRANCH_PREDICTOR def_bool y if ARM_32 && HARDEN_BRANCH_PREDICTOR =20 +config SYSTEM_SUSPEND + bool "System suspend support" + default y + depends on ARM_64 + help + This option enables the system suspend support. This is the + mechanism that allows the system to be suspended to RAM and + later resumed. + + If unsure, say Y. + source "arch/arm/platforms/Kconfig" =20 source "common/Kconfig" --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165975; cv=none; d=zohomail.com; s=zohoarc; b=IaHW3MLmNKu1egDg1kC3RMxNPg17etQY2lQcg6yaxR05UKgA9rffdCJc+yeJ5PL8gYPiHCR5TcwZKMNfui/8G3u706KndCDIobcIxf0ijwrfFYsLqOukBRBkxofcSWUDbIfJFyVVGHj4jwAdefuNvG6pipLbutk3Rplbvj6sVUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165975; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Hk7OlNvHyGrBIxhedAYhMR4TCL3M3B56gPlyju/+iaE=; b=CYGWBkCWKjQ5CA5ySa7fqpwudEVgMaqzOgNcKpR2ljiKwDrQ4O9j2sy0c1phq6tGunAbOAPr9RELyqJqiUp8mxUFNYmX6EmTr4tobFEkaumFt+hOOgpScI9NkDyNzEu8skj74RXHf/msRL9xhUi0QvvB5ixFPTPmq43UMNs//r4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165975118707.2154701017821; Wed, 5 Mar 2025 01:12:55 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901874.1309853 (Exim 4.92) (envelope-from ) id 1tpknP-0008FW-KE; Wed, 05 Mar 2025 09:12:07 +0000 Received: by outflank-mailman (output) from mailman id 901874.1309853; Wed, 05 Mar 2025 09:12:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknP-0008Eh-Ck; Wed, 05 Mar 2025 09:12:07 +0000 Received: by outflank-mailman (input) for mailman id 901874; Wed, 05 Mar 2025 09:12:06 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknO-0006ew-7y for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:06 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e7d6b355-f9a1-11ef-9898-31a8f345e629; Wed, 05 Mar 2025 10:12:04 +0100 (CET) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-548430564d9so6960606e87.2 for ; Wed, 05 Mar 2025 01:12:04 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:02 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e7d6b355-f9a1-11ef-9898-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165924; x=1741770724; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Hk7OlNvHyGrBIxhedAYhMR4TCL3M3B56gPlyju/+iaE=; b=cDCjt77bN2Pk28HYeWZzKju7Rb0gQh0LFmo0f45du8Zrm9CSkcbMMnKpZQTgeQUNEw SMPAiaJI9FyxPoWIw/zixgqPTHXW7fgKcI6nw/NrKCOd+kDXqH+t4AX5WuXca5dXNHMx pXowUOwCyNIYPAYLAek39kK8EDhDwTSZpkKZBrJY6Fw+8K3X20qGR1wSw4s7cnGpDUjS njzeUKPF/OohHaYKIRUSIMlN5PBeGaEhNCLjWicRXi9wvXOJwWVshbpR6u/jerfOoyN/ KsOIlgf90AYv3NGv4HbXBvTbZQUUxAb/2QFj4mpkfhErX3GyvcvpaWm0NoyGGBBAg+t3 SBmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165924; x=1741770724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hk7OlNvHyGrBIxhedAYhMR4TCL3M3B56gPlyju/+iaE=; b=A6ihjZ1ZEHosMdkpGA0qHfLS3+Gg1CjIvFAK3vmxV43LfjhvxYUqsEVH13HYduJQqN sy970NyGQ/E764ALcXVDWUNfpAM79/REgxngbZdpiNRpdkBFqNkUe12Smad+3gUYE+MD VLhGKTPwzfX02R+vWn9541W3GIOvOTnlTfKmSC5SZUxW6/IWUPzGyA/0tnlzR9P6PUBM HoTjdXUuohK36Dv4E4A+mZlTOKOoe4awXl/cXncUI0qI43ZruA7r+Jz/8Cpme6t0IcM+ CPIHEG4epO9vuH8s9xKqGOJathV3oNafb+1wvpiSwxis/CFbMynge0lEZnXOZih8mIgc TPAg== X-Gm-Message-State: AOJu0Yxtw9ll/0samTbMc25iSHFAw57X10Pl0PcGC/1LxkZphjhDypP7 0nBaHbGBlAQRQUDv38rAZJiEa9RUciG+md/2guh+vP+D5n9LfIzAO/awOqIz X-Gm-Gg: ASbGnctCVBZL86rywC6SqXELoa1edValxEscJmB7EOZpzvg+l1nbzxN3z1CBUkdZxAP ZyufRqrmlu/pFtKzdPf4KGz60AdNxqUgP4FY7XMuHhGWki9oH3Mlkx363s5UCnBmNrhQ81a8R07 0iqvQYfr9d2O+oiLhTHeJgVR+iUXOElucNKN9CUk2r3FCOcmHwRR6Uz/K0hPYw+Iu+p/xR/MUPe 6nCNc2wl42PSRZC4wKV5fPAilOj/QBXTPz+N1EaF1cUaYxVjrcz3tTxYlLbprsov70eSItGCZ+c /67Wv+MfTA8BgncIeftSyS0dWWoGeiiiFJDv+LhSCYm8wdPq0w== X-Google-Smtp-Source: AGHT+IEIUNIyqIxvynpuLuIPXWu5ZNrVatGILJqxFJ5qgs7gjphHV9/kq2qqAOMcHFIgr20BAbiaZg== X-Received: by 2002:a05:6512:3b11:b0:549:7c13:e895 with SMTP id 2adb3069b0e04-5497d380d02mr820547e87.47.1741165923806; Wed, 05 Mar 2025 01:12:03 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mykola Kvach , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Volodymyr Babchuk , Oleksandr Andrushchenko Subject: [PATCH 07/16] xen/char: implement suspend/resume calls for SCIF driver Date: Wed, 5 Mar 2025 11:11:15 +0200 Message-ID: <503edd5fb277699aaeb87507bb39fbb52e81f168.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165977412019100 Content-Type: text/plain; charset="utf-8" From: Mykola Kvach The changes have been tested only on the Renesas R-Car-H3 Starter Kit board. Signed-off-by: Volodymyr Babchuk Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Mykola Kvach --- xen/drivers/char/scif-uart.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/xen/drivers/char/scif-uart.c b/xen/drivers/char/scif-uart.c index 757793ca45..e166fb0f36 100644 --- a/xen/drivers/char/scif-uart.c +++ b/xen/drivers/char/scif-uart.c @@ -139,7 +139,7 @@ static void scif_uart_interrupt(int irq, void *data) } } =20 -static void __init scif_uart_init_preirq(struct serial_port *port) +static void scif_uart_init_preirq(struct serial_port *port) { struct scif_uart *uart =3D port->uart; const struct port_params *params =3D uart->params; @@ -271,6 +271,33 @@ static void scif_uart_stop_tx(struct serial_port *port) scif_writew(uart, SCIF_SCSCR, scif_readw(uart, SCIF_SCSCR) & ~SCSCR_TI= E); } =20 +static void scif_uart_suspend(struct serial_port *port) +{ + struct scif_uart *uart =3D port->uart; + + scif_uart_stop_tx(port); + + /* Wait until last bit has been transmitted. */ + while ( !(scif_readw(uart, SCIF_SCFSR) & SCFSR_TEND) ); + + /* Disable TX/RX parts and all interrupts */ + scif_writew(uart, SCIF_SCSCR, 0); + + /* Reset TX/RX FIFOs */ + scif_writew(uart, SCIF_SCFCR, SCFCR_RFRST | SCFCR_TFRST); +} + +static void scif_uart_resume(struct serial_port *port) +{ + struct scif_uart *uart =3D port->uart; + + scif_uart_init_preirq(port); + + /* Enable TX/RX and Error Interrupts */ + scif_writew(uart, SCIF_SCSCR, scif_readw(uart, SCIF_SCSCR) | + SCSCR_TIE | SCSCR_RIE | SCSCR_REIE); +} + static struct uart_driver __read_mostly scif_uart_driver =3D { .init_preirq =3D scif_uart_init_preirq, .init_postirq =3D scif_uart_init_postirq, @@ -281,6 +308,8 @@ static struct uart_driver __read_mostly scif_uart_drive= r =3D { .start_tx =3D scif_uart_start_tx, .stop_tx =3D scif_uart_stop_tx, .vuart_info =3D scif_vuart_info, + .suspend =3D scif_uart_suspend, + .resume =3D scif_uart_resume, }; =20 static const struct dt_device_match scif_uart_dt_match[] __initconst =3D --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165992; cv=none; d=zohomail.com; s=zohoarc; b=DP6kEbrXpzfTNOddNGd1c7FxyVnVvN0MnplrqpKLRFGmmAxZ3g5q6iqrf3jU4+c1cYz80o+5heHIztfzMW8ust+6Wz9CDwB2qJ4Ik2L5EfMf4yC5hrrjj+G07Cq1HYz6uBmwaJmezPGrHAtndD8IjKJOH57OCLhTFitqBY9LqJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165992; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kd9A3RPHtE4WbhtZy7g4A6o5dxf1Hpbh5fmcqVM2Avc=; b=ZLQTpWG2MleuMIVQ8mz1sit4sx63nqVTvB+tJ+S7wIkK2hY2paCeOLAY9+3YMxQ0Gza5VXjDMjT3jlzhpQQfaX1+9PsVIqN6JSTMQXsoOeKzaFTPviCaNopS674svCiFCCnyTAbCMZ9AiUewgevD47r7T7B6Klhy2KbXsWrLT7c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165992748949.670314128384; Wed, 5 Mar 2025 01:13:12 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901877.1309872 (Exim 4.92) (envelope-from ) id 1tpknS-0000Po-Eb; Wed, 05 Mar 2025 09:12:10 +0000 Received: by outflank-mailman (output) from mailman id 901877.1309872; Wed, 05 Mar 2025 09:12:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknS-0000Op-2g; Wed, 05 Mar 2025 09:12:10 +0000 Received: by outflank-mailman (input) for mailman id 901877; Wed, 05 Mar 2025 09:12:08 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknQ-0006ew-8W for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:08 +0000 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [2a00:1450:4864:20::22d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e88812e1-f9a1-11ef-9898-31a8f345e629; Wed, 05 Mar 2025 10:12:05 +0100 (CET) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-30795988ebeso70454201fa.3 for ; Wed, 05 Mar 2025 01:12:05 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:04 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e88812e1-f9a1-11ef-9898-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165925; x=1741770725; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kd9A3RPHtE4WbhtZy7g4A6o5dxf1Hpbh5fmcqVM2Avc=; b=X0ey0JHH8QNYZUAscvqafQ9HXMVnKLqo2M/kcasVOuYQ7acU2yE2/81aarCn2gPPAH gfJLkKPqn4EOWG1Bu64H91ZevnlQrPkovmvrChtG7yiMzPVRiriTNWpwV10MEYQiw7Ve dETSkXgzgM80cFE0lUyLcAiPi28GjeDNVC4OkRrkg1sqKoSI6KmdUf9ELuhHU4spXGIB XJFWhG67jomZn7jKHeaxKOFzdMUUmlNPvl0WTMPGSY7gD/njwmT1/MXhrKYXHD+OiIVB sY5ldm7kkZ+nGoPDtWptkyH3WztpTXvER6kO5ftcf5LiEw4zGX9xOyrGAn3vrcevg93T FLXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165925; x=1741770725; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kd9A3RPHtE4WbhtZy7g4A6o5dxf1Hpbh5fmcqVM2Avc=; b=brWwbFnEdjgGvM2ZvDshauVsukazoe6rLd+jS/OWJw9WIDqL6/7HyfU2RsRaQPEk09 LT7wg8ePKAMDJZbKP7cb0RPsiVvSmpvEpiS8ojS5vzGIZAMjHFQ0nM4vmLeSvwVZl7t5 pX3xJ09jxPJGcTJr+zdZxYc7su0drPqAzDvlGGpHUOXkcHCWSa1IbG+bN8Jj30weiZSZ diJtV9B5TrVtSumRy5xZWNX6CuIv8Iej3Qu6w3jbGUISRRmJL4V4oF9XPlR764k+bOzG d8kkg0R1M1lKXgcCuCIVFUqcybo0FgXK7MVnlcB50v3/teIs2RXOMvzuMhgPIy1TZX2I tMLw== X-Gm-Message-State: AOJu0YwiIxJ9OVEUpWGDciugkPoKAuobXm1bINF/9hVhaE1yN/dXcQmd bpaCIg0bIM6HITME18r1WyqGSTet+lKK5CsQx7cSWcBYqMMW925eJOAq8vOe X-Gm-Gg: ASbGncvjT4kifJRjYmwEpxNXYIL3u/XHK6W6wncKw4oc97Oct8XK/n+l5We6TilFutq pwyqVJlMmSem7Wf5HRAJVSwWxllsP034jETUbOzyUO5RJ9zUC/9pRf2OFJ7BiN9RUkSZ1iWejGY pM88uc/RYmoidrhwTt4pj8LRBdFjOyGtzVYHuzi75g75tA8ErrZc+AuR/yjDntGLSL6TFtfK7MC L/mvkc+2qzgUpC/QizSSZ2u/y7I1zsPzmwxTfIkogztQs9QN+rf4wj9KiLPw1LlsvCQEv6ByQdY 7EghN5l2iPnYRpAHpR4Us6oPHsmR8FmWmg9ATmxSzbtgiaGiOQ== X-Google-Smtp-Source: AGHT+IHrsYsDR4qMXWVpxHaZu+wKGEz/PXJcy2Ue5u4oge/Kp9XG1dzWJFj7drL2FXF8JTW6lj9+WA== X-Received: by 2002:a05:6512:3e06:b0:546:2f7a:38c4 with SMTP id 2adb3069b0e04-5497d335a4bmr910391e87.13.1741165924863; Wed, 05 Mar 2025 01:12:04 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mykola Kvach , Dario Faggioli , Juergen Gross , George Dunlap , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Mirela Simonovic , Saeed Nowshadi , Mykyta Poturai Subject: [PATCH 08/16] xen/arm: add watchdog domain suspend/resume helpers Date: Wed, 5 Mar 2025 11:11:16 +0200 Message-ID: <15604985aae5333670467a84cccbaaa403a10000.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165995480019100 Content-Type: text/plain; charset="utf-8" From: Mykola Kvach This patch implements suspend/resume helpers for the watchdog. While a domain is suspended its watchdogs must be paused. Otherwise, if the domain stays in the suspend state for a longer period of time compared to the watchdog period, the domain would be shutdown on resume. Proper solution to this problem is to stop (suspend) the watchdog timers after the domain suspends and to restart (resume) the watchdog timers before the domain resumes. The suspend/resume of watchdog timers is done in Xen and is invisible to the guests. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- Changes in v3: - cover the code with CONFIG_SYSTEM_SUSPEND Changes in v2: - drop suspended field from timer structure - drop the call of watchdog_domain_resume from ctxt_switch_to --- xen/common/sched/core.c | 39 +++++++++++++++++++++++++++++++++++++++ xen/include/xen/sched.h | 9 +++++++++ 2 files changed, 48 insertions(+) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index b1c6b6b9fa..6c2231826a 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -1605,6 +1605,45 @@ void watchdog_domain_destroy(struct domain *d) kill_timer(&d->watchdog_timer[i].timer); } =20 +#ifdef CONFIG_SYSTEM_SUSPEND + +void watchdog_domain_suspend(struct domain *d) +{ + unsigned int i; + + spin_lock(&d->watchdog_lock); + + for ( i =3D 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ ) + { + if ( test_bit(i, &d->watchdog_inuse_map) ) + { + stop_timer(&d->watchdog_timer[i].timer); + } + } + + spin_unlock(&d->watchdog_lock); +} + +void watchdog_domain_resume(struct domain *d) +{ + unsigned int i; + + spin_lock(&d->watchdog_lock); + + for ( i =3D 0; i < NR_DOMAIN_WATCHDOG_TIMERS; i++ ) + { + if ( test_bit(i, &d->watchdog_inuse_map) ) + { + set_timer(&d->watchdog_timer[i].timer, + NOW() + SECONDS(d->watchdog_timer[i].timeout)); + } + } + + spin_unlock(&d->watchdog_lock); +} + +#endif /* CONFIG_SYSTEM_SUSPEND */ + /* * Pin a vcpu temporarily to a specific CPU (or restore old pinning state = if * cpu is NR_CPUS). diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index d0d10612ce..caab4aad93 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -1109,6 +1109,15 @@ void scheduler_disable(void); void watchdog_domain_init(struct domain *d); void watchdog_domain_destroy(struct domain *d); =20 +#ifdef CONFIG_SYSTEM_SUSPEND +/* + * Suspend/resume watchdogs of domain (while the domain is suspended its + * watchdogs should be on pause) + */ +void watchdog_domain_suspend(struct domain *d); +void watchdog_domain_resume(struct domain *d); +#endif /* CONFIG_SYSTEM_SUSPEND */ + /* * Use this check when the following are both true: * - Using this feature or interface requires full access to the hardware --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741165991; cv=none; d=zohomail.com; s=zohoarc; b=Nt+4KjztVf23xbZMIkFYFwfE03g2+qe/Z77Knl9ovocVeyuHWKE8DFcfGBsTB9UDJWOeRxsyHYbahLr/ugEvzKYTsee4pzej+Wy0lh7GLF0IN9Uw5EcYOP6qFvtZTgbVZEsov7kpF+BbpjHBt5fEG5B4K+4JA2nuOSDuhm9pPqs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741165991; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m/DQSzA8Mm1BXyH1yps+EV4PgxUn5myADhhJYlS6Wxs=; b=JbKUsr7NRuATGa3OTVEkrINnvNY0uHNMAI5CvOhUxHVHAngwxL0EsO8FQSVMDWOz9yz8Ok8Y6aWB7Kuri2jPK+XwpQgqvMJsIY18jAd8LA8olAo1NDYBoDDuLzZWG7XuMG4P3JQ1yjbWzPmrjlbOdGxUgsrlrP2CJlCxxA8vUzk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741165991145445.93446465844534; Wed, 5 Mar 2025 01:13:11 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901876.1309867 (Exim 4.92) (envelope-from ) id 1tpknR-0000Lu-Sf; Wed, 05 Mar 2025 09:12:09 +0000 Received: by outflank-mailman (output) from mailman id 901876.1309867; Wed, 05 Mar 2025 09:12:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknR-0000Ld-O2; Wed, 05 Mar 2025 09:12:09 +0000 Received: by outflank-mailman (input) for mailman id 901876; Wed, 05 Mar 2025 09:12:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknP-0006ev-S6 for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:07 +0000 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [2a00:1450:4864:20::12f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e957a17f-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:12:07 +0100 (CET) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-54958009d4dso4389302e87.2 for ; Wed, 05 Mar 2025 01:12:07 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:05 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e957a17f-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165926; x=1741770726; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=m/DQSzA8Mm1BXyH1yps+EV4PgxUn5myADhhJYlS6Wxs=; b=Ckp1V16ZPYSAPtzFzs0WwiF5I5aidZKU/HO6+7+C/CO061QX4jM1SSL9ejlOs1IZwZ gbwpyv6og7nvRXPvyGZAfkr59hQRLqmaWUjZymW+ZcD+0Dt7m2SiIFruwgX5jyQhvEBs /sYbVwRJlBlVd5b1wHdF65IGKcvp3LFfEzUinKd0wITYP/lkI2v5K+rxG+Bjr2TyQi78 vLwaK5ov5Yu1NeC5dqjkD/Me2mj9/D7Y56hsJ0uNQ0XgJAU3Rpo+64kKh+iA92oCW5SD zrdPIlZRgjDhBwVkKZlXVgrs+CbpdQFTsBqwiJOrIulLHIQ36Cr/lzd7SLbYx8Ij1CDN YncA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165926; x=1741770726; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m/DQSzA8Mm1BXyH1yps+EV4PgxUn5myADhhJYlS6Wxs=; b=xSFH4xp/qN5jRY7K2ZHJLx0oJYwT263xQgDjJaIODy1hx4gxvEsAFOuyFBgceXokbP bymrQ4Puh1Xmx3UaTRWOaPq/nmEIiXH4haVObBkGwrKL2erseH0JKr88SH94agemncpg 0N5CnPQVm4Q7czVHr2MinJD5Mt6tcHYKOZU+gnkkJf9BSiX+47Nux86LLcAIduJD7AG8 AIEgRkuBiaW5odAh+hZMDlq5W+5TLGCu1dJ+JzUR13/Tdp50jtTWLYQW3uCkOtX2+dC9 db9z3h+9gRwmsrRpDcUVCRi0r/ZYryUtKNjBnevdw7EnC/QgjbMJlkznF7C680M8Hzt2 lC5g== X-Gm-Message-State: AOJu0Yy35fWO6HWKaDmvx/GZLxPB+NdLr195Zas+Z0qN9lCaaPW3HTrF Tt1H1np10BDjN/kOnDHUvEVAUvqyQI8sZH1+qCP+Kqn316uAp/6ZhHGQBWYg X-Gm-Gg: ASbGncvuoN1Q0GlDceD39dAsZwT1gZQglxD1YlX4xCfeH33gfpglpeEe1b6WUPAY11U VPmFiwRecjU7g/POz+aFdW9Kx+TXhu+i7S+w9eSVRrxhop0WJREcLQD9gRJ4uiBF0vtBBs+8dnJ wsaoiNChr/8R/bx2DAX5i/DOWUHNo/7OwFFFHPDrWdLSuqNFanfSFAHtyij0whAaspfEp/09bZN Vx9+78urPniYa7maFr21WcPtveq/jvgLcEg1FeQiiivnkEKockxd4OaJPw/GxK5ASKAyZ15rDkm hFhU8OVNUJHHUyC2ym4Zk2cIMRX3MPyAHvpL5ZdGP8gWVq7/Sg== X-Google-Smtp-Source: AGHT+IGtxa5Pj8kBsJaWyLXDgkv7/rHGgii+0cSx8gjh5ZUbdc71zh95bWBESehdjid4tSsm3aPzQQ== X-Received: by 2002:a05:6512:2316:b0:545:1193:1256 with SMTP id 2adb3069b0e04-5497d32f847mr706274e87.1.1741165925893; Wed, 05 Mar 2025 01:12:05 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Saeed Nowshadi , Mykola Kvach Subject: [PATCH 09/16] xen/arm: add suspend and resume timer helpers Date: Wed, 5 Mar 2025 11:11:17 +0200 Message-ID: <1c84532d015797f23172598a820223b6fa8bcb8d.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741165992415019000 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic Timer interrupts have to be disabled while the system is in suspend. Otherwise, a timer interrupt would fire and wake-up the system. Suspending the timer interrupts consists of disabling physical EL1 and EL2 timers. The resume consists only of raising timer softirq, which will trigger the generic timer code to reprogram the EL2 timer as needed. Enabling of EL1 physical timer will be triggered by an entity which uses it. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykola Kvach --- xen/arch/arm/include/asm/time.h | 5 +++++ xen/arch/arm/time.c | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/xen/arch/arm/include/asm/time.h b/xen/arch/arm/include/asm/tim= e.h index 49ad8c1a6d..f4fd0c6af5 100644 --- a/xen/arch/arm/include/asm/time.h +++ b/xen/arch/arm/include/asm/time.h @@ -108,6 +108,11 @@ void preinit_xen_time(void); =20 void force_update_vcpu_system_time(struct vcpu *v); =20 +#ifdef CONFIG_SYSTEM_SUSPEND +void time_suspend(void); +void time_resume(void); +#endif /* CONFIG_SYSTEM_SUSPEND */ + #endif /* __ARM_TIME_H__ */ /* * Local variables: diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index e74d30d258..89c5773244 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -372,6 +372,32 @@ void domain_set_time_offset(struct domain *d, int64_t = time_offset_seconds) /* XXX update guest visible wallclock time */ } =20 +#ifdef CONFIG_SYSTEM_SUSPEND + +void time_suspend(void) +{ + /* Disable physical EL1 timer */ + WRITE_SYSREG(0, CNTP_CTL_EL0); + + /* Disable hypervisor's timer */ + WRITE_SYSREG(0, CNTHP_CTL_EL2); + isb(); +} + +void time_resume(void) +{ + /* + * Raising timer softirq will trigger generic timer code to reprogram_= timer + * with the correct timeout value (which is not known here). There is = no + * need to do anything else in order to recover the time keeping from = power + * down, because the system counter is not affected by the power down = (it + * resides out of the ARM's cluster in an always-on part of the SoC). + */ + raise_softirq(TIMER_SOFTIRQ); +} + +#endif /* CONFIG_SYSTEM_SUSPEND */ + static int cpu_time_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) --=20 2.43.0 From nobody Sun Mar 9 21:40:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741166000; cv=none; d=zohomail.com; s=zohoarc; b=ZlnyLDlC8Ic7FRf/2WknKT1i1f9q5XuT4bRHm52d52lCu+BBTzVFdfFBsPHVnrd4K6XNMwGZs/czc/9KZg3VDn59RBnqC60mrCGav5/2I2BlWvguGNxhJTYIMIZ0tiouiVC1Q3AbeFySbFCtzifZAQqlj86r3KFUvl5++Dl7vZU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741166000; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4/8kyy/e+kyBcwvFFlXXM+fJPKdq7qtfTXyKQk0fSJ8=; b=SYkLJ7p5iSZJ/PD9OH1C5wkJLAxcypPNehT1k2VOSHQgflxILpRnaNFLJy6lOSr3Ehg3vB3zBdK+9Rhq6ro8yH4xJCBogZWeK7YgDyyRzrfmJ3CYncemgYqFOTiByBcJQ/0EIUGxQD4JXyMVPkzDVHG5zmmw2xedKx8cYdgx+sA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741166000805321.2745334576907; Wed, 5 Mar 2025 01:13:20 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901878.1309879 (Exim 4.92) (envelope-from ) id 1tpknT-0000en-DS; Wed, 05 Mar 2025 09:12:11 +0000 Received: by outflank-mailman (output) from mailman id 901878.1309879; Wed, 05 Mar 2025 09:12:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknT-0000cg-4e; Wed, 05 Mar 2025 09:12:11 +0000 Received: by outflank-mailman (input) for mailman id 901878; Wed, 05 Mar 2025 09:12:09 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknR-0006ev-0q for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:09 +0000 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [2a00:1450:4864:20::134]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ea07c654-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:12:08 +0100 (CET) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5496bc2e261so3041218e87.3 for ; Wed, 05 Mar 2025 01:12:08 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:06 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ea07c654-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165928; x=1741770728; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4/8kyy/e+kyBcwvFFlXXM+fJPKdq7qtfTXyKQk0fSJ8=; b=WunxoxaipK6FYHudkuN7MbHOUXK6wlUt5o6uDuT7FFSJLOUc5JgDrJTkaebMyCgNGS f0nOMEqfab5RQrZYco9iryeHABzqJ2LFkUDIjPE69ihKgE6cb1ja2Z56WwXxE0jyiOCz G3o+WKKsIbQI2jXtwsbpSoGLXWe1FvYW8PN/+/4DNyONQV5JGNuotJvd9TpovW8fvcKF zbeLBHOfPv0gLuJH+H0xRdo4JKNUrx5m0mpc+7gjedNOt1LUqshlbDnBVKCBPYDT0FhQ sWLS9kakWX7D12/gqYGA6+flP4fgNxnP/P+hMWiuFxno3f2PfHJlHl5RP2r1d/HetYTq 5XoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165928; x=1741770728; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4/8kyy/e+kyBcwvFFlXXM+fJPKdq7qtfTXyKQk0fSJ8=; b=imo+zg6bIYWKPewl9mp2miXO3QLY3QOV7F2sC8Keqy4/FJFZRQ98VFB3JTXtd9NqHL lxd/4kVhCCjGEj7AA7synb7dl+D0RimcyCQcXoFSQof02JD2CLaVtbch0dzxydIic37U J5Ql+4AosHYKCDcCG39xHbjCCt6qj9fwoIcn+tBUHyOAkrUsu1ijavjj0KLxTfC8aeoq w+ZemMi2nwnsIEmJGGS6yx7uZ0kssZg0pvqHYB/MVBzLQNS+/dOTfZuU8Lp0gYheCvBD zWwo61kgslWa6/RSu4QXl6K6PSKS3lxeW9apm0IWVGXUybtS2CMwfmtNFvT/ETFNl3Tb vscw== X-Gm-Message-State: AOJu0YykOebJKau0OxbVWuKvXwbi95QyTP50v7TYKX3R2jCyWf70NEom FG3GJqHOQWVWNcpktgTTJ6rZCc/iUPxNzL2Ng2eyV5tqwLat1Vk1/ybBFI7E X-Gm-Gg: ASbGncvYD8rhZtTQyJ0dzikWRQV52xes5yi3nr0rGZnnHHOOe+9emG+9lSupwGYMGf1 wmcLKTJ1jWTB1empylWUcIVkg462Mf7+5C2mIR60AN/xQl/2RB9lXxd7qGqMDqU4pzPykU0fV26 DhJKZQZ2bZxiXl3TeWHU5Xw5V7j6m2JrdxBpuoAjU4X1WIIX1Pl46TBQcsb/evbllQHYKGpPq5n 6X6goKKXzEo19+dbn/DVicXC9shcq3Br09xmDi2qSIyylq4pessB3FfADy1yfju6WclHXFsUxH+ OscfWwZZZJOh3IF/EyJHIVUt+KdNxqAetTajk7Zp6YjEs9WgkA== X-Google-Smtp-Source: AGHT+IFW+lziWbHd1pIz+0JjTnkeWoKJRDeU1VuvnilEd64flrtnOsLy0B3LNUJx4k/lQIaKCBhqMQ== X-Received: by 2002:a05:6512:1596:b0:549:74a7:12d6 with SMTP id 2adb3069b0e04-5497d357da3mr752284e87.26.1741165927466; Wed, 05 Mar 2025 01:12:07 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Saeed Nowshadi , Mykyta Poturai , Mykola Kvach Subject: [PATCH 10/16] xen/arm: Implement GIC suspend/resume functions (gicv2 only) Date: Wed, 5 Mar 2025 11:11:18 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741166002403019000 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic System suspend may lead to a state where GIC would be powered down. Therefore, Xen should save/restore the context of GIC on suspend/resume. Note that the context consists of states of registers which are controlled by the hypervisor. Other GIC registers which are accessible by guests are saved/restored on context switch. Tested on Xilinx Ultrascale+ MPSoC with (and without) powering down the GIC. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- changes in v3: - drop asserts, return error code instead - cover the code with CONFIG_SYSTEM_SUSPEND changes in v2: - minor fixes after review --- xen/arch/arm/gic-v2.c | 142 +++++++++++++++++++++++++++++++++ xen/arch/arm/gic.c | 29 +++++++ xen/arch/arm/include/asm/gic.h | 12 +++ 3 files changed, 183 insertions(+) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 02043c0d4b..868e1a5026 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -1098,6 +1098,139 @@ static int gicv2_iomem_deny_access(struct domain *d) return iomem_deny_access(d, mfn, mfn + nr); } =20 +#ifdef CONFIG_SYSTEM_SUSPEND + +/* GICv2 registers to be saved/restored on system suspend/resume */ +struct gicv2_context { + /* GICC context */ + uint32_t gicc_ctlr; + uint32_t gicc_pmr; + uint32_t gicc_bpr; + /* GICD context */ + uint32_t gicd_ctlr; + uint32_t *gicd_isenabler; + uint32_t *gicd_isactiver; + uint32_t *gicd_ipriorityr; + uint32_t *gicd_itargetsr; + uint32_t *gicd_icfgr; +}; + +static struct gicv2_context gicv2_context; + +static int gicv2_suspend(void) +{ + unsigned int i; + + if ( !gicv2_context.gicd_isenabler ) + return -ENOMEM; + + /* Save GICC configuration */ + gicv2_context.gicc_ctlr =3D readl_gicc(GICC_CTLR); + gicv2_context.gicc_pmr =3D readl_gicc(GICC_PMR); + gicv2_context.gicc_bpr =3D readl_gicc(GICC_BPR); + + /* Save GICD configuration */ + gicv2_context.gicd_ctlr =3D readl_gicd(GICD_CTLR); + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 32); i++ ) + gicv2_context.gicd_isenabler[i] =3D readl_gicd(GICD_ISENABLER + i = * 4); + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 32); i++ ) + gicv2_context.gicd_isactiver[i] =3D readl_gicd(GICD_ISACTIVER + i = * 4); + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 4); i++ ) + gicv2_context.gicd_ipriorityr[i] =3D readl_gicd(GICD_IPRIORITYR + = i * 4); + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 4); i++ ) + gicv2_context.gicd_itargetsr[i] =3D readl_gicd(GICD_ITARGETSR + i = * 4); + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 16); i++ ) + gicv2_context.gicd_icfgr[i] =3D readl_gicd(GICD_ICFGR + i * 4); + + return 0; +} + +static void gicv2_resume(void) +{ + unsigned int i; + + if ( !gicv2_context.gicd_isenabler ) + return; + + /* Disable CPU interface and distributor */ + writel_gicc(0, GICC_CTLR); + writel_gicd(0, GICD_CTLR); + + /* Restore GICD configuration */ + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 32); i++ ) { + writel_gicd(0xffffffff, GICD_ICENABLER + i * 4); + writel_gicd(gicv2_context.gicd_isenabler[i], GICD_ISENABLER + i * = 4); + } + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 32); i++ ) { + writel_gicd(0xffffffff, GICD_ICACTIVER + i * 4); + writel_gicd(gicv2_context.gicd_isactiver[i], GICD_ISACTIVER + i * = 4); + } + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 4); i++ ) + writel_gicd(gicv2_context.gicd_ipriorityr[i], GICD_IPRIORITYR + i = * 4); + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 4); i++ ) + writel_gicd(gicv2_context.gicd_itargetsr[i], GICD_ITARGETSR + i * = 4); + + for ( i =3D 0; i < DIV_ROUND_UP(gicv2_info.nr_lines, 16); i++ ) + writel_gicd(gicv2_context.gicd_icfgr[i], GICD_ICFGR + i * 4); + + /* Make sure all registers are restored and enable distributor */ + writel_gicd(gicv2_context.gicd_ctlr | GICD_CTL_ENABLE, GICD_CTLR); + + /* Restore GIC CPU interface configuration */ + writel_gicc(gicv2_context.gicc_pmr, GICC_PMR); + writel_gicc(gicv2_context.gicc_bpr, GICC_BPR); + + /* Enable GIC CPU interface */ + writel_gicc(gicv2_context.gicc_ctlr | GICC_CTL_ENABLE | GICC_CTL_EOI, + GICC_CTLR); +} + +static void gicv2_alloc_context(struct gicv2_context *gc) +{ + uint32_t n =3D gicv2_info.nr_lines; + + gc->gicd_isenabler =3D xzalloc_array(uint32_t, DIV_ROUND_UP(n, 32)); + if ( !gc->gicd_isenabler ) + goto err_free; + + gc->gicd_isactiver =3D xzalloc_array(uint32_t, DIV_ROUND_UP(n, 32)); + if ( !gc->gicd_isactiver ) + goto err_free; + + gc->gicd_itargetsr =3D xzalloc_array(uint32_t, DIV_ROUND_UP(n, 4)); + if ( !gc->gicd_itargetsr ) + goto err_free; + + gc->gicd_ipriorityr =3D xzalloc_array(uint32_t, DIV_ROUND_UP(n, 4)); + if ( !gc->gicd_ipriorityr ) + goto err_free; + + gc->gicd_icfgr =3D xzalloc_array(uint32_t, DIV_ROUND_UP(n, 16)); + if ( !gc->gicd_icfgr ) + goto err_free; + + return; + + err_free: + xfree(gc->gicd_icfgr); + xfree(gc->gicd_ipriorityr); + xfree(gc->gicd_itargetsr); + xfree(gc->gicd_isactiver); + xfree(gc->gicd_isenabler); + + memset(gc, 0, sizeof(*gc)); +} + +#endif /* CONFIG_SYSTEM_SUSPEND */ + #ifdef CONFIG_ACPI static unsigned long gicv2_get_hwdom_extra_madt_size(const struct domain *= d) { @@ -1302,6 +1435,11 @@ static int __init gicv2_init(void) =20 spin_unlock(&gicv2.lock); =20 +#ifdef CONFIG_SYSTEM_SUSPEND + /* Allocate memory to be used for saving GIC context during the suspen= d */ + gicv2_alloc_context(&gicv2_context); +#endif /* CONFIG_SYSTEM_SUSPEND */ + return 0; } =20 @@ -1345,6 +1483,10 @@ const static struct gic_hw_operations gicv2_ops =3D { .map_hwdom_extra_mappings =3D gicv2_map_hwdom_extra_mappings, .iomem_deny_access =3D gicv2_iomem_deny_access, .do_LPI =3D gicv2_do_LPI, +#ifdef CONFIG_SYSTEM_SUSPEND + .suspend =3D gicv2_suspend, + .resume =3D gicv2_resume, +#endif /* CONFIG_SYSTEM_SUSPEND */ }; =20 /* Set up the GIC */ diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index acf61a4de3..1c974cf0f5 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -422,6 +422,35 @@ int gic_iomem_deny_access(struct domain *d) return gic_hw_ops->iomem_deny_access(d); } =20 +#ifdef CONFIG_SYSTEM_SUSPEND + +int gic_suspend(void) +{ + /* Must be called by boot CPU#0 with interrupts disabled */ + ASSERT(!local_irq_is_enabled()); + ASSERT(!smp_processor_id()); + + if ( !gic_hw_ops->suspend || !gic_hw_ops->resume ) + return -ENOSYS; + + return gic_hw_ops->suspend(); +} + +void gic_resume(void) +{ + /* + * Must be called by boot CPU#0 with interrupts disabled after gic_sus= pend + * has returned successfully. + */ + ASSERT(!local_irq_is_enabled()); + ASSERT(!smp_processor_id()); + ASSERT(gic_hw_ops->resume); + + gic_hw_ops->resume(); +} + +#endif /* CONFIG_SYSTEM_SUSPEND */ + static int cpu_gic_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) diff --git a/xen/arch/arm/include/asm/gic.h b/xen/arch/arm/include/asm/gic.h index 541f0eeb80..a706303008 100644 --- a/xen/arch/arm/include/asm/gic.h +++ b/xen/arch/arm/include/asm/gic.h @@ -280,6 +280,12 @@ extern int gicv_setup(struct domain *d); extern void gic_save_state(struct vcpu *v); extern void gic_restore_state(struct vcpu *v); =20 +#ifdef CONFIG_SYSTEM_SUSPEND +/* Suspend/resume */ +extern int gic_suspend(void); +extern void gic_resume(void); +#endif /* CONFIG_SYSTEM_SUSPEND */ + /* SGI (AKA IPIs) */ enum gic_sgi { GIC_SGI_EVENT_CHECK, @@ -395,6 +401,12 @@ struct gic_hw_operations { int (*iomem_deny_access)(struct domain *d); /* Handle LPIs, which require special handling */ void (*do_LPI)(unsigned int lpi); +#ifdef CONFIG_SYSTEM_SUSPEND + /* Save GIC configuration due to the system suspend */ + int (*suspend)(void); + /* Restore GIC configuration due to the system resume */ + void (*resume)(void); +#endif /* CONFIG_SYSTEM_SUSPEND */ }; =20 extern const struct gic_hw_operations *gic_hw_ops; --=20 2.43.0 From nobody Sun Mar 9 21:40:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741167271; cv=none; d=zohomail.com; s=zohoarc; b=A59IPiBD+eikZ5aIxY8gj0WPkXjPI5mptYtX5CtVL2+qQmeLP3dyAUucY8svX9W/5eDzaCVRxhzfnehCvVtHI6h/uinKHIA+1tkQ2fWkaFEwB7aERh56bW7UlU1ajqsQZHuo/qxTtaBE4KYRZuMs+0S11gWW1VCpbHqI+z+IpkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741167271; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3W14MD7/86/g9aWL0OyKxo1c/Lcp0Ms013eqB7XEj1s=; b=YSDovaA2/+f2jETbhBuw5OKAZS0UT8527hP+p8ih+QXj/00n/2B6B50mIexDvXwBtivtY+yYO6jyG/agUOIDsGuEyKeFTDJKipmmuaUdLAlmb1rHTJkJPrr/ciK19BM4U97tbuKZ0WNWpF76rkf2g5EJ1N8N4l560/r51L1j7Zo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741167271228174.76148580026427; Wed, 5 Mar 2025 01:34:31 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.902050.1310007 (Exim 4.92) (envelope-from ) id 1tpl8p-0005E7-O0; Wed, 05 Mar 2025 09:34:15 +0000 Received: by outflank-mailman (output) from mailman id 902050.1310007; Wed, 05 Mar 2025 09:34:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpl8p-0005E0-Kv; Wed, 05 Mar 2025 09:34:15 +0000 Received: by outflank-mailman (input) for mailman id 902050; Wed, 05 Mar 2025 09:34:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknV-0006ew-9e for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:13 +0000 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [2a00:1450:4864:20::232]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id eae9feb7-f9a1-11ef-9898-31a8f345e629; Wed, 05 Mar 2025 10:12:09 +0100 (CET) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-30795988ebeso70455221fa.3 for ; Wed, 05 Mar 2025 01:12:09 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:08 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: eae9feb7-f9a1-11ef-9898-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165929; x=1741770729; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3W14MD7/86/g9aWL0OyKxo1c/Lcp0Ms013eqB7XEj1s=; b=Z3yWu9J4a+us/cE2M+nyFs/v8dcHXtvQP4niHtf1nC4Q85MHU+tSU3U7Zqb8j3f3WT U7ZNlYxs6G+S6yzjq33Y7/OJaXU6jKUWtDb+w+cZg+ux2P6bv1dkTDkFgAm+mViwQo/m TO1gNgOV+A6wdDMZrJt4tOyWtStsXy0j9YqPd46Rg41rzZ++EUgkBCVYA5ck54pOCB4L hbU1pGRilNR7o6f09B/G3MzMk34F1sXnO+fTkA7AIPJeeuImhMNL5HAi519hVeP0md92 slUxW7Ksc9NonMSrI7hxIfFlbmK/dMXYJApYNNQO71qu5jraC+rn7cKvOswqijKdkscZ jtww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165929; x=1741770729; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3W14MD7/86/g9aWL0OyKxo1c/Lcp0Ms013eqB7XEj1s=; b=gtvWRKrMX5aOnDpsNmwFhQsJopf5/flmH2rCmRm5noxSYQURXujxe4M+exXARZ+pOU phxXvwVQLqHoJ3k7hl4dDbI0gR4zH9qESov/cauDabYwEVni+/N/iuMvd90kvCuQicDB 2dyL1aH5lKtnvFgKkPj5SAjeUO5eKmOtRmgCGfs7//nZTm5aIXBliHWUuf/vd+5yadpp C4tk3JnOvTCcGPoxQxhumT/5h2JJF7w3UgiiAp5I5KHqW6+m2S9qnmjoYJd7ZOfAPQ1u hGnlQQPt6C4tJX9Izw6I31PC0O1SSesvYOEvyy2Ff0K0ozuqTO6nYuGtHs2k9SOQ7lBj mMdA== X-Gm-Message-State: AOJu0Yx6qAQa+vG5jyFNsHMjk3UKfheUp81Y4Y22gbutwg5ddHGmhh0V qkQJufnHcn05eB1Lrwnkln8FFEUPdWnysuyZTu0gVy/0ljRa40bx4shuRMfi X-Gm-Gg: ASbGncsLG8AEuedvg+P8CbkqW7tG9nyvDocwkCJSyVmEXWO70AwQOz9QmTBeazF7AYI UwA3dMmfduvejOuaPp8AoT7HnhFojyBbl8ue8gZJ+O69071LRehU2QyHXJeyrsxI54yzxXsTdfF mN4gg/OU3X8EI8FECACLA5UhttO5Aq+d8pcUGzWOMw7BzzpoaONL0yP7+Plo5gV1sd6bK64Kfp7 2Ud+2VBkU5O4+MKp6raL/haLI20lDaj5ENQJsSrnciatozyGB+6XWhc06vTEd08lxpftOnL3W2Q ndp80wlzjndbJu9AUKZZAidDzbBnr/VdBVKjwDPFZxqqCt1QGg== X-Google-Smtp-Source: AGHT+IHQsJOO4SuJsHrELM1lWwUKSgDLp7NtfJ0oyLHVNFhvpstCp9DJaI/6CvympNyJ+jpwD5UDHQ== X-Received: by 2002:a05:6512:3e06:b0:546:2f7a:38c4 with SMTP id 2adb3069b0e04-5497d335a4bmr910471e87.13.1741165928655; Wed, 05 Mar 2025 01:12:08 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Saeed Nowshadi , Mykyta Poturai , Mykola Kvach Subject: [PATCH 11/16] xen/arm: Implement PSCI system suspend Date: Wed, 5 Mar 2025 11:11:19 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741167272761019100 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic The implementation consists of: -Adding PSCI system suspend call as new PSCI function -Trapping PSCI system_suspend HVC -Implementing PSCI system suspend call (virtual interface that allows guests to suspend themselves), but currently it is only partially implemented, so suspend/resume will correctly work only for dom0 The PSCI system suspend should be called by a guest from its boot VCPU. Non-boot VCPUs of the guest should be hot-unplugged using PSCI CPU_OFF call prior to issuing PSCI system suspend. Interrupts that are left enabled by the guest are assumed to be its wake-up interrupts. Therefore, a wake-up interrupt triggers the resume of the guest. Guest should resume regardless of the state of Xen (suspended or not). When a guest calls PSCI system suspend the respective domain will be suspended if the following conditions are met: 1) Given resume entry point is not invalid 2) Other (if any) VCPUs of the calling guest are hot-unplugged If the conditions above are met the calling domain is labeled as suspended and the calling VCPU is blocked. If nothing else wouldn't be done the suspended domain would resume from the place where it called PSCI system suspend. This is expected if processing of the PSCI system suspend call fails. However, in the case of success the calling guest should resume (continue execution after the wake-up) from the entry point which is given as the first argument of the PSCI system suspend call. In addition to the entry point, the guest expects to start within the environment whose state matches the state after reset. This means that the guest should find reset register values, MMU disabled, etc. Thereby, the context of VCPU should be 'reset' (as if the system is comming out of reset), the program counter should contain entry point, which is 1st argument, and r0/x0 should contain context ID which is 2nd argument of PSCI system suspend call. The context of VCPU is set accordingly when the PSCI system suspend is processed, so that nothing needs to be done on resume/wake-up path. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- Changes in V3: Dropped all domain flags and related code (which touched common functions l= ike vcpu_unblock), keeping only the necessary changes for Xen suspend/resume, i= .e. suspend/resume is now fully supported only for the hardware domain. Proper support for domU suspend/resume will be added in a future patch. This patch does not yet include VCPU context reset or domain context restoration in VCPU. --- xen/arch/arm/Makefile | 1 + xen/arch/arm/include/asm/domain.h | 3 ++ xen/arch/arm/include/asm/perfc_defn.h | 1 + xen/arch/arm/include/asm/psci.h | 2 + xen/arch/arm/include/asm/suspend.h | 18 +++++++ xen/arch/arm/suspend.c | 67 +++++++++++++++++++++++++++ xen/arch/arm/vpsci.c | 32 +++++++++++++ 7 files changed, 124 insertions(+) create mode 100644 xen/arch/arm/include/asm/suspend.h create mode 100644 xen/arch/arm/suspend.c diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 43ab5e8f25..70d4b5daf8 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -53,6 +53,7 @@ obj-y +=3D smpboot.o obj-$(CONFIG_STATIC_EVTCHN) +=3D static-evtchn.init.o obj-$(CONFIG_STATIC_MEMORY) +=3D static-memory.init.o obj-$(CONFIG_STATIC_SHM) +=3D static-shmem.init.o +obj-$(CONFIG_SYSTEM_SUSPEND) +=3D suspend.o obj-y +=3D sysctl.o obj-y +=3D time.o obj-y +=3D traps.o diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/d= omain.h index 50b6a4b009..8b1bdf3d74 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -233,6 +233,9 @@ struct arch_vcpu struct vtimer virt_timer; bool vtimer_initialized; =20 + register_t suspend_ep; + register_t suspend_cid; + /* * The full P2M may require some cleaning (e.g when emulation * set/way). As the action can take a long time, it requires diff --git a/xen/arch/arm/include/asm/perfc_defn.h b/xen/arch/arm/include/a= sm/perfc_defn.h index 3ab0391175..5049563718 100644 --- a/xen/arch/arm/include/asm/perfc_defn.h +++ b/xen/arch/arm/include/asm/perfc_defn.h @@ -33,6 +33,7 @@ PERFCOUNTER(vpsci_system_reset, "vpsci: system_res= et") PERFCOUNTER(vpsci_cpu_suspend, "vpsci: cpu_suspend") PERFCOUNTER(vpsci_cpu_affinity_info, "vpsci: cpu_affinity_info") PERFCOUNTER(vpsci_features, "vpsci: features") +PERFCOUNTER(vpsci_system_suspend, "vpsci: system_suspend") =20 PERFCOUNTER(vcpu_kick, "vcpu: notify other vcpu") =20 diff --git a/xen/arch/arm/include/asm/psci.h b/xen/arch/arm/include/asm/psc= i.h index 4780972621..48a93e6b79 100644 --- a/xen/arch/arm/include/asm/psci.h +++ b/xen/arch/arm/include/asm/psci.h @@ -47,10 +47,12 @@ void call_psci_system_reset(void); #define PSCI_0_2_FN32_SYSTEM_OFF PSCI_0_2_FN32(8) #define PSCI_0_2_FN32_SYSTEM_RESET PSCI_0_2_FN32(9) #define PSCI_1_0_FN32_PSCI_FEATURES PSCI_0_2_FN32(10) +#define PSCI_1_0_FN32_SYSTEM_SUSPEND PSCI_0_2_FN32(14) =20 #define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) #define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) #define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) +#define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) =20 /* PSCI v0.2 affinity level state returned by AFFINITY_INFO */ #define PSCI_0_2_AFFINITY_LEVEL_ON 0 diff --git a/xen/arch/arm/include/asm/suspend.h b/xen/arch/arm/include/asm/= suspend.h new file mode 100644 index 0000000000..745377dbcf --- /dev/null +++ b/xen/arch/arm/include/asm/suspend.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_ARM_SUSPEND_H__ +#define __ASM_ARM_SUSPEND_H__ + +int32_t domain_suspend(register_t epoint, register_t cid); + +#endif + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c new file mode 100644 index 0000000000..27fab8c999 --- /dev/null +++ b/xen/arch/arm/suspend.c @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include +#include +#include + +static void vcpu_suspend_prepare(register_t epoint, register_t cid) +{ + struct vcpu *v =3D current; + + v->arch.suspend_ep =3D epoint; + v->arch.suspend_cid =3D cid; +} + +int32_t domain_suspend(register_t epoint, register_t cid) +{ + struct vcpu *v; + struct domain *d =3D current->domain; + bool is_thumb =3D epoint & 1; + + dprintk(XENLOG_DEBUG, + "Dom%d suspend: epoint=3D0x%"PRIregister", cid=3D0x%"PRIregist= er"\n", + d->domain_id, epoint, cid); + + /* THUMB set is not allowed with 64-bit domain */ + if ( is_64bit_domain(d) && is_thumb ) + return PSCI_INVALID_ADDRESS; + + /* TODO: care about locking here */ + /* Ensure that all CPUs other than the calling one are offline */ + for_each_vcpu ( d, v ) + { + if ( v !=3D current && is_vcpu_online(v) ) + return PSCI_DENIED; + } + + /* + * Prepare the calling VCPU for suspend (save entry point into pc and + * context ID into r0/x0 as specified by PSCI SYSTEM_SUSPEND) + */ + vcpu_suspend_prepare(epoint, cid); + + /* Disable watchdogs of this domain */ + watchdog_domain_suspend(d); + + /* + * The calling domain is suspended by blocking its last running VCPU. = If an + * event is pending the domain will resume right away (VCPU will not b= lock, + * but when scheduled in it will resume from the given entry point). + */ + vcpu_block_unless_event_pending(current); + + return PSCI_SUCCESS; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c index d1615be8a6..96eef06c18 100644 --- a/xen/arch/arm/vpsci.c +++ b/xen/arch/arm/vpsci.c @@ -7,6 +7,7 @@ #include #include #include +#include =20 #include =20 @@ -197,6 +198,15 @@ static void do_psci_0_2_system_reset(void) domain_shutdown(d,SHUTDOWN_reboot); } =20 +static int32_t do_psci_1_0_system_suspend(register_t epoint, register_t ci= d) +{ +#ifdef CONFIG_SYSTEM_SUSPEND + return domain_suspend(epoint, cid); +#else + return PSCI_NOT_SUPPORTED; +#endif +} + static int32_t do_psci_1_0_features(uint32_t psci_func_id) { /* /!\ Ordered by function ID and not name */ @@ -214,6 +224,8 @@ static int32_t do_psci_1_0_features(uint32_t psci_func_= id) case PSCI_0_2_FN32_SYSTEM_OFF: case PSCI_0_2_FN32_SYSTEM_RESET: case PSCI_1_0_FN32_PSCI_FEATURES: + case PSCI_1_0_FN32_SYSTEM_SUSPEND: + case PSCI_1_0_FN64_SYSTEM_SUSPEND: case ARM_SMCCC_VERSION_FID: return 0; default: @@ -344,6 +356,26 @@ bool do_vpsci_0_2_call(struct cpu_user_regs *regs, uin= t32_t fid) return true; } =20 + case PSCI_1_0_FN32_SYSTEM_SUSPEND: + case PSCI_1_0_FN64_SYSTEM_SUSPEND: + { + register_t epoint =3D PSCI_ARG(regs,1); + register_t cid =3D PSCI_ARG(regs,2); + register_t ret; + + perfc_incr(vpsci_system_suspend); + /* Set the result to PSCI_SUCCESS if the call fails. + * Otherwise preserve the context_id in x0. For now + * we don't support the case where the system is suspended + * to a shallower level and PSCI_SUCCESS is returned to the + * caller. + */ + ret =3D do_psci_1_0_system_suspend(epoint, cid); + if ( ret !=3D PSCI_SUCCESS ) + PSCI_SET_RESULT(regs, ret); + return true; + } + default: return false; } --=20 2.43.0 From nobody Sun Mar 9 21:40:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741166001; cv=none; d=zohomail.com; s=zohoarc; b=hq6sZEsDcBq3qEkWfufe3Uv+w2MAO6GiHwmav9MpPLcxn2jr3khBzsmAWprhnPRpGTxbUTEb/tBAuOrGOfpRvhXzrB0/BfzMF5lS1EXX4K82HFRU0W88JBeW3PskOstl43rzkCOYjRwwuY8gQZTkj6DhU1gULLRBfTjcyRisDvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741166001; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7vRDesRQb/Nxhcf66JbLCYMstts9xs0Oaigt+qqhPzM=; b=FZaOw8KZaJ9QR+dlg1l5cZr1ymSnaOmaO/BKYt0Fp41Gl9wz0tcmThuLLubAOZPZB/U0TKMrUQ8dq1DHGjiAjiA9QeiA+8hRynumTRUOUJAugkTOGUW8IH1fxt3AaMxW7VcX8ZAVKHXMwfMVkxqDn4S20txys1x+QGhk+W2J0G0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741166001558103.04660473337049; Wed, 5 Mar 2025 01:13:21 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901883.1309897 (Exim 4.92) (envelope-from ) id 1tpknW-0001Hu-4j; Wed, 05 Mar 2025 09:12:14 +0000 Received: by outflank-mailman (output) from mailman id 901883.1309897; Wed, 05 Mar 2025 09:12:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknV-0001Gw-S2; Wed, 05 Mar 2025 09:12:13 +0000 Received: by outflank-mailman (input) for mailman id 901883; Wed, 05 Mar 2025 09:12:12 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknT-0006ev-Sd for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:11 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ebabc915-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:12:11 +0100 (CET) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-549490e290dso5158117e87.2 for ; Wed, 05 Mar 2025 01:12:11 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:09 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ebabc915-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165930; x=1741770730; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7vRDesRQb/Nxhcf66JbLCYMstts9xs0Oaigt+qqhPzM=; b=ESjib+ijtuRtIkop52jBXTWP/vZdjuq1LbSSb1bzrDHb3gXFQvmlqL9guzkqGVBYzY kXmsuGEREScjkGdZzXQtstSaLfSTpsPPIOsaShYoB5cDsIJIejMfwPrSgTvjjenMQgxn okmqnTMvIJiDB30DhXA2ScJ1PFz/hWHT/NM8hsEvVIOnmL9yqzkfaiCv27IADyWiAxGX +4KVOspvBB5lgawJUJ86izoHwHQ9v6Rj2tOwI77qYT5H4sXwFUOXxfPRWRonq9ABPg38 pnDIJ8IdlOIMv4gntyNvcopOjaPJr2l3twfNzUI8Q35vlykHTvuRZRh0J86LON0mXj8R n7lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165930; x=1741770730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7vRDesRQb/Nxhcf66JbLCYMstts9xs0Oaigt+qqhPzM=; b=G1EdZXq4Gtqq0NaL8HczTcVS0TUT5RhtSeHQz6CVvXQtKpOyQAjDtK0DJtxGvxk5LT etGTEqjEBKwJ4q5q/aZj+qhGb6vdH75W8mBZ+Zyyrk1/lG3BvKK/YHHppGpQHks9RAEx Iy4thdXDOus/BxGEByueTs8y+uucdqMQdsHtD21vIx4RCbj864vsglzWoMI5MmjjkvWO m0rE/vLgpqcb+HlBFoKZUVn57A9Iz9tzjjpZd25JU47DZ7Caz90guGYtW4yE3M/yxmCA 0lq4gTcvliiQJZeeam3gIbOAXBBdjmbl/CMU7VBKi76Y21uZTa+ZrUO4Eh7+j4S5NztN 7MKg== X-Gm-Message-State: AOJu0Yzk+dHKtN38TaKQXyBCVoZgVGWaAJ9XKkvLJTSLEtfjhleQwocW PU2oFZBH7+MkkKY79r3SY/ZWqWr7UNZr5dbUAoCghrvnj6xQ5gRgML8Bi/oE X-Gm-Gg: ASbGncthnCbAeb7lEf/HqdFWt5PXIlfMzUobZJAjSbz1RkVV3Gb2skFwL646vvWNzDl S+L0nkGROS976xt8RpV30LBgpU7M3ZBRrwBsZsNVu6VPnYYWSsOt6UHIOzANGFOaYkaFHfA0DtH U59K6mR+hUuOM2g7+LcOa45AgwBqF0kaMlKFU2XC1IsQ/VykoFUzLp/PJZzYSM3m6A4Kpf1dAjL 1CauwSTKd5UO6xmLBhHTPE6jzZqDoAnvOLRYpdiyqJwqLAjr9JNapghFLF1tkU89n8a9oZ0BWVS bL1BYdNAn0oJu2Uhocp0Yn1gc8pC9n7ELD2yPImRfLV05PCTVA== X-Google-Smtp-Source: AGHT+IGgw7tZ/KupAA7aqLgKd7RgPJr1KdPD7ZGpud0YGWY6QTwxlrBZ7x7v9bHnysTCB2vsApcPRQ== X-Received: by 2002:a05:6512:3e1a:b0:545:1082:91a1 with SMTP id 2adb3069b0e04-5497d32f7bamr789411e87.7.1741165929631; Wed, 05 Mar 2025 01:12:09 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Saeed Nowshadi , Mykyta Poturai , Mykola Kvach Subject: [PATCH 12/16] xen/arm: Trigger Xen suspend when hardware domain completes suspend Date: Wed, 5 Mar 2025 11:11:20 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741166003594019100 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic When hardware domain finalizes its suspend procedure the suspend of Xen is triggered by calling system_suspend(). Hardware domain finalizes the suspend from its boot core (VCPU#0), which could be mapped to any physical CPU, i.e. the system_suspend() function could be executed by any physical CPU. Since Xen suspend procedure has to be run by the boot CPU (non-boot CPUs will be disabled at some point in suspend procedure), system_suspend() execution has to continue on CPU#0. When the system_suspend() returns 0, it means that the system was suspended and it is coming out of the resume procedure. Regardless of the system_suspend() return value, after this function returns Xen is fully functional, and its state, including all devices and data structures, matches the state prior to calling system_suspend(). The status is returned by system_suspend() for debugging/logging purposes and function prototype compatibility. This patch also introduces some state changes in peripherals and CPUs during suspend/resume. Specifically, it: - disable/enable non-boot physical CPUs, freeze/thaw domains; - suspend/resume the timer, GIC, console, IOMMU, and hardware domain. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- Changes introduced in V3: Merged changes from other commits into this one (stashed changes): - disabled/enabled non-boot physical CPUs and froze/thawed domains; - suspended/resumed the timer, GIC, console, IOMMU, and hardware domain. --- xen/arch/arm/suspend.c | 233 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c index 27fab8c999..fa81be5a4f 100644 --- a/xen/arch/arm/suspend.c +++ b/xen/arch/arm/suspend.c @@ -1,6 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 #include +#include +#include +#include #include #include #include @@ -8,6 +11,210 @@ #include #include =20 +/* Reset values of VCPU architecture specific registers */ +static void vcpu_arch_reset(struct vcpu *v) +{ + v->arch.ttbr0 =3D 0; + v->arch.ttbr1 =3D 0; + v->arch.ttbcr =3D 0; + + v->arch.csselr =3D 0; + v->arch.cpacr =3D 0; + v->arch.contextidr =3D 0; + v->arch.tpidr_el0 =3D 0; + v->arch.tpidrro_el0 =3D 0; + v->arch.tpidr_el1 =3D 0; + v->arch.vbar =3D 0; + v->arch.dacr =3D 0; + v->arch.par =3D 0; +#if defined(CONFIG_ARM_32) + v->arch.mair0 =3D 0; + v->arch.mair1 =3D 0; + v->arch.amair0 =3D 0; + v->arch.amair1 =3D 0; +#else + v->arch.mair =3D 0; + v->arch.amair =3D 0; +#endif + /* Fault Status */ +#if defined(CONFIG_ARM_32) + v->arch.dfar =3D 0; + v->arch.ifar =3D 0; + v->arch.dfsr =3D 0; +#elif defined(CONFIG_ARM_64) + v->arch.far =3D 0; + v->arch.esr =3D 0; +#endif + + v->arch.ifsr =3D 0; + v->arch.afsr0 =3D 0; + v->arch.afsr1 =3D 0; + +#ifdef CONFIG_ARM_32 + v->arch.joscr =3D 0; + v->arch.jmcr =3D 0; +#endif + + v->arch.teecr =3D 0; + v->arch.teehbr =3D 0; +} + +/* + * This function sets the context of current VCPU to the state which is ex= pected + * by the guest on resume. The expected VCPU state is: + * 1) pc to contain resume entry point (1st argument of PSCI SYSTEM_SUSPEN= D) + * 2) r0/x0 to contain context ID (2nd argument of PSCI SYSTEM_SUSPEND) + * 3) All other general purpose and system registers should have reset val= ues + */ +static void vcpu_resume(struct vcpu *v) +{ + + struct vcpu_guest_context ctxt; + + /* Make sure that VCPU guest regs are zeroed */ + memset(&ctxt, 0, sizeof(ctxt)); + + /* Set non-zero values to the registers prior to copying */ + ctxt.user_regs.pc64 =3D (u64)v->arch.suspend_ep; + + /* TODO: test changes on 32-bit domain */ + if ( is_32bit_domain(v->domain) ) + { + ctxt.user_regs.r0_usr =3D v->arch.suspend_cid; + ctxt.user_regs.cpsr =3D PSR_GUEST32_INIT; + + /* Thumb set is allowed only for 32-bit domain */ + if ( v->arch.suspend_ep & 1 ) + { + ctxt.user_regs.cpsr |=3D PSR_THUMB; + ctxt.user_regs.pc64 &=3D ~(u64)1; + } + } +#ifdef CONFIG_ARM_64 + else + { + ctxt.user_regs.x0 =3D v->arch.suspend_cid; + ctxt.user_regs.cpsr =3D PSR_GUEST64_INIT; + } +#endif + ctxt.sctlr =3D SCTLR_GUEST_INIT; + ctxt.flags =3D VGCF_online; + + /* Reset architecture specific registers */ + vcpu_arch_reset(v); + + /* Initialize VCPU registers */ + domain_lock(v->domain); + arch_set_info_guest(v, &ctxt); + domain_unlock(v->domain); + watchdog_domain_resume(v->domain); +} + +/* Xen suspend. Note: data is not used (suspend is the suspend to RAM) */ +static long system_suspend(void *data) +{ + int status; + unsigned long flags; + + BUG_ON(system_state !=3D SYS_STATE_active); + + system_state =3D SYS_STATE_suspend; + freeze_domains(); + + /* + * Non-boot CPUs have to be disabled on suspend and enabled on resume + * (hotplug-based mechanism). Disabling non-boot CPUs will lead to PSCI + * CPU_OFF to be called by each non-boot CPU. Depending on the underly= ing + * platform capabilities, this may lead to the physical powering down = of + * CPUs. Tested on Xilinx Zynq Ultrascale+ MPSoC (including power down= of + * each non-boot CPU). + */ + status =3D disable_nonboot_cpus(); + if ( status ) + { + system_state =3D SYS_STATE_resume; + goto resume_nonboot_cpus; + } + + time_suspend(); + + local_irq_save(flags); + status =3D gic_suspend(); + if ( status ) + { + system_state =3D SYS_STATE_resume; + goto resume_irqs; + } + + printk("Xen suspending...\n"); + console_start_sync(); + + status =3D console_suspend(); + if ( status ) + { + dprintk(XENLOG_ERR, "Failed to suspend the console, err=3D%d\n", s= tatus); + system_state =3D SYS_STATE_resume; + goto resume_console; + } + + status =3D iommu_suspend(); + if ( status ) + { + system_state =3D SYS_STATE_resume; + goto resume_console; + } + + /* + * Enable identity mapping before entering suspend to simplify + * the resume path + */ + update_boot_mapping(true); + + system_state =3D SYS_STATE_resume; + update_boot_mapping(false); + + iommu_resume(); + +resume_console: + console_resume(); + + gic_resume(); + +resume_irqs: + local_irq_restore(flags); + + time_resume(); + +resume_nonboot_cpus: + /* + * The rcu_barrier() has to be added to ensure that the per cpu area is + * freed before a non-boot CPU tries to initialize it (_free_percpu_ar= ea() + * has to be called before the init_percpu_area()). This scenario occu= rs + * when non-boot CPUs are hot-unplugged on suspend and hotplugged on r= esume. + */ + rcu_barrier(); + enable_nonboot_cpus(); + thaw_domains(); + system_state =3D SYS_STATE_active; + + /* + * The hardware domain owns most of the devices and may be part of the + * suspend/resume path. Since the hardware domain suspend is tied to + * the host suspend, it makes sense to resume it at the same time, + * i.e. after host resumes. + */ + vcpu_resume(hardware_domain->vcpu[0]); + /* + * The resume of hardware domain should always follow Xen's resume. + * This is done by unblocking the first vCPU of Dom0. + */ + vcpu_unblock(hardware_domain->vcpu[0]); + + printk("Resume (status %d)\n", status); + + return status; +} + static void vcpu_suspend_prepare(register_t epoint, register_t cid) { struct vcpu *v =3D current; @@ -21,6 +228,7 @@ int32_t domain_suspend(register_t epoint, register_t cid) struct vcpu *v; struct domain *d =3D current->domain; bool is_thumb =3D epoint & 1; + int status; =20 dprintk(XENLOG_DEBUG, "Dom%d suspend: epoint=3D0x%"PRIregister", cid=3D0x%"PRIregist= er"\n", @@ -54,6 +262,31 @@ int32_t domain_suspend(register_t epoint, register_t ci= d) */ vcpu_block_unless_event_pending(current); =20 + /* If this was dom0 the whole system should suspend: trigger Xen suspe= nd */ + if ( is_hardware_domain(d) ) + { + /* + * system_suspend should be called when Dom0 finalizes the suspend + * procedure from its boot core (VCPU#0). However, Dom0's VCPU#0 c= ould + * be mapped to any PCPU (this function could be executed by any P= CPU). + * The suspend procedure has to be finalized by the PCPU#0 (non-bo= ot + * PCPUs will be disabled during the suspend). + */ + status =3D continue_hypercall_on_cpu(0, system_suspend, NULL); + /* + * If an error happened, there is nothing that needs to be done he= re + * because the system_suspend always returns in fully functional s= tate + * no matter what the outcome of suspend procedure is. If the syst= em + * suspended successfully the function will return 0 after the res= ume. + * Otherwise, if an error is returned it means Xen did not suspend= ed, + * but it is still in the same state as if the system_suspend was = never + * called. We dump a debug message in case of an error for debuggi= ng/ + * logging purpose. + */ + if ( status ) + dprintk(XENLOG_ERR, "Failed to suspend, errno=3D%d\n", status); + } + return PSCI_SUCCESS; } =20 --=20 2.43.0 From nobody Sun Mar 9 21:40:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741167379; cv=none; d=zohomail.com; s=zohoarc; b=KzJBAIYY0EEFYKH4IMZm3Izdkwn8PYpnKi50nc+C0BoD8doEBB0NnC/uOClgL1+lij2hz9SRCHolEUQ9GRvaJ79Do9WUYtcPK3L9o0Lingk+veydom9py+R6z5NSLbcqRURtNSGi+aLCRrZjNkqPwxeozJay85ogz5itD3RQFlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741167379; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OXLlKW5nv40S06WQPFz6hgkP1NsQEMxuauOitke4PHE=; b=cJt0DYmLnrIDRRu3oddLmA5/GPXKgY6PTCG8wOg4b9MQ/cWakAT7viOj6R/gV2hOqA9gDWpOT286iWmSEBdFrSr6YMrCdRN9K+9j+0ghqYtZixurVCgslZjK68NCc+qcKEM09qfaqkzPYwTvtNg8Idh6SpDNDDjUwgR+N70/fac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741167379428840.7555023040303; Wed, 5 Mar 2025 01:36:19 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.902085.1310026 (Exim 4.92) (envelope-from ) id 1tplAU-0006as-8j; Wed, 05 Mar 2025 09:35:58 +0000 Received: by outflank-mailman (output) from mailman id 902085.1310026; Wed, 05 Mar 2025 09:35:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tplAU-0006aM-6F; Wed, 05 Mar 2025 09:35:58 +0000 Received: by outflank-mailman (input) for mailman id 902085; Wed, 05 Mar 2025 09:35:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknV-0006ev-T5 for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:13 +0000 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [2a00:1450:4864:20::132]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ec4b6969-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:12:12 +0100 (CET) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-549644ae382so3791337e87.1 for ; Wed, 05 Mar 2025 01:12:12 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:10 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ec4b6969-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165931; x=1741770731; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OXLlKW5nv40S06WQPFz6hgkP1NsQEMxuauOitke4PHE=; b=P3ER3n5Xori1TIRyYOY0eHzg3z5ah1DNS+Kg+6zvqc4CJTsgh1vyKOP+tibBAOyA3K lTZKM5q38/iSGOyUqLStl8YA+SHxCC1lujzG0OKbgbAU5iMo6rvYUCJ6nKeBOcC/Zacw RRsFFp6ZXF1LdR2yiW+B3Z9BpbsEIA3HflVaTvWy3gmmhuvkttxLGum66n2d93rC/UNL jAJmHbM2DpCYazOClxpUkati/ShIC4v8bDBA11VOqpnRg39upSuf9nJWPFpi5YL+tZ1F N4tKgWAP0CaU/Q2J2TUU0+Djpmmq0myd1oYDeowLaYTeO5tpgb32HFgpmA2qzFRNEoK2 XWXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165931; x=1741770731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OXLlKW5nv40S06WQPFz6hgkP1NsQEMxuauOitke4PHE=; b=KrkI5463sRgdiAIobGRhuavnRgbtkm/oOXw6vDZx02VjZmEZKwCYct2rR4ZChU8svS si9cIP5uEvci3RPiBAbt2S7nHjOSZ6VplEfWUuO3oD7CiEmJ73oZvtMAUIyBUtpnM/zw 0hDsI2cbhmKD6xR5HD5bsWLOb2H3tzzP1BpOJMTdDUrjE8spagFH19yxlZLXDsdASflR AbpZWOuzaUmKPc+9oQ3HyS2gG1JQ9ZkAoh+GZDkqe5zFotseNHJy8U0UcofgFS76ymGP Gb4dGbTjQQ4XcOCKZb385dQDhStiOVSr5VKiQBMX2ceB8D5d2qSEflqQhHngFhEbfl05 Pyyg== X-Gm-Message-State: AOJu0YyTtunychFjgry0/PzXxVFH49hPtnT9FgJAIk7UDvg8ZeJtK2bW IR7xh8/m/++5sI4tTUTFwX568G4KfcA+QfyLPaUGh1LYB2HwWTAwLWusbGMT X-Gm-Gg: ASbGncsz2LrjBSqOBQWDo/c+1sqomjrUkBCwsdcaIio+iIOUuN95hKEBtOgikAUx5h5 RiOQMESnbyncqyTMRVql1KW/lk170ox+DS3rlCjGiZ9KdTag+XLvq3csuBXK9z2/Mls6Kd1LdX7 HxU8GCwlPGAlJSj0OccdcHDQgVjKWtah3UMBVjVdJZfX+Hpc0ZYRki6+Uvi4EFINNnY6kRx8oFk 1c+hdOwHpwyQaOeN6mKCcAdfgson7aDbpl5YYLMwA5VLLs6xnJz+Jh8T2g7IMfHyjBZaSwcjIyU Zvpf6D1+n27tj5/UkIYaNhK2kNMIA1A+qBLjCCr05n6OOPXgoQ== X-Google-Smtp-Source: AGHT+IED2pTmgmlwYHsZ5O+krX5IHb1uPznDzqX7LlpSapMlugzkbIuCnCD0SHcp4PftUEdRub8uag== X-Received: by 2002:a05:6512:3d0e:b0:549:6759:3979 with SMTP id 2adb3069b0e04-5497d336a8dmr887121e87.18.1741165931284; Wed, 05 Mar 2025 01:12:11 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Saeed Nowshadi , Mykyta Poturai , Mykola Kvach Subject: [PATCH 13/16] xen/arm: Implement PSCI SYSTEM_SUSPEND call (physical interface) Date: Wed, 5 Mar 2025 11:11:21 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741167381037019100 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic PSCI system suspend function shall be invoked to finalize Xen suspend procedure. Resume entry point, which needs to be passed via 1st argument of PSCI system suspend call to the EL3, is hyp_resume. For now, hyp_resume is just a placeholder that will be implemented in assembly. Context ID, which is 2nd argument of system suspend PSCI call, is unused, as in Linux. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- Changes introduced in v3: - return PSCI_NOT_SUPPORTED instead of 1 for arm32 - add checking of PSCI version for psci suspend call --- xen/arch/arm/arm64/head.S | 8 ++++++++ xen/arch/arm/include/asm/psci.h | 1 + xen/arch/arm/include/asm/suspend.h | 1 + xen/arch/arm/psci.c | 19 +++++++++++++++++++ xen/arch/arm/suspend.c | 4 ++++ 5 files changed, 33 insertions(+) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 72c7b24498..3522c497c5 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -561,6 +561,14 @@ END(efi_xen_start) =20 #endif /* CONFIG_ARM_EFI */ =20 +#ifdef CONFIG_SYSTEM_SUSPEND + +FUNC(hyp_resume) + b . +END(hyp_resume) + +#endif /* CONFIG_SYSTEM_SUSPEND */ + /* * Local variables: * mode: ASM diff --git a/xen/arch/arm/include/asm/psci.h b/xen/arch/arm/include/asm/psc= i.h index 48a93e6b79..15eb2c6013 100644 --- a/xen/arch/arm/include/asm/psci.h +++ b/xen/arch/arm/include/asm/psci.h @@ -20,6 +20,7 @@ extern uint32_t psci_ver; =20 int psci_init(void); int call_psci_cpu_on(int cpu); +int call_psci_system_suspend(void); void call_psci_cpu_off(void); void call_psci_system_off(void); void call_psci_system_reset(void); diff --git a/xen/arch/arm/include/asm/suspend.h b/xen/arch/arm/include/asm/= suspend.h index 745377dbcf..0d2f0da0ad 100644 --- a/xen/arch/arm/include/asm/suspend.h +++ b/xen/arch/arm/include/asm/suspend.h @@ -4,6 +4,7 @@ #define __ASM_ARM_SUSPEND_H__ =20 int32_t domain_suspend(register_t epoint, register_t cid); +void hyp_resume(void); =20 #endif =20 diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c index b6860a7760..8e9c571467 100644 --- a/xen/arch/arm/psci.c +++ b/xen/arch/arm/psci.c @@ -17,6 +17,7 @@ #include #include #include +#include =20 /* * While a 64-bit OS can make calls with SMC32 calling conventions, for @@ -60,6 +61,24 @@ void call_psci_cpu_off(void) } } =20 +int call_psci_system_suspend(void) +{ +#ifdef CONFIG_SYSTEM_SUSPEND + struct arm_smccc_res res; + + if ( psci_ver < PSCI_VERSION(1, 0) ) + return PSCI_NOT_SUPPORTED; + + /* 2nd argument (context ID) is not used */ + arm_smccc_smc(PSCI_1_0_FN64_SYSTEM_SUSPEND, __pa(hyp_resume), &res); + + return PSCI_RET(res); +#else + /* not supported */ + return PSCI_NOT_SUPPORTED; +#endif +} + void call_psci_system_off(void) { if ( psci_ver > PSCI_VERSION(0, 1) ) diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c index fa81be5a4f..ac88faee2e 100644 --- a/xen/arch/arm/suspend.c +++ b/xen/arch/arm/suspend.c @@ -170,6 +170,10 @@ static long system_suspend(void *data) */ update_boot_mapping(true); =20 + status =3D call_psci_system_suspend(); + if ( status ) + dprintk(XENLOG_ERR, "PSCI system suspend failed, err=3D%d\n", stat= us); + system_state =3D SYS_STATE_resume; update_boot_mapping(false); =20 --=20 2.43.0 From nobody Sun Mar 9 21:40:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741167284; cv=none; d=zohomail.com; s=zohoarc; b=Q9e0sHzs1fxfBNwLfKr7iQbAFw+BEuATvQvd2n2N5hYcyTnwYFcFVZ7QIdlZRRByUcw6kERSC+zkDX+AhSQiVbrk8+vh3ANkVf5uM+e74rDCrIYLcufAHGQMlkNj7Xy4fidDwKdBMbnmcVM3f9Lv2l/qtnZp9fqKnvRyWkXUUD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741167284; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=l2TmN1BzAMOulOXirn8ZPb+RBDTzjlvF9BdHXNBPEhs=; b=AUZNKQ1bD+zkbDr7bOHCwV2eCIIV+gMVrK/OYlX9GqWFyor23kf1m2YZF4erYfpY4PbOAQZG5v/i/8HBb8rXCct/92J42Qo7G4z/qPWlRPh9XCZ7ndrRWgxm/v23qPjNnqf8CJGBvQdwq9OBEwIaA28SA9PlxmxHHirKoEWKC1g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741167284490671.8476252645066; Wed, 5 Mar 2025 01:34:44 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.902065.1310018 (Exim 4.92) (envelope-from ) id 1tpl9A-0005rR-1R; Wed, 05 Mar 2025 09:34:36 +0000 Received: by outflank-mailman (output) from mailman id 902065.1310018; Wed, 05 Mar 2025 09:34:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpl99-0005rE-Sp; Wed, 05 Mar 2025 09:34:35 +0000 Received: by outflank-mailman (input) for mailman id 902065; Wed, 05 Mar 2025 09:34:35 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknY-0006ew-AT for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:16 +0000 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [2a00:1450:4864:20::135]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ed12a1a3-f9a1-11ef-9898-31a8f345e629; Wed, 05 Mar 2025 10:12:13 +0100 (CET) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-5495078cd59so5447662e87.1 for ; Wed, 05 Mar 2025 01:12:13 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:11 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ed12a1a3-f9a1-11ef-9898-31a8f345e629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165933; x=1741770733; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l2TmN1BzAMOulOXirn8ZPb+RBDTzjlvF9BdHXNBPEhs=; b=Bw0Bbwab6Nn7l8N5/AbxGThhI/5BSttUFcUvamw6o4PnBw372zJl5q/Ftm8hJn+YkI qlNATeOw1iPmJUr0WSW6pf/7qmErGR6biBe/Hfi4pEdpPYiEf5CnANzqnplqlreu0J0x i+TnqxPIBM1q0wjSz4jVJ7tr8u5YmNeAXyqhlmkmkLArI2P5Oy0hPlhvNx5pw0bQIxtd jqNUSSsCTNzNSuaigon3wasGvoxnFaZISzvu+Z9sxD5e2G45JdYKhVzI4iXkMR413VLC sP7gBkAm0sDgE6JJgPALS/V41yzs8wSIcKC5pAJX+FpubSi8wtnLOBk6frgF/GJyrqYZ NIew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165933; x=1741770733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l2TmN1BzAMOulOXirn8ZPb+RBDTzjlvF9BdHXNBPEhs=; b=pM9lRNWYwiTjUEvQRMwcNeH+4KEsAFLLn8LfXp/rfPBRHZF+LYxaPwFGhooEbTWrnX tZf491sDelIDyVmyTZdeak5s+yihECIp1Ev1kb836Y5vMuIcUEsYBW82aLWgwil0kjFN Os41wtvafxQLKne9G43w5wO2NVSzmgPDvRNnDKawDkerbr9pykmOEKx1DC3gbpDzYE8Z rajgXddkER8N5pFz3hWaEyB2mF+f69VDcghf4ry8mKHc/okWOJuYfdat/Hm+b9fTXMiY WQiAsXRwO2FINIQjYglX+k8gQ4iQDsyD9Zo9xNVnneBRo2cySz9BWSukiBfAI0NTl2CA 2f8w== X-Gm-Message-State: AOJu0Yz33CXb2SDeUbcgN6Zw5n8zI0qlNyLyhog9ihw1SNsoc3ZjDN6l Ht1MBj8ODoBkaB7sXk8SA+0A60TOOFemussuOXLgUWGG6PQm+V/6E7BAJTFR X-Gm-Gg: ASbGncseUd71bNplJrfQnHYaVvrVh9PXYZyCeDDn5sZGIV5lvU3ltsa+chaW+cWSuJy cElU55U11K2/EWAVFbLtY641IM+WM7Jz/DVGU5R8r25/10ziocS3doffNC1zPazyX8ngspI3JQ0 hBH76d88mH4sPgtAOjBu+qlmNvSmmCKSzUpmmL95t0kxMqRQ1c89INOXd3/bjED5N9cnxGLSs+i +r3usU1YF/bSpWBIb+xNtmQ6S6V76/fmbJ6FSIO22FxwkRnHW3fZbFL402voW+TLzRnO+dwfTCu H3SoJbTA6VVpA9Qg1TkpiLqeICTr0mH/NREJXRBQ9TgrIlGAMQ== X-Google-Smtp-Source: AGHT+IEawaJ5thoARcmiuSdGY6fIkdNnAu5jE7n/R2L8GjsZ4boHnU4722Pq87bdX6owRtzPi9cjgA== X-Received: by 2002:a05:6512:3d90:b0:545:576:cbca with SMTP id 2adb3069b0e04-5497d3305b7mr807982e87.8.1741165932532; Wed, 05 Mar 2025 01:12:12 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Saeed Nowshadi , Mykyta Poturai , Mykola Kvach Subject: [PATCH 14/16] xen/arm: Resume memory management on Xen resume Date: Wed, 5 Mar 2025 11:11:22 +0200 Message-ID: <2ef15cb605f987eb087c5496d123c47c01cc0ae7.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741167286644019100 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic The MMU needs to be enabled in the resume flow before the context can be restored (we need to be able to access the context data by virtual address in order to restore it). The configuration of system registers prior to branching to the routine that sets up the page tables is copied from xen/arch/arm/arm64/head.S. After the MMU is enabled, the content of TTBR0_EL2 is changed to point to init_ttbr (page tables used at runtime). At boot the init_ttbr variable is updated when a secondary CPU is hotplugged. In the scenario where there is only one physical CPU in the system, the init_ttbr would not be initialized for the use in resume flow. To get the variable initialized in all scenarios in this patch we add that the boot CPU updates init_ttbr after it sets the page tables for runtime. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- Changes in V3: - updated commit message - instead of using create_page_tables, enable_mmu, and mmu_init_secondary_c= pu, the existing function enable_secondary_cpu_mm is now used - prepare_secondary_mm (previously init_secondary_pagetables in the previous patch series) is now called at the end of start_xen instead of setup_pagetables. Calling it in the previous location caused a crash - add early printk init during resume Changes in V2: - moved hyp_resume to head.S to place it near the rest of the start code - simplified the code in hyp_resume by using existing functions such as check_cpu_mode, cpu_init, create_page_tables, and enable_mmu --- xen/arch/arm/arm64/head.S | 23 +++++++++++++++++++++++ xen/arch/arm/setup.c | 8 ++++++++ 2 files changed, 31 insertions(+) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 3522c497c5..fab2812e54 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -564,6 +564,29 @@ END(efi_xen_start) #ifdef CONFIG_SYSTEM_SUSPEND =20 FUNC(hyp_resume) + msr DAIFSet, 0xf /* Disable all interrupts */ + + tlbi alle2 + dsb sy /* Ensure completion of TLB flush */ + isb + + ldr x0, =3Dstart + adr x19, start /* x19 :=3D paddr (start) */ + sub x20, x19, x0 /* x20 :=3D phys-offset */ + + /* Initialize the UART if earlyprintk has been enabled. */ +#ifdef CONFIG_EARLY_PRINTK + bl init_uart +#endif + PRINT_ID("- Xen resuming -\r\n") + + bl check_cpu_mode + bl cpu_init + + ldr lr, =3Dmmu_resumed + b enable_secondary_cpu_mm + +mmu_resumed: b . END(hyp_resume) =20 diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index ffcae900d7..3a89ac436b 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -508,6 +508,14 @@ void asmlinkage __init start_xen(unsigned long fdt_pad= dr) for_each_domain( d ) domain_unpause_by_systemcontroller(d); =20 +#ifdef CONFIG_SYSTEM_SUSPEND + /* + * It is called to initialize init_ttbr. + * Without this call, Xen gets stuck after resuming. + */ + prepare_secondary_mm(0); +#endif + /* Switch on to the dynamically allocated stack for the idle vcpu * since the static one we're running on is about to be freed. */ memcpy(idle_vcpu[0]->arch.cpu_info, get_cpu_info(), --=20 2.43.0 From nobody Sun Mar 9 21:40:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741167124; cv=none; d=zohomail.com; s=zohoarc; b=N2HbhlXshjqp+u9SCnvRkK+pSNl/VtItXLg9eLwYsmunf60nqYeC91l2551/Uxu+FN8/aLFAvtqH9ivIAr4VH1Q+24QpotpGGN22JP/GufMUSm5dzcRkKkOB2+gq6yw32XVGv0cBTTSK3YQMrxNTw4/50cgqu4ASUQaATZj0FTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741167124; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jMUxuA0p+11DhmKCRgLrkhcrfUHcDebAliUl05KMaQU=; b=iwLs3PugibcyQaW38Fxdn1+yYbei4uizLqCogrW+GNLPLLLreJdwjTtXn8J9leb/N1LBG32XP7ApMfd1klvxRAkX8yFLCx13VFI7x3mcgTHTqe4geVHPRFXh3NgpZV9xbDmPdzLyfYt9ZsqKeFooKaFMmVAQ8TI+u8h/NN0WyBc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741167124135593.3139491475475; Wed, 5 Mar 2025 01:32:04 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.901993.1309966 (Exim 4.92) (envelope-from ) id 1tpl6O-0002HC-J0; Wed, 05 Mar 2025 09:31:44 +0000 Received: by outflank-mailman (output) from mailman id 901993.1309966; Wed, 05 Mar 2025 09:31:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpl6O-0002H5-GM; Wed, 05 Mar 2025 09:31:44 +0000 Received: by outflank-mailman (input) for mailman id 901993; Wed, 05 Mar 2025 09:31:43 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknX-0006ev-TC for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:15 +0000 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [2a00:1450:4864:20::231]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id edb2acaf-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:12:14 +0100 (CET) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-307bc125e2eso72811531fa.3 for ; Wed, 05 Mar 2025 01:12:14 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:13 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: edb2acaf-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165934; x=1741770734; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jMUxuA0p+11DhmKCRgLrkhcrfUHcDebAliUl05KMaQU=; b=TXdyyusktPZRDqBC4ux8P8YgZEYrOa8xUDvmXwD1fLDpVh3OGUvqH0l+m+2nJqyAPa sZe2xFzWGIN1wk0wVx9H1qT2JlXcSWdEWdDBscgKJ6O4TnE4q08K9RGUkXugz89CmtCW 3m5m5eMCGkzMa1crNULJi0yMpH23PtNqC5y4C05GFNEjhKF+c6LjbhWpcgRM+adSMJmh SnPQE0nCdiFgnR0rL0IV1BAOcrWr/l36sk8a90KeCIdouM5asa1GpPzTIaUjvD80yFhi jfXiRwdgCS3W/tjlj8Ebl0r0zokHOAciRu71FATKTd3MAoK14zijJ4ijj+Vy+ljJ+vys yTVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165934; x=1741770734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jMUxuA0p+11DhmKCRgLrkhcrfUHcDebAliUl05KMaQU=; b=MLv6OrHdtoRWOZ66iiFTkBbnLTbDZIbrgqTDk2oNgXOgvlYrMj0Q9+6RIXMS4gfvTT fvyLVt8FAiXho9gtSsh14gRjkknhGLUnrsRwVy4pnXTCtbtb3fRY8borwCLGgbcoZCZ0 UopguvHnK885xnWoxv5713eLoGAEufY4hs2tWONOQHklYM2+4x9NK6f+XRK0QNSFbsOr 5cZge+w1JprDxDExFLiS2wwVeYCbq2F8aNt7Ljkrs1XiI7lf1uyOPnozLHkhNu3GIxqc ODQvIJAu5cQ4RlJ3UcJdczQeAdH6G9BWeJypeJLMwdEqWkPacVg6EwYPC6qedHWkrmUx G6TA== X-Gm-Message-State: AOJu0Yyz9MF+ZOsrMieFu0Uj0dkxHgWppgKGUcVyJVgHYqSfujT9xZ6Y FKIRa8HjYTVII4Ecv960uaPLsCrRkfJ4KZD5H6cn3DpVCcOEYgOHzBG73UYF X-Gm-Gg: ASbGncu8BdkvySvlz5rB2U2+nMVTFEuQTTTZldBlDlFtpjb/zXmP2uppURTAfAND9tZ v4d4ybaHOfp+zSeei+ZBNoKn/5nu8ADVMpQIcrL2/31H2UujDvgf2qZVReG+5uTGUnkDwDmRye+ yqHmBXoFAiYLKlDMhabjXsp/zrmLWJuS5SCjYxZREphh/eCdnap9V7+AuhYj6wXwOHQmj/PfTMG 8cs133UFDX/ahRk6W2j5LOx0zrwbCfSEfCHtPD0MVxS9T/a4mMTX4NrvlyyDGjf2FmSF0Whfhf5 +rp8403SmzqGTc8cutnsldO5anYppH6V06iR4y4p/twR02zJHw== X-Google-Smtp-Source: AGHT+IHb/F3dGwdiDc0xz14jw9QlV1aW1ohSHUl1Ftqtj20uvoGdOJV7UQWSLRrX+Ioc3/KL3aA6Sg== X-Received: by 2002:a05:6512:2308:b0:545:df9:5bb5 with SMTP id 2adb3069b0e04-5497d37e3c9mr829458e87.45.1741165933584; Wed, 05 Mar 2025 01:12:13 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mirela Simonovic , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Saeed Nowshadi , Mykyta Poturai , Mykola Kvach Subject: [PATCH 15/16] xen/arm: Save/restore context on suspend/resume Date: Wed, 5 Mar 2025 11:11:23 +0200 Message-ID: <8a3c38a9db28cfe6303ef150c269232f611c6371.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741167128440019100 Content-Type: text/plain; charset="utf-8" From: Mirela Simonovic The context of CPU general purpose and system control registers has to be saved on suspend and restored on resume. This is implemented in hyp_suspend and before the return from hyp_resume function. The hyp_suspend is invoked just before the PSCI system suspend call is issued to the ATF. The hyp_suspend has to return a non-zero value so that the calling 'if' statement evaluates to true, causing the system suspend to be invoked. Upon the resume, context saved on suspend will be restored, including the link register. Therefore, after restoring the context the control flow will return to the address pointed by the saved link register, which is the place from which the hyp_suspend was called. To ensure that the calling 'if' statement doesn't again evaluate to true and initiate system suspend, hyp_resume has to return a zero value after restoring the context. Note that the order of saving register context into cpu_context structure has to match the order of restoring. Since the suspend/resume is supported only for arm64, we define a null cpu_context structure so arm32 could compile. Signed-off-by: Mirela Simonovic Signed-off-by: Saeed Nowshadi Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach --- xen/arch/arm/arm64/head.S | 88 +++++++++++++++++++++++++++++- xen/arch/arm/include/asm/suspend.h | 22 ++++++++ xen/arch/arm/suspend.c | 22 +++++++- 3 files changed, 128 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index fab2812e54..c10eec751b 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -562,6 +562,52 @@ END(efi_xen_start) #endif /* CONFIG_ARM_EFI */ =20 #ifdef CONFIG_SYSTEM_SUSPEND +/* + * int32_t hyp_suspend(struct cpu_context *ptr) + * + * x0 - pointer to the storage where callee's context will be saved + * + * CPU context saved here will be restored on resume in hyp_resume functio= n. + * hyp_suspend shall return a non-zero value. Upon restoring context + * hyp_resume shall return value zero instead. From C code that invokes + * hyp_suspend, the return value is interpreted to determine whether the c= ontext + * is saved (hyp_suspend) or restored (hyp_resume). + */ +FUNC(hyp_suspend) + /* Store callee-saved registers */ + stp x19, x20, [x0], #16 + stp x21, x22, [x0], #16 + stp x23, x24, [x0], #16 + stp x25, x26, [x0], #16 + stp x27, x28, [x0], #16 + stp x29, lr, [x0], #16 + + /* Store stack-pointer */ + mov x2, sp + str x2, [x0], #8 + + /* Store system control registers */ + mrs x2, VBAR_EL2 + str x2, [x0], #8 + mrs x2, VTCR_EL2 + str x2, [x0], #8 + mrs x2, VTTBR_EL2 + str x2, [x0], #8 + mrs x2, TPIDR_EL2 + str x2, [x0], #8 + mrs x2, MDCR_EL2 + str x2, [x0], #8 + mrs x2, HSTR_EL2 + str x2, [x0], #8 + mrs x2, CPTR_EL2 + str x2, [x0], #8 + mrs x2, HCR_EL2 + str x2, [x0], #8 + + /* hyp_suspend must return a non-zero value */ + mov x0, #1 + ret +END(hyp_suspend) =20 FUNC(hyp_resume) msr DAIFSet, 0xf /* Disable all interrupts */ @@ -587,7 +633,47 @@ FUNC(hyp_resume) b enable_secondary_cpu_mm =20 mmu_resumed: - b . + /* Now we can access the cpu_context, so restore the context here = */ + ldr x0, =3Dcpu_context + + /* Restore callee-saved registers */ + ldp x19, x20, [x0], #16 + ldp x21, x22, [x0], #16 + ldp x23, x24, [x0], #16 + ldp x25, x26, [x0], #16 + ldp x27, x28, [x0], #16 + ldp x29, lr, [x0], #16 + + /* Restore stack pointer */ + ldr x2, [x0], #8 + mov sp, x2 + + /* Restore system control registers */ + ldr x2, [x0], #8 + msr VBAR_EL2, x2 + ldr x2, [x0], #8 + msr VTCR_EL2, x2 + ldr x2, [x0], #8 + msr VTTBR_EL2, x2 + ldr x2, [x0], #8 + msr TPIDR_EL2, x2 + ldr x2, [x0], #8 + msr MDCR_EL2, x2 + ldr x2, [x0], #8 + msr HSTR_EL2, x2 + ldr x2, [x0], #8 + msr CPTR_EL2, x2 + ldr x2, [x0], #8 + msr HCR_EL2, x2 + isb + + /* Since context is restored return from this function will appear= as + * return from hyp_suspend. To distinguish a return from hyp_suspe= nd + * which is called upon finalizing the suspend, as opposed to retu= rn + * from this function which executes on resume, we need to return = zero + * value here. */ + mov x0, #0 + ret END(hyp_resume) =20 #endif /* CONFIG_SYSTEM_SUSPEND */ diff --git a/xen/arch/arm/include/asm/suspend.h b/xen/arch/arm/include/asm/= suspend.h index 0d2f0da0ad..1d98acacc6 100644 --- a/xen/arch/arm/include/asm/suspend.h +++ b/xen/arch/arm/include/asm/suspend.h @@ -3,8 +3,30 @@ #ifndef __ASM_ARM_SUSPEND_H__ #define __ASM_ARM_SUSPEND_H__ =20 +#ifdef CONFIG_ARM_64 +struct cpu_context { + uint64_t callee_regs[12]; + uint64_t sp; + uint64_t vbar_el2; + uint64_t vtcr_el2; + uint64_t vttbr_el2; + uint64_t tpidr_el2; + uint64_t mdcr_el2; + uint64_t hstr_el2; + uint64_t cptr_el2; + uint64_t hcr_el2; +} __aligned(16); +#else +struct cpu_context { + uint8_t pad; +}; +#endif + +extern struct cpu_context cpu_context; + int32_t domain_suspend(register_t epoint, register_t cid); void hyp_resume(void); +int32_t hyp_suspend(struct cpu_context *ptr); =20 #endif =20 diff --git a/xen/arch/arm/suspend.c b/xen/arch/arm/suspend.c index ac88faee2e..72eeca3fdf 100644 --- a/xen/arch/arm/suspend.c +++ b/xen/arch/arm/suspend.c @@ -11,6 +11,8 @@ #include #include =20 +struct cpu_context cpu_context; + /* Reset values of VCPU architecture specific registers */ static void vcpu_arch_reset(struct vcpu *v) { @@ -170,9 +172,23 @@ static long system_suspend(void *data) */ update_boot_mapping(true); =20 - status =3D call_psci_system_suspend(); - if ( status ) - dprintk(XENLOG_ERR, "PSCI system suspend failed, err=3D%d\n", stat= us); + if ( hyp_suspend(&cpu_context) ) + { + status =3D call_psci_system_suspend(); + /* + * If suspend is finalized properly by above system suspend PSCI c= all, + * the code below in this 'if' branch will never execute. Execution + * will continue from hyp_resume which is the hypervisor's resume = point. + * In hyp_resume CPU context will be restored and since link-regis= ter is + * restored as well, it will appear to return from hyp_suspend. The + * difference in returning from hyp_suspend on system suspend vers= us + * resume is in function's return value: on suspend, the return va= lue is + * a non-zero value, on resume it is zero. That is why the control= flow + * will not re-enter this 'if' branch on resume. + */ + if ( status ) + dprintk(XENLOG_ERR, "PSCI system suspend failed, err=3D%d\n", = status); + } =20 system_state =3D SYS_STATE_resume; update_boot_mapping(false); --=20 2.43.0 From nobody Sun Mar 9 21:40:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1741167206; cv=none; d=zohomail.com; s=zohoarc; b=mjOV4efh4DHAwTbh+7AjZsqBh7vPdPaVKDrvaG4TUMUhzsL1hn1DdawGAAHZpPm0/nBi4h81iLVq9qgDTGDWygL0Yupfnf4q2e+hXmsLm6ARa6DSZtlhOQ3WY3ifhkWjJCMjS8CJE8AAjaC+2KLaY6naLduGFUn7dUINcU6fvs8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741167206; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Fom5vYEavsJUJ3+dko1FMXQbvv5VOQe0FeS8qUTVCQo=; b=aaC/mnigMrmz2BGD7ZTlG4UyJseXrBWlzukstyaWFDpODOVi0ZfJ1qrNhc0kz1U776RByvb7Kz89iEiMFV3KwlWF4ntq3sThaqaU6GLt6M53HNabDANfYKznRHdOLlU2XgbwVDuIJ0x1cBRM2AngC5TWqiswlB9XsXcIzYzLQ70= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1741167206484610.926487562801; Wed, 5 Mar 2025 01:33:26 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.902023.1309987 (Exim 4.92) (envelope-from ) id 1tpl7l-0003ep-5Q; Wed, 05 Mar 2025 09:33:09 +0000 Received: by outflank-mailman (output) from mailman id 902023.1309987; Wed, 05 Mar 2025 09:33:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpl7l-0003eh-1o; Wed, 05 Mar 2025 09:33:09 +0000 Received: by outflank-mailman (input) for mailman id 902023; Wed, 05 Mar 2025 09:33:07 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tpknY-0006ev-Tb for xen-devel@lists.xenproject.org; Wed, 05 Mar 2025 09:12:16 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id eeacb515-f9a1-11ef-9ab4-95dc52dad729; Wed, 05 Mar 2025 10:12:16 +0100 (CET) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5439a6179a7so700294e87.1 for ; Wed, 05 Mar 2025 01:12:16 -0800 (PST) Received: from EPUAKYIW02F7.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5495de028fasm1078264e87.139.2025.03.05.01.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 01:12:14 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: eeacb515-f9a1-11ef-9ab4-95dc52dad729 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741165935; x=1741770735; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fom5vYEavsJUJ3+dko1FMXQbvv5VOQe0FeS8qUTVCQo=; b=Sh52NujH+4bjdTb63VZmE/JZDhbR/oRl/O2m8n+bQDsstB99BdEuw7xygxVWw+QIyT /Y7RnRWdCOsM5mOBhX03rCaLpaHUhUghBrMyzBwUZ+nrlVlV3Qkm5nNkEZa08iCO6WA8 p42FhxDmgmf4HqrXq2EGwD2929S5U5umBnD1LCjhBvNtV9eMnsD62srSpgLYoIc1x51q oAOvGYOuHcHwiHp4PyqLUd690GngvnuNQ/iUAlHYwqg7nRca3r2BH7NPggc38IS2lTrd drIIw2P1Jc4kH6zgDZmq1gIqvyEbr0eDsDa9P3kWwOKUe6/WQoxMGEcRwfvrlxW2adC/ zGIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741165935; x=1741770735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fom5vYEavsJUJ3+dko1FMXQbvv5VOQe0FeS8qUTVCQo=; b=IrahyQJ7zUDhgfYGDoKa87wiLGAiiO3UCkDzkRKTMQAehqeOr+Es7dRxwVWGA4hBeQ bZuunBL0MDWkgxvKmi1FFE/h4Yc8FPYX/WWPvITF70Z+nCuVYVMF3E0z9+1gtmgXa5UI bqaedsbPc/SN4ahhMqdVZNHJ9mwB9ShjD92YTeNvppIMu210QKQxEbeqOv11MQEzFTp3 2W3Hy09gZOOYIYiVKBqhAqMLXxx3CQYUx/km1Nl1sbkNGPGFq9F806tVffsI1NJD+lVD CP4w45HFw265E9hlAgARe/BfK0gGWciM05BSMqW590ZtNxdx1KBEUmI8V+jpaXuim7W3 QWtA== X-Gm-Message-State: AOJu0YywYyskwB/39Ul/Ub3R39MB3ALxamgkY9xh1BR8KvGa7tdpzR1B WtR2myWDVoV6glG/q9ys7a8Ybffk0ZhaTzw9KtQ0ux/xuo8JvcuXpA5URwKG X-Gm-Gg: ASbGncsVsikaq7BwB5SfpbgGH7DyF2PDXhSBk7m4FbOrPF4BVmfqjvId95Rebkfd1Ak qja9PywQEZYgUs3y+/d4QFUiUCmPHwunnvyvxP96YgVLlwyGU3zoG6wZqLY0Uxv5XeEebQsBHAd gnkuDvxEUHKoXwFOJbNm60TLkZasgALha1aTmI20UXC3mh4+AQJtLIENKpdMElTp82J03AjM7cD /wHeGpPsukvbdw7oP6j435p+W4CVwMoEOnkqBwZSh4LJLnkzHFG/NVKdmCJFnjezUf/xuudrqk6 OlMwTM0odNTCjaCbKyLor9QJ9CRN9RJ4JF5U1POH9MEqz4Wr0Q== X-Google-Smtp-Source: AGHT+IFAc1Ams7sn+LNQEkTshCCOTQ5utdGiE0jtEvDhHC+tA+0o0e0N8ab613j4dEdZ1eOz5OZaUQ== X-Received: by 2002:a05:6512:31ca:b0:549:5769:6af6 with SMTP id 2adb3069b0e04-5497d36bb41mr847018e87.9.1741165934816; Wed, 05 Mar 2025 01:12:14 -0800 (PST) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Community Manager , Mykola Kvach Subject: [PATCH 16/16] CHANGELOG: Mention Xen suspend/resume to RAM feature on arm64 Date: Wed, 5 Mar 2025 11:11:24 +0200 Message-ID: <9706307f5349238240704c5edf2e708a5d93ddf5.1741164138.git.xakep.amatop@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1741167208391019100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mykola Kvach --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04c21d5bce..489404fc8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachan= gelog.com/en/1.0.0/) ## [4.21.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=3Dxen.git;= a=3Dshortlog;h=3Dstaging) - TBD =20 ### Changed + - On Arm: + - Support for suspend/resume to/from RAM on arm64 =20 ### Added =20 --=20 2.43.0