From patchwork Wed Jun 1 08:23:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Fleytman X-Patchwork-Id: 9146365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 74E6B60761 for ; Wed, 1 Jun 2016 08:29:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 641582040D for ; Wed, 1 Jun 2016 08:29:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58DA325819; Wed, 1 Jun 2016 08:29:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D86762040D for ; Wed, 1 Jun 2016 08:29:58 +0000 (UTC) Received: from localhost ([::1]:40856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81XJ-0005Xx-Fp for patchwork-qemu-devel@patchwork.kernel.org; Wed, 01 Jun 2016 04:29:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81Re-0000hw-Pt for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:24:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b81Rc-000097-NW for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:24:05 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33952) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b81Rc-00008s-H8 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 04:24:04 -0400 Received: by mail-wm0-x242.google.com with SMTP id n184so3888056wmn.1 for ; Wed, 01 Jun 2016 01:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4WEU8KuAZG5j0imYDnZ1CUc1w23Fw31OMnneFS4cDhY=; b=gDXE+MYGkJlYfzFSeDgtSgMOaHpFtxrRGZGIJeRRYjJz40aLwmKEMx5nBpy244vXIa E/brEJc+aDfbBOkFuRrruM92P9hnojTCqghMYawv1EUoVij3GUZa08ImBorFEJTiAlX7 NAeq44izIEBE+LF+ihZAm8aoBPmvPYiyYodPu53u6sEqBqF3OHE7ImGJpasmE+IppKso HMYqJuB/a0Pd3ss3TJx4ep0/h394xASxiOcUw961XdTywugH3ZPiKMwGl4z7aDbD9XvQ QfEv/jl9bU83U6FAALxjdX5r83HLCILLsiwtsY6ov7/GEywsKm7YvpnIiCi9mOMWu1xm pQXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4WEU8KuAZG5j0imYDnZ1CUc1w23Fw31OMnneFS4cDhY=; b=HwFseIvL5DDBsaz3pDczsEZ/QtvXbt3F5Ctc3ogvRdOkG1OHmlXMH+7lcBe1atdDwv Zu7YkTQH6JNHxst9HDJ3GGx+G7cab0N5Fo1aeP2MPD0a9oN3uOBX+HjbArSYacrSl8w2 8t0XjXun/y9Dv7p0KWQ0wH0P+70Nm56tqbw0Kz9BDp3NDA5G8YCPXVHNJQiMyVR/CaWB NaQ5Qdq0XjAw0CtwXL/VuyjRLRwXK2BkWLjy7RcpNx9+RmjGQhoG8jDIkGBZOoSnGhWE QYAUB9F04/8n/8FfptrltsE6cfEeHPobzdfT1ypc735oyTANNfq8uI69fhxhitAgFAQh EnBg== X-Gm-Message-State: ALyK8tLS9OjfJv/aXb4jiN6i0ERb+roMRpO4rKPMkv1zgVfo2QINsWiW62ZUW/IjJ/HkTQ== X-Received: by 10.28.60.215 with SMTP id j206mr20564425wma.82.1464769443920; Wed, 01 Jun 2016 01:24:03 -0700 (PDT) Received: from bark.daynix ([5.102.236.99]) by smtp.gmail.com with ESMTPSA id o10sm29242719wjz.37.2016.06.01.01.24.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2016 01:24:03 -0700 (PDT) From: Dmitry Fleytman To: qemu-devel@nongnu.org Date: Wed, 1 Jun 2016 11:23:34 +0300 Message-Id: <1464769426-22276-6-git-send-email-dmitry@daynix.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464769426-22276-1-git-send-email-dmitry@daynix.com> References: <1464769426-22276-1-git-send-email-dmitry@daynix.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v8 05/17] pcie: Introduce function for DSN capability creation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yan Vugenfirer , Jason Wang , Leonid Bloch , Shmulik Ladkani , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Dmitry Fleytman Signed-off-by: Dmitry Fleytman Signed-off-by: Leonid Bloch Reviewed-by: Michael S. Tsirkin --- hw/pci/pcie.c | 10 ++++++++++ include/hw/pci/pcie.h | 1 + 2 files changed, 11 insertions(+) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 24cfc3b..9599fde 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -695,3 +695,13 @@ void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn) offset, PCI_ARI_SIZEOF); pci_set_long(dev->config + offset + PCI_ARI_CAP, (nextfn & 0xff) << 8); } + +void pcie_dev_ser_num_init(PCIDevice *dev, uint16_t offset, uint64_t ser_num) +{ + static const int pci_dsn_ver = 1; + static const int pci_dsn_cap = 4; + + pcie_add_capability(dev, PCI_EXT_CAP_ID_DSN, pci_dsn_ver, offset, + PCI_EXT_CAP_DSN_SIZEOF); + pci_set_quad(dev->config + offset + pci_dsn_cap, ser_num); +} diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index cbbf0c5..056d25e 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -119,6 +119,7 @@ void pcie_add_capability(PCIDevice *dev, uint16_t offset, uint16_t size); void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn); +void pcie_dev_ser_num_init(PCIDevice *dev, uint16_t offset, uint64_t ser_num); extern const VMStateDescription vmstate_pcie_device;