mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging
Block layer patches - Fix missing block_acct_setup() with -blockdev - Keep auto_backing_file post-migration - file-posix: Fixed O_DIRECT memory alignment - ide: Fix state after EXECUTE DEVICE DIAGNOSTIC and implement INITIALIZE DEVICE PARAMETERS - qemu-img: Wean documentation and help output off '?' for help - qcow2: fix memory leak and compiler warning - Code cleanups # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmM3Hm4RHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9ZhqA//WGN9tlx3Pf1D6SG3PtIG6/2DOJ6/gVNw # R17BwoGTw36Nmt9xDzrHih753dcguLS19Kd6EySTg6j8mPogmFszquORMgGmcYcW # 0KtneRR7Y9XsamIGgentek1zsWajsP5muvZQF+hFJyZ24MZtWB+5Ucw2VuUTWnRl # YaKP/tGMP5sC8nK3Npste/o7yh9Wgv4cv/mdKuyKoxjZhELeTTpHoTC2IZK9bV5I # Bh19zjPRUPodm37nzONruUVzn53xKK3Qn26ZT5Hgx39HOdccPEu9N8wawQyqLr/x # 2whcn8kFfpFBLLxVbMYjwcWNo41SCn1itRcgV38PilBvG2UInUFK2QCmVgYxWluB # 9I5sRasfD3/BPPmw3n+j2TRJ+uvrLkkwXqIhAg+mAeiS0MccWUnLhJLW2S1Yai5L # nkjkLmuV7KCLQTY39WvKBq0TPgj3QR0WJtEYHuUDtduvzKxAWd47Ff1tEPvFm5Ys # RpmLSUQdPZiOkiwnV1qVg6a3gbIjUcT0Pai/Knc3iYrwCWLdNSCGoPkVemOg5wvN # GxsQcKnfayQqIdZU6lBQehUjPamm3ffAEELeqLQXCbZe9lsbhNBXLJjVnA3cOu3f # 1PX6w+4MNeTg5ZekUJGS1fnYlq9CDOWGSv37+csB8dBhi6vQTc6YjABWU1IrB0S5 # 1ihOYtc8fOo= # =IIJz # -----END PGP SIGNATURE----- # gpg: Signature made Fri 30 Sep 2022 12:50:54 EDT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * tag 'for-upstream' of git://repo.or.cz/qemu/kevin: hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS command tests/qtest/ide-test: Verify that DIAGNOSTIC clears DEV to zero hw/ide/core: Clear LBA and drive bits for EXECUTE DEVICE DIAGNOSTIC tests/qtest/ide-test.c: Create disk image for use as a secondary piix_ide_reset: Use pci_set_* functions instead of direct access block: use the request length for iov alignment block: move bdrv_qiov_is_aligned to file-posix iotests/backing-file-invalidation: Add new test block/qed: Keep auto_backing_file if possible block/qcow2: Keep auto_backing_file if possible gluster: stop using .bdrv_needs_filename block: make serializing requests functions 'void' block: use bdrv_is_sg() helper instead of raw bs->sg reading block: add missed block_acct_setup with new block device init procedure block: pass OnOffAuto instead of bool to block_acct_setup() qemu-img: Wean documentation and help output off '?' for help block/qcow2-bitmap: Add missing cast to silent GCC error qcow2: fix memory leak in qcow2_read_extensions Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
+22
-4
@@ -38,13 +38,31 @@ void block_acct_init(BlockAcctStats *stats)
|
||||
if (qtest_enabled()) {
|
||||
clock_type = QEMU_CLOCK_VIRTUAL;
|
||||
}
|
||||
stats->account_invalid = true;
|
||||
stats->account_failed = true;
|
||||
}
|
||||
|
||||
void block_acct_setup(BlockAcctStats *stats, bool account_invalid,
|
||||
bool account_failed)
|
||||
static bool bool_from_onoffauto(OnOffAuto val, bool def)
|
||||
{
|
||||
stats->account_invalid = account_invalid;
|
||||
stats->account_failed = account_failed;
|
||||
switch (val) {
|
||||
case ON_OFF_AUTO_AUTO:
|
||||
return def;
|
||||
case ON_OFF_AUTO_ON:
|
||||
return true;
|
||||
case ON_OFF_AUTO_OFF:
|
||||
return false;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
|
||||
enum OnOffAuto account_failed)
|
||||
{
|
||||
stats->account_invalid = bool_from_onoffauto(account_invalid,
|
||||
stats->account_invalid);
|
||||
stats->account_failed = bool_from_onoffauto(account_failed,
|
||||
stats->account_failed);
|
||||
}
|
||||
|
||||
void block_acct_cleanup(BlockAcctStats *stats)
|
||||
|
||||
+23
-1
@@ -1295,7 +1295,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (bs->sg || S_ISBLK(st.st_mode)) {
|
||||
if (bdrv_is_sg(bs) || S_ISBLK(st.st_mode)) {
|
||||
int ret = hdev_get_max_hw_transfer(s->fd, &st);
|
||||
|
||||
if (ret > 0 && ret <= BDRV_REQUEST_MAX_BYTES) {
|
||||
@@ -2061,6 +2061,28 @@ static int coroutine_fn raw_thread_pool_submit(BlockDriverState *bs,
|
||||
return thread_pool_submit_co(pool, func, arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if all memory in this vector is sector aligned.
|
||||
*/
|
||||
static bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
|
||||
{
|
||||
int i;
|
||||
size_t alignment = bdrv_min_mem_align(bs);
|
||||
size_t len = bs->bl.request_alignment;
|
||||
IO_CODE();
|
||||
|
||||
for (i = 0; i < qiov->niov; i++) {
|
||||
if ((uintptr_t) qiov->iov[i].iov_base % alignment) {
|
||||
return false;
|
||||
}
|
||||
if (qiov->iov[i].iov_len % len) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int coroutine_fn raw_co_prw(BlockDriverState *bs, uint64_t offset,
|
||||
uint64_t bytes, QEMUIOVector *qiov, int type)
|
||||
{
|
||||
|
||||
@@ -1555,7 +1555,6 @@ static BlockDriver bdrv_gluster = {
|
||||
.format_name = "gluster",
|
||||
.protocol_name = "gluster",
|
||||
.instance_size = sizeof(BDRVGlusterState),
|
||||
.bdrv_needs_filename = false,
|
||||
.bdrv_file_open = qemu_gluster_open,
|
||||
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
|
||||
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
|
||||
@@ -1585,7 +1584,6 @@ static BlockDriver bdrv_gluster_tcp = {
|
||||
.format_name = "gluster",
|
||||
.protocol_name = "gluster+tcp",
|
||||
.instance_size = sizeof(BDRVGlusterState),
|
||||
.bdrv_needs_filename = false,
|
||||
.bdrv_file_open = qemu_gluster_open,
|
||||
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
|
||||
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
|
||||
@@ -1615,7 +1613,6 @@ static BlockDriver bdrv_gluster_unix = {
|
||||
.format_name = "gluster",
|
||||
.protocol_name = "gluster+unix",
|
||||
.instance_size = sizeof(BDRVGlusterState),
|
||||
.bdrv_needs_filename = true,
|
||||
.bdrv_file_open = qemu_gluster_open,
|
||||
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
|
||||
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
|
||||
@@ -1651,7 +1648,6 @@ static BlockDriver bdrv_gluster_rdma = {
|
||||
.format_name = "gluster",
|
||||
.protocol_name = "gluster+rdma",
|
||||
.instance_size = sizeof(BDRVGlusterState),
|
||||
.bdrv_needs_filename = true,
|
||||
.bdrv_file_open = qemu_gluster_open,
|
||||
.bdrv_reopen_prepare = qemu_gluster_reopen_prepare,
|
||||
.bdrv_reopen_commit = qemu_gluster_reopen_commit,
|
||||
|
||||
+7
-37
@@ -828,20 +828,16 @@ bdrv_find_conflicting_request(BdrvTrackedRequest *self)
|
||||
}
|
||||
|
||||
/* Called with self->bs->reqs_lock held */
|
||||
static bool coroutine_fn
|
||||
static void coroutine_fn
|
||||
bdrv_wait_serialising_requests_locked(BdrvTrackedRequest *self)
|
||||
{
|
||||
BdrvTrackedRequest *req;
|
||||
bool waited = false;
|
||||
|
||||
while ((req = bdrv_find_conflicting_request(self))) {
|
||||
self->waiting_for = req;
|
||||
qemu_co_queue_wait(&req->wait_queue, &self->bs->reqs_lock);
|
||||
self->waiting_for = NULL;
|
||||
waited = true;
|
||||
}
|
||||
|
||||
return waited;
|
||||
}
|
||||
|
||||
/* Called with req->bs->reqs_lock held */
|
||||
@@ -934,36 +930,31 @@ void bdrv_dec_in_flight(BlockDriverState *bs)
|
||||
bdrv_wakeup(bs);
|
||||
}
|
||||
|
||||
static bool coroutine_fn bdrv_wait_serialising_requests(BdrvTrackedRequest *self)
|
||||
static void coroutine_fn
|
||||
bdrv_wait_serialising_requests(BdrvTrackedRequest *self)
|
||||
{
|
||||
BlockDriverState *bs = self->bs;
|
||||
bool waited = false;
|
||||
|
||||
if (!qatomic_read(&bs->serialising_in_flight)) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_co_mutex_lock(&bs->reqs_lock);
|
||||
waited = bdrv_wait_serialising_requests_locked(self);
|
||||
bdrv_wait_serialising_requests_locked(self);
|
||||
qemu_co_mutex_unlock(&bs->reqs_lock);
|
||||
|
||||
return waited;
|
||||
}
|
||||
|
||||
bool coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req,
|
||||
void coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req,
|
||||
uint64_t align)
|
||||
{
|
||||
bool waited;
|
||||
IO_CODE();
|
||||
|
||||
qemu_co_mutex_lock(&req->bs->reqs_lock);
|
||||
|
||||
tracked_request_set_serialising(req, align);
|
||||
waited = bdrv_wait_serialising_requests_locked(req);
|
||||
bdrv_wait_serialising_requests_locked(req);
|
||||
|
||||
qemu_co_mutex_unlock(&req->bs->reqs_lock);
|
||||
|
||||
return waited;
|
||||
}
|
||||
|
||||
int bdrv_check_qiov_request(int64_t offset, int64_t bytes,
|
||||
@@ -3236,27 +3227,6 @@ void *qemu_try_blockalign0(BlockDriverState *bs, size_t size)
|
||||
return mem;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if all memory in this vector is sector aligned.
|
||||
*/
|
||||
bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
|
||||
{
|
||||
int i;
|
||||
size_t alignment = bdrv_min_mem_align(bs);
|
||||
IO_CODE();
|
||||
|
||||
for (i = 0; i < qiov->niov; i++) {
|
||||
if ((uintptr_t) qiov->iov[i].iov_base % alignment) {
|
||||
return false;
|
||||
}
|
||||
if (qiov->iov[i].iov_len % alignment) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void bdrv_io_plug(BlockDriverState *bs)
|
||||
{
|
||||
BdrvChild *child;
|
||||
|
||||
+1
-1
@@ -2065,7 +2065,7 @@ static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)
|
||||
uint64_t max_xfer_len = iscsilun->use_16_for_rw ? 0xffffffff : 0xffff;
|
||||
unsigned int block_size = MAX(BDRV_SECTOR_SIZE, iscsilun->block_size);
|
||||
|
||||
assert(iscsilun->block_size >= BDRV_SECTOR_SIZE || bs->sg);
|
||||
assert(iscsilun->block_size >= BDRV_SECTOR_SIZE || bdrv_is_sg(bs));
|
||||
|
||||
bs->bl.request_alignment = block_size;
|
||||
|
||||
|
||||
@@ -1208,7 +1208,7 @@ int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp)
|
||||
}
|
||||
}
|
||||
|
||||
g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false);
|
||||
g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, (gpointer)false);
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
|
||||
+17
-5
@@ -275,6 +275,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "ERROR: ext_feature_table: "
|
||||
"Could not read table");
|
||||
g_free(feature_table);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1696,16 +1697,27 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->image_backing_file = g_malloc(len + 1);
|
||||
ret = bdrv_pread(bs->file, header.backing_file_offset, len,
|
||||
bs->auto_backing_file, 0);
|
||||
s->image_backing_file, 0);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Could not read backing file name");
|
||||
goto fail;
|
||||
}
|
||||
bs->auto_backing_file[len] = '\0';
|
||||
pstrcpy(bs->backing_file, sizeof(bs->backing_file),
|
||||
bs->auto_backing_file);
|
||||
s->image_backing_file = g_strdup(bs->auto_backing_file);
|
||||
s->image_backing_file[len] = '\0';
|
||||
|
||||
/*
|
||||
* Update only when something has changed. This function is called by
|
||||
* qcow2_co_invalidate_cache(), and we do not want to reset
|
||||
* auto_backing_file unless necessary.
|
||||
*/
|
||||
if (!g_str_equal(s->image_backing_file, bs->backing_file)) {
|
||||
pstrcpy(bs->backing_file, sizeof(bs->backing_file),
|
||||
s->image_backing_file);
|
||||
pstrcpy(bs->auto_backing_file, sizeof(bs->auto_backing_file),
|
||||
s->image_backing_file);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+11
-4
@@ -445,6 +445,8 @@ static int coroutine_fn bdrv_qed_do_open(BlockDriverState *bs, QDict *options,
|
||||
}
|
||||
|
||||
if ((s->header.features & QED_F_BACKING_FILE)) {
|
||||
g_autofree char *backing_file_str = NULL;
|
||||
|
||||
if ((uint64_t)s->header.backing_filename_offset +
|
||||
s->header.backing_filename_size >
|
||||
s->header.cluster_size * s->header.header_size) {
|
||||
@@ -452,16 +454,21 @@ static int coroutine_fn bdrv_qed_do_open(BlockDriverState *bs, QDict *options,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
backing_file_str = g_malloc(sizeof(bs->backing_file));
|
||||
ret = qed_read_string(bs->file, s->header.backing_filename_offset,
|
||||
s->header.backing_filename_size,
|
||||
bs->auto_backing_file,
|
||||
sizeof(bs->auto_backing_file));
|
||||
backing_file_str, sizeof(bs->backing_file));
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Failed to read backing filename");
|
||||
return ret;
|
||||
}
|
||||
pstrcpy(bs->backing_file, sizeof(bs->backing_file),
|
||||
bs->auto_backing_file);
|
||||
|
||||
if (!g_str_equal(backing_file_str, bs->backing_file)) {
|
||||
pstrcpy(bs->backing_file, sizeof(bs->backing_file),
|
||||
backing_file_str);
|
||||
pstrcpy(bs->auto_backing_file, sizeof(bs->auto_backing_file),
|
||||
backing_file_str);
|
||||
}
|
||||
|
||||
if (s->header.features & QED_F_BACKING_FORMAT_NO_PROBE) {
|
||||
pstrcpy(bs->backing_format, sizeof(bs->backing_format), "raw");
|
||||
|
||||
+2
-2
@@ -463,7 +463,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bs->sg = bs->file->bs->sg;
|
||||
bs->sg = bdrv_is_sg(bs->file->bs);
|
||||
bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
|
||||
(BDRV_REQ_FUA & bs->file->bs->supported_write_flags);
|
||||
bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
|
||||
@@ -489,7 +489,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (bs->sg && (s->offset || s->has_size)) {
|
||||
if (bdrv_is_sg(bs) && (s->offset || s->has_size)) {
|
||||
error_setg(errp, "Cannot use offset/size with SCSI generic devices");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+14
-3
@@ -455,6 +455,17 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
|
||||
}
|
||||
}
|
||||
|
||||
static OnOffAuto account_get_opt(QemuOpts *opts, const char *name)
|
||||
{
|
||||
if (!qemu_opt_find(opts, name)) {
|
||||
return ON_OFF_AUTO_AUTO;
|
||||
}
|
||||
if (qemu_opt_get_bool(opts, name, true)) {
|
||||
return ON_OFF_AUTO_ON;
|
||||
}
|
||||
return ON_OFF_AUTO_OFF;
|
||||
}
|
||||
|
||||
/* Takes the ownership of bs_opts */
|
||||
static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
|
||||
Error **errp)
|
||||
@@ -462,7 +473,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
|
||||
const char *buf;
|
||||
int bdrv_flags = 0;
|
||||
int on_read_error, on_write_error;
|
||||
bool account_invalid, account_failed;
|
||||
OnOffAuto account_invalid, account_failed;
|
||||
bool writethrough, read_only;
|
||||
BlockBackend *blk;
|
||||
BlockDriverState *bs;
|
||||
@@ -496,8 +507,8 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
|
||||
/* extract parameters */
|
||||
snapshot = qemu_opt_get_bool(opts, "snapshot", 0);
|
||||
|
||||
account_invalid = qemu_opt_get_bool(opts, "stats-account-invalid", true);
|
||||
account_failed = qemu_opt_get_bool(opts, "stats-account-failed", true);
|
||||
account_invalid = account_get_opt(opts, "stats-account-invalid");
|
||||
account_failed = account_get_opt(opts, "stats-account-failed");
|
||||
|
||||
writethrough = !qemu_opt_get_bool(opts, BDRV_OPT_CACHE_WB, true);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ cases. See below for a description of the supported disk formats.
|
||||
*OUTPUT_FMT* is the destination format.
|
||||
|
||||
*OPTIONS* is a comma separated list of format specific options in a
|
||||
name=value format. Use ``-o ?`` for an overview of the options supported
|
||||
name=value format. Use ``-o help`` for an overview of the options supported
|
||||
by the used format or see the format descriptions below for details.
|
||||
|
||||
*SNAPSHOT_PARAM* is param used for internal snapshot, format is
|
||||
|
||||
@@ -205,6 +205,8 @@ bool blkconf_apply_backend_options(BlockConf *conf, bool readonly,
|
||||
blk_set_enable_write_cache(blk, wce);
|
||||
blk_set_on_error(blk, rerror, werror);
|
||||
|
||||
block_acct_setup(blk_get_stats(blk), conf->account_invalid,
|
||||
conf->account_failed);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+32
-3
@@ -1340,6 +1340,11 @@ static void ide_reset(IDEState *s)
|
||||
s->pio_aiocb = NULL;
|
||||
}
|
||||
|
||||
if (s->reset_reverts) {
|
||||
s->reset_reverts = false;
|
||||
s->heads = s->drive_heads;
|
||||
s->sectors = s->drive_sectors;
|
||||
}
|
||||
if (s->drive_kind == IDE_CFATA)
|
||||
s->mult_sectors = 0;
|
||||
else
|
||||
@@ -1618,6 +1623,20 @@ static bool cmd_check_power_mode(IDEState *s, uint8_t cmd)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* INITIALIZE DEVICE PARAMETERS */
|
||||
static bool cmd_specify(IDEState *s, uint8_t cmd)
|
||||
{
|
||||
if (s->blk && s->drive_kind != IDE_CD) {
|
||||
s->heads = (s->select & (ATA_DEV_HS)) + 1;
|
||||
s->sectors = s->nsector;
|
||||
ide_set_irq(s->bus);
|
||||
} else {
|
||||
ide_abort_command(s);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool cmd_set_features(IDEState *s, uint8_t cmd)
|
||||
{
|
||||
uint16_t *identify_data;
|
||||
@@ -1641,7 +1660,11 @@ static bool cmd_set_features(IDEState *s, uint8_t cmd)
|
||||
ide_flush_cache(s);
|
||||
return false;
|
||||
case 0xcc: /* reverting to power-on defaults enable */
|
||||
s->reset_reverts = true;
|
||||
return true;
|
||||
case 0x66: /* reverting to power-on defaults disable */
|
||||
s->reset_reverts = false;
|
||||
return true;
|
||||
case 0xaa: /* read look-ahead enable */
|
||||
case 0x55: /* read look-ahead disable */
|
||||
case 0x05: /* set advanced power management mode */
|
||||
@@ -1704,8 +1727,14 @@ static bool cmd_identify_packet(IDEState *s, uint8_t cmd)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* EXECUTE DEVICE DIAGNOSTIC */
|
||||
static bool cmd_exec_dev_diagnostic(IDEState *s, uint8_t cmd)
|
||||
{
|
||||
/*
|
||||
* Clear the device register per the ATA (v6) specification,
|
||||
* because ide_set_signature does not clear LBA or drive bits.
|
||||
*/
|
||||
s->select = (ATA_DEV_ALWAYS_ON);
|
||||
ide_set_signature(s);
|
||||
|
||||
if (s->drive_kind == IDE_CD) {
|
||||
@@ -2045,7 +2074,7 @@ static const struct {
|
||||
[WIN_SEEK] = { cmd_seek, HD_CFA_OK | SET_DSC },
|
||||
[CFA_TRANSLATE_SECTOR] = { cmd_cfa_translate_sector, CFA_OK },
|
||||
[WIN_DIAGNOSE] = { cmd_exec_dev_diagnostic, ALL_OK },
|
||||
[WIN_SPECIFY] = { cmd_nop, HD_CFA_OK | SET_DSC },
|
||||
[WIN_SPECIFY] = { cmd_specify, HD_CFA_OK | SET_DSC },
|
||||
[WIN_STANDBYNOW2] = { cmd_nop, HD_CFA_OK },
|
||||
[WIN_IDLEIMMEDIATE2] = { cmd_nop, HD_CFA_OK },
|
||||
[WIN_STANDBY2] = { cmd_nop, HD_CFA_OK },
|
||||
@@ -2535,8 +2564,8 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,
|
||||
|
||||
blk_get_geometry(blk, &nb_sectors);
|
||||
s->cylinders = cylinders;
|
||||
s->heads = heads;
|
||||
s->sectors = secs;
|
||||
s->heads = s->drive_heads = heads;
|
||||
s->sectors = s->drive_sectors = secs;
|
||||
s->chs_trans = chs_trans;
|
||||
s->nb_sectors = nb_sectors;
|
||||
s->wwn = wwn;
|
||||
|
||||
+9
-8
@@ -21,6 +21,10 @@
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* References:
|
||||
* [1] 82371FB (PIIX) AND 82371SB (PIIX3) PCI ISA IDE XCELERATOR,
|
||||
* 290550-002, Intel Corporation, April 1997.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
@@ -114,14 +118,11 @@ static void piix_ide_reset(DeviceState *dev)
|
||||
ide_bus_reset(&d->bus[i]);
|
||||
}
|
||||
|
||||
/* TODO: this is the default. do not override. */
|
||||
pci_conf[PCI_COMMAND] = 0x00;
|
||||
/* TODO: this is the default. do not override. */
|
||||
pci_conf[PCI_COMMAND + 1] = 0x00;
|
||||
/* TODO: use pci_set_word */
|
||||
pci_conf[PCI_STATUS] = PCI_STATUS_FAST_BACK;
|
||||
pci_conf[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_MEDIUM >> 8;
|
||||
pci_conf[0x20] = 0x01; /* BMIBA: 20-23h */
|
||||
/* PCI command register default value (0000h) per [1, p.48]. */
|
||||
pci_set_word(pci_conf + PCI_COMMAND, 0x0000);
|
||||
pci_set_word(pci_conf + PCI_STATUS,
|
||||
PCI_STATUS_DEVSEL_MEDIUM | PCI_STATUS_FAST_BACK);
|
||||
pci_set_byte(pci_conf + 0x20, 0x01); /* BMIBA: 20-23h */
|
||||
}
|
||||
|
||||
static int pci_piix_init_ports(PCIIDEState *d)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "qemu/timed-average.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "qapi/qapi-builtin-types.h"
|
||||
#include "qapi/qapi-types-common.h"
|
||||
|
||||
typedef struct BlockAcctTimedStats BlockAcctTimedStats;
|
||||
typedef struct BlockAcctStats BlockAcctStats;
|
||||
@@ -100,8 +100,8 @@ typedef struct BlockAcctCookie {
|
||||
} BlockAcctCookie;
|
||||
|
||||
void block_acct_init(BlockAcctStats *stats);
|
||||
void block_acct_setup(BlockAcctStats *stats, bool account_invalid,
|
||||
bool account_failed);
|
||||
void block_acct_setup(BlockAcctStats *stats, enum OnOffAuto account_invalid,
|
||||
enum OnOffAuto account_failed);
|
||||
void block_acct_cleanup(BlockAcctStats *stats);
|
||||
void block_acct_add_interval(BlockAcctStats *stats, unsigned interval_length);
|
||||
BlockAcctTimedStats *block_acct_interval_next(BlockAcctStats *stats,
|
||||
|
||||
@@ -150,7 +150,6 @@ void *qemu_blockalign(BlockDriverState *bs, size_t size);
|
||||
void *qemu_blockalign0(BlockDriverState *bs, size_t size);
|
||||
void *qemu_try_blockalign(BlockDriverState *bs, size_t size);
|
||||
void *qemu_try_blockalign0(BlockDriverState *bs, size_t size);
|
||||
bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov);
|
||||
|
||||
void bdrv_enable_copy_on_read(BlockDriverState *bs);
|
||||
void bdrv_disable_copy_on_read(BlockDriverState *bs);
|
||||
|
||||
@@ -73,7 +73,7 @@ static inline int coroutine_fn bdrv_co_pwrite(BdrvChild *child,
|
||||
return bdrv_co_pwritev(child, offset, bytes, &qiov, flags);
|
||||
}
|
||||
|
||||
bool coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req,
|
||||
void coroutine_fn bdrv_make_request_serialising(BdrvTrackedRequest *req,
|
||||
uint64_t align);
|
||||
BdrvTrackedRequest *coroutine_fn bdrv_co_get_self_request(BlockDriverState *bs);
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ typedef struct BlockConf {
|
||||
uint32_t lcyls, lheads, lsecs;
|
||||
OnOffAuto wce;
|
||||
bool share_rw;
|
||||
OnOffAuto account_invalid, account_failed;
|
||||
BlockdevOnError rerror;
|
||||
BlockdevOnError werror;
|
||||
} BlockConf;
|
||||
@@ -61,7 +62,11 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
|
||||
_conf.discard_granularity, -1), \
|
||||
DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, \
|
||||
ON_OFF_AUTO_AUTO), \
|
||||
DEFINE_PROP_BOOL("share-rw", _state, _conf.share_rw, false)
|
||||
DEFINE_PROP_BOOL("share-rw", _state, _conf.share_rw, false), \
|
||||
DEFINE_PROP_ON_OFF_AUTO("account-invalid", _state, \
|
||||
_conf.account_invalid, ON_OFF_AUTO_AUTO), \
|
||||
DEFINE_PROP_ON_OFF_AUTO("account-failed", _state, \
|
||||
_conf.account_failed, ON_OFF_AUTO_AUTO)
|
||||
|
||||
#define DEFINE_BLOCK_PROPERTIES(_state, _conf) \
|
||||
DEFINE_PROP_DRIVE("drive", _state, _conf.blk), \
|
||||
|
||||
@@ -375,6 +375,7 @@ struct IDEState {
|
||||
uint8_t unit;
|
||||
/* ide config */
|
||||
IDEDriveKind drive_kind;
|
||||
int drive_heads, drive_sectors;
|
||||
int cylinders, heads, sectors, chs_trans;
|
||||
int64_t nb_sectors;
|
||||
int mult_sectors;
|
||||
@@ -401,6 +402,8 @@ struct IDEState {
|
||||
uint8_t select;
|
||||
uint8_t status;
|
||||
|
||||
bool reset_reverts;
|
||||
|
||||
/* set for lba48 access */
|
||||
uint8_t lba48;
|
||||
BlockBackend *blk;
|
||||
|
||||
+2
-2
@@ -164,8 +164,8 @@ void help(void)
|
||||
" 'output_filename' is the destination disk image filename\n"
|
||||
" 'output_fmt' is the destination format\n"
|
||||
" 'options' is a comma separated list of format specific options in a\n"
|
||||
" name=value format. Use -o ? for an overview of the options supported by the\n"
|
||||
" used format\n"
|
||||
" name=value format. Use -o help for an overview of the options supported by\n"
|
||||
" the used format\n"
|
||||
" 'snapshot_param' is param used for internal snapshot, format\n"
|
||||
" is 'snapshot.id=[ID],snapshot.name=[NAME]', or\n"
|
||||
" '[ID_OR_NAME]'\n"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user