Received: from eggs.gnu.org ([208.118.235.92]:41807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UckG6-0001s2-Vb for qemu-devel@nongnu.org; Wed, 15 May 2013 18:33:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UckFz-0004ud-89 for qemu-devel@nongnu.org; Wed, 15 May 2013 18:33:18 -0400 Received: from mail-ia0-x232.google.com ([2607:f8b0:4001:c02::232]:58767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UckFz-0004sH-2O for qemu-devel@nongnu.org; Wed, 15 May 2013 18:33:11 -0400 Received: by mail-ia0-f178.google.com with SMTP id i9so2656961iad.23 for ; Wed, 15 May 2013 15:33:10 -0700 (PDT) From: Bjorn Helgaas Date: Wed, 15 May 2013 16:33:08 -0600 Message-ID: <20130515223308.11335.86381.stgit@bhelgaas-glaptop> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] pcie: Add more ASPM support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org Indicate ASPM L0s and L1 support in Link Capabilities and make the ASPM bits in Link Control writable. These Link Control bits don't do anything in qemu, but having them writable means the BIOS or OS can write them as on real hardware. Signed-off-by: Bjorn Helgaas --- hw/pci/pcie.c | 4 +++- include/hw/pci/pcie_regs.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 62bd0b8..7336054 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -73,13 +73,15 @@ int pcie_cap_init(PCIDevice *dev, uint8_t offset, uint8_t type, uint8_t port) pci_set_long(exp_cap + PCI_EXP_LNKCAP, (port << PCI_EXP_LNKCAP_PN_SHIFT) | - PCI_EXP_LNKCAP_ASPMS_0S | + PCI_EXP_LNKCAP_ASPMS_0S | PCI_EXP_LNKCAP_ASPMS_1 | PCI_EXP_LNK_MLW_1 | PCI_EXP_LNK_LS_25); pci_set_word(exp_cap + PCI_EXP_LNKSTA, PCI_EXP_LNK_MLW_1 | PCI_EXP_LNK_LS_25); + pci_set_word(dev->wmask + pos + PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_ASPM); + pci_set_long(exp_cap + PCI_EXP_DEVCAP2, PCI_EXP_DEVCAP2_EFF | PCI_EXP_DEVCAP2_EETLPP); diff --git a/include/hw/pci/pcie_regs.h b/include/hw/pci/pcie_regs.h index 4d123d9..6b80a8d 100644 --- a/include/hw/pci/pcie_regs.h +++ b/include/hw/pci/pcie_regs.h @@ -31,7 +31,7 @@ #define PCI_EXP_FLAGS_TYPE_SHIFT (ffs(PCI_EXP_FLAGS_TYPE) - 1) -/* PCI_EXP_LINK{CAP, STA} */ +/* PCI_EXP_LINK{CAP, STA, CTL} */ /* link speed */ #define PCI_EXP_LNK_LS_25 1 @@ -41,9 +41,12 @@ /* PCI_EXP_LINKCAP */ #define PCI_EXP_LNKCAP_ASPMS_SHIFT (ffs(PCI_EXP_LNKCAP_ASPMS) - 1) #define PCI_EXP_LNKCAP_ASPMS_0S (1 << PCI_EXP_LNKCAP_ASPMS_SHIFT) +#define PCI_EXP_LNKCAP_ASPMS_1 (2 << PCI_EXP_LNKCAP_ASPMS_SHIFT) #define PCI_EXP_LNKCAP_PN_SHIFT (ffs(PCI_EXP_LNKCAP_PN) - 1) +#define PCI_EXP_LNKCTL_ASPM 0x0003 + #define PCI_EXP_SLTCAP_PSN_SHIFT (ffs(PCI_EXP_SLTCAP_PSN) - 1) #define PCI_EXP_SLTCTL_IND_RESERVED 0x0