===================================================================
@@ -380,6 +380,10 @@ static void virtio_blk_update_config(Vir
blkcfg.heads = heads;
blkcfg.sectors = secs;
blkcfg.size_max = 0;
+ blkcfg.physical_block_exp = bdrv_get_physical_block_exp(s->bs);
+ blkcfg.alignment_offset = 0;
+ blkcfg.min_io_size = bdrv_get_min_io_size(s->bs);
+ blkcfg.opt_io_size = bdrv_get_opt_io_size(s->bs);
memcpy(config, &blkcfg, sizeof(struct virtio_blk_config));
}
@@ -389,6 +393,7 @@ static uint32_t virtio_blk_get_features(
features |= (1 << VIRTIO_BLK_F_SEG_MAX);
features |= (1 << VIRTIO_BLK_F_GEOMETRY);
+ features |= (1 << VIRTIO_BLK_F_TOPOLOGY);
if (bdrv_enable_write_cache(s->bs))
features |= (1 << VIRTIO_BLK_F_WCACHE);
===================================================================
@@ -32,6 +32,7 @@
#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru
*/
/* #define VIRTIO_BLK_F_IDENTIFY 8 ATA IDENTIFY supported,
DEPRECATED */
#define VIRTIO_BLK_F_WCACHE 9 /* write cache enabled */
+#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is
available */
struct virtio_blk_config
{
@@ -42,6 +43,10 @@ struct virtio_blk_config
uint8_t heads;
uint8_t sectors;
uint32_t _blk_size; /* structure pad, currently unused */
+ uint8_t physical_block_exp;
+ uint8_t alignment_offset;
+ uint16_t min_io_size;
+ uint32_t opt_io_size;
} __attribute__((packed));
/* These two define direction. */
------------------------------
Message: 2
Date: Fri, 29 Jan 2010 11:19:20 -0800
From: Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] Porting TCG to alpha platform
To: identifier scorpio <cidentifier@yahoo.com.cn>
Cc: qemu-devel@nongnu.org
Message-ID: <4B6334B8.9040002@twiddle.net>
Content-Type: text/plain; charset="utf-8"
> + } else if (cond == TCG_COND_EQ || cond == TCG_COND_NE) {
> + tcg_out_mem_long(s, INSN_LDA, TMP_REG1, arg1, -arg2);
> + opc = (cond == TCG_COND_EQ ? INSN_BEQ : INSN_BNE);
Bug here. What was intended was to add "arg1 = TMP_REG1".
But since the constraints use "I" for uint8_t input constants,
we might as well remove this hunk entirely.
Also, let's future-proof this routine against changes to
the layout of the TCGCond enumeration.
r~
-------------- next part --------------
commit 9d787576342c193f13e2531953fc81442458de7e
Author: Richard Henderson <rth@twiddle.net>
Date: Fri Jan 29 11:14:20 2010 -0800
tcg-alpha: Fix EQ/NE with a constant.
There was start of code to handle EQ and NE with arbitrary constants,
but it wasn't completed. Remove the half-done code and add a comment
for future enhancements.
Also, don't rely on the current layout of TCGCond; instead encode the
need for inversion of the compare insn result by means of a low bit set
in the cmp_opc table. Reduce the element size of cmp_opc.
@@ -540,9 +540,11 @@ static void tcg_out_br(TCGContext *s, int opc, int ra,
int label_index)
tcg_out_fmt_br(s, opc, ra, value);
}
-static void tcg_out_brcond(TCGContext *s, int cond, TCGArg arg1,
+static void tcg_out_brcond(TCGContext *s, TCGCond cond, TCGArg arg1,
TCGArg arg2, int const_arg2, int label_index)
{
+ /* Note that unsigned comparisons are not present here, which means
+ that their entries will contain zeros. */
static const int br_opc[10] = {
[TCG_COND_EQ] = INSN_BEQ,
[TCG_COND_NE] = INSN_BNE,
@@ -552,38 +554,56 @@ static void tcg_out_brcond(TCGContext *s, int cond,
TCGArg arg1,
[TCG_COND_GT] = INSN_BGT
};
- static const uint64_t cmp_opc[10] = {
+ /* The low bit of these entries indicates that the result of
+ the comparison must be inverted. This bit should not be
+ output with the rest of the instruction. */
+ static const int cmp_opc[10] = {
[TCG_COND_EQ] = INSN_CMPEQ,
- [TCG_COND_NE] = INSN_CMPEQ,
+ [TCG_COND_NE] = INSN_CMPEQ | 1,
[TCG_COND_LT] = INSN_CMPLT,
- [TCG_COND_GE] = INSN_CMPLT,
+ [TCG_COND_GE] = INSN_CMPLT | 1,
[TCG_COND_LE] = INSN_CMPLE,
- [TCG_COND_GT] = INSN_CMPLE,
+ [TCG_COND_GT] = INSN_CMPLE | 1,
[TCG_COND_LTU] = INSN_CMPULT,
- [TCG_COND_GEU] = INSN_CMPULT,
+ [TCG_COND_GEU] = INSN_CMPULT | 1,
[TCG_COND_LEU] = INSN_CMPULE,
- [TCG_COND_GTU] = INSN_CMPULE
+ [TCG_COND_GTU] = INSN_CMPULE | 1
};
int opc = 0;
- if (const_arg2) {
- if (arg2 == 0) {
- opc = br_opc[cond];
- } else if (cond == TCG_COND_EQ || cond == TCG_COND_NE) {
- tcg_out_mem_long(s, INSN_LDA, TMP_REG1, arg1, -arg2);
- opc = (cond == TCG_COND_EQ ? INSN_BEQ : INSN_BNE);
- }
+ /* Possible improvements:
+ (1) Notice arg1 == $31 and !const_arg2. In this case, swap the
+ two operands and swap the sense of the comparison to allow the
+ use of the direct branches.
+
+ (2) Allow arbitrary constants. We can, on occasion, generate one
+ less instruction if we compute
+ TMP = ARG1 - CONST
+ instead of
+ TMP = ARG1 cmp TMP2
+ where TMP2 is the constant loaded into a register by generic code.
+ Note that for 64-bit operands this works only for EQ and NE. For
+ 32-bit operands, we would need to either limit this to signed
+ comparisons or properly zero-extend unsigned inputs. The payoff
+ here isn't great though; much less than(1). */
+
+ /* Notice signed comparisons vs zero. These are handled by the
+ branch instructions directly. */
+ if (const_arg2 && arg2 == 0) {
+ opc = br_opc[cond];
}
+ /* Otherwise, generate a comparison into a temporary. */
if (opc == 0) {
- opc = cmp_opc[cond];
+ opc = cmp_opc[cond] & ~1;
if (const_arg2) {
tcg_out_fmt_opi(s, opc, arg1, arg2, TMP_REG1);
} else {
tcg_out_fmt_opr(s, opc, arg1, arg2, TMP_REG1);
}
- opc = (cond & 1) ? INSN_BEQ : INSN_BNE;
+
+ opc = (cmp_opc[cond] & 1 ? INSN_BEQ : INSN_BNE);
arg1 = TMP_REG1;
}
------------------------------
Message: 3
Date: Sat, 30 Jan 2010 03:28:58 +0800
From: Scott Tsai <scottt.tw@gmail.com>
Subject: [Qemu-devel] [PATCH] doc: Update mingw cross compile
instructions
To: qemu-devel@nongnu.org
Cc: Scott Tsai <scottt.tw@gmail.com>
Message-ID: <1264793338-30981-1-git-send-email-scottt.tw@gmail.com>
The "Cross compilation for Windows with Linux" section of qemu-doc.texi
still instructs the user to use 'configure --enable-mingw32'
even after the option was removed in Aug 2008:
http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=cd01b4a312248dd4e12c3d3
89d1a349cea4015d8
This documentation only change updates the instructions to:
* Remove use of '--enable-mingw32' in the configure example
* Correct the 'sdl-config' script name
* Remove references to i386-mingw32msvc.tar.gz which no longer exists in
recent SDL releases
* Document the zlib dependency
Signed-off-by: Scott Tsai <scottt.tw@gmail.com>
---
qemu-doc.texi | 45 +++++++++++++++++++++++++++++++--------------
1 files changed, 31 insertions(+), 14 deletions(-)
@@ -2313,11 +2313,14 @@ instructions in the download section and the FAQ.
@item Download
the MinGW development library of SDL 1.2.x
(@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
-@url{http://www.libsdl.org}. Unpack it in a temporary place, and
-unpack the archive @file{i386-mingw32msvc.tar.gz} in the MinGW tool
-directory. Edit the @file{sdl-config} script so that it gives the
+@url{http://www.libsdl.org}. Unpack it in a temporary place and
+edit the @file{sdl-config} script so that it gives the
correct SDL directory when invoked.
+@item Install the MinGW version of zlib and make sure
+@file{zlib.h} and @file{libz.dll.a} are in
+MingGW's default header and linker search paths.
+
@item Extract the current version of QEMU.
@item Start the MSYS shell (file @file{msys.bat}).
@@ -2340,29 +2343,43 @@ correct SDL directory when invoked.
Install the MinGW cross compilation tools available at
@url{http://www.mingw.org/}.
-@item
-Install the Win32 version of SDL (@url{http://www.libsdl.org}) by
-unpacking @file{i386-mingw32msvc.tar.gz}. Set up the PATH environment
-variable so that @file{i386-mingw32msvc-sdl-config} can be launched by
+@item Download
+the MinGW development library of SDL 1.2.x
+(@file{SDL-devel-1.2.x-@/mingw32.tar.gz}) from
+@url{http://www.libsdl.org}. Unpack it in a temporary place and
+edit the @file{sdl-config} script so that it gives the
+correct SDL directory when invoked. Set up the @code{PATH} environment
+variable so that @file{sdl-config} can be launched by
the QEMU configuration script.
+@item Install the MinGW version of zlib and make sure
+@file{zlib.h} and @file{libz.dll.a} are in
+MingGW's default header and linker search paths.
+
@item
Configure QEMU for Windows cross compilation:
@example
-./configure --enable-mingw32
+PATH=/usr/i686-pc-mingw32/sys-root/mingw/bin:$PATH ./configure
--cross-prefix='i686-pc-mingw32-'
+@end example
+The example assumes @file{sdl-config} is installed under
@file{/usr/i686-pc-mingw32/sys-root/mingw/bin} and
+MinGW cross compilation tools have names like @file{i686-pc-mingw32-gcc}
and @file{i686-pc-mingw32-strip}.
+We set the @code{PATH} environment variable to ensure the MingW version of
@file{sdl-config} is used and
+use --cross-prefix to specify the name of the cross compiler.
+You can also use --prefix to set the Win32 install path which defaults to
@file{c:/Program Files/Qemu}.
+
+Under Fedora Linux, you can run:
+@example
+yum -y install mingw32-gcc mingw32-SDL mingw32-zlib
@end example
-If necessary, you can change the cross-prefix according to the prefix
-chosen for the MinGW tools with --cross-prefix. You can also use
---prefix to set the Win32 install path.
+to get a suitable cross compilation environment.
@item You can install QEMU in the installation directory by typing
-@file{make install}. Don't forget to copy @file{SDL.dll} in the
+@code{make install}. Don't forget to copy @file{SDL.dll} and
@file{zlib1.dll} into the
installation directory.
@end itemize