-
Notifications
You must be signed in to change notification settings - Fork 21
Adjust the pci format and add new example for qemu with pci #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7b5cf7c
9f5073e
7b6ff70
febd052
b3ff20f
9fd2351
b38e455
23d3311
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "name": "linux2", | ||||||||||||||||||||||||||||||||||
| "zone_id": 1, | ||||||||||||||||||||||||||||||||||
| "cpus": [2, 3], | ||||||||||||||||||||||||||||||||||
| "memory_regions": [ | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "type": "ram", | ||||||||||||||||||||||||||||||||||
| "physical_start": "0x50000000", | ||||||||||||||||||||||||||||||||||
| "virtual_start": "0x50000000", | ||||||||||||||||||||||||||||||||||
| "size": "0x30000000" | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "type": "virtio", | ||||||||||||||||||||||||||||||||||
| "physical_start": "0xa000000", | ||||||||||||||||||||||||||||||||||
| "virtual_start": "0xa000000", | ||||||||||||||||||||||||||||||||||
| "size": "0x4000" | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||
| "interrupts": [76, 78], | ||||||||||||||||||||||||||||||||||
| "ivc_configs": [], | ||||||||||||||||||||||||||||||||||
| "kernel_filepath": "./Image", | ||||||||||||||||||||||||||||||||||
| "dtb_filepath": "./linux2.dtb", | ||||||||||||||||||||||||||||||||||
| "kernel_load_paddr": "0x50400000", | ||||||||||||||||||||||||||||||||||
| "dtb_load_paddr": "0x50000000", | ||||||||||||||||||||||||||||||||||
| "entry_point": "0x50400000", | ||||||||||||||||||||||||||||||||||
| "arch_config": { | ||||||||||||||||||||||||||||||||||
| "gic_version": "v3", | ||||||||||||||||||||||||||||||||||
| "gicd_base": "0x8000000", | ||||||||||||||||||||||||||||||||||
| "gicd_size": "0x10000", | ||||||||||||||||||||||||||||||||||
| "gicr_base": "0x80a0000", | ||||||||||||||||||||||||||||||||||
| "gicr_size": "0xf60000", | ||||||||||||||||||||||||||||||||||
| "gits_base": "0x8080000", | ||||||||||||||||||||||||||||||||||
| "gits_size": "0x20000", | ||||||||||||||||||||||||||||||||||
| "is_aarch32": false | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
| "pci_config": [{ | ||||||||||||||||||||||||||||||||||
| "ecam_base": "0x4010000000", | ||||||||||||||||||||||||||||||||||
| "ecam_size": "0x10000000", | ||||||||||||||||||||||||||||||||||
| "io_base": "0x3eff0000", | ||||||||||||||||||||||||||||||||||
| "io_size": "0x10000", | ||||||||||||||||||||||||||||||||||
| "pci_io_base": "0x0", | ||||||||||||||||||||||||||||||||||
| "mem32_base": "0x10000000", | ||||||||||||||||||||||||||||||||||
| "mem32_size": "0x2eff0000", | ||||||||||||||||||||||||||||||||||
| "pci_mem32_base": "0x10000000", | ||||||||||||||||||||||||||||||||||
| "mem64_base": "0x8000000000", | ||||||||||||||||||||||||||||||||||
| "mem64_size": "0x8000000000", | ||||||||||||||||||||||||||||||||||
| "pci_mem64_base": "0x8000000000", | ||||||||||||||||||||||||||||||||||
| "bus_range_begin": "0x0", | ||||||||||||||||||||||||||||||||||
| "bus_range_end": "0x1f" | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+48
to
+49
|
||||||||||||||||||||||||||||||||||
| }], | ||||||||||||||||||||||||||||||||||
| "num_pci_devs": 2, | ||||||||||||||||||||||||||||||||||
| "alloc_pci_devs": [ | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "bdf": "0x0", | ||||||||||||||||||||||||||||||||||
| "dev_type": "0x0" | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "bdf": "0x18", | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+54
to
+58
|
||||||||||||||||||||||||||||||||||
| "bdf": "0x0", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "bdf": "0x18", | |
| "domain": "0x0", | |
| "bus": "0x0", | |
| "device": "0x0", | |
| "function": "0x0", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "domain": "0x0", | |
| "bus": "0x0", | |
| "device": "0x3", | |
| "function": "0x0", |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -47,8 +47,23 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "pci_mem32_base": "0x40000000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "mem64_base": "0x400000000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "mem64_size": "0x400000000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "pci_mem64_base": "0x400000000" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "pci_mem64_base": "0x400000000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bus_range_begin": "0x0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bus_range_end": "0x1f" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+52
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "num_pci_devs": 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "alloc_pci_devs": [0, 16] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "num_pci_devs": 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "alloc_pci_devs": [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bdf": "0x0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "dev_type": "0x0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bdf": "0x10", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "dev_type": "0x0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bdf": "0x20", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+57
to
+65
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bdf": "0x0", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "bdf": "0x10", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "bdf": "0x20", | |
| "domain": "0x0", | |
| "bus": "0x0", | |
| "device": "0x0", | |
| "function": "0x0", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "domain": "0x0", | |
| "bus": "0x0", | |
| "device": "0x2", | |
| "function": "0x0", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "domain": "0x0", | |
| "bus": "0x0", | |
| "device": "0x4", | |
| "function": "0x0", |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -47,8 +47,23 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "pci_mem32_base": "0x40000000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "mem64_base": "0x400000000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "mem64_size": "0x400000000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "pci_mem64_base": "0x400000000" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "pci_mem64_base": "0x400000000", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bus_range_begin": "0x0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bus_range_end": "0x1f" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+52
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "num_pci_devs": 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "alloc_pci_devs": [0, 16] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "num_pci_devs": 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "alloc_pci_devs": [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bdf": "0x0", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "dev_type": "0x0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bdf": "0x10", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "dev_type": "0x0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bdf": "0x20", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+57
to
+65
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "bdf": "0x0", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "bdf": "0x10", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "bdf": "0x20", | |
| "domain": "0x0", | |
| "bus": "0x0", | |
| "device": "0x0", | |
| "function": "0x0", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "domain": "0x0", | |
| "bus": "0x0", | |
| "device": "0x2", | |
| "function": "0x0", | |
| "dev_type": "0x0" | |
| }, | |
| { | |
| "domain": "0x0", | |
| "bus": "0x0", | |
| "device": "0x4", | |
| "function": "0x0", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ typedef __u32 BitmapWord; | |
| #define CONFIG_MAX_ZONES 32 | ||
| #define CONFIG_NAME_MAXLEN 32 | ||
| #define CONFIG_MAX_PCI_DEV 32 | ||
| #define CONFIG_PCI_BUS_MAXNUM 4 | ||
|
|
||
| #define IVC_PROTOCOL_USER 0x0 | ||
| #define IVC_PROTOCOL_HVISOR 0x01 | ||
|
|
@@ -39,6 +40,16 @@ struct memory_region { | |
|
|
||
| typedef struct memory_region memory_region_t; | ||
|
|
||
| struct hv_pci_dev_config { | ||
| __u8 domain; | ||
| __u8 bus; | ||
| __u8 device; | ||
| __u8 function; | ||
| __u32 dev_type; | ||
| }; | ||
|
|
||
| typedef struct hv_pci_dev_config hv_pci_dev_config_t; | ||
|
|
||
| struct pci_config { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we added |
||
| __u64 ecam_base; | ||
| __u64 ecam_size; | ||
|
|
@@ -51,6 +62,9 @@ struct pci_config { | |
| __u64 mem64_base; | ||
| __u64 mem64_size; | ||
| __u64 pci_mem64_base; | ||
| __u32 bus_range_begin; | ||
| __u32 bus_range_end; | ||
| __u8 domain; | ||
| }; | ||
|
|
||
| typedef struct pci_config pci_config_t; | ||
|
|
@@ -142,7 +156,7 @@ struct ivc_config { | |
| }; | ||
| typedef struct ivc_config ivc_config_t; | ||
|
|
||
| #define CONFIG_MAGIC_VERSION 0x04 | ||
| #define CONFIG_MAGIC_VERSION 0x05 | ||
|
|
||
| // Every time you change the struct, you should also change the | ||
| // `CONFIG_MAGIC_VERSION` | ||
|
|
@@ -164,9 +178,10 @@ struct zone_config { | |
| char name[CONFIG_NAME_MAXLEN]; | ||
|
|
||
| arch_zone_config_t arch_config; | ||
| pci_config_t pci_config; | ||
| __u64 num_pci_bus; | ||
| pci_config_t pci_config[CONFIG_PCI_BUS_MAXNUM]; | ||
| __u64 num_pci_devs; | ||
| __u64 alloc_pci_devs[CONFIG_MAX_PCI_DEV]; | ||
| hv_pci_dev_config_t alloc_pci_devs[CONFIG_MAX_PCI_DEV]; | ||
| }; | ||
|
|
||
| typedef struct zone_config zone_config_t; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type name uses the underscore suffix convention (hv_pci_dev_config_t) which is inconsistent with the type name used in the other Rust file (hv_pci_dev_config without _t suffix). For consistency, both files should use the same type name.