From nobody Thu Oct 06 08:16:43 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Mjkmr0kd7z4fJZP; Thu, 6 Oct 2022 08:16:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mjkmr05hgz3wV3; Thu, 6 Oct 2022 08:16:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665044204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aSWOkco/1adEfGPBNWRz+6mL6+0nVZ/nxlgt0Fsrst4=; b=T87xa1DchPHtU/dtnCMAyC5PbDNkiozJLz3sVd7yMC+DHHEZA1ImC+1+Ki1Kj70zRg8feS A4aQ9NLIpcFqbr7bRTxD/WcdDOrcrXrjwi9Rwz7rfLusD4WzW5RF4w3si1ZFgt0RnjUT8T XW6oBER+vb5V/XCnMcpMTB1YC84Dl/t1wfaqOiDRI0IxKth6WtOmfrxgBpWB4KgJW5/Boc oPnPT3F0eFPa+jdW2ZJiTuN8EOENYYN4l2MB9f+QFLIgyLeiN0z5FpEhVQTehacj89o1x4 2Nj9lC+wDP8d8qEkq73hPnm44V/SQMWsICVe66oF3tsDFuqVoeoeFU+III/6gg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Mjkmq68zrz19xR; Thu, 6 Oct 2022 08:16:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2968GhRO020169; Thu, 6 Oct 2022 08:16:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2968GhDP020168; Thu, 6 Oct 2022 08:16:43 GMT (envelope-from git) Date: Thu, 6 Oct 2022 08:16:43 GMT Message-Id: <202210060816.2968GhDP020168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 4cb3cb2de206 - main - LinuxKPI: Add pci_power querying for drm-kmod List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4cb3cb2de2065bccbab65b0139c1be65f1da3fdf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665044204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aSWOkco/1adEfGPBNWRz+6mL6+0nVZ/nxlgt0Fsrst4=; b=StdDJysv5CKPGo/EigoiswDlSmninF1m5vFNIWuyLrmaVEXds/3mdxQVyXR7V7OSF52kNf kHqE3iS944euesbcCsTLgzpCpVRGvM7ejlW8AVkUnWm+e2o1uJYcoj/I+Wjkt5CUP6HewV 8cCzmPF4yC28Q2m2tXy663erY4BXQ6Y/7AK7f9o06ELAfekZzU/3JZd4LafDnLWtlTN2uC 9K91IPY/unVgMnugkcMDaRyJPfDrgC6iF8Wdzttr/FVmxvTq3eN28Z9OjdWLuY9XA7+leb FC5vHI8H/4yHHpuvP38hocxA+9SP/jJzrZ4d2Jp1bcrDs9mIhOxkoqPrHaJ5sw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665044204; a=rsa-sha256; cv=none; b=N3VO4meEn9NoXHnz/3Vvb4tbwFJj/k1Bak9DXsbRJr4H8P/5uzldg/kDe/JHuAhJrfuA8s JvqfaSxdG+5+f17uVL6lNJvLtoMCmGnxANfunGhwmw0f+UZA1AJPJp4/l6MZzEdAnPtQ+v wQivDjJajNpNYzCJLmgW7F7UmGyu6ynFkwuAs+F5fzdI/m8RIsp6ABy5ccrHa13NaDh451 6ysFbbbEXvkATsLTxlkxgkjHc3pcSete9CtMdRHiSfiU9HIdwmJG4SibQejdQBvHoAUKmb jhQZOZYgPNF4nMArr1be2vaYhftA4yV8dSIAOmmL6QUiGsG+LiRCYaRTDeXxag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=4cb3cb2de2065bccbab65b0139c1be65f1da3fdf commit 4cb3cb2de2065bccbab65b0139c1be65f1da3fdf Author: Jake Freeland AuthorDate: 2022-10-06 08:15:41 +0000 Commit: Emmanuel Vadot CommitDate: 2022-10-06 08:15:41 +0000 LinuxKPI: Add pci_power querying for drm-kmod Adds a few struct members and a function to get i915_runtime_pm_status() to compile in drm-kmod. Differential Revision: https://reviews.freebsd.org/D36749 Sponsored by: Google, Inc. (GSoC 2022) --- sys/compat/linuxkpi/common/include/linux/device.h | 2 ++ sys/compat/linuxkpi/common/include/linux/pci.h | 14 ++++++++++++++ sys/compat/linuxkpi/common/include/linux/pm.h | 6 ++++++ sys/compat/linuxkpi/common/src/linux_pci.c | 4 ++++ 4 files changed, 26 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 32195ad5b0a6..f3e2c4697562 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -127,6 +127,8 @@ struct device { spinlock_t devres_lock; struct list_head devres_head; + + struct dev_pm_info power; }; extern struct device linux_root_device; diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 34076e0ff1d5..775bac72a145 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -202,6 +202,8 @@ typedef int pci_power_t; #define PCI_POWER_ERROR PCI_POWERSTATE_UNKNOWN +extern const char *pci_power_names[6]; + #define PCI_ERR_ROOT_COMMAND PCIR_AER_ROOTERR_CMD #define PCI_ERR_ROOT_ERR_SRC PCIR_AER_COR_SOURCE_ID @@ -288,6 +290,7 @@ struct pci_dev { struct pci_driver *pdrv; struct pci_bus *bus; struct pci_dev *root; + pci_power_t current_state; uint16_t device; uint16_t vendor; uint16_t subsystem_vendor; @@ -1576,6 +1579,17 @@ pci_ignore_hotplug(struct pci_dev *pdev) { } +static inline const char * +pci_power_name(pci_power_t state) +{ + int pstate = state + 1; + + if (pstate >= 0 && pstate < nitems(pci_power_names)) + return (pci_power_names[pstate]); + else + return (pci_power_names[0]); +} + static inline int pcie_get_readrq(struct pci_dev *dev) { diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h index d67cebb9764a..d054a95f17a3 100644 --- a/sys/compat/linuxkpi/common/include/linux/pm.h +++ b/sys/compat/linuxkpi/common/include/linux/pm.h @@ -33,6 +33,8 @@ #ifndef _LINUXKPI_LINUX_PM_H #define _LINUXKPI_LINUX_PM_H +#include + /* Needed but breaks linux_usb.c */ /* #include */ /* #include */ @@ -44,6 +46,10 @@ typedef struct pm_message { struct dev_pm_domain { }; +struct dev_pm_info { + atomic_t usage_count; +}; + #define PM_EVENT_FREEZE 0x0001 #define PM_EVENT_SUSPEND 0x0002 diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index aaa6d646f04d..aab4bfb6650d 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -117,6 +117,10 @@ static device_method_t pci_methods[] = { DEVMETHOD_END }; +const char *pci_power_names[] = { + "UNKNOWN", "D0", "D1", "D2", "D3hot", "D3cold" +}; + struct linux_dma_priv { uint64_t dma_mask; bus_dma_tag_t dmat;