From patchwork Tue Aug 9 20:27:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Kiarie X-Patchwork-Id: 9272153 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 4707A60231 for ; Tue, 9 Aug 2016 20:28:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48A6028389 for ; Tue, 9 Aug 2016 20:28:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D33C283E5; Tue, 9 Aug 2016 20:28:14 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 D314D28389 for ; Tue, 9 Aug 2016 20:28:13 +0000 (UTC) Received: from localhost ([::1]:37926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXDdD-0005Bv-EZ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Aug 2016 16:28:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXDcs-00059o-Vg for qemu-devel@nongnu.org; Tue, 09 Aug 2016 16:27:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXDcq-0004Dj-Tn for qemu-devel@nongnu.org; Tue, 09 Aug 2016 16:27:49 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXDcq-0004DY-Mj for qemu-devel@nongnu.org; Tue, 09 Aug 2016 16:27:48 -0400 Received: by mail-wm0-x242.google.com with SMTP id i138so5477709wmf.3 for ; Tue, 09 Aug 2016 13:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y3O40tLc/7e78wXXfxwqYtABK1BQaSjia39wydvJ4/4=; b=zDtREqtpKHuD8gX50BG06FcYdDTFY8CvUMbHcWLYEiYkqFjNX1Kbroc7rowGXd8Zye 6gwm7lPqggg5i1M9IHdBiT25/0q0srAFsK21BnwSwiQ4xQ5xrOP7FdmGdbbgyV+RGGLT Zd9riOhc47w4TZEUZ9WLB3o4hNNLxDbWzm0CHARpZmaWA6d9sjTRKhkKL7eB3sQj490Y 1g0UguSiSd/1XeZWdMhiIzvY+XgwRl5JK5Y3AGgvSqubuhm6IZvnbIlWYtjxIa8jssJ3 nRPjZdtQ4nplNDaLpPKIjKLqIcD8zzgNOt2WbM/ByUhhngTIwk189mH8XcfcQ0noZcnx rl3Q== 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=y3O40tLc/7e78wXXfxwqYtABK1BQaSjia39wydvJ4/4=; b=SCZIkNBUjmWiK1BN0ox9KmFxjn6WC+2ZrAEI0O07oPUllbAIIX02Rpy1pZgbKamw8H epXbornE15YqWB3csxA9NPtrekvwoxJQaFqpDCn6JAP2HBChFKKSwK6DbFZenG4vbXsy Znj+YMY2mBUMtYP1lheiVy9lr1WnrkrltQn0k8u7hzL5btUB5aHhOdnUtA+/sSvsNHbz YIqE7KcwaBtaH+55bvm9rIQ9nvO2ufBSf6ZIPJi/j8YI7LkqRlWE7GoiXKn2rAEYatWq 5nrs2l87u4/IxqJ34eVvl7WqIdkaCxIC9dPpwvTp7tR8DIfqwjYwdp01LV981H+9535h pjJA== X-Gm-Message-State: AEkoous28NtxIKDzK2F6TgUADyx9fFXQ//rwSAZvL4WB63GHS+VUWCKDDhzfTIg5kiqiNQ== X-Received: by 10.28.22.70 with SMTP id 67mr25138366wmw.52.1470774467861; Tue, 09 Aug 2016 13:27:47 -0700 (PDT) Received: from debian.flybox.orange ([154.123.18.5]) by smtp.googlemail.com with ESMTPSA id al10sm39606630wjc.12.2016.08.09.13.27.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Aug 2016 13:27:47 -0700 (PDT) From: David Kiarie To: qemu-devel@nongnu.org Date: Tue, 9 Aug 2016 23:27:29 +0300 Message-Id: <1470774452-16785-2-git-send-email-davidkiarie4@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1470774452-16785-1-git-send-email-davidkiarie4@gmail.com> References: <1470774452-16785-1-git-send-email-davidkiarie4@gmail.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] [V15 1/4] hw/pci: Prepare for AMD IOMMU 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: ehabkost@redhat.com, mst@redhat.com, rkrcmar@redhat.com, peterx@redhat.com, valentine.sinitsyn@gmail.com, jan.kiszka@web.de, David Kiarie Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Introduce PCI macros from for use by AMD IOMMU Signed-off-by: David Kiarie --- include/hw/pci/pci.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 929ec2f..5ff92de 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -11,11 +11,13 @@ #include "hw/pci/pcie.h" /* PCI bus */ - #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) +#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) #define PCI_BUILD_BDF(bus, devfn) ((bus << 8) | (devfn)) +#define PCI_BUS_MAX 256 +#define PCI_DEVFN_MAX 256 #define PCI_SLOT_MAX 32 #define PCI_FUNC_MAX 8