From patchwork Thu Aug 17 23:12:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Bezzubikov X-Patchwork-Id: 802956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CCnU5clB"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xYMTK0wwXz9t2c for ; Fri, 18 Aug 2017 09:13:23 +1000 (AEST) Received: from localhost ([::1]:57038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diTyb-0005KX-2K for incoming@patchwork.ozlabs.org; Thu, 17 Aug 2017 19:13:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diTy5-0005JU-PB for qemu-devel@nongnu.org; Thu, 17 Aug 2017 19:12:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1diTy2-000701-KO for qemu-devel@nongnu.org; Thu, 17 Aug 2017 19:12:49 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:34488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1diTy2-0006zh-Ct for qemu-devel@nongnu.org; Thu, 17 Aug 2017 19:12:46 -0400 Received: by mail-lf0-x241.google.com with SMTP id o85so5235796lff.1 for ; Thu, 17 Aug 2017 16:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JkYh3oQ9fyVfBf1WCfQknt9ahHGwgKu5WzdZIV13rjI=; b=CCnU5clB3027mw6hrija/HVoe3/8UtM32LP3seV62dOE+Gpe+sHVdgG2geOlWBQYQA GjcjKr+EdTJclS6Co1L1n+g/uY5eYgVePnKMLoeQPb00dUyv9FFgOZru/zpdmhM5IJ7S 21j0o+KHd8wVSBnBmTmuefOO4z8cje9wMjEcA4j9WfkwljAz62KTVjEIqQ/ioeNWf+lH OYYkGdeVQiMurYCPMADLdNsFGyMBgcP1Xz2abgqmrxDFJy/Maf851XdUX4E9lIwoHWbl P8by3K0y/Q2PK4jNHr4blkpPH1uNxKnBBCDSrUI7X/iAHvGMEhBq427hcgl0PgrQFJ7z k8UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JkYh3oQ9fyVfBf1WCfQknt9ahHGwgKu5WzdZIV13rjI=; b=TjAFdTXP1d30wQHMf7f6/XguShJXMljxZap/b2DmSLI04I9iz7IxqAFnzahjN6iIOr 5+cH5iAYgAbh9WInUHHWSGp5KxCmCIJs9hr4s30bNOr2HbWPwLUJVchjP0eoOzjZRZ4m VYFHcTdCMRJv7xhqD18ThkWYUSXf707tQaGtgKZyy1uTMKFQcLIC/jBMzhqalwvYjbVv L6dOeJSeOGsk5ILxhOj2Jv/PeTGZ/hxZwAm7V26f8NCulrpdANsAFNqRlYInVcskl0oq 6FH460nUpu+tdW7NwUPoFaDRD0/MQDoWlsN+qJmn8eFg4qP6jsuiJCKCPkiJKera1mYU SY9A== X-Gm-Message-State: AHYfb5h685CK/t93ATDSEAW5hUd1bRKU1S1Tp0/+LyAZFamfHgPkrDUV yTRphjqq9NpE4JbF+sw= X-Received: by 10.25.225.12 with SMTP id y12mr2991185lfg.83.1503011565227; Thu, 17 Aug 2017 16:12:45 -0700 (PDT) Received: from localhost.localdomain ([93.185.28.201]) by smtp.gmail.com with ESMTPSA id d17sm987659lfl.86.2017.08.17.16.12.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Aug 2017 16:12:44 -0700 (PDT) From: Aleksandr Bezzubikov To: seabios@seabios.org Date: Fri, 18 Aug 2017 02:12:30 +0300 Message-Id: <1503011551-7246-3-git-send-email-zuban32s@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503011551-7246-1-git-send-email-zuban32s@gmail.com> References: <1503011551-7246-1-git-send-email-zuban32s@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH v7 2/3] pci: add QEMU-specific PCI capability structure 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: mst@redhat.com, qemu-devel@nongnu.org, Aleksandr Bezzubikov , kevin@koconnor.net, kraxel@redhat.com, marcel@redhat.com, lersek@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" On PCI init PCI bridge devices may need some extra info about bus number to reserve, IO, memory and prefetchable memory limits. QEMU can provide this with special vendor-specific PCI capability. This capability is intended to be used only for Red Hat PCI bridges, i.e. QEMU cooperation. Signed-off-by: Aleksandr Bezzubikov Reviewed-by: Marcel Apfelbaum --- src/fw/dev-pci.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/fw/dev-pci.h diff --git a/src/fw/dev-pci.h b/src/fw/dev-pci.h new file mode 100644 index 0000000..0dc5556 --- /dev/null +++ b/src/fw/dev-pci.h @@ -0,0 +1,53 @@ +#ifndef _PCI_CAP_H +#define _PCI_CAP_H + +#include "types.h" + +/* + * + * QEMU-specific vendor(Red Hat)-specific capability. + * It's intended to provide some hints for firmware to init PCI devices. + * + * Its structure is shown below: + * + * Header: + * + * u8 id; Standard PCI Capability Header field + * u8 next; Standard PCI Capability Header field + * u8 len; Standard PCI Capability Header field + * u8 type; Red Hat vendor-specific capability type + * Data: + * + * u32 bus_res; minimum bus number to reserve; + * this is necessary for PCI Express Root Ports + * to support PCI bridges hotplug + * u64 io; IO space to reserve + * u32 mem; non-prefetchable memory to reserve + * + * At most of the following two fields may be set to a value + * different from 0xFF...F: + * u32 prefetchable_mem_32; prefetchable memory to reserve (32-bit MMIO) + * u64 prefetchable_mem_64; prefetchable memory to reserve (64-bit MMIO) + * + * If any field value in Data section is 0xFF...F, + * it means that such kind of reservation is not needed and must be ignored. + * +*/ + +/* Offset of vendor-specific capability type field */ +#define PCI_CAP_REDHAT_TYPE_OFFSET 3 + +/* List of valid Red Hat vendor-specific capability types */ +#define REDHAT_CAP_RESOURCE_RESERVE 1 + + +/* Offsets of RESOURCE_RESERVE capability fields */ +#define RES_RESERVE_BUS_RES 4 +#define RES_RESERVE_IO 8 +#define RES_RESERVE_MEM 16 +#define RES_RESERVE_PREF_MEM_32 20 +#define RES_RESERVE_PREF_MEM_64 24 +#define RES_RESERVE_CAP_SIZE 32 + +#endif /* _PCI_CAP_H */ +