block: vpc support for ~2 TB disks

The VHD specification allows for up to a 2 TB disk size. The current
implementation in qemu emulates EIDE and ATA-2 hardware which only allows
for up to 127 GB.  This disk size limitation can be overridden by allowing
up to 255 heads instead of the normal 4 bit limitation of 16.  Doing so
allows disk images to be created of up to nearly 2 TB.  This change does
not violate the VHD format specification nor does it change how smaller
disks (ie, <=127GB) are defined.

[Charles Arnold also writes: "In analyzing a 160 GB VHD fixed disk image
created on Windows 2008 R2, it appears that MS is also ignoring the CHS
values in the footer geometry field in whatever driver they use for
accessing the image.  The CHS values are set at 65535,16,255 which
obviously doesn't represent an image size of 160 GB." -- Stefan]

Signed-off-by: Charles Arnold <carnold@suse.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
1 file changed
tree: 297b5a5c8b66a74ffcc341332f126b19978d8793
  1. audio/
  2. backends/
  3. block/
  4. bsd-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. include/
  12. libcacard/
  13. linux-headers/
  14. linux-user/
  15. net/
  16. pc-bios/
  17. qapi/
  18. qga/
  19. QMP/
  20. qom/
  21. roms/
  22. scripts/
  23. slirp/
  24. stubs/
  25. sysconfigs/
  26. target-alpha/
  27. target-arm/
  28. target-cris/
  29. target-i386/
  30. target-lm32/
  31. target-m68k/
  32. target-microblaze/
  33. target-mips/
  34. target-openrisc/
  35. target-ppc/
  36. target-s390x/
  37. target-sh4/
  38. target-sparc/
  39. target-unicore32/
  40. target-xtensa/
  41. tcg/
  42. tests/
  43. trace/
  44. ui/
  45. .exrc
  46. .gitignore
  47. .gitmodules
  48. .mailmap
  49. a.out.h
  50. acl.c
  51. acl.h
  52. aes.c
  53. aes.h
  54. aio-posix.c
  55. aio-win32.c
  56. alpha-dis.c
  57. alpha.ld
  58. arch_init.c
  59. arch_init.h
  60. arm-dis.c
  61. arm.ld
  62. async.c
  63. balloon.c
  64. balloon.h
  65. bitmap.c
  66. bitmap.h
  67. bitops.c
  68. bitops.h
  69. block-migration.c
  70. block-migration.h
  71. block.c
  72. block.h
  73. block_int.h
  74. blockdev-nbd.c
  75. blockdev.c
  76. blockdev.h
  77. blockjob.c
  78. blockjob.h
  79. bswap.h
  80. bt-host.c
  81. bt-host.h
  82. bt-vhci.c
  83. buffered_file.c
  84. buffered_file.h
  85. cache-utils.c
  86. cache-utils.h
  87. Changelog
  88. cmd.c
  89. cmd.h
  90. CODING_STYLE
  91. compatfd.c
  92. compatfd.h
  93. compiler.h
  94. config.h
  95. configure
  96. console.c
  97. console.h
  98. COPYING
  99. COPYING.LIB
  100. coroutine-gthread.c
  101. coroutine-sigaltstack.c
  102. coroutine-ucontext.c
  103. coroutine-win32.c
  104. cpu-all.h
  105. cpu-common.h
  106. cpu-defs.h
  107. cpu-exec.c
  108. cpus.c
  109. cpus.h
  110. cputlb.c
  111. cputlb.h
  112. cris-dis.c
  113. cursor.c
  114. cursor_hidden.xpm
  115. cursor_left_ptr.xpm
  116. cutils.c
  117. def-helper.h
  118. device_tree.c
  119. device_tree.h
  120. dis-asm.h
  121. disas.c
  122. disas.h
  123. dma-helpers.c
  124. dma.h
  125. dump-stub.c
  126. dump.c
  127. dump.h
  128. elf.h
  129. envlist.c
  130. envlist.h
  131. error.c
  132. error.h
  133. event_notifier-posix.c
  134. event_notifier-win32.c
  135. event_notifier.h
  136. exec-all.h
  137. exec-memory.h
  138. exec.c
  139. gdbstub.c
  140. gdbstub.h
  141. gen-icount.h
  142. HACKING
  143. hmp-commands.hx
  144. hmp.c
  145. hmp.h
  146. host-utils.c
  147. host-utils.h
  148. hppa-dis.c
  149. hppa.ld
  150. hwaddr.h
  151. i386-dis.c
  152. i386.ld
  153. ia64-dis.c
  154. ia64.ld
  155. input.c
  156. int128.h
  157. iohandler.c
  158. ioport.c
  159. ioport.h
  160. iorange.h
  161. iov.c
  162. iov.h
  163. json-lexer.c
  164. json-lexer.h
  165. json-parser.c
  166. json-parser.h
  167. json-streamer.c
  168. json-streamer.h
  169. kvm-all.c
  170. kvm-stub.c
  171. kvm.h
  172. libfdt_env.h
  173. LICENSE
  174. lm32-dis.c
  175. m68k-dis.c
  176. m68k.ld
  177. main-loop.c
  178. main-loop.h
  179. MAINTAINERS
  180. Makefile
  181. Makefile.dis
  182. Makefile.objs
  183. Makefile.target
  184. Makefile.user
  185. memory-internal.h
  186. memory.c
  187. memory.h
  188. memory_mapping-stub.c
  189. memory_mapping.c
  190. memory_mapping.h
  191. microblaze-dis.c
  192. migration-exec.c
  193. migration-fd.c
  194. migration-tcp.c
  195. migration-unix.c
  196. migration.c
  197. migration.h
  198. mips-dis.c
  199. mips.ld
  200. module.c
  201. module.h
  202. monitor.c
  203. monitor.h
  204. nbd.c
  205. nbd.h
  206. net.c
  207. net.h
  208. notify.c
  209. notify.h
  210. os-posix.c
  211. os-win32.c
  212. osdep.c
  213. osdep.h
  214. oslib-posix.c
  215. oslib-win32.c
  216. page_cache.c
  217. path.c
  218. pci-ids.txt
  219. poison.h
  220. ppc-dis.c
  221. ppc.ld
  222. ppc64.ld
  223. qapi-schema-guest.json
  224. qapi-schema-test.json
  225. qapi-schema.json
  226. qbool.c
  227. qbool.h
  228. qdict-test-data.txt
  229. qdict.c
  230. qdict.h
  231. qemu-aio.h
  232. qemu-barrier.h
  233. qemu-bridge-helper.c
  234. qemu-char.c
  235. qemu-char.h
  236. qemu-common.h
  237. qemu-config.c
  238. qemu-config.h
  239. qemu-coroutine-int.h
  240. qemu-coroutine-io.c
  241. qemu-coroutine-lock.c
  242. qemu-coroutine-sleep.c
  243. qemu-coroutine.c
  244. qemu-coroutine.h
  245. qemu-doc.texi
  246. qemu-error.c
  247. qemu-error.h
  248. qemu-file.h
  249. qemu-ga.c
  250. qemu-img-cmds.hx
  251. qemu-img.c
  252. qemu-img.texi
  253. qemu-io.c
  254. qemu-lock.h
  255. qemu-log.c
  256. qemu-log.h
  257. qemu-nbd.c
  258. qemu-nbd.texi
  259. qemu-objects.h
  260. qemu-option-internal.h
  261. qemu-option.c
  262. qemu-option.h
  263. qemu-options-wrapper.h
  264. qemu-options.h
  265. qemu-options.hx
  266. qemu-os-posix.h
  267. qemu-os-win32.h
  268. qemu-pixman.c
  269. qemu-pixman.h
  270. qemu-progress.c
  271. qemu-queue.h
  272. qemu-seccomp.c
  273. qemu-seccomp.h
  274. qemu-sockets.c
  275. qemu-tech.texi
  276. qemu-thread-posix.c
  277. qemu-thread-posix.h
  278. qemu-thread-win32.c
  279. qemu-thread-win32.h
  280. qemu-thread.h
  281. qemu-timer-common.c
  282. qemu-timer.c
  283. qemu-timer.h
  284. qemu-tls.h
  285. qemu-tool.c
  286. qemu-types.h
  287. qemu-user-types.h
  288. qemu-user.c
  289. qemu-x509.h
  290. qemu-xattr.h
  291. qemu.sasl
  292. qemu_socket.h
  293. qerror.c
  294. qerror.h
  295. qfloat.c
  296. qfloat.h
  297. qint.c
  298. qint.h
  299. qjson.c
  300. qjson.h
  301. qlist.c
  302. qlist.h
  303. qmp-commands.hx
  304. qmp.c
  305. qobject.h
  306. qstring.c
  307. qstring.h
  308. qtest.c
  309. qtest.h
  310. range.h
  311. readline.c
  312. readline.h
  313. README
  314. rules.mak
  315. s390-dis.c
  316. s390.ld
  317. savevm.c
  318. sh4-dis.c
  319. softmmu-semi.h
  320. softmmu_defs.h
  321. softmmu_exec.h
  322. softmmu_header.h
  323. softmmu_template.h
  324. sparc-dis.c
  325. sparc.ld
  326. sparc64.ld
  327. spice-qemu-char.c
  328. sysemu.h
  329. tcg-runtime.c
  330. tci-dis.c
  331. tci.c
  332. thread-pool.c
  333. thread-pool.h
  334. thunk.c
  335. thunk.h
  336. TODO
  337. trace-events
  338. translate-all.c
  339. uboot_image.h
  340. uri.c
  341. uri.h
  342. user-exec.c
  343. VERSION
  344. version.rc
  345. vgafont.h
  346. vl.c
  347. vmstate.h
  348. x86_64.ld
  349. xen-all.c
  350. xen-mapcache.c
  351. xen-mapcache.h
  352. xen-stub.c