A User VM can access its virtual PCI configuration spaces via port IO approach, which has two following steps: 1) writes address into port 0xCF8 2) put/get data in/from port 0xCFC To distribute a complete PCI configuration space access one time, HSM need to combine such two accesses together. Combine two paired PIO I/O requests into one PCI I/O request and continue the I/O request distribution.
Showing the changes to include/uapi (1 of 3 files). Show all
Unified · Split
| @@ -23,6 +23,7 @@ · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | #define ACRN_IOREQ_TYPE_PORTIO 0 | 24 | #define ACRN_IOREQ_TYPE_PORTIO 0 |
| 25 | #define ACRN_IOREQ_TYPE_MMIO 1 | 25 | #define ACRN_IOREQ_TYPE_MMIO 1 |
| 26 | #define ACRN_IOREQ_TYPE_PCICFG 2 | ||
| 26 | 27 | ||
| 27 | #define ACRN_IOREQ_DIR_READ 0 | 28 | #define ACRN_IOREQ_DIR_READ 0 |
| 28 | #define ACRN_IOREQ_DIR_WRITE 1 | 29 | #define ACRN_IOREQ_DIR_WRITE 1 |
| @@ -59,6 +60,30 @@ struct acrn_pio_request { · 30 unmodified lines | |||
| 59 | __u32 value; | 60 | __u32 value; |
| 60 | }; | 61 | }; |
| 61 | 62 | ||
| 63 | /** | ||
| 64 | * struct acrn_pci_request - Info of a PCI I/O request | ||
| 65 | * @direction: Access direction of this request (ACRN_IOREQ_DIR_*) | ||
| 66 | * @reserved: Reserved for alignment and should be 0 | ||
| 67 | * @size: Access size of this PCI I/O request | ||
| 68 | * @value: Read/write value of this PIO I/O request | ||
| 69 | * @bus: PCI bus value of this PCI I/O request | ||
| 70 | * @dev: PCI device value of this PCI I/O request | ||
| 71 | * @func: PCI function value of this PCI I/O request | ||
| 72 | * @reg: PCI config space offset of this PCI I/O request | ||
| 73 | * | ||
| 74 | * Need keep same header layout with &struct acrn_pio_request. | ||
| 75 | */ | ||
| 76 | struct acrn_pci_request { | ||
| 77 | __u32 direction; | ||
| 78 | __u32 reserved[3]; | ||
| 79 | __u64 size; | ||
| 80 | __u32 value; | ||
| 81 | __u32 bus; | ||
| 82 | __u32 dev; | ||
| 83 | __u32 func; | ||
| 84 | __u32 reg; | ||
| 85 | }; | ||
| 86 | |||
| 62 | /** | 87 | /** |
| 63 | * struct acrn_io_request - 256-byte ACRN I/O request | 88 | * struct acrn_io_request - 256-byte ACRN I/O request |
| 64 | * @type: Type of this request (ACRN_IOREQ_TYPE_*). | 89 | * @type: Type of this request (ACRN_IOREQ_TYPE_*). |
| @@ -67,6 +92,7 @@ struct acrn_pio_request { · 2 unmodified lines | |||
| 67 | * @reserved0: Reserved fields. | 92 | * @reserved0: Reserved fields. |
| 68 | * @reqs: Union of different types of request. Byte offset: 64. | 93 | * @reqs: Union of different types of request. Byte offset: 64. |
| 69 | * @reqs.pio_request: PIO request data of the I/O request. | 94 | * @reqs.pio_request: PIO request data of the I/O request. |
| 95 | * @reqs.pci_request: PCI configuration space request data of the I/O request. | ||
| 70 | * @reqs.mmio_request: MMIO request data of the I/O request. | 96 | * @reqs.mmio_request: MMIO request data of the I/O request. |
| 71 | * @reqs.data: Raw data of the I/O request. | 97 | * @reqs.data: Raw data of the I/O request. |
| 72 | * @reserved1: Reserved fields. | 98 | * @reserved1: Reserved fields. |
| @@ -126,6 +152,7 @@ struct acrn_io_request { · 53 unmodified lines | |||
| 126 | __u32 reserved0[14]; | 152 | __u32 reserved0[14]; |
| 127 | union { | 153 | union { |
| 128 | struct acrn_pio_request pio_request; | 154 | struct acrn_pio_request pio_request; |
| 155 | struct acrn_pci_request pci_request; | ||
| 129 | struct acrn_mmio_request mmio_request; | 156 | struct acrn_mmio_request mmio_request; |
| 130 | __u64 data[8]; | 157 | __u64 data[8]; |
| 131 | } reqs; | 158 | } reqs; |