From patchwork Mon May 20 17:09:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 245075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5D6592C00A2 for ; Tue, 21 May 2013 03:11:16 +1000 (EST) Received: from localhost ([::1]:37348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeTcA-0003Zc-Hc for incoming@patchwork.ozlabs.org; Mon, 20 May 2013 13:11:14 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeTb4-0002Lw-PZ for qemu-devel@nongnu.org; Mon, 20 May 2013 13:10:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UeTaw-0003rr-RN for qemu-devel@nongnu.org; Mon, 20 May 2013 13:10:06 -0400 Received: from mail-ie0-x230.google.com ([2607:f8b0:4001:c03::230]:63949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UeTaw-0003rb-Lc for qemu-devel@nongnu.org; Mon, 20 May 2013 13:09:58 -0400 Received: by mail-ie0-f176.google.com with SMTP id at1so13834662iec.7 for ; Mon, 20 May 2013 10:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding; bh=SBUuFoUoKEPNg20IY3uF/nRi4NHwcAZOk7YugmQ4Azs=; b=XWrFj9xD72lfs2uz05yAPMSPcJjijgcml94JqiyT7bIe9kCxCQCHm787j86WAombmz dN1UZ/Y8+eMflG84ZFOvXDjahc/8TP8NwzvUpgzW7sUnRpjTPOtHzr7/8qWg4lgaVqYT OWW7eUFvQiLXUjmbBVTNW2GdfdcDuweR398EOzj4KPd6xWcHTJEbAHHuVmDCEG3tQ/SC ZWXOYGbVF1APuIzFxqEbvkTge/NltGn38PnWZ/T0cOaYEFECqVxeicNRkTqWJ8DSbMhX ZXWwEvL3uayja3pAfklIFv0u/9RJEAPnc1SOunOVpjBUhiO8QDI+JS6hNszkGruyFidi NxCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:subject:to:from:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=SBUuFoUoKEPNg20IY3uF/nRi4NHwcAZOk7YugmQ4Azs=; b=dVSp9ke6l/ob2fTgu4fYT9Uux1qIDsmOuxrAnQV5jIbRSkzWkC+oGFTi9BJNMaIjVp GNjCujZO+ZM7BI3ejTGaaXAgKdLTSVVOY4cab15r7HWgbGnpK8JCXhGzQpkCDJTk1067 SlalEjWys74vDwuKL1IG4HTzlTkko+yfjp9KAEB/IuUmm/yMxNCW15/sUm8og0yaAnG9 krqWpQ7WffiJxP1/rnQ3EjVug2niodzfxJyofuTuL6PJ4dHs6KDlDsfcJedxN0fvof04 23k/dxsJ5k8yxB+eSOod/UW0qX5SSYMIlxF+jpxbHbTnAH7q2I+oxewzRp3CutC7avKH EznQ== X-Received: by 10.50.117.42 with SMTP id kb10mr5891635igb.78.1369069798247; Mon, 20 May 2013 10:09:58 -0700 (PDT) Received: from localhost ([172.29.122.152]) by mx.google.com with ESMTPSA id ji5sm2850489igb.0.2013.05.20.10.09.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 20 May 2013 10:09:57 -0700 (PDT) To: "Michael S. Tsirkin" From: Bjorn Helgaas Date: Mon, 20 May 2013 11:09:56 -0600 Message-ID: <20130520170956.29259.87841.stgit@bhelgaas-glaptop> In-Reply-To: <20130520170949.29259.99889.stgit@bhelgaas-glaptop> References: <20130520170949.29259.99889.stgit@bhelgaas-glaptop> User-Agent: StGit/0.16 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQl1aWQrjKWeU5norla350Cf6B1LL3K+Rkr8S8w5eRGsLoJBNGEvL+MRxNJqDN7qirJl5wXH60/SSE5xaX82S0Z+BU9flF+lbLotuBl08GPG+kNLk0j7vY54BmrDteYNny5EwbCEyr27SAli3DtcpDay9e3LHX1ELOBs0xOotbhLqxXx5NqhECeuY+zvIMucwvjlX+U2 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c03::230 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/2] pcie: Add more ASPM support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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 54fcac8..f194445 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_ASPM_L0S | + PCI_EXP_LNKCAP_ASPM_L0S | PCI_EXP_LNKCAP_ASPM_L1 | 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_ASPMC); + 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 109f2f4..5b81b36 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 @@ -40,9 +40,12 @@ /* PCI_EXP_LINKCAP */ #define PCI_EXP_LNKCAP_ASPM_L0S 0x00000400 /* L0s supported */ +#define PCI_EXP_LNKCAP_ASPM_L1 0x00000800 /* L1 supported */ #define PCI_EXP_LNKCAP_PN_SHIFT (ffs(PCI_EXP_LNKCAP_PN) - 1) +#define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */ + #define PCI_EXP_SLTCAP_PSN_SHIFT (ffs(PCI_EXP_SLTCAP_PSN) - 1) #define PCI_EXP_SLTCTL_IND_RESERVED 0x0