Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1649189iog; Thu, 16 Jun 2022 10:37:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1saa49R77yzNz7Qr8xiDOxZhNv6yzcUUezJPuTInKhx9VDxyfNS5V9vGBBP9YpiXIxzu8pJ X-Received: by 2002:a17:906:14d5:b0:711:c55a:998 with SMTP id y21-20020a17090614d500b00711c55a0998mr5468004ejc.708.1655401065918; Thu, 16 Jun 2022 10:37:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655401065; cv=pass; d=google.com; s=arc-20160816; b=nrbsfT7UVQpKPEeWLmfbksSjVbnGCZJDWONqoTtpMSHB1E0o9afKHLHvBDqcM/yv3K Xwu06WbyQcXIXvjlQ02+G/LOWMeqrXw6ovO0v3Ye2kJhtTutgnyTjNHJCFqzgWs5va21 hzyJgNalWYlaHHuOQM1KLiZBwGrDz0IbMzUKoV/F/smRd+w+37kIjkJN98VF7OhMFb6k bufLiRYvpUt8OCkAZHzgJzViqzciam8B/OmwmUe9TpKwnGFcDq1eh3OPuU2/kepnO2tx QzT82J23W9ytPiZIchq/pUkfrjg2HHDQeQLvjiRfoouYoP9PKbqwZwM64lufCPl9BgCD 5kvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=624zNFanFXZLwD9Y7k5Su5NEQKeVxbGF0MfpFYCC2ME=; b=DnVyiZWbFAVIMA6Rjj+HmQJFmNl46OSyQDPps88bxWGG5Bk1Pf7tugg7LmgH0N3izX Fssm5RR61pmN/EnJRtWuKB88C8O1Gev05ksfy3o1E9psXGyrXeFnKZFn8FGlbQjDLQdq +PGoocLuuJSrCPt72eNZwdBSin7IhzhcQ4hl2Fx/v/ZiQVRhCDjo8GUqw9HAn1WvLxhR ckpiaGmxRlfcLq1PJz7X+Ieiwnd6W/yjwqAXHZ05OwOtg93NJ1wR23qfHlLqo3zXqwSh fgG7bGSycltXeTnJhIV+Jm2xI73O/qY9hB5KihYhtpuu0CBlQWfSjTPBNAVQRK7JeHfo eWCw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=btKK+X15; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e2-20020a170906748200b00718e483c586si2404737ejl.201.2022.06.16.10.37.19; Thu, 16 Jun 2022 10:37:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=btKK+X15; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243975AbiFPQ6y (ORCPT + 99 others); Thu, 16 Jun 2022 12:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345057AbiFPQ6u (ORCPT ); Thu, 16 Jun 2022 12:58:50 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2082.outbound.protection.outlook.com [40.107.223.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F9073B546; Thu, 16 Jun 2022 09:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dTEM4LG1UVjbFQQO0ekctctr1sQg6AgpO6WwWJjyRGXyXLHooFWz7VxQsn5Y/3P3iefgNMgoPjuD6RxcnPrBzBOUWFj9IVuWOFaXYDKmoHS9yMfCMriJttdr6iZF0NFdqV/R6OgrEfuvHEQu2ZrJ+cIfXzwbz0COGeZTKf9nFCSxq5gD6cKX/wrqMDgVLXmJtNbYg4aDsLel8eCwSOw5imCFX/CgnFTsX/59x/uEMdKaMyYDPQb4wOkC1x+doDC8fo2kyH5QIBd5P3lYvsayrazL1qpok85Xt7CqknxSujdjNLnGBLcMGWFNTO6iF6iv2MQRdJpmltozb/+qBdRL2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=624zNFanFXZLwD9Y7k5Su5NEQKeVxbGF0MfpFYCC2ME=; b=hfeuqz9MEP/JM3mtUI8hd1j/o8FcQc3a1hGPFsGMcXfaA+PVci2WXzEPn5K2kKmMMNlvaw+cHEbTutBdDep0PoPtXDwFOz35OQojRTg5B3zg7HmCL84hAg4W5feZDdBvLgxgj9+uuYCgGkvIutL3hQF+Wi51vfikiAKafv8c7DWS9QIVixmAS8UZ6bd/VHAssOUnrZ6E2+cm19PXCtwwoSwuRYAw2WvDBDDQ4901tiejcHXsxnOka1J8Z1Jkd6hDKsN7Xjs3jY8MT7Og7i7g1yIVg3IannRtmotQb5NAvqFweUOjESyfRuCKGV5doSszVXyowMOLTryqJFmAY1P1RQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=624zNFanFXZLwD9Y7k5Su5NEQKeVxbGF0MfpFYCC2ME=; b=btKK+X15UMCF8SboDKgIfmMFI6nuwanX9V0NI+uz1h1H4e2c19YJWTC93UEu89kAFVzqI0OZpPxQpNQpzOeyuKH0BPv4DtJ63oSUa816XizkAn2cyDnRuB68XVVZNOStGoYP8ep2AAuY4Aj9ZdlEgVKeB1Slli0sk2Y80q92RPs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MN0PR12MB6101.namprd12.prod.outlook.com (2603:10b6:208:3cb::10) by BN7PR12MB2658.namprd12.prod.outlook.com (2603:10b6:408:25::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Thu, 16 Jun 2022 16:58:47 +0000 Received: from MN0PR12MB6101.namprd12.prod.outlook.com ([fe80::3839:4183:6783:b1d1]) by MN0PR12MB6101.namprd12.prod.outlook.com ([fe80::3839:4183:6783:b1d1%6]) with mapi id 15.20.5332.022; Thu, 16 Jun 2022 16:58:47 +0000 Message-ID: <2201fe5f-5bd8-baaf-aad5-eaaea2f1e20e@amd.com> Date: Thu, 16 Jun 2022 11:58:42 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 1/2] x86: notify hypervisor about guest entering s2idle state Content-Language: en-US To: Sean Christopherson , Grzegorz Jaszczyk Cc: linux-kernel@vger.kernel.org, Dmytro Maluka , Zide Chen , Peter Fang , Tomasz Nowicki , Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Ashish Kalra , Hans de Goede , Sachi King , Arnaldo Carvalho de Melo , David Dunn , Wei Wang , Nicholas Piggin , "open list:KERNEL VIRTUAL MACHINE (KVM)" , "open list:DOCUMENTATION" , "open list:ACPI" , "open list:HIBERNATION (aka Software Suspend, aka swsusp)" , Dominik Behr , Dmitry Torokhov References: <20220609110337.1238762-1-jaz@semihalf.com> <20220609110337.1238762-2-jaz@semihalf.com> From: "Limonciello, Mario" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: CH2PR19CA0025.namprd19.prod.outlook.com (2603:10b6:610:4d::35) To MN0PR12MB6101.namprd12.prod.outlook.com (2603:10b6:208:3cb::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6139956b-efd3-4cc0-a2bf-08da4fb97a7d X-MS-TrafficTypeDiagnostic: BN7PR12MB2658:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i+BiIN1RVpBeeHY2oLMX2nqh9IezcdoMYbBm/ihThdF/puY4DOrFdDdYkRTZ8b3v51ED9IlYYRyZcegV8W8zEh3YevZlzK4Eviq4ssVk+gquxUdRRVcfVu1bfsiQE4GmNrfZTW5I7mdekkYnv3reegCJqKqQ6V90tcMq2SsgOfsRrzLjjcDIckTECXtB9dgugZVVgmn+fbHk1vSYMsMwLboqYriowCm71BZ5JQrHYDhoA+5r0ldvDe1d3XyLyRmkuR9BAi2+c8pUc3PWfF6t04n9c95jK9/FFkeWZYOvk/c9sYGCdPDu2WcW3Eixqav3EP1efNuF1xn66L2KXrdh+YlESy7ygJHCirSx+rFKVh27UCnGGZbQAPK0q0W0PADWVitAJy4nOpzzZLxAAJqHP8ppD+u7EcJ9jDsvAqYOjO6e3odJBgNq0F5FbS/nIV7NAzfoiJRJHGwHPt13mUwe3tYUh77JCfV8ZsbQzN9b3eTXDkkh7FpMmE3wOMuYM0A1x4telgSLjLJdduUmQXsHRZcKSAGo0vPIgG5j74eygyoAU3WsFLaZ7bz13hQ5iw9qJU+VYidElhnIfedL02Temriy0Z/pIsooHExEbN2IC7vm4ZNqw9nyLJk/nLv6Kfyvz4pDr/eUhkNwMpcC27Urs4GCEkPolkiwxIHmuokItznawoBrPwTrCPhMVd9fAZk/qOVfTjBXYima6uzOKNjIU9liUJqO7apCpVM2JkEj2dFICEl1JP9K+wr9AOGjS8PG X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR12MB6101.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(366004)(31686004)(86362001)(36756003)(8676002)(4326008)(8936002)(7406005)(5660300002)(6486002)(508600001)(66476007)(7416002)(66946007)(110136005)(316002)(2906002)(54906003)(6506007)(2616005)(66556008)(26005)(186003)(31696002)(6666004)(53546011)(45080400002)(38100700002)(83380400001)(6512007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?OUtaVStqWUZiWnVScEdUZ0M5VTVsdXVGbWJVb3NoZFE0aHdLUkM3S1p1dDMy?= =?utf-8?B?SGZlY3kzQ3VQeXhpMm1oWlMvOWJ1bXVsdU9PaFpWa3ozTFN2WS9JV01EV296?= =?utf-8?B?N0JBcUF0YmJ4WVEwWGI2ejhFZWtnVSs0R2U1WEJNZTJCVUxodFdadkJyaUVI?= =?utf-8?B?MEV2bW4raDc3NGh0YWI4SmNKV0RySGhNWGR5eE9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NlpCYUVLaDhxTHRMUTJDcDJjRkxsbzAxaWNLN1FUdFc3S2RLS2dT?= =?utf-8?B?RzFrWEQ0YUlRY3FGY21lN2pyeFFibDZ5aDErU0hMTGJzazhRcVpDd1JlSExa?= =?utf-8?B?ZU51ZVcrRFZYYjJvc25GQ3hhNkU3Nkd4TndYZ0c2bjZPMUU0QUtJMVp5YXpR?= =?utf-8?B?VUpVSC9UZjA0WC9CTW0xQWxOQ2NoNnMrQXFlTDlNVFZ6WkVFdldnSWVaSkZO?= =?utf-8?B?V2dQN29HSlJpeHRQaHgvS0ZFTzJ4czBVZ2VqY3dFQkduUzFzUndBTElZZDI4?= =?utf-8?B?blNFZlFUekZCMEdGNWFLb0VKajFjK3ZlRUJFOEQ0S1hubHhSTDhBUT09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6139956b-efd3-4cc0-a2bf-08da4fb97a7d X-MS-Exchange-CrossTenant-AuthSource: MN0PR12MB6101.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 16:58:47.0663 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QtcuqTw/NwZ3oiii0IDakCnRrfgCf0EtiLjkjcnqWSHVJUPRMJJAAqMaQ615ajVx2npsdVPo2SvBX/tYYhoMoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2658 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/16/2022 11:48, Sean Christopherson wrote: > On Wed, Jun 15, 2022, Grzegorz Jaszczyk wrote: >> pt., 10 cze 2022 o 16:30 Sean Christopherson napisaƂ(a): >>> MMIO or PIO for the actual exit, there's nothing special about hypercalls. As for >>> enumerating to the guest that it should do something, why not add a new ACPI_LPS0_* >>> function? E.g. something like >>> >>> static void s2idle_hypervisor_notify(void) >>> { >>> if (lps0_dsm_func_mask > 0) >>> acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT_HYPERVISOR_NOTIFY >>> lps0_dsm_func_mask, lps0_dsm_guid); >>> } >> >> Great, thank you for your suggestion! I will try this approach and >> come back. Since this will be the main change in the next version, >> will it be ok for you to add Suggested-by: Sean Christopherson >> tag? > > If you want, but there's certainly no need to do so. But I assume you or someone > at Intel will need to get formal approval for adding another ACPI LPS0 function? > I.e. isn't there work to be done outside of the kernel before any patches can be > merged? There are 3 different LPS0 GUIDs in use. An Intel one, an AMD (legacy) one, and a Microsoft one. They all have their own specs, and so if this was to be added I think all 3 need to be updated. As this is Linux specific hypervisor behavior, I don't know you would be able to convince Microsoft to update theirs' either. How about using s2idle_devops? There is a prepare() call and a restore() call that is set for each handler. The only consumer of this ATM I'm aware of is the amd-pmc driver, but it's done like a notification chain so that a bunch of drivers can hook in if they need to. Then you can have this notification path and the associated ACPI device it calls out to be it's own driver.