4 * Copyright (c) 2003-2008 Fabrice Bellard
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 #include <sys/types.h>
34 #include "arch_init.h"
35 #include "audio/audio.h"
38 #include "hw/audiodev.h"
40 #include "migration.h"
43 #include "hw/smbios.h"
44 #include "exec-memory.h"
46 #include "qemu/page_cache.h"
48 #ifdef DEBUG_ARCH_INIT
49 #define DPRINTF(fmt, ...) \
50 do { fprintf(stdout, "arch_init: " fmt, ## __VA_ARGS__); } while (0)
52 #define DPRINTF(fmt, ...) \
57 int graphic_width
= 1024;
58 int graphic_height
= 768;
59 int graphic_depth
= 8;
61 int graphic_width
= 800;
62 int graphic_height
= 600;
63 int graphic_depth
= 15;
67 #if defined(TARGET_ALPHA)
68 #define QEMU_ARCH QEMU_ARCH_ALPHA
69 #elif defined(TARGET_ARM)
70 #define QEMU_ARCH QEMU_ARCH_ARM
71 #elif defined(TARGET_CRIS)
72 #define QEMU_ARCH QEMU_ARCH_CRIS
73 #elif defined(TARGET_I386)
74 #define QEMU_ARCH QEMU_ARCH_I386
75 #elif defined(TARGET_M68K)
76 #define QEMU_ARCH QEMU_ARCH_M68K
77 #elif defined(TARGET_LM32)
78 #define QEMU_ARCH QEMU_ARCH_LM32
79 #elif defined(TARGET_MICROBLAZE)
80 #define QEMU_ARCH QEMU_ARCH_MICROBLAZE
81 #elif defined(TARGET_MIPS)
82 #define QEMU_ARCH QEMU_ARCH_MIPS
83 #elif defined(TARGET_OPENRISC)
84 #define QEMU_ARCH QEMU_ARCH_OPENRISC
85 #elif defined(TARGET_PPC)
86 #define QEMU_ARCH QEMU_ARCH_PPC
87 #elif defined(TARGET_S390X)
88 #define QEMU_ARCH QEMU_ARCH_S390X
89 #elif defined(TARGET_SH4)
90 #define QEMU_ARCH QEMU_ARCH_SH4
91 #elif defined(TARGET_SPARC)
92 #define QEMU_ARCH QEMU_ARCH_SPARC
93 #elif defined(TARGET_XTENSA)
94 #define QEMU_ARCH QEMU_ARCH_XTENSA
97 const uint32_t arch_type
= QEMU_ARCH
;
99 /***********************************************************/
100 /* ram save/restore */
102 #define RAM_SAVE_FLAG_FULL 0x01 /* Obsolete, not used anymore */
103 #define RAM_SAVE_FLAG_COMPRESS 0x02
104 #define RAM_SAVE_FLAG_MEM_SIZE 0x04
105 #define RAM_SAVE_FLAG_PAGE 0x08
106 #define RAM_SAVE_FLAG_EOS 0x10
107 #define RAM_SAVE_FLAG_CONTINUE 0x20
108 #define RAM_SAVE_FLAG_XBZRLE 0x40
112 #define VECTYPE vector unsigned char
113 #define SPLAT(p) vec_splat(vec_ld(0, p), 0)
114 #define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
115 /* altivec.h may redefine the bool macro as vector type.
116 * Reset it to POSIX semantics. */
119 #elif defined __SSE2__
120 #include <emmintrin.h>
121 #define VECTYPE __m128i
122 #define SPLAT(p) _mm_set1_epi8(*(p))
123 #define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF)
125 #define VECTYPE unsigned long
126 #define SPLAT(p) (*(p) * (~0UL / 255))
127 #define ALL_EQ(v1, v2) ((v1) == (v2))
131 static struct defconfig_file
{
132 const char *filename
;
133 /* Indicates it is an user config file (disabled by -no-user-config) */
135 } default_config_files
[] = {
136 { CONFIG_QEMU_DATADIR
"/cpus-" TARGET_ARCH
".conf", false },
137 { CONFIG_QEMU_CONFDIR
"/qemu.conf", true },
138 { CONFIG_QEMU_CONFDIR
"/target-" TARGET_ARCH
".conf", true },
139 { NULL
}, /* end of list */
143 int qemu_read_default_config_files(bool userconfig
)
146 struct defconfig_file
*f
;
148 for (f
= default_config_files
; f
->filename
; f
++) {
149 if (!userconfig
&& f
->userconfig
) {
152 ret
= qemu_read_config_file(f
->filename
);
153 if (ret
< 0 && ret
!= -ENOENT
) {
161 static int is_dup_page(uint8_t *page
)
163 VECTYPE
*p
= (VECTYPE
*)page
;
164 VECTYPE val
= SPLAT(page
);
167 for (i
= 0; i
< TARGET_PAGE_SIZE
/ sizeof(VECTYPE
); i
++) {
168 if (!ALL_EQ(val
, p
[i
])) {
176 /* struct contains XBZRLE cache and a static page
177 used by the compression */
179 /* buffer used for XBZRLE encoding */
180 uint8_t *encoded_buf
;
181 /* buffer for storing page content */
182 uint8_t *current_buf
;
183 /* buffer used for XBZRLE decoding */
184 uint8_t *decoded_buf
;
185 /* Cache for XBZRLE */
195 int64_t xbzrle_cache_resize(int64_t new_size
)
197 if (XBZRLE
.cache
!= NULL
) {
198 return cache_resize(XBZRLE
.cache
, new_size
/ TARGET_PAGE_SIZE
) *
201 return pow2floor(new_size
);
204 /* accounting for migration statistics */
205 typedef struct AccountingInfo
{
211 static AccountingInfo acct_info
;
213 static void acct_clear(void)
215 memset(&acct_info
, 0, sizeof(acct_info
));
218 uint64_t dup_mig_bytes_transferred(void)
220 return acct_info
.dup_pages
* TARGET_PAGE_SIZE
;
223 uint64_t dup_mig_pages_transferred(void)
225 return acct_info
.dup_pages
;
228 uint64_t norm_mig_bytes_transferred(void)
230 return acct_info
.norm_pages
* TARGET_PAGE_SIZE
;
233 uint64_t norm_mig_pages_transferred(void)
235 return acct_info
.norm_pages
;
238 static void save_block_hdr(QEMUFile
*f
, RAMBlock
*block
, ram_addr_t offset
,
241 qemu_put_be64(f
, offset
| cont
| flag
);
243 qemu_put_byte(f
, strlen(block
->idstr
));
244 qemu_put_buffer(f
, (uint8_t *)block
->idstr
,
245 strlen(block
->idstr
));
250 #define ENCODING_FLAG_XBZRLE 0x1
252 static int save_xbzrle_page(QEMUFile
*f
, uint8_t *current_data
,
253 ram_addr_t current_addr
, RAMBlock
*block
,
254 ram_addr_t offset
, int cont
)
256 int encoded_len
= 0, bytes_sent
= -1;
257 uint8_t *prev_cached_page
;
259 if (!cache_is_cached(XBZRLE
.cache
, current_addr
)) {
260 cache_insert(XBZRLE
.cache
, current_addr
,
261 g_memdup(current_data
, TARGET_PAGE_SIZE
));
265 prev_cached_page
= get_cached_data(XBZRLE
.cache
, current_addr
);
267 /* save current buffer into memory */
268 memcpy(XBZRLE
.current_buf
, current_data
, TARGET_PAGE_SIZE
);
270 /* XBZRLE encoding (if there is no overflow) */
271 encoded_len
= xbzrle_encode_buffer(prev_cached_page
, XBZRLE
.current_buf
,
272 TARGET_PAGE_SIZE
, XBZRLE
.encoded_buf
,
274 if (encoded_len
== 0) {
275 DPRINTF("Skipping unmodified page\n");
277 } else if (encoded_len
== -1) {
278 DPRINTF("Overflow\n");
279 /* update data in the cache */
280 memcpy(prev_cached_page
, current_data
, TARGET_PAGE_SIZE
);
284 /* we need to update the data in the cache, in order to get the same data */
285 memcpy(prev_cached_page
, XBZRLE
.current_buf
, TARGET_PAGE_SIZE
);
287 /* Send XBZRLE based compressed page */
288 save_block_hdr(f
, block
, offset
, cont
, RAM_SAVE_FLAG_XBZRLE
);
289 qemu_put_byte(f
, ENCODING_FLAG_XBZRLE
);
290 qemu_put_be16(f
, encoded_len
);
291 qemu_put_buffer(f
, XBZRLE
.encoded_buf
, encoded_len
);
292 bytes_sent
= encoded_len
+ 1 + 2;
297 static RAMBlock
*last_block
;
298 static ram_addr_t last_offset
;
301 * ram_save_block: Writes a page of memory to the stream f
303 * Returns: 0: if the page hasn't changed
304 * -1: if there are no more dirty pages
305 * n: the amount of bytes written in other case
308 static int ram_save_block(QEMUFile
*f
)
310 RAMBlock
*block
= last_block
;
311 ram_addr_t offset
= last_offset
;
314 ram_addr_t current_addr
;
317 block
= QLIST_FIRST(&ram_list
.blocks
);
321 if (memory_region_get_dirty(mr
, offset
, TARGET_PAGE_SIZE
,
322 DIRTY_MEMORY_MIGRATION
)) {
324 int cont
= (block
== last_block
) ? RAM_SAVE_FLAG_CONTINUE
: 0;
326 memory_region_reset_dirty(mr
, offset
, TARGET_PAGE_SIZE
,
327 DIRTY_MEMORY_MIGRATION
);
329 p
= memory_region_get_ram_ptr(mr
) + offset
;
331 if (is_dup_page(p
)) {
332 acct_info
.dup_pages
++;
333 save_block_hdr(f
, block
, offset
, cont
, RAM_SAVE_FLAG_COMPRESS
);
334 qemu_put_byte(f
, *p
);
336 } else if (migrate_use_xbzrle()) {
337 current_addr
= block
->offset
+ offset
;
338 bytes_sent
= save_xbzrle_page(f
, p
, current_addr
, block
,
340 p
= get_cached_data(XBZRLE
.cache
, current_addr
);
343 /* either we didn't send yet (we may have had XBZRLE overflow) */
344 if (bytes_sent
== -1) {
345 save_block_hdr(f
, block
, offset
, cont
, RAM_SAVE_FLAG_PAGE
);
346 qemu_put_buffer(f
, p
, TARGET_PAGE_SIZE
);
347 bytes_sent
= TARGET_PAGE_SIZE
;
348 acct_info
.norm_pages
++;
351 /* if page is unmodified, continue to the next */
352 if (bytes_sent
!= 0) {
357 offset
+= TARGET_PAGE_SIZE
;
358 if (offset
>= block
->length
) {
360 block
= QLIST_NEXT(block
, next
);
362 block
= QLIST_FIRST(&ram_list
.blocks
);
364 } while (block
!= last_block
|| offset
!= last_offset
);
367 last_offset
= offset
;
372 static uint64_t bytes_transferred
;
374 static ram_addr_t
ram_save_remaining(void)
376 return ram_list
.dirty_pages
;
379 uint64_t ram_bytes_remaining(void)
381 return ram_save_remaining() * TARGET_PAGE_SIZE
;
384 uint64_t ram_bytes_transferred(void)
386 return bytes_transferred
;
389 uint64_t ram_bytes_total(void)
394 QLIST_FOREACH(block
, &ram_list
.blocks
, next
)
395 total
+= block
->length
;
400 static int block_compar(const void *a
, const void *b
)
402 RAMBlock
* const *ablock
= a
;
403 RAMBlock
* const *bblock
= b
;
405 return strcmp((*ablock
)->idstr
, (*bblock
)->idstr
);
408 static void sort_ram_list(void)
410 RAMBlock
*block
, *nblock
, **blocks
;
413 QLIST_FOREACH(block
, &ram_list
.blocks
, next
) {
416 blocks
= g_malloc(n
* sizeof *blocks
);
418 QLIST_FOREACH_SAFE(block
, &ram_list
.blocks
, next
, nblock
) {
420 QLIST_REMOVE(block
, next
);
422 qsort(blocks
, n
, sizeof *blocks
, block_compar
);
424 QLIST_INSERT_HEAD(&ram_list
.blocks
, blocks
[n
], next
);
429 static void migration_end(void)
431 memory_global_dirty_log_stop();
433 if (migrate_use_xbzrle()) {
434 cache_fini(XBZRLE
.cache
);
435 g_free(XBZRLE
.cache
);
436 g_free(XBZRLE
.encoded_buf
);
437 g_free(XBZRLE
.current_buf
);
438 g_free(XBZRLE
.decoded_buf
);
443 static void ram_migration_cancel(void *opaque
)
448 #define MAX_WAIT 50 /* ms, half buffered_file limit */
450 static int ram_save_setup(QEMUFile
*f
, void *opaque
)
455 bytes_transferred
= 0;
460 if (migrate_use_xbzrle()) {
461 XBZRLE
.cache
= cache_init(migrate_xbzrle_cache_size() /
465 DPRINTF("Error creating cache\n");
468 XBZRLE
.encoded_buf
= g_malloc0(TARGET_PAGE_SIZE
);
469 XBZRLE
.current_buf
= g_malloc(TARGET_PAGE_SIZE
);
473 /* Make sure all dirty bits are set */
474 QLIST_FOREACH(block
, &ram_list
.blocks
, next
) {
475 for (addr
= 0; addr
< block
->length
; addr
+= TARGET_PAGE_SIZE
) {
476 if (!memory_region_get_dirty(block
->mr
, addr
, TARGET_PAGE_SIZE
,
477 DIRTY_MEMORY_MIGRATION
)) {
478 memory_region_set_dirty(block
->mr
, addr
, TARGET_PAGE_SIZE
);
483 memory_global_dirty_log_start();
485 qemu_put_be64(f
, ram_bytes_total() | RAM_SAVE_FLAG_MEM_SIZE
);
487 QLIST_FOREACH(block
, &ram_list
.blocks
, next
) {
488 qemu_put_byte(f
, strlen(block
->idstr
));
489 qemu_put_buffer(f
, (uint8_t *)block
->idstr
, strlen(block
->idstr
));
490 qemu_put_be64(f
, block
->length
);
493 qemu_put_be64(f
, RAM_SAVE_FLAG_EOS
);
498 static int ram_save_iterate(QEMUFile
*f
, void *opaque
)
500 uint64_t bytes_transferred_last
;
504 uint64_t expected_time
;
506 bytes_transferred_last
= bytes_transferred
;
507 bwidth
= qemu_get_clock_ns(rt_clock
);
510 while ((ret
= qemu_file_rate_limit(f
)) == 0) {
513 bytes_sent
= ram_save_block(f
);
514 /* no more blocks to sent */
515 if (bytes_sent
< 0) {
518 bytes_transferred
+= bytes_sent
;
519 acct_info
.iterations
++;
520 /* we want to check in the 1st loop, just in case it was the 1st time
521 and we had to sync the dirty bitmap.
522 qemu_get_clock_ns() is a bit expensive, so we only check each some
526 uint64_t t1
= (qemu_get_clock_ns(rt_clock
) - bwidth
) / 1000000;
528 DPRINTF("big wait: " PRIu64
" milliseconds, %d iterations\n",
540 bwidth
= qemu_get_clock_ns(rt_clock
) - bwidth
;
541 bwidth
= (bytes_transferred
- bytes_transferred_last
) / bwidth
;
543 /* if we haven't transferred anything this round, force expected_time to a
544 * a very high value, but without crashing */
549 qemu_put_be64(f
, RAM_SAVE_FLAG_EOS
);
551 expected_time
= ram_save_remaining() * TARGET_PAGE_SIZE
/ bwidth
;
553 DPRINTF("ram_save_live: expected(" PRIu64
") <= max(" PRIu64
")?\n",
554 expected_time
, migrate_max_downtime());
556 if (expected_time
<= migrate_max_downtime()) {
557 memory_global_sync_dirty_bitmap(get_system_memory());
558 expected_time
= ram_save_remaining() * TARGET_PAGE_SIZE
/ bwidth
;
560 return expected_time
<= migrate_max_downtime();
565 static int ram_save_complete(QEMUFile
*f
, void *opaque
)
567 memory_global_sync_dirty_bitmap(get_system_memory());
569 /* try transferring iterative blocks of memory */
571 /* flush all remaining blocks regardless of rate limiting */
575 bytes_sent
= ram_save_block(f
);
576 /* no more blocks to sent */
577 if (bytes_sent
< 0) {
580 bytes_transferred
+= bytes_sent
;
582 memory_global_dirty_log_stop();
584 qemu_put_be64(f
, RAM_SAVE_FLAG_EOS
);
589 static int load_xbzrle(QEMUFile
*f
, ram_addr_t addr
, void *host
)
595 if (!XBZRLE
.decoded_buf
) {
596 XBZRLE
.decoded_buf
= g_malloc(TARGET_PAGE_SIZE
);
599 /* extract RLE header */
600 xh_flags
= qemu_get_byte(f
);
601 xh_len
= qemu_get_be16(f
);
603 if (xh_flags
!= ENCODING_FLAG_XBZRLE
) {
604 fprintf(stderr
, "Failed to load XBZRLE page - wrong compression!\n");
608 if (xh_len
> TARGET_PAGE_SIZE
) {
609 fprintf(stderr
, "Failed to load XBZRLE page - len overflow!\n");
612 /* load data and decode */
613 qemu_get_buffer(f
, XBZRLE
.decoded_buf
, xh_len
);
616 ret
= xbzrle_decode_buffer(XBZRLE
.decoded_buf
, xh_len
, host
,
619 fprintf(stderr
, "Failed to load XBZRLE page - decode error!\n");
621 } else if (ret
> TARGET_PAGE_SIZE
) {
622 fprintf(stderr
, "Failed to load XBZRLE page - size %d exceeds %d!\n",
623 ret
, TARGET_PAGE_SIZE
);
630 static inline void *host_from_stream_offset(QEMUFile
*f
,
634 static RAMBlock
*block
= NULL
;
638 if (flags
& RAM_SAVE_FLAG_CONTINUE
) {
640 fprintf(stderr
, "Ack, bad migration stream!\n");
644 return memory_region_get_ram_ptr(block
->mr
) + offset
;
647 len
= qemu_get_byte(f
);
648 qemu_get_buffer(f
, (uint8_t *)id
, len
);
651 QLIST_FOREACH(block
, &ram_list
.blocks
, next
) {
652 if (!strncmp(id
, block
->idstr
, sizeof(id
)))
653 return memory_region_get_ram_ptr(block
->mr
) + offset
;
656 fprintf(stderr
, "Can't find block %s!\n", id
);
660 static int ram_load(QEMUFile
*f
, void *opaque
, int version_id
)
665 static uint64_t seq_iter
;
669 if (version_id
< 4 || version_id
> 4) {
674 addr
= qemu_get_be64(f
);
676 flags
= addr
& ~TARGET_PAGE_MASK
;
677 addr
&= TARGET_PAGE_MASK
;
679 if (flags
& RAM_SAVE_FLAG_MEM_SIZE
) {
680 if (version_id
== 4) {
681 /* Synchronize RAM block list */
684 ram_addr_t total_ram_bytes
= addr
;
686 while (total_ram_bytes
) {
690 len
= qemu_get_byte(f
);
691 qemu_get_buffer(f
, (uint8_t *)id
, len
);
693 length
= qemu_get_be64(f
);
695 QLIST_FOREACH(block
, &ram_list
.blocks
, next
) {
696 if (!strncmp(id
, block
->idstr
, sizeof(id
))) {
697 if (block
->length
!= length
) {
706 fprintf(stderr
, "Unknown ramblock \"%s\", cannot "
707 "accept migration\n", id
);
712 total_ram_bytes
-= length
;
717 if (flags
& RAM_SAVE_FLAG_COMPRESS
) {
721 host
= host_from_stream_offset(f
, addr
, flags
);
726 ch
= qemu_get_byte(f
);
727 memset(host
, ch
, TARGET_PAGE_SIZE
);
730 (!kvm_enabled() || kvm_has_sync_mmu())) {
731 qemu_madvise(host
, TARGET_PAGE_SIZE
, QEMU_MADV_DONTNEED
);
734 } else if (flags
& RAM_SAVE_FLAG_PAGE
) {
737 host
= host_from_stream_offset(f
, addr
, flags
);
742 qemu_get_buffer(f
, host
, TARGET_PAGE_SIZE
);
743 } else if (flags
& RAM_SAVE_FLAG_XBZRLE
) {
744 if (!migrate_use_xbzrle()) {
747 void *host
= host_from_stream_offset(f
, addr
, flags
);
752 if (load_xbzrle(f
, addr
, host
) < 0) {
757 error
= qemu_file_get_error(f
);
762 } while (!(flags
& RAM_SAVE_FLAG_EOS
));
765 DPRINTF("Completed load of VM with exit code %d seq iteration " PRIu64
"\n",
770 SaveVMHandlers savevm_ram_handlers
= {
771 .save_live_setup
= ram_save_setup
,
772 .save_live_iterate
= ram_save_iterate
,
773 .save_live_complete
= ram_save_complete
,
774 .load_state
= ram_load
,
775 .cancel
= ram_migration_cancel
,
785 int (*init_isa
) (ISABus
*bus
);
786 int (*init_pci
) (PCIBus
*bus
);
790 static struct soundhw soundhw
[] = {
791 #ifdef HAS_AUDIO_CHOICE
798 { .init_isa
= pcspk_audio_init
}
805 "Creative Sound Blaster 16",
808 { .init_isa
= SB16_init
}
812 #ifdef CONFIG_CS4231A
818 { .init_isa
= cs4231a_init
}
826 "Yamaha YMF262 (OPL3)",
828 "Yamaha YM3812 (OPL2)",
832 { .init_isa
= Adlib_init
}
839 "Gravis Ultrasound GF1",
842 { .init_isa
= GUS_init
}
849 "Intel 82801AA AC97 Audio",
852 { .init_pci
= ac97_init
}
859 "ENSONIQ AudioPCI ES1370",
862 { .init_pci
= es1370_init
}
872 { .init_pci
= intel_hda_and_codec_init
}
876 #endif /* HAS_AUDIO_CHOICE */
878 { NULL
, NULL
, 0, 0, { NULL
} }
881 void select_soundhw(const char *optarg
)
885 if (is_help_option(optarg
)) {
888 printf("Valid sound card names (comma separated):\n");
889 for (c
= soundhw
; c
->name
; ++c
) {
890 printf ("%-11s %s\n", c
->name
, c
->descr
);
892 printf("\n-soundhw all will enable all of the above\n");
893 exit(!is_help_option(optarg
));
901 if (!strcmp(optarg
, "all")) {
902 for (c
= soundhw
; c
->name
; ++c
) {
911 l
= !e
? strlen(p
) : (size_t) (e
- p
);
913 for (c
= soundhw
; c
->name
; ++c
) {
914 if (!strncmp(c
->name
, p
, l
) && !c
->name
[l
]) {
923 "Unknown sound card name (too big to show)\n");
926 fprintf(stderr
, "Unknown sound card name `%.*s'\n",
931 p
+= l
+ (e
!= NULL
);
935 goto show_valid_cards
;
940 void audio_init(ISABus
*isa_bus
, PCIBus
*pci_bus
)
944 for (c
= soundhw
; c
->name
; ++c
) {
948 c
->init
.init_isa(isa_bus
);
952 c
->init
.init_pci(pci_bus
);
959 void select_soundhw(const char *optarg
)
962 void audio_init(ISABus
*isa_bus
, PCIBus
*pci_bus
)
967 int qemu_uuid_parse(const char *str
, uint8_t *uuid
)
971 if (strlen(str
) != 36) {
975 ret
= sscanf(str
, UUID_FMT
, &uuid
[0], &uuid
[1], &uuid
[2], &uuid
[3],
976 &uuid
[4], &uuid
[5], &uuid
[6], &uuid
[7], &uuid
[8], &uuid
[9],
977 &uuid
[10], &uuid
[11], &uuid
[12], &uuid
[13], &uuid
[14],
984 smbios_add_field(1, offsetof(struct smbios_type_1
, uuid
), 16, uuid
);
989 void do_acpitable_option(const char *optarg
)
992 if (acpi_table_add(optarg
) < 0) {
993 fprintf(stderr
, "Wrong acpi table provided\n");
999 void do_smbios_option(const char *optarg
)
1002 if (smbios_entry_add(optarg
) < 0) {
1003 fprintf(stderr
, "Wrong smbios provided\n");
1009 void cpudef_init(void)
1011 #if defined(cpudef_setup)
1012 cpudef_setup(); /* parse cpu definitions in target config file */
1016 int audio_available(void)
1025 int tcg_available(void)
1030 int kvm_available(void)
1039 int xen_available(void)