From patchwork Mon May 30 09:14:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 9140779 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 DBE4960759 for ; Mon, 30 May 2016 09:29:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB8932819E for ; Mon, 30 May 2016 09:29:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C06E528210; Mon, 30 May 2016 09:29:15 +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 38BC82819E for ; Mon, 30 May 2016 09:29:15 +0000 (UTC) Received: from localhost ([::1]:58817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7JVZ-0006nr-Pu for patchwork-qemu-devel@patchwork.kernel.org; Mon, 30 May 2016 05:29:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45883) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7JLS-0004qW-Ci for qemu-devel@nongnu.org; Mon, 30 May 2016 05:18:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7JLQ-0008Nb-D8 for qemu-devel@nongnu.org; Mon, 30 May 2016 05:18:45 -0400 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:37165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7JLP-0008NQ-Oi for qemu-devel@nongnu.org; Mon, 30 May 2016 05:18:44 -0400 Received: by mail-wm0-x235.google.com with SMTP id z87so63545799wmh.0 for ; Mon, 30 May 2016 02:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravellosystems-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tPhQaCfxbc1NJj12bK8y7y9OsDSsKPvLa4GAN4E1mZU=; b=UGqhfHr7smo+UYO4+UGMqJ/5h7izaX2+Gax9EP+JVVO46xR7pYGC/IeKxaDLmBOxAX Yj712OsJVjJ66bErxk0Yz0O/LLadPFlqBofDcHE4Kx0Pl1Rf/RoUfII+3Bm8/u6kkxKd JOeje86g6m7xBcElT8UftngjvEUucdku8pvLvMSVMZrtv36y1o/jWvENVcYzjHuFI6ux 2l/QIcVKBtchrX0MYIc8xBFDHY/2mcLHmVuuUehe8Ty/MndqLXNNmLIzS9IfaYLNXyGP llH8vECwatED2PR84HL1eYS+px1Lrp7YM3yDCzmmleiYYmOpTLC1YWs0VIbabLT3Xw2X d/XQ== 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=tPhQaCfxbc1NJj12bK8y7y9OsDSsKPvLa4GAN4E1mZU=; b=MVjZx9SOYVxQiF51GPjzI1cKRtU0L1PmrvHWQnUum8GRXhwphp2Q35j6oxMtfkHYHX hcP8T7f0kmh3B7/5fU2WAmfzSbOXk3go5HRAISdH/QnW+u0IjhDlJxej9raauIn5nBFH vCjIuz1RM5uifCI9M7YQSrpQuylm7NzOTcHt4c4izoDlFO5ens56P93wr/yKrgYjvzHo fTzvd2g5T21F4Ziy1C5La2FX+iPo9WRl9EjljSH5It8QbGFBILcV5jiIyg8beJBjVuN/ bXiy5xEYZ8CaPd7thznZcEnB9edEu52Z5V7dgXH+kRs83SgSFXSgN/WRmZcT9AJKmdpg RicA== X-Gm-Message-State: ALyK8tJJV2N4+DV53obhumul/Lgx4tAQ+hn+XxLoen0B9ktdXJJgASMsP9sviAb4j+jW5lPH X-Received: by 10.28.216.208 with SMTP id p199mr9546758wmg.57.1464599923163; Mon, 30 May 2016 02:18:43 -0700 (PDT) Received: from bark.daynix ([5.102.236.99]) by smtp.gmail.com with ESMTPSA id k127sm22753850wmf.21.2016.05.30.02.18.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 May 2016 02:18:42 -0700 (PDT) From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 30 May 2016 12:14:30 +0300 Message-Id: <1464599682-14592-6-git-send-email-leonid.bloch@ravellosystems.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464599682-14592-1-git-send-email-leonid.bloch@ravellosystems.com> References: <1464599682-14592-1-git-send-email-leonid.bloch@ravellosystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::235 Subject: [Qemu-devel] [PATCH v6 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: Dmitry Fleytman , 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 --- 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;