History

virt: acrn: Introduce PCI configuration space PIO accesses combiner

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.

Shuo Liu committed 5 years ago

Commit 3c4c3311 parent 72f293d3 files · +105 −0Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/acrn.h+27−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323
2424 #define ACRN_IOREQ_TYPE_PORTIO 0
2525 #define ACRN_IOREQ_TYPE_MMIO 1
26+#define ACRN_IOREQ_TYPE_PCICFG 2
2627
2728 #define ACRN_IOREQ_DIR_READ 0
2829 #define ACRN_IOREQ_DIR_WRITE 1
@@ -59,6 +60,30 @@ struct acrn_pio_request { · 30 unmodified lines
5960 __u32 value;
6061 };
6162
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+
6287 /**
6388 * struct acrn_io_request - 256-byte ACRN I/O request
6489 * @type: Type of this request (ACRN_IOREQ_TYPE_*).
@@ -67,6 +92,7 @@ struct acrn_pio_request { · 2 unmodified lines
6792 * @reserved0: Reserved fields.
6893 * @reqs: Union of different types of request. Byte offset: 64.
6994 * @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.
7096 * @reqs.mmio_request: MMIO request data of the I/O request.
7197 * @reqs.data: Raw data of the I/O request.
7298 * @reserved1: Reserved fields.
@@ -126,6 +152,7 @@ struct acrn_io_request { · 53 unmodified lines
126152 __u32 reserved0[14];
127153 union {
128154 struct acrn_pio_request pio_request;
155+ struct acrn_pci_request pci_request;
129156 struct acrn_mmio_request mmio_request;
130157 __u64 data[8];
131158 } reqs;