Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932710AbcLHGih (ORCPT ); Thu, 8 Dec 2016 01:38:37 -0500 Received: from p3plsmtps2ded02.prod.phx3.secureserver.net ([208.109.80.59]:54766 "EHLO p3plsmtps2ded02.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932421AbcLHGid (ORCPT ); Thu, 8 Dec 2016 01:38:33 -0500 x-originating-ip: 72.167.245.219 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, bjorn.helgaas@gmail.com Cc: Haiyang Zhang , "K. Y. Srinivasan" Subject: [PATCH 1/3] hyperv: Move hv_pci_dev and related structs to hyperv.h Date: Thu, 8 Dec 2016 00:33:41 -0800 Message-Id: <1481186023-30429-1-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1481185988-30383-1-git-send-email-kys@exchange.microsoft.com> References: <1481185988-30383-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfH06jp0HHWNT0P+FFgwTi+ak3NK5plWt0dG1dSRsQpZEfMk3OMXnk4FhYOCdbgVG9HNf7E25/OdOXXJO+PZxP2pj2LRX8xvFamVABg/xJL5PeyrtGSVP hTplxhxXatPwpGEKfFp0jrGNhDfBaz4n8k8kKJkoaQI+8CwfQAZ5zTmSHT7+2/we5lxmnPr9rxk0hPx7lDeVxRn8/1wo+lva4QjbO9dvrJhPLNSsVgW03cwE CbPAZQZLH9sTwiW0zyEmfYEUIuGs/ZSe4Bba42zU6HrXQKZS1tgw+ShqnvqQoK7hA8ZYobvWDesen0VZySSC58VfbgEhQ1Cb31Vkak5Aud9z1zKJF+vxWsI0 CUXxvdLVNjCYT9FNVCkqSEV0ATDw0NghULuyPCRl9K9t5MkOzJmTZxGv4eJToIA5gglhM7ODU9PDfbkZT1agDdOP99DWXb2aKqcdmSj5CsE7C93zSkc9MFSR 7KJMfqxxP0ZqhLm53O4b8JjB3JsObB6JaW1vsc1F5hD5uBDyh5SQel/REVE= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6668 Lines: 263 From: Haiyang Zhang Move some vPCI data structures to hyperv.h, because we share them with other module. Signed-off-by: Haiyang Zhang Signed-off-by: K. Y. Srinivasan --- drivers/pci/host/pci-hyperv.c | 91 -------------------------------------- include/linux/hyperv.h | 98 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 97 insertions(+), 92 deletions(-) diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c index a63c3a4..7a97b4f 100644 --- a/drivers/pci/host/pci-hyperv.c +++ b/drivers/pci/host/pci-hyperv.c @@ -49,12 +49,10 @@ #include #include -#include #include #include #include #include -#include #include #include @@ -122,35 +120,6 @@ enum pci_message_type { u32 version; } __packed; -/* - * Function numbers are 8-bits wide on Express, as interpreted through ARI, - * which is all this driver does. This representation is the one used in - * Windows, which is what is expected when sending this back and forth with - * the Hyper-V parent partition. - */ -union win_slot_encoding { - struct { - u32 func:8; - u32 reserved:24; - } bits; - u32 slot; -} __packed; - -/* - * Pretty much as defined in the PCI Specifications. - */ -struct pci_function_description { - u16 v_id; /* vendor ID */ - u16 d_id; /* device ID */ - u8 rev; - u8 prog_intf; - u8 subclass; - u8 base_class; - u32 subsystem_id; - union win_slot_encoding win_slot; - u32 ser; /* serial number */ -} __packed; - /** * struct hv_msi_desc * @vector: IDT entry @@ -345,41 +314,6 @@ struct retarget_msi_interrupt { * Driver specific state. */ -enum hv_pcibus_state { - hv_pcibus_init = 0, - hv_pcibus_probed, - hv_pcibus_installed, - hv_pcibus_maximum -}; - -struct hv_pcibus_device { - struct pci_sysdata sysdata; - enum hv_pcibus_state state; - atomic_t remove_lock; - struct hv_device *hdev; - resource_size_t low_mmio_space; - resource_size_t high_mmio_space; - struct resource *mem_config; - struct resource *low_mmio_res; - struct resource *high_mmio_res; - struct completion *survey_event; - struct completion remove_event; - struct pci_bus *pci_bus; - spinlock_t config_lock; /* Avoid two threads writing index page */ - spinlock_t device_list_lock; /* Protect lists below */ - void __iomem *cfg_addr; - - struct semaphore enum_sem; - struct list_head resources_for_children; - - struct list_head children; - struct list_head dr_list; - - struct msi_domain_info msi_info; - struct msi_controller msi_chip; - struct irq_domain *irq_domain; -}; - /* * Tracks "Device Relations" messages from the host, which must be both * processed in order and deferred so that they don't run in the context @@ -396,14 +330,6 @@ struct hv_dr_state { struct pci_function_description func[0]; }; -enum hv_pcichild_state { - hv_pcichild_init = 0, - hv_pcichild_requirements, - hv_pcichild_resourced, - hv_pcichild_ejecting, - hv_pcichild_maximum -}; - enum hv_pcidev_ref_reason { hv_pcidev_ref_invalid = 0, hv_pcidev_ref_initial, @@ -415,23 +341,6 @@ enum hv_pcidev_ref_reason { hv_pcidev_ref_max }; -struct hv_pci_dev { - /* List protected by pci_rescan_remove_lock */ - struct list_head list_entry; - atomic_t refs; - enum hv_pcichild_state state; - struct pci_function_description desc; - bool reported_missing; - struct hv_pcibus_device *hbus; - struct work_struct wrk; - - /* - * What would be observed if one wrote 0xFFFFFFFF to a BAR and then - * read it back, for each of the BAR offsets within config space. - */ - u32 probed_bar[6]; -}; - struct hv_pci_compl { struct completion host_event; s32 completion_status; diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 42fe43f..ff6cd3e 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -36,7 +36,8 @@ #include #include #include - +#include +#include #define MAX_PAGE_BUFFER_COUNT 32 #define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ @@ -1590,5 +1591,100 @@ static inline void commit_rd_index(struct vmbus_channel *channel) hv_signal_on_read(channel); } +/* vPCI structures */ + +/* + * Function numbers are 8-bits wide on Express, as interpreted through ARI, + * which is all this driver does. This representation is the one used in + * Windows, which is what is expected when sending this back and forth with + * the Hyper-V parent partition. + */ +union win_slot_encoding { + struct { + u32 func:8; + u32 reserved:24; + } bits; + u32 slot; +} __packed; + +/* + * Pretty much as defined in the PCI Specifications. + */ +struct pci_function_description { + u16 v_id; /* vendor ID */ + u16 d_id; /* device ID */ + u8 rev; + u8 prog_intf; + u8 subclass; + u8 base_class; + u32 subsystem_id; + union win_slot_encoding win_slot; + u32 ser; /* serial number */ +} __packed; + + +/* + * Driver specific state. + */ + +enum hv_pcibus_state { + hv_pcibus_init = 0, + hv_pcibus_probed, + hv_pcibus_installed, + hv_pcibus_maximum +}; + +struct hv_pcibus_device { + struct pci_sysdata sysdata; + enum hv_pcibus_state state; + atomic_t remove_lock; + struct hv_device *hdev; + resource_size_t low_mmio_space; + resource_size_t high_mmio_space; + struct resource *mem_config; + struct resource *low_mmio_res; + struct resource *high_mmio_res; + struct completion *survey_event; + struct completion remove_event; + struct pci_bus *pci_bus; + spinlock_t config_lock; /* Avoid two threads writing index page */ + spinlock_t device_list_lock; /* Protect lists below */ + void __iomem *cfg_addr; + + struct semaphore enum_sem; + struct list_head resources_for_children; + + struct list_head children; + struct list_head dr_list; + + struct msi_domain_info msi_info; + struct msi_controller msi_chip; + struct irq_domain *irq_domain; +}; + +enum hv_pcichild_state { + hv_pcichild_init = 0, + hv_pcichild_requirements, + hv_pcichild_resourced, + hv_pcichild_ejecting, + hv_pcichild_maximum +}; + +struct hv_pci_dev { + /* List protected by pci_rescan_remove_lock */ + struct list_head list_entry; + atomic_t refs; + enum hv_pcichild_state state; + struct pci_function_description desc; + bool reported_missing; + struct hv_pcibus_device *hbus; + struct work_struct wrk; + + /* + * What would be observed if one wrote 0xFFFFFFFF to a BAR and then + * read it back, for each of the BAR offsets within config space. + */ + u32 probed_bar[6]; +}; #endif /* _HYPERV_H */ -- 1.7.4.1