From 38a22db999cc4ace0ba9fd9a1f3582156ead0997 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Thu, 2 Nov 2017 15:31:11 +0100 Subject: [PATCH] rte_virtio: remove virtio_pci.h virtio_hw struct definition is now hidden in virtio_pci.c. The API to enumerate all PCI devices is available through virtio_dev.h. Change-Id: Ib9c968732d9f78204e9664c426ad99542cfe8c93 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/385425 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris --- lib/bdev/virtio/bdev_virtio.c | 2 +- lib/bdev/virtio/rte_virtio/virtio_dev.h | 5 ++ lib/bdev/virtio/rte_virtio/virtio_pci.c | 23 ++++++- lib/bdev/virtio/rte_virtio/virtio_pci.h | 67 ------------------- lib/bdev/virtio/rte_virtio/virtio_user.c | 1 - .../virtio/rte_virtio/virtio_user/vhost.h | 2 +- 6 files changed, 28 insertions(+), 72 deletions(-) delete mode 100644 lib/bdev/virtio/rte_virtio/virtio_pci.h diff --git a/lib/bdev/virtio/bdev_virtio.c b/lib/bdev/virtio/bdev_virtio.c index 5c74a3472..785b45bd8 100644 --- a/lib/bdev/virtio/bdev_virtio.c +++ b/lib/bdev/virtio/bdev_virtio.c @@ -1081,7 +1081,7 @@ bdev_virtio_process_config(void) enable_pci = spdk_conf_section_get_boolval(sp, "Enable", false); if (enable_pci) { - rc = vtpci_enumerate_pci(); + rc = virtio_enumerate_pci(); } out: diff --git a/lib/bdev/virtio/rte_virtio/virtio_dev.h b/lib/bdev/virtio/rte_virtio/virtio_dev.h index cac84dc93..1c310badd 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_dev.h +++ b/lib/bdev/virtio/rte_virtio/virtio_dev.h @@ -379,6 +379,11 @@ vtpci_with_feature(struct virtio_dev *dev, uint64_t bit) void vtpci_dump_json_config(struct virtio_dev *hw, struct spdk_json_write_ctx *w); +/** + * Init all compatible Virtio PCI devices. + */ +int virtio_enumerate_pci(void); + extern const struct virtio_pci_ops virtio_user_ops; #endif /* _VIRTIO_DEV_H_ */ diff --git a/lib/bdev/virtio/rte_virtio/virtio_pci.c b/lib/bdev/virtio/rte_virtio/virtio_pci.c index 44376139d..31bee8700 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_pci.c +++ b/lib/bdev/virtio/rte_virtio/virtio_pci.c @@ -39,7 +39,26 @@ #include "spdk/string.h" #include "spdk/env.h" -#include "virtio_pci.h" +#include "virtio_dev.h" + +struct virtio_hw { + uint8_t use_msix; + uint32_t notify_off_multiplier; + uint8_t *isr; + uint16_t *notify_base; + + struct { + /** Mem-mapped resources from given PCI BAR */ + void *vaddr; + + /** Length of the address space */ + uint32_t len; + } pci_bar[6]; + + struct virtio_pci_common_cfg *common_cfg; + struct spdk_pci_device *pci_dev; + struct virtio_scsi_config *dev_cfg; +}; /* * Following macros are derived from linux/pci_regs.h, however, @@ -472,7 +491,7 @@ err: } int -vtpci_enumerate_pci(void) +virtio_enumerate_pci(void) { if (!spdk_process_is_primary()) { SPDK_WARNLOG("virtio_pci secondary process support is not implemented yet.\n"); diff --git a/lib/bdev/virtio/rte_virtio/virtio_pci.h b/lib/bdev/virtio/rte_virtio/virtio_pci.h deleted file mode 100644 index c21274a1f..000000000 --- a/lib/bdev/virtio/rte_virtio/virtio_pci.h +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _VIRTIO_PCI_H_ -#define _VIRTIO_PCI_H_ - -#include "spdk/stdinc.h" - -#include "virtio_dev.h" - -struct virtqueue; - -struct virtio_hw { - uint8_t use_msix; - uint32_t notify_off_multiplier; - uint8_t *isr; - uint16_t *notify_base; - - struct { - /** Mem-mapped resources from given PCI BAR */ - void *vaddr; - - /** Length of the address space */ - uint32_t len; - } pci_bar[6]; - - struct virtio_pci_common_cfg *common_cfg; - struct spdk_pci_device *pci_dev; - struct virtio_scsi_config *dev_cfg; -}; - -/** - * Init all compatible Virtio PCI devices. - */ -int vtpci_enumerate_pci(void); - -#endif /* _VIRTIO_PCI_H_ */ diff --git a/lib/bdev/virtio/rte_virtio/virtio_user.c b/lib/bdev/virtio/rte_virtio/virtio_user.c index caa0841f0..b2f9be730 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_user.c +++ b/lib/bdev/virtio/rte_virtio/virtio_user.c @@ -42,7 +42,6 @@ #include #include "virtio_dev.h" -#include "virtio_pci.h" #include "virtio_user/virtio_user_dev.h" #include "spdk/string.h" diff --git a/lib/bdev/virtio/rte_virtio/virtio_user/vhost.h b/lib/bdev/virtio/rte_virtio/virtio_user/vhost.h index 396e10142..c28bc3292 100644 --- a/lib/bdev/virtio/rte_virtio/virtio_user/vhost.h +++ b/lib/bdev/virtio/rte_virtio/virtio_user/vhost.h @@ -38,7 +38,7 @@ #include "spdk_internal/log.h" -#include "../virtio_pci.h" +#include "../virtio_dev.h" struct vhost_vring_state { unsigned int index;