Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp215022rwb; Fri, 2 Sep 2022 12:51:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ubxlOFWnlenbU0ZvNmSiiDD9eFwEvgTpBX0+Y+VBu0EB03Dfg+0Qu1IFJFaF2Ly8MSuR5 X-Received: by 2002:a17:907:1c27:b0:73d:ce49:6dd7 with SMTP id nc39-20020a1709071c2700b0073dce496dd7mr28251564ejc.470.1662148284978; Fri, 02 Sep 2022 12:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662148284; cv=none; d=google.com; s=arc-20160816; b=D5kkO0zp3NEv6l25s1pRTlmawfU3/3HIE3hVYxhggpw/tXIYDa7Dg/vi+U9wyMbkAg pq+ste/MqFfInraYy0wIZKIbIkDNc715HEvRbhceDBthqwO8m91wFAsC5sPUvxhHsnHa SDFAmSqhy1YSpnh/H+wjfHwmZNBg0I5iPse7ybSs2f5mKoE9nRowPt5fKtBbPxxASxHz cBW73DW5DR81APdfSL1/hJVfsmyO7QUMDXM1whLNIMXbklLS7vh/w7qILgiFj6qS7CPy 5JDbVWKPnVB2nqAQBiqq4k2C6CFjlMXI/1SW4zsFtLL9LnjtwfjRgyBehmdto0RTuRGG btTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=2ohTeF4+cvF8PKkr4lYOWbH1b2UayUkG4FJ3FZMJwY0=; b=w2tstfC5GC+kRHgZt8njfGQqk3M5yKOeia12dPK5ar2Rtb+69DbUxb4o1mbo8R6RqV Pnvhrdt+otEfnY1LMN6T3rGuQdUj0fWWJVCLT8Tr2h4r1oZ/lZRWd+FVJ4RZoJJPTKnx oBmNlJiKkOTnIIc2TPtECC9FGYJmmfcWdHd387GeHWZP7WrfkuAlvk0k1NwvTVbadfJw TWJI+7Bc6/bEWPmKmmoK0IVfV6HQPnYSgMemNfis3iiTlkGoxiRR7ZJmfPQlWh0BCDS5 0f36eP0n6ykeS8M2KmvEHXOpab7z/tB5MKaaV/whZalaLzedyZDcojbAI2rWAHC3mOXw 2q4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L2TSwXM7; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020a056402349100b0043b9617f589si2992831edc.209.2022.09.02.12.51.00; Fri, 02 Sep 2022 12:51:24 -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=@redhat.com header.s=mimecast20190719 header.b=L2TSwXM7; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230030AbiIBSnL (ORCPT + 99 others); Fri, 2 Sep 2022 14:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229980AbiIBSnJ (ORCPT ); Fri, 2 Sep 2022 14:43:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88E231144DB for ; Fri, 2 Sep 2022 11:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662144186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2ohTeF4+cvF8PKkr4lYOWbH1b2UayUkG4FJ3FZMJwY0=; b=L2TSwXM77c7FKmq1huyxY6eOoV8zZXw4z8d0wwZfCZktNUG6q81DYa59MGdzFbaqUdj1Bb 41wZJXxphclCn0vSTf6pCqg2iRxr0rV3EU5BqEAzezZVF00AmQJvSVEsT0jYwMjawR6neF mhtU1O8JIMCNbSMuwsqD0ZIifuJO4ug= Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-556-yj4AEEuyNgiv9v2QjluVZw-1; Fri, 02 Sep 2022 14:43:05 -0400 X-MC-Unique: yj4AEEuyNgiv9v2QjluVZw-1 Received: by mail-io1-f69.google.com with SMTP id b16-20020a5d8950000000b006891a850acfso1803094iot.19 for ; Fri, 02 Sep 2022 11:43:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date; bh=2ohTeF4+cvF8PKkr4lYOWbH1b2UayUkG4FJ3FZMJwY0=; b=R7eb/AHu6cSnuBbiC6hxzU6ztjWfPrhNKccrV5JSougYRwG8q7cA4T+JsXL6D6dnJZ fanUaS44IiSf0TcI+/6aD9yNGyutYfZfznth9MuOF6EEFenpTGAqN2SrdrJ8pDtaG/7X r8r8CHWN5mpItXSKVoZBZ8/cclaI4+juYyqtAGFMYK5yUCta0AwAoJEF/DOY0JKmpfgc yB+QLibKZTUaFdCOdEwVeQX4kdDOb7GE2wP4DNjVnXc6ZbKhordCemJbo/a9YklS+pMV 1fKqjjXLXtyWEeJMDxVMqYAcOme63tTUDrh9jsQvbnWjdK7Upq0Ijozo1KgDHekT6ytl qE6w== X-Gm-Message-State: ACgBeo3PDQ6P5oW1pi529qTypu9vUfZm1WlP5+LC8GXOa2kI7BFCASvp OAlu1lIsgPfdOJ54XSo2RvU6Fee1g71TZhSnkoGJ62cVl1qxwQvfRdEi797brAn8alxWGhmbOrr 5OekHqAq+sgNM2NFMU77+O0oL X-Received: by 2002:a5d:8b47:0:b0:689:a436:81d2 with SMTP id c7-20020a5d8b47000000b00689a43681d2mr17433527iot.138.1662144185062; Fri, 02 Sep 2022 11:43:05 -0700 (PDT) X-Received: by 2002:a5d:8b47:0:b0:689:a436:81d2 with SMTP id c7-20020a5d8b47000000b00689a43681d2mr17433520iot.138.1662144184825; Fri, 02 Sep 2022 11:43:04 -0700 (PDT) Received: from redhat.com ([38.15.36.239]) by smtp.gmail.com with ESMTPSA id x6-20020a056602160600b0067b7a057ee8sm1126680iow.25.2022.09.02.11.43.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 11:43:04 -0700 (PDT) Date: Fri, 2 Sep 2022 12:42:34 -0600 From: Alex Williamson To: Abhishek Sahu Cc: Cornelia Huck , Yishai Hadas , Jason Gunthorpe , Shameer Kolothum , Kevin Tian , "Rafael J . Wysocki" , Max Gurtovoy , Bjorn Helgaas , , , , Subject: Re: [PATCH v7 0/5] vfio/pci: power management changes Message-ID: <20220902124234.472737cd.alex.williamson@redhat.com> In-Reply-To: <20220829114850.4341-1-abhsahu@nvidia.com> References: <20220829114850.4341-1-abhsahu@nvidia.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 29 Aug 2022 17:18:45 +0530 Abhishek Sahu wrote: > This is part 2 for the vfio-pci driver power management support. > Part 1 of this patch series was related to adding D3cold support > when there is no user of the VFIO device and has already merged in the > mainline kernel. If we enable the runtime power management for > vfio-pci device in the guest OS, then the device is being runtime > suspended (for linux guest OS) and the PCI device will be put into > D3hot state (in function vfio_pm_config_write()). If the D3cold > state can be used instead of D3hot, then it will help in saving > maximum power. The D3cold state can't be possible with native > PCI PM. It requires interaction with platform firmware which is > system-specific. To go into low power states (Including D3cold), > the runtime PM framework can be used which internally interacts > with PCI and platform firmware and puts the device into the > lowest possible D-States. > > This patch series adds the support to engage runtime power management > initiated by the user. Since D3cold state can't be achieved by writing > PCI standard PM config registers, so new device features have been > added in DEVICE_FEATURE IOCTL for low power entry and exit related > handling. For the PCI device, this low power state will be D3cold > (if the platform supports the D3cold state). The hypervisors can implement > virtual ACPI methods to make the integration with guest OS. > For example, in guest Linux OS if PCI device ACPI node has > _PR3 and _PR0 power resources with _ON/_OFF method, then guest > Linux OS makes the _OFF call during D3cold transition and > then _ON during D0 transition. The hypervisor can tap these virtual > ACPI calls and then do the low power related IOCTL. > > The entry device feature has two variants. These two variants are mainly > to support the different behaviour for the low power entry. > If there is any access for the VFIO device on the host side, then the > device will be moved out of the low power state without the user's > guest driver involvement. Some devices (for example NVIDIA VGA or > 3D controller) require the user's guest driver involvement for > each low-power entry. In the first variant, the host can move the > device into low power without any guest driver involvement while > in the second variant, the host will send a notification to user > through eventfd and then user guest driver needs to move the device > into low power. The hypervisor can implement the virtual PME > support to notify the guest OS. Please refer > https://lore.kernel.org/lkml/20220701110814.7310-7-abhsahu@nvidia.com/ > where initially this virtual PME was implemented in the vfio-pci driver > itself, but later-on, it has been decided that hypervisor can implement > this. > > * Changes in v7 Applied to vfio next branch for v6.1. Thanks, Alex