QEMU源码全解析32 —— Machine(2)

88 篇文章 19 订阅
本文继续探讨QEMU模拟主板架构,重点解析QEMU主板模拟图及其与Intel 440FX架构的相似之处。通过QEMU monitor的'info qtree'命令展示了虚拟机的设备结构,包括main-system-bus、北桥i440FX-pcihost、PCI根总线pci.0以及挂载的各种设备如hpet、kvm-ioapic、IDE设备、电源管理等。文章还提到了PCI根总线下的直接PCI设备和ISA总线下的ISA设备,阐述了总线与设备的层次关系。
摘要由CSDN通过智能技术生成

展开

接前一篇文章: QEMU源码全解析31 —— Machine(1)

本文内容参考:

《趣谈 Linux操作系统 》 —— 刘超, 极客时间

QEMU /KVM》源码解析与应用 —— 李强,机械工业出版社

特此致谢!

上一篇文章给machine即主板与固件开了个头,并主要介绍了Intel 440FX主板也可以说芯片组。本回讲解QEMU模拟主板架构。

QEMU模拟主板架构

QEMU主板模拟图如下图所示:

I440FX

可以发现,此图与上一篇文章中的Intel 440FX架构是比较接近的,两者的基本架构一致。为了便于对比和理解,再次贴出Intel 440FX的架构图,如下:

通过以下命令进入QEMU monitor:

  1. qemu-system-x86_64 -vnc :1 -monitor stdio
  2. qemu -vnc :1 -monitor stdio

实际命令及结果如下:

  1. $ qemu-system-x86_64 -vnc :1 -monitor stdio
  2. QEMU 7.1.0 monitor - type 'help' for more information
  3. (qemu)

在QEMU monitor中输入“info qtree”,可以看到QEMU 虚拟机 的设备结构,如下所示:

  1. $ qemu-system-x86_64 -vnc :1 -monitor stdio
  2. QEMU 7.1.0 monitor - type 'help' for more information
  3. (qemu) info qtree
  4. bus: main-system-bus
  5. type System
  6. dev: ps2-mouse, id ""
  7. gpio-out "" 1
  8. dev: ps2-kbd, id ""
  9. gpio-out "" 1
  10. dev: hpet, id ""
  11. gpio-in "" 2
  12. gpio-out "" 1
  13. gpio-out "sysbus-irq" 32
  14. timers = 3 (0x3)
  15. msi = false
  16. hpet-intcap = 4 (0x4)
  17. hpet-offset-saved = true
  18. mmio 00000000fed00000/0000000000000400
  19. dev: ioapic, id ""
  20. gpio-in "" 24
  21. version = 32 (0x20)
  22. mmio 00000000fec00000/0000000000001000
  23. dev: i440FX-pcihost, id ""
  24. pci-hole64-size = 2147483648 (2 GiB)
  25. short_root_bus = 0 (0x0)
  26. x-pci-hole64-fix = true
  27. x-config-reg-migration-enabled = true
  28. bypass-iommu = false
  29. bus: pci.0
  30. type PCI
  31. dev: PIIX4_PM, id ""
  32. gpio-out "smi-irq" 1
  33. gpio-out "" 1
  34. smb_io_base = 1792 (0x700)
  35. disable_s3 = 0 (0x0)
  36. disable_s4 = 0 (0x0)
  37. s4_val = 2 (0x2)
  38. acpi-pci-hotplug-with-bridge-support = true
  39. acpi-root-pci-hotplug = true
  40. memory-hotplug-support = true
  41. smm-compat = false
  42. smm-enabled = true
  43. x-not-migrate-acpi-index = false
  44. addr = 01.3
  45. romfile = ""
  46. romsize = 4294967295 (0xffffffff)
  47. rombar = 1 (0x1)
  48. multifunction = false
  49. x-pcie-lnksta-dllla = true
  50. x-pcie-extcap-init = true
  51. failover_pair_id = ""
  52. acpi-index = 0 (0x0)
  53. class Bridge, addr 00:01.3, pci id 8086:7113 (sub 1af4:1100)
  54. bus: i2c
  55. type i2c-bus
  56. dev: smbus-eeprom, id ""
  57. address = 87 (0x57)
  58. dev: smbus-eeprom, id ""
  59. address = 86 (0x56)
  60. dev: smbus-eeprom, id ""
  61. address = 85 (0x55)
  62. dev: smbus-eeprom, id ""
  63. address = 84 (0x54)
  64. dev: smbus-eeprom, id ""
  65. address = 83 (0x53)
  66. dev: smbus-eeprom, id ""
  67. address = 82 (0x52)
  68. dev: smbus-eeprom, id ""
  69. address = 81 (0x51)
  70. dev: smbus-eeprom, id ""
  71. address = 80 (0x50)
  72. dev: piix3-ide, id ""
  73. addr = 01.1
  74. romfile = ""
  75. romsize = 4294967295 (0xffffffff)
  76. rombar = 1 (0x1)
  77. multifunction = false
  78. x-pcie-lnksta-dllla = true
  79. x-pcie-extcap-init = true
  80. failover_pair_id = ""
  81. acpi-index = 0 (0x0)
  82. class IDE controller, addr 00:01.1, pci id 8086:7010 (sub 1af4:1100)
  83. bar 4: i/o at 0xc040 [0xc04f]
  84. bus: ide.1
  85. type IDE
  86. dev: ide-cd, id ""
  87. drive = "ide1-cd0"
  88. backend_defaults = "auto"
  89. logical_block_size = 512 (512 B)
  90. physical_block_size = 512 (512 B)
  91. min_io_size = 0 (0 B)
  92. opt_io_size = 0 (0 B)
  93. discard_granularity = 512 (512 B)
  94. write-cache = "auto"
  95. share-rw = false
  96. rerror = "auto"
  97. werror = "auto"
  98. ver = "2.5+"
  99. wwn = 0 (0x0)
  100. serial = "QM00003"
  101. model = ""
  102. unit = 0 (0x0)
  103. bus: ide.0
  104. type IDE
  105. dev: e1000, id ""
  106. mac = "52:54:00:12:34:56"
  107. netdev = "hub0port0"
  108. autonegotiation = true
  109. mitigation = true
  110. extra_mac_registers = true
  111. migrate_tso_props = true
  112. init-vet = true
  113. addr = 03.0
  114. romfile = "efi-e1000.rom"
  115. romsize = 262144 (0x40000)
  116. rombar = 1 (0x1)
  117. multifunction = false
  118. x-pcie-lnksta-dllla = true
  119. x-pcie-extcap-init = true
  120. failover_pair_id = ""
  121. acpi-index = 0 (0x0)
  122. class Ethernet controller, addr 00:03.0, pci id 8086:100e (sub 1af4:1100)
  123. bar 0: mem at 0xfebc0000 [0xfebdffff]
  124. bar 1: i/o at 0xc000 [0xc03f]
  125. bar 6: mem at 0xffffffffffffffff [0x3fffe]
  126. dev: VGA, id ""
  127. vgamem_mb = 16 (0x10)
  128. mmio = true
  129. qemu-extended-regs = true
  130. edid = true
  131. xres = 1280 (0x500)
  132. yres = 800 (0x320)
  133. xmax = 0 (0x0)
  134. ymax = 0 (0x0)
  135. refresh_rate = 0 (0x0)
  136. global-vmstate = false
  137. addr = 02.0
  138. romfile = "vgabios-stdvga.bin"
  139. romsize = 65536 (0x10000)
  140. rombar = 1 (0x1)
  141. multifunction = false
  142. x-pcie-lnksta-dllla = true
  143. x-pcie-extcap-init = true
  144. failover_pair_id = ""
  145. acpi-index = 0 (0x0)
  146. class VGA controller, addr 00:02.0, pci id 1234:1111 (sub 1af4:1100)
  147. bar 0: mem at 0xfd000000 [0xfdffffff]
  148. bar 2: mem at 0xfebf0000 [0xfebf0fff]
  149. bar 6: mem at 0xffffffffffffffff [0xfffe]
  150. dev: PIIX3, id ""
  151. addr = 01.0
  152. romfile = ""
  153. romsize = 4294967295 (0xffffffff)
  154. rombar = 1 (0x1)
  155. multifunction = true
  156. x-pcie-lnksta-dllla = true
  157. x-pcie-extcap-init = true
  158. failover_pair_id = ""
  159. acpi-index = 0 (0x0)
  160. class ISA bridge, addr 00:01.0, pci id 8086:7000 (sub 1af4:1100)
  161. bus: isa.0
  162. type ISA
  163. dev: port92, id ""
  164. gpio-out "a20" 1
  165. dev: vmmouse, id ""
  166. dev: vmport, id ""
  167. x-read-set-eax = true
  168. x-signal-unsupported-cmd = true
  169. x-report-vmx-type = true
  170. x-cmds-v2 = true
  171. vmware-vmx-version = 6 (0x6)
  172. vmware-vmx-type = 2 (0x2)
  173. dev: i8042, id ""
  174. gpio-in "ps2-mouse-input-irq" 1
  175. gpio-in "ps2-kbd-input-irq" 1
  176. gpio-out "" 2
  177. gpio-out "a20" 1
  178. extended-state = true
  179. kbd-throttle = false
  180. kbd-irq = 1 (0x1)
  181. mouse-irq = 12 (0xc)
  182. dev: isa-fdc, id ""
  183. iobase = 1008 (0x3f0)
  184. irq = 6 (0x6)
  185. dma = 2 (0x2)
  186. fdtypeA = "auto"
  187. fdtypeB = "auto"
  188. fallback = "288"
  189. bus: floppy-bus.0
  190. type floppy-bus
  191. dev: floppy, id ""
  192. unit = 0 (0x0)
  193. drive = "floppy0"
  194. backend_defaults = "auto"
  195. logical_block_size = 512 (512 B)
  196. physical_block_size = 512 (512 B)
  197. min_io_size = 0 (0 B)
  198. opt_io_size = 0 (0 B)
  199. discard_granularity = 4294967295 (4 GiB)
  200. write-cache = "auto"
  201. share-rw = false
  202. drive-type = "288"
  203. dev: isa-parallel, id ""
  204. index = 0 (0x0)
  205. iobase = 888 (0x378)
  206. irq = 7 (0x7)
  207. chardev = "parallel0"
  208. dev: isa-serial, id ""
  209. index = 0 (0x0)
  210. iobase = 1016 (0x3f8)
  211. irq = 4 (0x4)
  212. dev: i8257, id ""
  213. base = 192 (0xc0)
  214. page-base = 136 (0x88)
  215. pageh-base = -1 (0xffffffffffffffff)
  216. dshift = 1 (0x1)
  217. dev: i8257, id ""
  218. base = 0 (0x0)
  219. page-base = 128 (0x80)
  220. pageh-base = -1 (0xffffffffffffffff)
  221. dshift = 0 (0x0)
  222. dev: isa-pcspk, id ""
  223. audiodev = ""
  224. iobase = 97 (0x61)
  225. migrate = true
  226. dev: isa-pit, id ""
  227. gpio-in "" 1
  228. gpio-out "" 1
  229. iobase = 64 (0x40)
  230. dev: mc146818rtc, id ""
  231. gpio-out "" 1
  232. base_year = 0 (0x0)
  233. iobase = 112 (0x70)
  234. irq = 8 (0x8)
  235. lost_tick_policy = "discard"
  236. dev: isa-i8259, id ""
  237. gpio-in "" 8
  238. gpio-out "" 1
  239. iobase = 160 (0xa0)
  240. elcr_addr = 1233 (0x4d1)
  241. elcr_mask = 222 (0xde)
  242. master = false
  243. dev: isa-i8259, id ""
  244. gpio-in "" 8
  245. gpio-out "" 1
  246. iobase = 32 (0x20)
  247. elcr_addr = 1232 (0x4d0)
  248. elcr_mask = 248 (0xf8)
  249. master = true
  250. dev: i440FX, id ""
  251. addr = 00.0
  252. romfile = ""
  253. romsize = 4294967295 (0xffffffff)
  254. rombar = 1 (0x1)
  255. multifunction = false
  256. x-pcie-lnksta-dllla = true
  257. x-pcie-extcap-init = true
  258. failover_pair_id = ""
  259. acpi-index = 0 (0x0)
  260. class Host bridge, addr 00:00.0, pci id 8086:1237 (sub 1af4:1100)
  261. dev: fw_cfg_io, id ""
  262. dma_enabled = true
  263. x-file-slots = 32 (0x20)
  264. acpi-mr-restore = true
  265. dev: kvmvapic, id ""
  266. (qemu)

笔者后来又在另一台 Windows 的虚拟机环境下(VMware + Ubuntu 22.04)执行了以上命令,结果如下:

  1. ph@ph-virtual-machine:~$ qemu-system-x86_64 -vnc :1 -monitor stdio
  2. QEMU 6.2.0 monitor - type 'help' for more information
  3. (qemu) info qtree
  4. bus: main-system-bus
  5. type System
  6. dev: hpet, id ""
  7. gpio-in "" 2
  8. gpio-out "" 1
  9. gpio-out "sysbus-irq" 32
  10. timers = 3 (0x3)
  11. msi = false
  12. hpet-intcap = 4 (0x4)
  13. hpet-offset-saved = true
  14. mmio 00000000fed00000/0000000000000400
  15. dev: ioapic, id ""
  16. gpio-in "" 24
  17. version = 32 (0x20)
  18. mmio 00000000fec00000/0000000000001000
  19. dev: i440FX-pcihost, id ""
  20. pci-hole64-size = 2147483648 (2 GiB)
  21. short_root_bus = 0 (0x0)
  22. x-pci-hole64-fix = true
  23. x-config-reg-migration-enabled = true
  24. bypass-iommu = false
  25. bus: pci.0
  26. type PCI
  27. dev: PIIX4_PM, id ""
  28. smb_io_base = 1792 (0x700)
  29. disable_s3 = 0 (0x0)
  30. disable_s4 = 0 (0x0)
  31. s4_val = 2 (0x2)
  32. acpi-pci-hotplug-with-bridge-support = true
  33. acpi-root-pci-hotplug = true
  34. memory-hotplug-support = true
  35. smm-compat = false
  36. addr = 01.3
  37. romfile = ""
  38. romsize = 4294967295 (0xffffffff)
  39. rombar = 1 (0x1)
  40. multifunction = false
  41. x-pcie-lnksta-dllla = true
  42. x-pcie-extcap-init = true
  43. failover_pair_id = ""
  44. acpi-index = 0 (0x0)
  45. class Bridge, addr 00:01.3, pci id 8086:7113 (sub 1af4:1100)
  46. bus: i2c
  47. type i2c-bus
  48. dev: smbus-eeprom, id ""
  49. address = 87 (0x57)
  50. dev: smbus-eeprom, id ""
  51. address = 86 (0x56)
  52. dev: smbus-eeprom, id ""
  53. address = 85 (0x55)
  54. dev: smbus-eeprom, id ""
  55. address = 84 (0x54)
  56. dev: smbus-eeprom, id ""
  57. address = 83 (0x53)
  58. dev: smbus-eeprom, id ""
  59. address = 82 (0x52)
  60. dev: smbus-eeprom, id ""
  61. address = 81 (0x51)
  62. dev: smbus-eeprom, id ""
  63. address = 80 (0x50)
  64. dev: piix3-ide, id ""
  65. addr = 01.1
  66. romfile = ""
  67. romsize = 4294967295 (0xffffffff)
  68. rombar = 1 (0x1)
  69. multifunction = false
  70. x-pcie-lnksta-dllla = true
  71. x-pcie-extcap-init = true
  72. failover_pair_id = ""
  73. acpi-index = 0 (0x0)
  74. class IDE controller, addr 00:01.1, pci id 8086:7010 (sub 1af4:1100)
  75. bar 4: i/o at 0xc040 [0xc04f]
  76. bus: ide.1
  77. type IDE
  78. dev: ide-cd, id ""
  79. drive = "ide1-cd0"
  80. backend_defaults = "auto"
  81. logical_block_size = 512 (512 B)
  82. physical_block_size = 512 (512 B)
  83. min_io_size = 0 (0 B)
  84. opt_io_size = 0 (0 B)
  85. discard_granularity = 512 (512 B)
  86. write-cache = "auto"
  87. share-rw = false
  88. rerror = "auto"
  89. werror = "auto"
  90. ver = "2.5+"
  91. wwn = 0 (0x0)
  92. serial = "QM00003"
  93. model = ""
  94. unit = 0 (0x0)
  95. bus: ide.0
  96. type IDE
  97. dev: e1000, id ""
  98. mac = "52:54:00:12:34:56"
  99. netdev = "hub0port0"
  100. autonegotiation = true
  101. mitigation = true
  102. extra_mac_registers = true
  103. migrate_tso_props = true
  104. init-vet = true
  105. addr = 03.0
  106. romfile = "efi-e1000.rom"
  107. romsize = 524288 (0x80000)
  108. rombar = 1 (0x1)
  109. multifunction = false
  110. x-pcie-lnksta-dllla = true
  111. x-pcie-extcap-init = true
  112. failover_pair_id = ""
  113. acpi-index = 0 (0x0)
  114. class Ethernet controller, addr 00:03.0, pci id 8086:100e (sub 1af4:1100)
  115. bar 0: mem at 0xfeb80000 [0xfeb9ffff]
  116. bar 1: i/o at 0xc000 [0xc03f]
  117. bar 6: mem at 0xffffffffffffffff [0x7fffe]
  118. dev: VGA, id ""
  119. vgamem_mb = 16 (0x10)
  120. mmio = true
  121. qemu-extended-regs = true
  122. edid = true
  123. xres = 1024 (0x400)
  124. yres = 768 (0x300)
  125. xmax = 0 (0x0)
  126. ymax = 0 (0x0)
  127. refresh_rate = 0 (0x0)
  128. global-vmstate = false
  129. addr = 02.0
  130. romfile = "vgabios-stdvga.bin"
  131. romsize = 65536 (0x10000)
  132. rombar = 1 (0x1)
  133. multifunction = false
  134. x-pcie-lnksta-dllla = true
  135. x-pcie-extcap-init = true
  136. failover_pair_id = ""
  137. acpi-index = 0 (0x0)
  138. class VGA controller, addr 00:02.0, pci id 1234:1111 (sub 1af4:1100)
  139. bar 0: mem at 0xfd000000 [0xfdffffff]
  140. bar 2: mem at 0xfebb0000 [0xfebb0fff]
  141. bar 6: mem at 0xffffffffffffffff [0xfffe]
  142. dev: PIIX3, id ""
  143. addr = 01.0
  144. romfile = ""
  145. romsize = 4294967295 (0xffffffff)
  146. rombar = 1 (0x1)
  147. multifunction = true
  148. x-pcie-lnksta-dllla = true
  149. x-pcie-extcap-init = true
  150. failover_pair_id = ""
  151. acpi-index = 0 (0x0)
  152. class ISA bridge, addr 00:01.0, pci id 8086:7000 (sub 1af4:1100)
  153. bus: isa.0
  154. type ISA
  155. dev: port92, id ""
  156. gpio-out "a20" 1
  157. dev: vmmouse, id ""
  158. dev: vmport, id ""
  159. x-read-set-eax = true
  160. x-signal-unsupported-cmd = true
  161. x-report-vmx-type = true
  162. x-cmds-v2 = true
  163. vmware-vmx-version = 6 (0x6)
  164. vmware-vmx-type = 2 (0x2)
  165. dev: i8042, id ""
  166. gpio-out "a20" 1
  167. extended-state = true
  168. kbd-throttle = false
  169. isa irqs 1,12
  170. dev: isa-fdc, id ""
  171. iobase = 1008 (0x3f0)
  172. irq = 6 (0x6)
  173. dma = 2 (0x2)
  174. fdtypeA = "auto"
  175. fdtypeB = "auto"
  176. fallback = "288"
  177. isa irq 6
  178. bus: floppy-bus.0
  179. type floppy-bus
  180. dev: floppy, id ""
  181. unit = 0 (0x0)
  182. drive = "floppy0"
  183. backend_defaults = "auto"
  184. logical_block_size = 512 (512 B)
  185. physical_block_size = 512 (512 B)
  186. min_io_size = 0 (0 B)
  187. opt_io_size = 0 (0 B)
  188. discard_granularity = 4294967295 (4 GiB)
  189. write-cache = "auto"
  190. share-rw = false
  191. drive-type = "288"
  192. dev: isa-parallel, id ""
  193. index = 0 (0x0)
  194. iobase = 888 (0x378)
  195. irq = 7 (0x7)
  196. chardev = "parallel0"
  197. isa irq 7
  198. dev: isa-serial, id ""
  199. index = 0 (0x0)
  200. iobase = 1016 (0x3f8)
  201. irq = 4 (0x4)
  202. isa irq 4
  203. dev: i8257, id ""
  204. base = 192 (0xc0)
  205. page-base = 136 (0x88)
  206. pageh-base = -1 (0xffffffffffffffff)
  207. dshift = 1 (0x1)
  208. dev: i8257, id ""
  209. base = 0 (0x0)
  210. page-base = 128 (0x80)
  211. pageh-base = -1 (0xffffffffffffffff)
  212. dshift = 0 (0x0)
  213. dev: isa-pcspk, id ""
  214. audiodev = ""
  215. iobase = 97 (0x61)
  216. migrate = true
  217. dev: isa-pit, id ""
  218. gpio-in "" 1
  219. gpio-out "" 1
  220. iobase = 64 (0x40)
  221. dev: mc146818rtc, id ""
  222. gpio-out "" 1
  223. base_year = 0 (0x0)
  224. lost_tick_policy = "discard"
  225. dev: isa-i8259, id ""
  226. gpio-in "" 8
  227. gpio-out "" 1
  228. iobase = 160 (0xa0)
  229. elcr_addr = 1233 (0x4d1)
  230. elcr_mask = 222 (0xde)
  231. master = false
  232. dev: isa-i8259, id ""
  233. gpio-in "" 8
  234. gpio-out "" 1
  235. iobase = 32 (0x20)
  236. elcr_addr = 1232 (0x4d0)
  237. elcr_mask = 248 (0xf8)
  238. master = true
  239. dev: i440FX, id ""
  240. addr = 00.0
  241. romfile = ""
  242. romsize = 4294967295 (0xffffffff)
  243. rombar = 1 (0x1)
  244. multifunction = false
  245. x-pcie-lnksta-dllla = true
  246. x-pcie-extcap-init = true
  247. failover_pair_id = ""
  248. acpi-index = 0 (0x0)
  249. class Host bridge, addr 00:00.0, pci id 8086:1237 (sub 1af4:1100)
  250. dev: fw_cfg_io, id ""
  251. dma_enabled = true
  252. x-file-slots = 32 (0x20)
  253. acpi-mr-restore = true
  254. dev: kvmvapic, id ""
  255. (qemu)

仍以自研操作系统环境下的结果进行解析。可以看到,设备的 起点是main-system-bus系统总线 ,其上挂载了hpet和kvm-ioapic等设备,片断如下:

  1. bus: main-system-bus
  2. type System
  3. dev: ps2-mouse, id ""
  4. gpio-out "" 1
  5. dev: ps2-kbd, id ""
  6. gpio-out "" 1
  7. dev: hpet, id ""
  8. gpio-in "" 2
  9. gpio-out "" 1
  10. gpio-out "sysbus-irq" 32
  11. timers = 3 (0x3)
  12. msi = false
  13. hpet-intcap = 4 (0x4)
  14. hpet-offset-saved = true
  15. mmio 00000000fed00000/0000000000000400
  16. dev: ioapic, id ""
  17. gpio-in "" 24
  18. version = 32 (0x20)
  19. mmio 00000000fec00000/0000000000001000
  20. dev: i440FX-pcihost, id ""
  21. pci-hole64-size = 2147483648 (2 GiB)
  22. short_root_bus = 0 (0x0)
  23. x-pci-hole64-fix = true
  24. x-config-reg-migration-enabled = true
  25. bypass-iommu = false
  26. bus: pci.0

当然, 最重要的是北桥i440FX-pcihost 其通过main-system-bus系统总线连接到CPU

北桥的下面连接了一条PCI根总线pci.0 ,就是代码片段的最后一行(笔者是有意为之),大量的设备都挂在了pci.0总线上面。如:PIIX4_PM设备用于电源管理;piix3-ide设备是IDE设备的控制器,其下可以挂IDE总线,IDE总线下面可以挂IDE设备,如硬盘等。片段如下:

  1. bus: pci.0
  2. type PCI
  3. dev: PIIX4_PM, id ""
  4. gpio-out "smi-irq" 1
  5. gpio-out "" 1
  6. smb_io_base = 1792 (0x700)
  7. disable_s3 = 0 (0x0)
  8. disable_s4 = 0 (0x0)
  9. s4_val = 2 (0x2)
  10. acpi-pci-hotplug-with-bridge-support = true
  11. acpi-root-pci-hotplug = true
  12. memory-hotplug-support = true
  13. smm-compat = false
  14. smm-enabled = true
  15. x-not-migrate-acpi-index = false
  16. addr = 01.3
  17. romfile = ""
  18. romsize = 4294967295 (0xffffffff)
  19. rombar = 1 (0x1)
  20. multifunction = false
  21. x-pcie-lnksta-dllla = true
  22. x-pcie-extcap-init = true
  23. failover_pair_id = ""
  24. acpi-index = 0 (0x0)
  25. class Bridge, addr 00:01.3, pci id 8086:7113 (sub 1af4:1100)
  26. bus: i2c
  27. ……
  28. dev: piix3-ide, id ""
  29. addr = 01.1
  30. romfile = ""
  31. romsize = 4294967295 (0xffffffff)
  32. rombar = 1 (0x1)
  33. multifunction = false
  34. x-pcie-lnksta-dllla = true
  35. x-pcie-extcap-init = true
  36. failover_pair_id = ""
  37. acpi-index = 0 (0x0)
  38. class IDE controller, addr 00:01.1, pci id 8086:7010 (sub 1af4:1100)
  39. bar 4: i/o at 0xc040 [0xc04f]
  40. bus: ide.1

PCI根总线当然也可以直接挂PCI设备,如e1000、VGA等。片断如下:

  1. dev: piix3-ide, id ""
  2. addr = 01.1
  3. romfile = ""
  4. romsize = 4294967295 (0xffffffff)
  5. rombar = 1 (0x1)
  6. multifunction = false
  7. x-pcie-lnksta-dllla = true
  8. x-pcie-extcap-init = true
  9. failover_pair_id = ""
  10. acpi-index = 0 (0x0)
  11. class IDE controller, addr 00:01.1, pci id 8086:7010 (sub 1af4:1100)
  12. bar 4: i/o at 0xc040 [0xc04f]
  13. bus: ide.1
  14. type IDE
  15. dev: ide-cd, id ""
  16. drive = "ide1-cd0"
  17. backend_defaults = "auto"
  18. logical_block_size = 512 (512 B)
  19. physical_block_size = 512 (512 B)
  20. min_io_size = 0 (0 B)
  21. opt_io_size = 0 (0 B)
  22. discard_granularity = 512 (512 B)
  23. write-cache = "auto"
  24. share-rw = false
  25. rerror = "auto"
  26. werror = "auto"
  27. ver = "2.5+"
  28. wwn = 0 (0x0)
  29. serial = "QM00003"
  30. model = ""
  31. unit = 0 (0x0)
  32. bus: ide.0
  33. type IDE
  34. dev: e1000, id ""
  35. mac = "52:54:00:12:34:56"
  36. netdev = "hub0port0"
  37. autonegotiation = true
  38. mitigation = true
  39. extra_mac_registers = true
  40. migrate_tso_props = true
  41. init-vet = true
  42. addr = 03.0
  43. romfile = "efi-e1000.rom"
  44. romsize = 262144 (0x40000)
  45. rombar = 1 (0x1)
  46. multifunction = false
  47. x-pcie-lnksta-dllla = true
  48. x-pcie-extcap-init = true
  49. failover_pair_id = ""
  50. acpi-index = 0 (0x0)
  51. class Ethernet controller, addr 00:03.0, pci id 8086:100e (sub 1af4:1100)
  52. bar 0: mem at 0xfebc0000 [0xfebdffff]
  53. bar 1: i/o at 0xc000 [0xc03f]
  54. bar 6: mem at 0xffffffffffffffff [0x3fffe]
  55. dev: VGA, id ""
  56. vgamem_mb = 16 (0x10)
  57. mmio = true
  58. qemu-extended-regs = true
  59. edid = true
  60. xres = 1280 (0x500)
  61. yres = 800 (0x320)
  62. xmax = 0 (0x0)
  63. ymax = 0 (0x0)
  64. refresh_rate = 0 (0x0)
  65. global-vmstate = false
  66. addr = 02.0
  67. romfile = "vgabios-stdvga.bin"
  68. romsize = 65536 (0x10000)
  69. rombar = 1 (0x1)
  70. multifunction = false
  71. x-pcie-lnksta-dllla = true
  72. x-pcie-extcap-init = true
  73. failover_pair_id = ""
  74. acpi-index = 0 (0x0)
  75. class VGA controller, addr 00:02.0, pci id 1234:1111 (sub 1af4:1100)
  76. bar 0: mem at 0xfd000000 [0xfdffffff]
  77. bar 2: mem at 0xfebf0000 [0xfebf0fff]
  78. bar 6: mem at 0xffffffffffffffff [0xfffe]

PIIX3是PCI转ISA桥,下面挂了ISA总线,ISA总线下挂了很多ISA设备。片段如下:

  1. dev: PIIX3, id ""
  2. addr = 01.0
  3. romfile = ""
  4. romsize = 4294967295 (0xffffffff)
  5. rombar = 1 (0x1)
  6. multifunction = true
  7. x-pcie-lnksta-dllla = true
  8. x-pcie-extcap-init = true
  9. failover_pair_id = ""
  10. acpi-index = 0 (0x0)
  11. class ISA bridge, addr 00:01.0, pci id 8086:7000 (sub 1af4:1100)
  12. bus: isa.0
  13. type ISA
  14. dev: port92, id ""
  15. gpio-out "a20" 1
  16. dev: vmmouse, id ""
  17. dev: vmport, id ""
  18. x-read-set-eax = true
  19. x-signal-unsupported-cmd = true
  20. x-report-vmx-type = true
  21. x-cmds-v2 = true
  22. vmware-vmx-version = 6 (0x6)
  23. vmware-vmx-type = 2 (0x2)
  24. dev: i8042, id ""
  25. gpio-in "ps2-mouse-input-irq" 1
  26. gpio-in "ps2-kbd-input-irq" 1
  27. gpio-out "" 2
  28. gpio-out "a20" 1
  29. extended-state = true
  30. kbd-throttle = false
  31. kbd-irq = 1 (0x1)
  32. mouse-irq = 12 (0xc)
  33. dev: isa-fdc, id ""
  34. iobase = 1008 (0x3f0)
  35. ……

i440FX则表示北桥自身在PCI总线这一侧的抽象

  1. dev: i440FX, id ""
  2. addr = 00.0
  3. romfile = ""
  4. romsize = 4294967295 (0xffffffff)
  5. rombar = 1 (0x1)
  6. multifunction = false
  7. x-pcie-lnksta-dllla = true
  8. x-pcie-extcap-init = true
  9. failover_pair_id = ""
  10. acpi-index = 0 (0x0)
  11. class Host bridge, addr 00:00.0, pci id 8086:1237 (sub 1af4:1100)

从上边的结构可以看到, 总线和设备是交替的 设备只能挂在总线下边 ,而总线本身也属于一个设备。

上边介绍的是整个PC的系统结构,包括CPU、内存、外存、设备、中断等,后文书都会一一介绍。

举报

选择你想要举报的内容(必选)
  • 内容涉黄
  • 政治相关
  • 内容抄袭
  • 涉嫌广告
  • 内容侵权
  • 侮辱谩骂
  • 样式问题
  • 其他