diff mbox

[RFC,V2,06/10] Qemu/PCI: Add macros for faked PCI migration capability

Message ID 1448372127-28115-7-git-send-email-tianyu.lan@intel.com
State New
Headers show

Commit Message

Lan Tianyu Nov. 24, 2015, 1:35 p.m. UTC
This patch is to extend PCI CAP id for migration cap and
add reg macros. The CAP ID is trial and we may find better one if the
solution is feasible.

*PCI_VF_MIGRATION_CAP
For VF driver to  control that triggers mailbox irq or not during migration.

*PCI_VF_MIGRATION_VMM_STATUS
Qemu stores migration status in the reg

*PCI_VF_MIGRATION_VF_STATUS
VF driver tells Qemu ready for migration

*PCI_VF_MIGRATION_IRQ
VF driver stores mailbox interrupt vector in the reg for Qemu to trigger during migration.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
---
 include/hw/pci/pci_regs.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Alex Williamson Dec. 2, 2015, 10:25 p.m. UTC | #1
On Tue, 2015-11-24 at 21:35 +0800, Lan Tianyu wrote:
> This patch is to extend PCI CAP id for migration cap and
> add reg macros. The CAP ID is trial and we may find better one if the
> solution is feasible.
> 
> *PCI_VF_MIGRATION_CAP
> For VF driver to  control that triggers mailbox irq or not during migration.
> 
> *PCI_VF_MIGRATION_VMM_STATUS
> Qemu stores migration status in the reg
> 
> *PCI_VF_MIGRATION_VF_STATUS
> VF driver tells Qemu ready for migration
> 
> *PCI_VF_MIGRATION_IRQ
> VF driver stores mailbox interrupt vector in the reg for Qemu to trigger during migration.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
> ---
>  include/hw/pci/pci_regs.h | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/include/hw/pci/pci_regs.h b/include/hw/pci/pci_regs.h
> index 57e8c80..0dcaf7e 100644
> --- a/include/hw/pci/pci_regs.h
> +++ b/include/hw/pci/pci_regs.h
> @@ -213,6 +213,7 @@
>  #define  PCI_CAP_ID_MSIX	0x11	/* MSI-X */
>  #define  PCI_CAP_ID_SATA	0x12	/* Serial ATA */
>  #define  PCI_CAP_ID_AF		0x13	/* PCI Advanced Features */
> +#define  PCI_CAP_ID_MIGRATION   0x14 
>  #define PCI_CAP_LIST_NEXT	1	/* Next capability in the list */
>  #define PCI_CAP_FLAGS		2	/* Capability defined flags (16 bits) */
>  #define PCI_CAP_SIZEOF		4
> @@ -716,4 +717,22 @@
>  #define PCI_ACS_CTRL		0x06	/* ACS Control Register */
>  #define PCI_ACS_EGRESS_CTL_V	0x08	/* ACS Egress Control Vector */
>  
> +/* Migration*/
> +#define PCI_VF_MIGRATION_CAP        0x04
> +#define PCI_VF_MIGRATION_VMM_STATUS	0x05
> +#define PCI_VF_MIGRATION_VF_STATUS	0x06
> +#define PCI_VF_MIGRATION_IRQ		0x07
> +
> +#define PCI_VF_MIGRATION_CAP_SIZE   0x08
> +
> +#define VMM_MIGRATION_END        0x00
> +#define VMM_MIGRATION_START      0x01          
> +
> +#define PCI_VF_WAIT_FOR_MIGRATION   0x00          
> +#define PCI_VF_READY_FOR_MIGRATION  0x01        
> +
> +#define PCI_VF_MIGRATION_DISABLE    0x00
> +#define PCI_VF_MIGRATION_ENABLE     0x01
> +
> +
>  #endif /* LINUX_PCI_REGS_H */

This will of course break if the PCI SIG defines that capability index.
Couldn't this be done within a vendor defined capability?  Thanks,

Alex
Lan Tianyu Dec. 3, 2015, 8:57 a.m. UTC | #2
On 12/3/2015 6:25 AM, Alex Williamson wrote:
> This will of course break if the PCI SIG defines that capability index.
> Couldn't this be done within a vendor defined capability?  Thanks,

Yes, it should work and thanks for suggestion.
diff mbox

Patch

diff --git a/include/hw/pci/pci_regs.h b/include/hw/pci/pci_regs.h
index 57e8c80..0dcaf7e 100644
--- a/include/hw/pci/pci_regs.h
+++ b/include/hw/pci/pci_regs.h
@@ -213,6 +213,7 @@ 
 #define  PCI_CAP_ID_MSIX	0x11	/* MSI-X */
 #define  PCI_CAP_ID_SATA	0x12	/* Serial ATA */
 #define  PCI_CAP_ID_AF		0x13	/* PCI Advanced Features */
+#define  PCI_CAP_ID_MIGRATION   0x14 
 #define PCI_CAP_LIST_NEXT	1	/* Next capability in the list */
 #define PCI_CAP_FLAGS		2	/* Capability defined flags (16 bits) */
 #define PCI_CAP_SIZEOF		4
@@ -716,4 +717,22 @@ 
 #define PCI_ACS_CTRL		0x06	/* ACS Control Register */
 #define PCI_ACS_EGRESS_CTL_V	0x08	/* ACS Egress Control Vector */
 
+/* Migration*/
+#define PCI_VF_MIGRATION_CAP        0x04
+#define PCI_VF_MIGRATION_VMM_STATUS	0x05
+#define PCI_VF_MIGRATION_VF_STATUS	0x06
+#define PCI_VF_MIGRATION_IRQ		0x07
+
+#define PCI_VF_MIGRATION_CAP_SIZE   0x08
+
+#define VMM_MIGRATION_END        0x00
+#define VMM_MIGRATION_START      0x01          
+
+#define PCI_VF_WAIT_FOR_MIGRATION   0x00          
+#define PCI_VF_READY_FOR_MIGRATION  0x01        
+
+#define PCI_VF_MIGRATION_DISABLE    0x00
+#define PCI_VF_MIGRATION_ENABLE     0x01
+
+
 #endif /* LINUX_PCI_REGS_H */