From patchwork Mon Jan 18 17:35:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 8056711 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BD2FA9F440 for ; Mon, 18 Jan 2016 17:42:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F48A2045A for ; Mon, 18 Jan 2016 17:42:27 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 45CB720498 for ; Mon, 18 Jan 2016 17:42:26 +0000 (UTC) Received: from localhost ([::1]:32924 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLDov-0003o8-MQ for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Jan 2016 12:42:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLDjT-0002TN-2D for qemu-devel@nongnu.org; Mon, 18 Jan 2016 12:36:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLDjS-0004Mm-3X for qemu-devel@nongnu.org; Mon, 18 Jan 2016 12:36:47 -0500 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:35576) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLDjR-0004Mb-TZ for qemu-devel@nongnu.org; Mon, 18 Jan 2016 12:36:46 -0500 Received: by mail-wm0-x22e.google.com with SMTP id r129so60472630wmr.0 for ; Mon, 18 Jan 2016 09:36:45 -0800 (PST) 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=wqf7zjrwN2Vm5CN/Qe1pXw4i80ufiVSUFJOCoFzuh7U=; b=e/5O0iU7Qx8R+wMxTklOPHj4t1faX6iTZ5ET1BkCIw1oL2IX4r0B8Qx+H+9H0xdKWI t/EqC+YbGtvaW/m7De7qtFSqqQt1QQTdVBMOOLJzGk5qdYa2zz7hGr09Zq0xKguv3zrC DNGmY8QOTTmJY82V8NT4FUdU4QSQjm52/XBzkL0SSht7waPsZs4L1Inf1+tgZnGhGRqb ibEJ4nRWCKG6dKxg7D4nl4VioBI6Y1eDQtp5/Gls1go2TeQ/oYqlJRyBCZmqUD+HSnD8 31jV1kFlF513Lc8GAv6aE8OYC227JaeFR6uUTYZD82C51Ij0vbx3pr9VFXVLDtDfdQGY XnxQ== 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=wqf7zjrwN2Vm5CN/Qe1pXw4i80ufiVSUFJOCoFzuh7U=; b=RPyI9j7QxAhbHJBqpzTsk83eNTn80Yn+53lAh+0EDgKM4/dOG+KI+STirEQ3Miq+Kv tzHnOeIstjY2x/ywDfrGS23eXmwK+6/PMewsmiT60brI3/PYbEw8PfcV6jT9fExn953R +NCdHXDqyipUoBQr+GN9cY7j7UDZpHcoSEvFu3EYGzXaBKxK6ffgp7AErYH+apqiCO/p tD79TEt4PWovSdYGsiWYTwgtp+hIrIvo3cUTBVoRLzLmFDNfy5eSq0uvmCRzVZ/vvF3f nRRWavj4asp2pvTYCKbVFml8qtcRxliIjCmGBqvRK5goGgplkJ7nCyh1nsFWosHK2VpN WI0A== X-Gm-Message-State: ALoCoQlBhl1SidDszgK/rpd8f9kv620eGd/Qti+TQNj3jeTEJYnjyCQz8Xy+q10NnvdnbXPGcWwI+qrvMUyeWRTEBqHfAPlxyw== X-Received: by 10.194.88.130 with SMTP id bg2mr25226466wjb.162.1453138605259; Mon, 18 Jan 2016 09:36:45 -0800 (PST) Received: from bark.daynix ([5.102.236.99]) by smtp.gmail.com with ESMTPSA id 75sm16736952wmo.22.2016.01.18.09.36.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jan 2016 09:36:43 -0800 (PST) From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 18 Jan 2016 19:35:44 +0200 Message-Id: <1453138550-1096-5-git-send-email-leonid.bloch@ravellosystems.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1453138550-1096-1-git-send-email-leonid.bloch@ravellosystems.com> References: <1453138550-1096-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::22e Cc: Dmitry Fleytman , Jason Wang , Leonid Bloch , Shmulik Ladkani , "Michael S. Tsirkin" Subject: [Qemu-devel] [RFC PATCH v2 04/10] pcie: Introduce function for DSN capability creation 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dmitry Fleytman Signed-off-by: Dmitry Fleytman Signed-off-by: Leonid Bloch --- hw/pci/pcie.c | 7 +++++++ include/hw/pci/pci_regs.h | 3 +++ include/hw/pci/pcie.h | 1 + include/hw/pci/pcie_regs.h | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 7b8ff24..6d55f8f 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -678,3 +678,10 @@ 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_dsn_init(PCIDevice *dev, uint16_t offset, uint64_t val) +{ + pcie_add_capability(dev, PCI_EXT_CAP_ID_DSN, PCI_DSN_VER, + offset, PCI_DSN_SIZEOF); + pci_set_quad(dev->config + offset + PCI_DSN_CAP, val); +} diff --git a/include/hw/pci/pci_regs.h b/include/hw/pci/pci_regs.h index 2bd3ac9..4a0cc67 100644 --- a/include/hw/pci/pci_regs.h +++ b/include/hw/pci/pci_regs.h @@ -657,6 +657,9 @@ #define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ #define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ +/* Device serial number */ +#define PCI_DSN_CAP 0x04 /* Device Serial Number Register */ + /* Address Translation Service */ #define PCI_ATS_CAP 0x04 /* ATS Capability Register */ #define PCI_ATS_CAP_QDEP(x) ((x) & 0x1f) /* Invalidate Queue Depth */ diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index cbbf0c5..83a325c 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_dsn_init(PCIDevice *dev, uint16_t offset, uint64_t val); extern const VMStateDescription vmstate_pcie_device; diff --git a/include/hw/pci/pcie_regs.h b/include/hw/pci/pcie_regs.h index e3c969e..d06acd1 100644 --- a/include/hw/pci/pcie_regs.h +++ b/include/hw/pci/pcie_regs.h @@ -80,6 +80,10 @@ #define PCI_ARI_VER 1 #define PCI_ARI_SIZEOF 8 +/* DSN */ +#define PCI_DSN_VER 1 +#define PCI_DSN_SIZEOF 8 + /* AER */ #define PCI_ERR_VER 2 #define PCI_ERR_SIZEOF 0x48