From patchwork Fri Jul 8 08:18:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Kiarie X-Patchwork-Id: 9220143 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 7161B6044F for ; Fri, 8 Jul 2016 08:19:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0218528585 for ; Fri, 8 Jul 2016 08:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAC4D28590; Fri, 8 Jul 2016 08:19:13 +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 8F71428585 for ; Fri, 8 Jul 2016 08:19:13 +0000 (UTC) Received: from localhost ([::1]:44200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLR0C-0004CI-NJ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 08 Jul 2016 04:19:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLQzp-0004Ba-0i for qemu-devel@nongnu.org; Fri, 08 Jul 2016 04:18:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bLQzn-0003ay-6i for qemu-devel@nongnu.org; Fri, 08 Jul 2016 04:18:47 -0400 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]:35512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bLQzn-0003au-2H for qemu-devel@nongnu.org; Fri, 08 Jul 2016 04:18:47 -0400 Received: by mail-qt0-x243.google.com with SMTP id h56so2201852qte.2 for ; Fri, 08 Jul 2016 01:18:47 -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=RaHkIqyG6ZncJbDjYhaNIEs0ivzI/ShP2ukFzNqHREo=; b=tNF1gkMUaAxfGEjicyjDSz8xfYw6a3HpsW8IVVHSKnfPuxZ+ea9isDuDeTgbrN5cgG GIX2qz1HF2l05qKuI3VudGBp8HZeMY90BHNn2qAsUknq6v8vrb2BC3WJIJmX8ue1/kpI JrwbyVmkhp5faFyQXxjIn2LRz9usK/NBLTpzlA4uBxVM3Q/3h6OPhL4oV1vO/ghKNH/O 7zsrOb/KiBlEDR0HnJU1pLGKXBw6aAPaESa52w6Gw+K4PehpZmSd7DO9bMb9BsqTdJU0 5uu+Jq2n+rKA2/vh1o0h6xewmxeAXvLW0eErQ49ADqkaSE64Wyck+vkQYiLNXxHqvdeg 7Kew== 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=RaHkIqyG6ZncJbDjYhaNIEs0ivzI/ShP2ukFzNqHREo=; b=lLHvNj8shd2Sc3y9ZRqSiKhuycBUS4TiDUoAuXjexP+mdAOC3LDNhcRlgYA3v3sFXR 6ztWlgLtgp3SsoXt1r7jQZv7NLZh1b2yrX6aopcqsCjbCRSk//10OPZuJR/sOYDhdTw8 bJcOB5oGMA9Er6NdgDe+pxg+ct7WyzLHP68HLhwNrA6NJSP7t6pS92XWHwpSLKsBqNLR X2Av/N3gba3VoB79Q1ulZj6Z3w67ocgd0oo/+rslKOkYRPS/s24eEQHkzPRWgo25du02 SVKv8SFTTBRW+fGr2wjnPUjJG1WKPv3FBr3CdoTrkTWrSkf7dKTz3ebxQcVSjQ1S8gI8 aWRA== X-Gm-Message-State: ALyK8tI6jhvw1vFK+b1ICMJKOxqwwfu1Ze7epMDd4yGKLlHNiKquSNA17aGHBC0ZZep6FA== X-Received: by 10.194.201.133 with SMTP id ka5mr3966540wjc.145.1467965926634; Fri, 08 Jul 2016 01:18:46 -0700 (PDT) Received: from debian.flybox.orange ([154.123.15.185]) by smtp.googlemail.com with ESMTPSA id yo9sm3377531wjb.26.2016.07.08.01.18.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jul 2016 01:18:46 -0700 (PDT) From: David Kiarie To: qemu-devel@nongnu.org Date: Fri, 8 Jul 2016 11:18:20 +0300 Message-Id: <1467965903-22766-2-git-send-email-davidkiarie4@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1467965903-22766-1-git-send-email-davidkiarie4@gmail.com> References: <1467965903-22766-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: 2607:f8b0:400d:c0d::243 Subject: [Qemu-devel] [V13 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, valentine.sinitsyn@gmail.com, peterx@redhat.com, alex.williamson@redhat.com, jan.kiszka@web.de, marcel@redhat.com, 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 9ed1624..959d05b 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -11,11 +11,14 @@ #include "hw/pci/pcie.h" /* PCI bus */ - +#define PCI_BDF(bus, devfn) ((((uint16_t)(bus)) << 8) | (devfn)) #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