Re: How to enable virgl in headless mode?

2021-12-01 Thread Yonggang Luo
On Wed, Nov 24, 2021 at 7:06 PM Gerd Hoffmann  wrote:
>
> qemu -display egl-headless

Thanks a lot, I tried this, and it's forced me to provide  rendernode
option like this:
```
-display egl-headless,rendernode=/dev/dri/renderD128
```
My question is what I need to do to remove the need of rendernode, because
I wanna getting egl-headless to be usable on Windows.

>
> take care,
>   Gerd
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


How to enable virgl in headless mode?

2021-11-23 Thread Yonggang Luo
Here is my command line
```
qemu-system-arm ^
 -monitor telnet:127.0.0.1:5318,server=on,wait=off,nodelay=on ^
 -serial telnet:127.0.0.1:5319,server=on,wait=on,nodelay=on ^
 -parallel none ^
 -cpu cortex-a15 -smp 4 -M virt -m 2G ^
 -kernel armhf-installed/vmlinuz ^
 -initrd armhf-installed/initrd.img ^
 -vnc :1,websocket=5701 ^
 -nographic ^
 -append "root=/dev/vda2 console=ttyAMA0" ^
 -device virtio-gpu-gl-device ^
 -device virtio-blk-device,drive=hd -drive
file=armhf-installed/debian_11.img,if=none,id=hd ^
 -device virtio-net-device,netdev=net0 -netdev
user,hostfwd=tcp::-:22,id=net0
```
-- 
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: ppc/fpu_helper.c

2021-11-14 Thread Yonggang Luo
On Sun, Nov 14, 2021 at 5:07 PM Richard Henderson <
richard.hender...@linaro.org> wrote:
>
> On 11/13/21 11:07 AM, 罗勇刚(Yonggang Luo) wrote:
> > I've seen nothing in fpu_helper.c to update
> > the fpscr to FP_FR,
> > that is there is no code with `fpscr |= FP_FR`,
> > is that valid for PowerPC? or it's just because this is hard
> > to implement and then the FP_FR  are always not set  for  fpscr
>
> It is unimplemented, yes.  I think that no one has spent the time; I
don't think that it
> should be hard, necessarily.

Thanks, I also have a question, where is the complete PowerPC floating
point instrunctions tests case?
I wanna improve the performance of powerpc floating point calculation and
don't lost the accuracy of it
So I need a complete testsuite for it.


>
>
> r~



--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


ppc/fpu_helper.c

2021-11-13 Thread Yonggang Luo
I've seen nothing in fpu_helper.c to update
the fpscr to FP_FR,
that is there is no code with `fpscr |= FP_FR`,
is that valid for PowerPC? or it's just because this is hard
to implement and then the FP_FR  are always not set  for  fpscr

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Idea about float acceleration with tcg

2021-11-13 Thread Yonggang Luo
 float instructions.


-- 
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH 1/2] target/ppc: Fixed call to deferred exception

2021-11-11 Thread Yonggang Luo
t; > exception using only information from FPSCR (the one I used this patch),
> >
> > * Update only fp_status directly and call either a modified
> > do_float_check_status or a new helper that would update FPSCR and throw
the
> > correct exception based on fp_status, this one I don't see how it would
> > feasible in the current implementation as FPSCR has many bits without an
> > equivalent in fp_status.
> >
> > So with this I can see how to implement the 1st and 2nd option, I chose
not
> > to use the 1st one as do_float_check_status updates the FPSCR then
throw the
> > exception, which seemed unnecessary. Also looking back I should've
removed
> > gen_reset_fpstatus() as in the way it ended implemented these
instructions
> > don't interact with fp_status anywhere else, so I'll remove it in the
next
> > version.
> >
> > And looking at the suggestions the current implementation could be
changed to
> > take advantage of the optimization suggested in the discussion you
linked,
> > specially the parts about checking when exception bits aren't set (but
in
> > this case it would've to be the MSR exception bits) and the part about
> > skipping calculating a flag when marked to 1.
>
> I haven't followed the discussion but here's another message with some
> links I've collected when FPU came up that may be relevant to the topic:
>
> https://lists.nongnu.org/archive/html/qemu-ppc/2020-04/msg00387.html
>
> among those is a long thread on patchwork that has some info on the
> current situation. As far as I remember the oddity in handling FPU
> exceptions is partly because of two bits FI and FR in FPSCR that should

That's correct, the most hard part is to simulate FI and FR bits in FPSCR as
that was not provided on other CPU.

> reflect the result of the previous FPU op so has to be updated after every
> op which makes it hard to emulate as other CPUs usually don't do this. (We
> could easily improve it if we did not emulate those bits, most guest code
> don't use them anyway, but QEMU prefers accuracy so that way was ruled
> out.) Other than that the current code maybe also can be simplified and
> maybe optimised via some other ways which were discussed in those threads
> but nobody implemented any of the ideas so far. May worth reading through
> what was said before as there might be sume useful ideas in there.
>
> Regards,
> BALATON Zoltan



--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL 6/7] meson: fix meson 0.58 warning with libvhost-user subproject

2021-07-29 Thread Yonggang Luo
Relative symlink should work on Windows.
Only symlink that points to non-exist file would file.

On Thu, Jul 29, 2021 at 11:09 PM Peter Maydell 
wrote:
>
> On Thu, 29 Jul 2021 at 15:05, Thomas Huth  wrote:
> >
> > On 29/07/2021 14.58, Peter Maydell wrote:
> > > On Thu, 29 Jul 2021 at 13:56, Paolo Bonzini 
wrote:
> > >>
> > >> From: Marc-André Lureau 
> > >>
> > >> Meson now checks that subprojects do not access files from parent
> > >> project. While we all agree this is best practice, libvhost-user also
> > >> want to share a few headers with QEMU, and libvhost-user isn't
really a
> > >> standalone project at this point (although this is making the
dependency
> > >> a bit more explicit).
> > >>
> > >> Signed-off-by: Marc-André Lureau 
> > >> Message-Id: <20210505151313.203258-1-marcandre.lur...@redhat.com>
> > >> Signed-off-by: Paolo Bonzini 
> > >> ---
> > >>   subprojects/libvhost-user/include/atomic.h   | 1 +
> > >>   subprojects/libvhost-user/libvhost-user.c| 2 +-
> > >>   subprojects/libvhost-user/meson.build| 6 +-
> > >>   subprojects/libvhost-user/standard-headers/linux | 1 +
> > >
> > >> diff --git a/subprojects/libvhost-user/include/atomic.h
b/subprojects/libvhost-user/include/atomic.h
> > >> new file mode 12
> > >> index 00..8c2be64f7b
> > >> --- /dev/null
> > >> +++ b/subprojects/libvhost-user/include/atomic.h
> > >> @@ -0,0 +1 @@
> > >> +../../../include/qemu/atomic.h
> > >> \ No newline at end of file
> > >
> > >> diff --git a/subprojects/libvhost-user/standard-headers/linux
b/subprojects/libvhost-user/standard-headers/linux
> > >> new file mode 12
> > >> index 00..15a2378139
> > >> --- /dev/null
> > >> +++ b/subprojects/libvhost-user/standard-headers/linux
> > >> @@ -0,0 +1 @@
> > >> +../../../include/standard-headers/linux
> > >> \ No newline at end of file
> > >
> > >
> > > Should these really be missing the trailing newline ?
> >
> > It's a symlink, so yes, there does not need to be a newline in here.
>
> Interesting. How does it work on Windows hosts ?
>
> -- PMM
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL 09/12] configure, meson: convert libusb detection to meson

2021-06-24 Thread Yonggang Luo
libusb').auto(),
  version: '>=1.0.13', method: 'pkg-config',
  kwargs: static_kwargs)
endif
```

> +
>  libpmem = not_found
>  if 'CONFIG_LIBPMEM' in config_host
>libpmem = declare_dependency(compile_args:
config_host['LIBPMEM_CFLAGS'].split(),
> @@ -1210,6 +1212,7 @@ config_host_data.set('CONFIG_SDL', sdl.found())
>  config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
>  config_host_data.set('CONFIG_SECCOMP', seccomp.found())
>  config_host_data.set('CONFIG_SNAPPY', snappy.found())
> +config_host_data.set('CONFIG_USB_LIBUSB', libusb.found())
>  config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER',
have_vhost_user_blk_server)
>  config_host_data.set('CONFIG_VNC', vnc.found())
>  config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
> @@ -2779,7 +2782,7 @@ summary_info += {'rbd support':   rbd.found()}
>  summary_info += {'xfsctl support':config_host.has_key('CONFIG_XFS')}
>  summary_info += {'smartcard support':
config_host.has_key('CONFIG_SMARTCARD')}
>  summary_info += {'U2F support':   u2f.found()}
> -summary_info += {'libusb':
 config_host.has_key('CONFIG_USB_LIBUSB')}
> +summary_info += {'libusb':libusb.found()}
>  summary_info += {'usb net redir':
config_host.has_key('CONFIG_USB_REDIR')}
>  summary_info += {'OpenGL support':
 config_host.has_key('CONFIG_OPENGL')}
>  summary_info += {'GBM':   config_host.has_key('CONFIG_GBM')}
> diff --git a/meson_options.txt b/meson_options.txt
> index ac6e90da07..02c14d4751 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -86,6 +86,8 @@ option('gcrypt', type : 'feature', value : 'auto',
> description: 'libgcrypt cryptography support')
>  option('libudev', type : 'feature', value : 'auto',
> description: 'Use libudev to enumerate host devices')
> +option('libusb', type : 'feature', value : 'auto',
> +   description: 'libusb support for USB passthrough')
>  option('lzfse', type : 'feature', value : 'auto',
> description: 'lzfse support for DMG images')
>  option('lzo', type : 'feature', value : 'auto',
> --
> 2.31.1
>
>
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v2 29/30] cirrus.yml: Fix the MSYS2 task

2021-05-11 Thread Yonggang Luo
Reviewed-by: Yonggang Luo 

On Tue, May 4, 2021 at 6:09 PM Alex Bennée  wrote:
>
> From: Thomas Huth 
>
> The MSYS2 task in the Cirrus-CI is currently failing with error messages
> like this:
>
>  warning: database file for 'ucrt64' does not exist (use '-Sy' to
download)
>  :: Starting core system upgrade...
>   there is nothing to do
>  :: Starting full system upgrade...
>  error: failed to prepare transaction (could not find database)
>
> Seems like it can be fixed by switching to a newer release and by
refreshing
> the database one more time after changing the /etc/pacman.conf file.
>
> Signed-off-by: Thomas Huth 
> Signed-off-by: Alex Bennée 
> Message-Id: <20210427185524.281883-1-th...@redhat.com>
> ---
>  .cirrus.yml | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/.cirrus.yml b/.cirrus.yml
> index f53c519447..f4bf49b704 100644
> --- a/.cirrus.yml
> +++ b/.cirrus.yml
> @@ -67,7 +67,7 @@ windows_msys2_task:
>  CIRRUS_SHELL: powershell
>  MSYS: winsymlinks:nativestrict
>  MSYSTEM: MINGW64
> -MSYS2_URL:
https://github.com/msys2/msys2-installer/releases/download/2021-01-05/msys2-base-x86_64-20210105.sfx.exe
> +MSYS2_URL:
https://github.com/msys2/msys2-installer/releases/download/2021-04-19/msys2-base-x86_64-20210419.sfx.exe
>  MSYS2_FINGERPRINT: 0
>  MSYS2_PACKAGES: "
>diffutils git grep make pkg-config sed
> @@ -130,7 +130,7 @@ windows_msys2_task:
>  taskkill /F /FI "MODULES eq msys-2.0.dll"
>  tasklist
>  C:\tools\msys64\usr\bin\bash.exe -lc "mv -f
/etc/pacman.conf.pacnew /etc/pacman.conf || true"
> -C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Suu
--overwrite=*"
> +C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Syuu
--overwrite=*"
>  Write-Output "Core install time taken:
$((Get-Date).Subtract($start_time))"
>  $start_time = Get-Date
>
> --
> 2.20.1
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v2 29/30] cirrus.yml: Fix the MSYS2 task

2021-05-11 Thread Yonggang Luo
LGTM, Thanks, forget to update this

On Wed, May 12, 2021 at 12:49 PM Philippe Mathieu-Daudé 
wrote:

> Hi Yonggang Luo,
>
> Does this look OK to you?
>
> On 5/4/21 12:02 PM, Alex Bennée wrote:
> > From: Thomas Huth 
> >
> > The MSYS2 task in the Cirrus-CI is currently failing with error messages
> > like this:
> >
> >  warning: database file for 'ucrt64' does not exist (use '-Sy' to
> download)
> >  :: Starting core system upgrade...
> >   there is nothing to do
> >  :: Starting full system upgrade...
> >  error: failed to prepare transaction (could not find database)
> >
> > Seems like it can be fixed by switching to a newer release and by
> refreshing
> > the database one more time after changing the /etc/pacman.conf file.
> >
> > Signed-off-by: Thomas Huth 
> > Signed-off-by: Alex Bennée 
> > Message-Id: <20210427185524.281883-1-th...@redhat.com>
> > ---
> >  .cirrus.yml | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/.cirrus.yml b/.cirrus.yml
> > index f53c519447..f4bf49b704 100644
> > --- a/.cirrus.yml
> > +++ b/.cirrus.yml
> > @@ -67,7 +67,7 @@ windows_msys2_task:
> >  CIRRUS_SHELL: powershell
> >  MSYS: winsymlinks:nativestrict
> >  MSYSTEM: MINGW64
> > -MSYS2_URL:
> https://github.com/msys2/msys2-installer/releases/download/2021-01-05/msys2-base-x86_64-20210105.sfx.exe
> > +MSYS2_URL:
> https://github.com/msys2/msys2-installer/releases/download/2021-04-19/msys2-base-x86_64-20210419.sfx.exe
> >  MSYS2_FINGERPRINT: 0
> >  MSYS2_PACKAGES: "
> >diffutils git grep make pkg-config sed
> > @@ -130,7 +130,7 @@ windows_msys2_task:
> >  taskkill /F /FI "MODULES eq msys-2.0.dll"
> >  tasklist
> >  C:\tools\msys64\usr\bin\bash.exe -lc "mv -f
> /etc/pacman.conf.pacnew /etc/pacman.conf || true"
> > -C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Suu
> --overwrite=*"
> > +C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Syuu
> --overwrite=*"
> >  Write-Output "Core install time taken:
> $((Get-Date).Subtract($start_time))"
> >  $start_time = Get-Date
> >
> >
>


-- 
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH 1/2] plugins: Update qemu-plugins.symbols to match qemu-plugins.h

2021-03-18 Thread Yonggang Luo
Reorder the function symbols that consistence with qemu-plugins.h

Signed-off-by: Yonggang Luo 
---
 plugins/qemu-plugins.symbols | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols
index 4bdb381f48..a0ac1df62a 100644
--- a/plugins/qemu-plugins.symbols
+++ b/plugins/qemu-plugins.symbols
@@ -5,35 +5,34 @@
   qemu_plugin_register_vcpu_exit_cb;
   qemu_plugin_register_vcpu_idle_cb;
   qemu_plugin_register_vcpu_resume_cb;
-  qemu_plugin_register_vcpu_insn_exec_cb;
-  qemu_plugin_register_vcpu_insn_exec_inline;
-  qemu_plugin_register_vcpu_mem_cb;
-  qemu_plugin_register_vcpu_mem_haddr_cb;
-  qemu_plugin_register_vcpu_mem_inline;
-  qemu_plugin_ram_addr_from_host;
   qemu_plugin_register_vcpu_tb_trans_cb;
   qemu_plugin_register_vcpu_tb_exec_cb;
   qemu_plugin_register_vcpu_tb_exec_inline;
-  qemu_plugin_register_flush_cb;
-  qemu_plugin_register_vcpu_syscall_cb;
-  qemu_plugin_register_vcpu_syscall_ret_cb;
-  qemu_plugin_register_atexit_cb;
+  qemu_plugin_register_vcpu_insn_exec_cb;
+  qemu_plugin_register_vcpu_insn_exec_inline;
   qemu_plugin_tb_n_insns;
-  qemu_plugin_tb_get_insn;
   qemu_plugin_tb_vaddr;
+  qemu_plugin_tb_get_insn;
   qemu_plugin_insn_data;
   qemu_plugin_insn_size;
   qemu_plugin_insn_vaddr;
   qemu_plugin_insn_haddr;
-  qemu_plugin_insn_disas;
   qemu_plugin_mem_size_shift;
   qemu_plugin_mem_is_sign_extended;
   qemu_plugin_mem_is_big_endian;
   qemu_plugin_mem_is_store;
   qemu_plugin_get_hwaddr;
   qemu_plugin_hwaddr_is_io;
-  qemu_plugin_hwaddr_to_raddr;
+  qemu_plugin_hwaddr_phys_addr;
+  qemu_plugin_hwaddr_device_name;
+  qemu_plugin_register_vcpu_mem_cb;
+  qemu_plugin_register_vcpu_mem_inline;
+  qemu_plugin_register_vcpu_syscall_cb;
+  qemu_plugin_register_vcpu_syscall_ret_cb;
+  qemu_plugin_insn_disas;
   qemu_plugin_vcpu_for_each;
+  qemu_plugin_register_flush_cb;
+  qemu_plugin_register_atexit_cb;
   qemu_plugin_n_vcpus;
   qemu_plugin_n_max_vcpus;
   qemu_plugin_outs;
-- 
2.29.2.windows.3




[PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h

2021-03-18 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 include/qemu/qemu-plugin.h | 187 ++---
 1 file changed, 92 insertions(+), 95 deletions(-)

diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 97cdfd7761..2cb17f3051 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -81,27 +81,6 @@ typedef struct qemu_info_t {
 };
 } qemu_info_t;
 
-/**
- * qemu_plugin_install() - Install a plugin
- * @id: this plugin's opaque ID
- * @info: a block describing some details about the guest
- * @argc: number of arguments
- * @argv: array of arguments (@argc elements)
- *
- * All plugins must export this symbol which is called when the plugin
- * is first loaded. Calling qemu_plugin_uninstall() from this function
- * is a bug.
- *
- * Note: @info is only live during the call. Copy any information we
- * want to keep. @argv remains valid throughout the lifetime of the
- * loaded plugin.
- *
- * Return: 0 on successful loading, !0 for an error.
- */
-QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
-   const qemu_info_t *info,
-   int argc, char **argv);
-
 /**
  * typedef qemu_plugin_simple_cb_t - simple callback
  * @id: the unique qemu_plugin_id_t
@@ -135,6 +114,98 @@ typedef void 
(*qemu_plugin_vcpu_simple_cb_t)(qemu_plugin_id_t id,
 typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index,
 void *userdata);
 
+/** struct qemu_plugin_tb - Opaque handle for a translation block */
+struct qemu_plugin_tb;
+/** struct qemu_plugin_insn - Opaque handle for a translated instruction */
+struct qemu_plugin_insn;
+
+/**
+ * enum qemu_plugin_cb_flags - type of callback
+ *
+ * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs
+ * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs
+ * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs
+ *
+ * Note: currently unused, plugins cannot read or change system
+ * register state.
+ */
+enum qemu_plugin_cb_flags {
+QEMU_PLUGIN_CB_NO_REGS,
+QEMU_PLUGIN_CB_R_REGS,
+QEMU_PLUGIN_CB_RW_REGS,
+};
+
+enum qemu_plugin_mem_rw {
+QEMU_PLUGIN_MEM_R = 1,
+QEMU_PLUGIN_MEM_W,
+QEMU_PLUGIN_MEM_RW,
+};
+
+/**
+ * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback
+ * @id: unique plugin id
+ * @tb: opaque handle used for querying and instrumenting a block.
+ */
+typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id,
+   struct qemu_plugin_tb *tb);
+
+/**
+ * enum qemu_plugin_op - describes an inline op
+ *
+ * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t
+ *
+ * Note: currently only a single inline op is supported.
+ */
+
+enum qemu_plugin_op {
+QEMU_PLUGIN_INLINE_ADD_U64,
+};
+
+/**
+ * typedef qemu_plugin_meminfo_t - opaque memory transaction handle
+ *
+ * This can be further queried using the qemu_plugin_mem_* query
+ * functions.
+ */
+typedef uint32_t qemu_plugin_meminfo_t;
+/** struct qemu_plugin_hwaddr - opaque hw address handle */
+struct qemu_plugin_hwaddr;
+
+typedef void
+(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index,
+ qemu_plugin_meminfo_t info, uint64_t vaddr,
+ void *userdata);
+
+typedef void
+(*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_index,
+ int64_t num, uint64_t a1, uint64_t a2,
+ uint64_t a3, uint64_t a4, uint64_t a5,
+ uint64_t a6, uint64_t a7, uint64_t a8);
+typedef void
+(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int 
vcpu_idx,
+ int64_t num, int64_t ret);
+
+/**
+ * qemu_plugin_install() - Install a plugin
+ * @id: this plugin's opaque ID
+ * @info: a block describing some details about the guest
+ * @argc: number of arguments
+ * @argv: array of arguments (@argc elements)
+ *
+ * All plugins must export this symbol which is called when the plugin
+ * is first loaded. Calling qemu_plugin_uninstall() from this function
+ * is a bug.
+ *
+ * Note: @info is only live during the call. Copy any information we
+ * want to keep. @argv remains valid throughout the lifetime of the
+ * loaded plugin.
+ *
+ * Return: 0 on successful loading, !0 for an error.
+ */
+QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
+   const qemu_info_t *info,
+   int argc, char **argv);
+
 /**
  * qemu_plugin_uninstall() - Uninstall a plugin
  * @id: this plugin's opaque ID
@@ -205,41 +276,6 @@ void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id,
 void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id,
  qemu_plugin_vcpu_simple_cb_t cb);
 
-/** struct qemu_plugin_tb

[PATCH 0/2] Fix qemu-plugins.symbols and improve qemu-plugins.h

2021-03-18 Thread Yonggang Luo


Yonggang Luo (2):
  plugins: Update qemu-plugins.symbols to match qemu-plugins.h
  plugins: Move all typedef and type declaration to the front of the
qemu-plugin.h

 include/qemu/qemu-plugin.h   | 187 +--
 plugins/qemu-plugins.symbols |  25 +++--
 2 files changed, 104 insertions(+), 108 deletions(-)

-- 
2.29.2.windows.3




Re: [PATCH 0/2] *** This is based on pull request from Alex Bennée ***

2021-03-18 Thread Yonggang Luo
On Thu, Mar 18, 2021 at 8:50 AM Markus Armbruster  wrote:
>
> Please use the subject line for explaining the purpose of the series.
> "Based on" information should go into the body.  Ideally also in
> machine-readable form, like
>
> Based-on: <20171220185924.32756-1-arm...@redhat.com>
>
> where the thing in  is the pull request's Message-id.
>
> Note: I used one of my pull requests, not Alex's, for this example.
>
> Yonggang Luo  writes:
>
> > *** BLURB HERE ***
>
> Recommend to delete this placeholder next time :)
Thanks, i'll do it next time
>
> > The pull request
> > https://patchew.org/QEMU/20210317072216.16316-1-alex.ben...@linaro.org/
> >
> > Yonggang Luo (2):
> >   plugins: Update qemu-plugins.symbols to match qemu-plugins.h
> >   plugins: Move all typedef and type declaration to the front of the
> > qemu-plugin.h
> >
> >  include/qemu/qemu-plugin.h   | 187 +--
> >  plugins/qemu-plugins.symbols |  25 +++--
> >  2 files changed, 104 insertions(+), 108 deletions(-)
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH 1/2] plugins: Update qemu-plugins.symbols to match qemu-plugins.h

2021-03-17 Thread Yonggang Luo
Reorder the function symbols that consistence with qemu-plugins.h

Signed-off-by: Yonggang Luo 
---
 plugins/qemu-plugins.symbols | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols
index 4bdb381f48..a0ac1df62a 100644
--- a/plugins/qemu-plugins.symbols
+++ b/plugins/qemu-plugins.symbols
@@ -5,35 +5,34 @@
   qemu_plugin_register_vcpu_exit_cb;
   qemu_plugin_register_vcpu_idle_cb;
   qemu_plugin_register_vcpu_resume_cb;
-  qemu_plugin_register_vcpu_insn_exec_cb;
-  qemu_plugin_register_vcpu_insn_exec_inline;
-  qemu_plugin_register_vcpu_mem_cb;
-  qemu_plugin_register_vcpu_mem_haddr_cb;
-  qemu_plugin_register_vcpu_mem_inline;
-  qemu_plugin_ram_addr_from_host;
   qemu_plugin_register_vcpu_tb_trans_cb;
   qemu_plugin_register_vcpu_tb_exec_cb;
   qemu_plugin_register_vcpu_tb_exec_inline;
-  qemu_plugin_register_flush_cb;
-  qemu_plugin_register_vcpu_syscall_cb;
-  qemu_plugin_register_vcpu_syscall_ret_cb;
-  qemu_plugin_register_atexit_cb;
+  qemu_plugin_register_vcpu_insn_exec_cb;
+  qemu_plugin_register_vcpu_insn_exec_inline;
   qemu_plugin_tb_n_insns;
-  qemu_plugin_tb_get_insn;
   qemu_plugin_tb_vaddr;
+  qemu_plugin_tb_get_insn;
   qemu_plugin_insn_data;
   qemu_plugin_insn_size;
   qemu_plugin_insn_vaddr;
   qemu_plugin_insn_haddr;
-  qemu_plugin_insn_disas;
   qemu_plugin_mem_size_shift;
   qemu_plugin_mem_is_sign_extended;
   qemu_plugin_mem_is_big_endian;
   qemu_plugin_mem_is_store;
   qemu_plugin_get_hwaddr;
   qemu_plugin_hwaddr_is_io;
-  qemu_plugin_hwaddr_to_raddr;
+  qemu_plugin_hwaddr_phys_addr;
+  qemu_plugin_hwaddr_device_name;
+  qemu_plugin_register_vcpu_mem_cb;
+  qemu_plugin_register_vcpu_mem_inline;
+  qemu_plugin_register_vcpu_syscall_cb;
+  qemu_plugin_register_vcpu_syscall_ret_cb;
+  qemu_plugin_insn_disas;
   qemu_plugin_vcpu_for_each;
+  qemu_plugin_register_flush_cb;
+  qemu_plugin_register_atexit_cb;
   qemu_plugin_n_vcpus;
   qemu_plugin_n_max_vcpus;
   qemu_plugin_outs;
-- 
2.29.2.windows.3




[PATCH 0/2] *** This is based on pull request from Alex Bennée ***

2021-03-17 Thread Yonggang Luo
*** BLURB HERE ***
The pull request
https://patchew.org/QEMU/20210317072216.16316-1-alex.ben...@linaro.org/

Yonggang Luo (2):
  plugins: Update qemu-plugins.symbols to match qemu-plugins.h
  plugins: Move all typedef and type declaration to the front of the
qemu-plugin.h

 include/qemu/qemu-plugin.h   | 187 +--
 plugins/qemu-plugins.symbols |  25 +++--
 2 files changed, 104 insertions(+), 108 deletions(-)

-- 
2.29.2.windows.3




[PATCH 2/2] plugins: Move all typedef and type declaration to the front of the qemu-plugin.h

2021-03-17 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 include/qemu/qemu-plugin.h | 187 ++---
 1 file changed, 92 insertions(+), 95 deletions(-)

diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 97cdfd7761..2cb17f3051 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -81,27 +81,6 @@ typedef struct qemu_info_t {
 };
 } qemu_info_t;
 
-/**
- * qemu_plugin_install() - Install a plugin
- * @id: this plugin's opaque ID
- * @info: a block describing some details about the guest
- * @argc: number of arguments
- * @argv: array of arguments (@argc elements)
- *
- * All plugins must export this symbol which is called when the plugin
- * is first loaded. Calling qemu_plugin_uninstall() from this function
- * is a bug.
- *
- * Note: @info is only live during the call. Copy any information we
- * want to keep. @argv remains valid throughout the lifetime of the
- * loaded plugin.
- *
- * Return: 0 on successful loading, !0 for an error.
- */
-QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
-   const qemu_info_t *info,
-   int argc, char **argv);
-
 /**
  * typedef qemu_plugin_simple_cb_t - simple callback
  * @id: the unique qemu_plugin_id_t
@@ -135,6 +114,98 @@ typedef void 
(*qemu_plugin_vcpu_simple_cb_t)(qemu_plugin_id_t id,
 typedef void (*qemu_plugin_vcpu_udata_cb_t)(unsigned int vcpu_index,
 void *userdata);
 
+/** struct qemu_plugin_tb - Opaque handle for a translation block */
+struct qemu_plugin_tb;
+/** struct qemu_plugin_insn - Opaque handle for a translated instruction */
+struct qemu_plugin_insn;
+
+/**
+ * enum qemu_plugin_cb_flags - type of callback
+ *
+ * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs
+ * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs
+ * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs
+ *
+ * Note: currently unused, plugins cannot read or change system
+ * register state.
+ */
+enum qemu_plugin_cb_flags {
+QEMU_PLUGIN_CB_NO_REGS,
+QEMU_PLUGIN_CB_R_REGS,
+QEMU_PLUGIN_CB_RW_REGS,
+};
+
+enum qemu_plugin_mem_rw {
+QEMU_PLUGIN_MEM_R = 1,
+QEMU_PLUGIN_MEM_W,
+QEMU_PLUGIN_MEM_RW,
+};
+
+/**
+ * typedef qemu_plugin_vcpu_tb_trans_cb_t - translation callback
+ * @id: unique plugin id
+ * @tb: opaque handle used for querying and instrumenting a block.
+ */
+typedef void (*qemu_plugin_vcpu_tb_trans_cb_t)(qemu_plugin_id_t id,
+   struct qemu_plugin_tb *tb);
+
+/**
+ * enum qemu_plugin_op - describes an inline op
+ *
+ * @QEMU_PLUGIN_INLINE_ADD_U64: add an immediate value uint64_t
+ *
+ * Note: currently only a single inline op is supported.
+ */
+
+enum qemu_plugin_op {
+QEMU_PLUGIN_INLINE_ADD_U64,
+};
+
+/**
+ * typedef qemu_plugin_meminfo_t - opaque memory transaction handle
+ *
+ * This can be further queried using the qemu_plugin_mem_* query
+ * functions.
+ */
+typedef uint32_t qemu_plugin_meminfo_t;
+/** struct qemu_plugin_hwaddr - opaque hw address handle */
+struct qemu_plugin_hwaddr;
+
+typedef void
+(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index,
+ qemu_plugin_meminfo_t info, uint64_t vaddr,
+ void *userdata);
+
+typedef void
+(*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_index,
+ int64_t num, uint64_t a1, uint64_t a2,
+ uint64_t a3, uint64_t a4, uint64_t a5,
+ uint64_t a6, uint64_t a7, uint64_t a8);
+typedef void
+(*qemu_plugin_vcpu_syscall_ret_cb_t)(qemu_plugin_id_t id, unsigned int 
vcpu_idx,
+ int64_t num, int64_t ret);
+
+/**
+ * qemu_plugin_install() - Install a plugin
+ * @id: this plugin's opaque ID
+ * @info: a block describing some details about the guest
+ * @argc: number of arguments
+ * @argv: array of arguments (@argc elements)
+ *
+ * All plugins must export this symbol which is called when the plugin
+ * is first loaded. Calling qemu_plugin_uninstall() from this function
+ * is a bug.
+ *
+ * Note: @info is only live during the call. Copy any information we
+ * want to keep. @argv remains valid throughout the lifetime of the
+ * loaded plugin.
+ *
+ * Return: 0 on successful loading, !0 for an error.
+ */
+QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
+   const qemu_info_t *info,
+   int argc, char **argv);
+
 /**
  * qemu_plugin_uninstall() - Uninstall a plugin
  * @id: this plugin's opaque ID
@@ -205,41 +276,6 @@ void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id,
 void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id,
  qemu_plugin_vcpu_simple_cb_t cb);
 
-/** struct qemu_plugin_tb

Re: macOS (Big Sur, Apple Silicon) 'make check' fails in test-crypto-tlscredsx509

2021-02-01 Thread Yonggang Luo
SHA-1: 94c13c1048378cbffe552b6fe5c960dc04eaefb2

* gcrypt: test_tls_psk_init should write binary file instead text file.

On windows, if open file with "w", it's will automatically convert
"\n" to "\r\n" when writing to file.

Signed-off-by: Yonggang Luo 
Is this related?

On Wed, Jan 27, 2021 at 12:37 AM Peter Maydell 
wrote:

> My Big Sur/Apple Silicon system fails "make check" in
> test-crypto-tlscredsx509:
>
> MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))}
> G_TEST_SRCDIR=/Users/pm215/qemu/tests
> G_TEST_BUILDDIR=/Users/pm215/qemu/build/all/tests
> tests/test-crypto-tlscredsx509 --tap -k
>
> ** (tests/test-crypto-tlscredsx509:35180): CRITICAL **: 16:23:34.590:
> Failed to sign certificate ASN1 parser: Value is not valid.
> ERROR test-crypto-tlscredsx509 - Bail out! FATAL-CRITICAL: Failed to
> sign certificate ASN1 parser: Value is not valid.
> make: *** [run-test-70] Error 1
>
>
> Does this failure ring any bells for anybody?
>
> Here's the crypto part of the meson-log:
>
>   Crypto
>  TLS priority: "NORMAL"
>GNUTLS support: YES
> libgcrypt: NO
>nettle: YES
>   XTS: YES
>  crypto afalg: NO
>  rng-none: NO
> Linux keyring: NO
>
>
> thanks
> -- PMM
>
>

-- 
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v3 0/6] Enable plugin support on msys2/mingw

2021-01-26 Thread Yonggang Luo
Hi alex, when does plugins/next getting PR

On Tue, Oct 6, 2020 at 7:35 PM Alex Bennée  wrote:

>
> Yonggang Luo  writes:
>
> > V2-V3
> > Split following patches out
> >
> > V1-V2
> > 1. Fixes review comments
> > 2. Increase QEMU_PLUGIN_VERSION to 1 for compat  QEMU_PLUGIN_VERSION 0
> > 3. Revise the loader to support for version 0 and 1
> > 4. By export function qemu_plugin_initialize in plugin, and call it in
> loader=
> > , so
> >   we have no need call it in every plugin. And also provide a standard
> implem=
> > entation,
> >   anyway, use can also override it.
> >
> > Add this feature on msys2/mingw by using glib provided cross-platform
> dlsym f=
> > unctional.
>
> I've grabbed the first two fixes into plugins/next for now. Aside from
> fixing the review comments I'd like to have an indication that the
> proposed change to the API linking doesn't adversely affect the
> performance of the plugins.
>
> It might be worth enabling a --enable-plugins build for mingw gitlab as
> Cirrus
> seems a bit broken at the moment.
>
> Thanks,
>
>
> --
> Alex Bennée
>


-- 
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH 8/8] configure: automatically parse command line for meson -D options

2021-01-22 Thread Yonggang Luo
On Sat, Jan 23, 2021 at 4:44 AM Paolo Bonzini  wrote:
>
>
>
> Il ven 22 gen 2021, 09:00 罗勇刚(Yonggang Luo)  ha
scritto:
>>
>> Hi Paolo, as python and meson are required dependencies to building qemu
now,
>> can we detecting python/meson at the very begining of configure,
>> even before the --help parameter.
>
>
> We could and I did it in the first version. However it's ugly that the
user has to use --python on some setups in order to get a full help message.

  Yeap, but finally configure should gone, so I think --python are
acceptable by user, just need make sure to be noticed when the default
python
are not python3

>
> Paolo
>
>>
>> On Wed, Jan 13, 2021 at 6:08 AM Paolo Bonzini 
wrote:
>> >
>> > On 13/01/21 11:31, Daniel P. Berrangé wrote:
>> > >>   meson-buildoptions.json | 717

>> > > I'm not a fan of seeing this file introduced as it has significant
>> > > overlap with meson_options.txt.I feel like the latter has enough
>> > > information present to do an acceptable job for help output. After
>> > > all that's sufficient if we were using meson directly.
>> >
>> > Sorry, I missed this remark.  meson-buildoptions.json is not
>> > hand-written.  It is the result of Meson's own parsing
meson_options.txt
>> > exported as JSON.
>> >
>> > In the commit message "because we parse command-line options before
>> > meson is available, the introspection output is stored in the source
>> > tree.  This is the reason for the unattractive diffstat; the number of
>> > JSON lines added is higher than the number of configure lines removed.
>> > Of course the latter are code that must be maintained manually and the
>> > former is not".
>> >
>> > Paolo
>> >
>> >
>>
>>
>> --
>>  此致
>> 礼
>> 罗勇刚
>> Yours
>> sincerely,
>> Yonggang Luo



--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH 8/8] configure: automatically parse command line for meson -D options

2021-01-22 Thread Yonggang Luo
Hi Paolo, as python and meson are required dependencies to building qemu
now,
can we detecting python/meson at the very begining of configure,
even before the --help parameter.

On Wed, Jan 13, 2021 at 6:08 AM Paolo Bonzini  wrote:
>
> On 13/01/21 11:31, Daniel P. Berrangé wrote:
> >>   meson-buildoptions.json | 717

> > I'm not a fan of seeing this file introduced as it has significant
> > overlap with meson_options.txt.I feel like the latter has enough
> > information present to do an acceptable job for help output. After
> > all that's sufficient if we were using meson directly.
>
> Sorry, I missed this remark.  meson-buildoptions.json is not
> hand-written.  It is the result of Meson's own parsing meson_options.txt
> exported as JSON.
>
> In the commit message "because we parse command-line options before
> meson is available, the introspection output is stored in the source
> tree.  This is the reason for the unattractive diffstat; the number of
> JSON lines added is higher than the number of configure lines removed.
> Of course the latter are code that must be maintained manually and the
> former is not".
>
> Paolo
>
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: What's the correct way to implement rfi and related instruction.

2021-01-13 Thread Yonggang Luo
On Tue, Jan 12, 2021 at 1:23 AM Cédric Le Goater  wrote:
>
> > QEMU 5.2.x, an e300 based machine ppc603 are impacted.
> > Here is my fix, narrowed down to  MSR_TGPR and  MSR_ILE
> > ```
> > From 42ce41671f1e6c4dd44e6fb481bbda9df09320bd Mon Sep 17 00:00:00 2001
> > From: Yonggang Luo mailto:luoyongg...@gmail.com
>>
> > Date: Sun, 10 Jan 2021 00:08:00 -0800
> > Subject: [PATCH] ppc: Fix rfi/rfid/hrfi/... emulation again
> >
> > This revert part mask bits for ppc603/ppc4x that disabled in
 a2e71b28e832346409efc795ecd1f0a2bcb705a3.
> > Remove redundant macro MSR_BOOK3S_MASK.
> > Fixes boot VxWorks on e300
> >
> > Signed-off-by: Yonggang Luo >
> > ---
> >  target/ppc/excp_helper.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> > index 1c48b9fdf6..df70c5a4e8 100644
> > --- a/target/ppc/excp_helper.c
> > +++ b/target/ppc/excp_helper.c
> > @@ -1156,8 +1156,10 @@ static inline void do_rfi(CPUPPCState *env,
target_ulong nip, target_ulong msr)
> >  {
> >  CPUState *cs = env_cpu(env);
> >
> > -/* MSR:POW cannot be set by any form of rfi */
> > +/* MSR:POW,TGPR,ILE cannot be set by any form of rfi */
> >  msr &= ~(1ULL << MSR_POW);
> > +msr &= ~(1ULL << MSR_TGPR);
>
> Indeed. The e300 user manual says that TGPR is cleared by rfi. We should
> add a per-cpu family mask and not a global setting.
>
> > +msr &= ~(1ULL << MSR_ILE);
>
> that's curious. I am still trying to understand that part. May be this is
> due to the lack of HID2 modeling which contains a "True little-endian"
bit.
>
> Is your image Little endian ?

Hi, According to ` Table 2-4. MSR Bit Settings (continued) ` in
https://www.nxp.com/docs/en/reference-manual/e300coreRM.pdf
```
  Interrupt little-endian mode. When an interrupt occurs, this bit is
copied into MSR[LE] to select the endian mode for the context established
by the interrupt.
```
Does this means MSR[LE] =  MSR[LE]
>
> C.
>
> >
> >  #if defined(TARGET_PPC64)
> >  /* Switching to 32-bit ? Crop the nip */
> > @@ -1190,7 +1192,6 @@ void helper_rfi(CPUPPCState *env)
> >  do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1] & 0xfffful);
> >  }
> >
> > -#define MSR_BOOK3S_MASK
> >  #if defined(TARGET_PPC64)
> >  void helper_rfid(CPUPPCState *env)
> >  {
> > --
> > 2.29.2.windows.3
> >
> > ```
> >
> > --
> >  此致
> > 礼
> > 罗勇刚
> > Yours
> > sincerely,
> > Yonggang Luo
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: What's the correct way to implement rfi and related instruction.

2021-01-12 Thread Yonggang Luo
On Tue, Jan 12, 2021 at 5:23 PM Cédric Le Goater  wrote:
>
> > QEMU 5.2.x, an e300 based machine ppc603 are impacted.
> > Here is my fix, narrowed down to  MSR_TGPR and  MSR_ILE
> > ```
> > From 42ce41671f1e6c4dd44e6fb481bbda9df09320bd Mon Sep 17 00:00:00 2001
> > From: Yonggang Luo mailto:luoyongg...@gmail.com
>>
> > Date: Sun, 10 Jan 2021 00:08:00 -0800
> > Subject: [PATCH] ppc: Fix rfi/rfid/hrfi/... emulation again
> >
> > This revert part mask bits for ppc603/ppc4x that disabled in
 a2e71b28e832346409efc795ecd1f0a2bcb705a3.
> > Remove redundant macro MSR_BOOK3S_MASK.
> > Fixes boot VxWorks on e300
> >
> > Signed-off-by: Yonggang Luo >
> > ---
> >  target/ppc/excp_helper.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
> > index 1c48b9fdf6..df70c5a4e8 100644
> > --- a/target/ppc/excp_helper.c
> > +++ b/target/ppc/excp_helper.c
> > @@ -1156,8 +1156,10 @@ static inline void do_rfi(CPUPPCState *env,
target_ulong nip, target_ulong msr)
> >  {
> >  CPUState *cs = env_cpu(env);
> >
> > -/* MSR:POW cannot be set by any form of rfi */
> > +/* MSR:POW,TGPR,ILE cannot be set by any form of rfi */
> >  msr &= ~(1ULL << MSR_POW);
> > +msr &= ~(1ULL << MSR_TGPR);
>
> Indeed. The e300 user manual says that TGPR is cleared by rfi. We should
> add a per-cpu family mask and not a global setting.
Refer to https://www.nxp.com/docs/en/reference-manual/e300coreRM.pdf

`Table 2-4. MSR Bit Settings`

```
  Temporary GPR remapping (implementation-specific) 0 Normal operation 1
TGPR mode. GPR0–GPR3 are remapped to TGPR0–TGPR3 for use by TLB miss
routines. The contents of GPR0–GPR3 remain unchanged while MSR[TGPR] = 1.
Attempts to use GPR4–GPR31 with MSR[TGPR] = 1 yield undefined results.
Temporarily replaces TGPR0–TGPR3 with GPR0–GPR3 for use by TLB miss
routines. The TGPR bit is set when either an instruction TLB miss, data
read miss, or data write miss interrupt is taken. The TGPR bit is cleared
by an rfi instruction.
```

>
> > +msr &= ~(1ULL << MSR_ILE);
>
> that's curious. I am still trying to understand that part. May be this is
> due to the lack of HID2 modeling which contains a "True little-endian"
bit.

Don't understand this part, I am running VxWorks 6.9 on MPC8349EA
https://www.nxp.com/docs/en/reference-manual/MPC8349EARM.pdf

Didn't got any idea about why  MSR_ILE are set

>
> Is your image Little endian ?
>
Big Endian vxworks image.

> C.
>
> >
> >  #if defined(TARGET_PPC64)
> >  /* Switching to 32-bit ? Crop the nip */
> > @@ -1190,7 +1192,6 @@ void helper_rfi(CPUPPCState *env)
> >  do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1] & 0xfffful);
> >  }
> >
> > -#define MSR_BOOK3S_MASK
> >  #if defined(TARGET_PPC64)
> >  void helper_rfid(CPUPPCState *env)
> >  {
> > --
> > 2.29.2.windows.3
> >
> > ```
> >
> > --
> >  此致
> > 礼
> > 罗勇刚
> > Yours
> > sincerely,
> > Yonggang Luo
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH] cirrus.yml: Replace the hard-coded python-sphinx version with the generic one

2021-01-11 Thread Yonggang Luo
On Mon, Jan 11, 2021 at 6:34 PM Thomas Huth  wrote:
>
> The mingw-w64-x86_64-python-sphinx-2.3.1 package has been removed from
> the server, so the windows_msys2_task is currently failing. Replace the
> old version with the current generic one to fix the issue (the current
> version seems to work fine now, too).
>
> Signed-off-by: Thomas Huth 
> ---
>  Successful run (with sphinx building the docs) can be seen here:
>  https://cirrus-ci.com/task/6568987054047232
>
>  .cirrus.yml | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/.cirrus.yml b/.cirrus.yml
> index 3907e036da..886addedd3 100644
> --- a/.cirrus.yml
> +++ b/.cirrus.yml
> @@ -117,12 +117,8 @@ windows_msys2_task:
>mingw-w64-x86_64-curl \
>mingw-w64-x86_64-gnutls \
>mingw-w64-x86_64-libnfs \
> +  mingw-w64-x86_64-python-sphinx
>"
> -bitsadmin /transfer msys_download /dynamic /download /priority
FOREGROUND `
> -
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
`
> -  C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
> -C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -U
/c/tools/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz"
> -del
C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
>  C:\tools\msys64\usr\bin\bash.exe -lc "rm -rf
/var/cache/pacman/pkg/*"
>  cd C:\tools\msys64
>  echo "Start archive"
> --
> 2.27.0
>
Hi, I've done that in my previous patch and queued by Paolo Bonzini 4 days,
8 hours ago

https://patchew.org/QEMU/20210107101919.80-1-luoyongg...@gmail.com/
--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v16 00/20] Initial support for multi-process Qemu

2021-01-11 Thread Yonggang Luo
On Tue, Jan 12, 2021 at 2:02 AM Jag Raman  wrote:
>
>
>
> > On Jan 11, 2021, at 12:20 AM, 罗勇刚(Yonggang Luo) 
wrote:
> >
> > I have a question, does this support/test on Windows?
>
> Hi Yonggang, we have not tested this on Windows. The project only builds
on Linux for now.
>
> Thank you!
I may interested add Windows support, what's the hard part?
If we add Windows/OSX support, we can create same code base for all three
platforms, and reduce #ifdef _WIN32 like macros


> —
> Jag
>
> >
> > On Mon, Jan 11, 2021 at 1:08 PM Jagannathan Raman 
wrote:
> > >
> > > Hi
> > >
> > > This is the v16 of the patchset. Thank you for your time reviewing
v15.
> > >
> > > This version has the following changes:
> > >
> > > [PATCH v16 04/20] multi-process: Add config option for multi-process
QEMU
> > >   - Using “default_feature” value to enable/disable multiprocess
> > >
> > > [PATCH v16 07/20] io: add qio_channel_writev_full_all helper
> > >   - Removed local variable in qio_channel_writev_full_all(), setting
arguments
> > > directly
> > >   - Fixed indentation issues
> > >   - Updated commit message
> > >
> > > [PATCH v16 08/20] io: add qio_channel_readv_full_all_eof &
> > >   qio_channel_readv_full_all helpers
> > >   - Added two variants of readv - _full_all_eof & _full_all based on
feedback
> > >   - Dropped errno return value
> > >   - Updated commit message
> > >   - Unable to remove local variables and set arguments directly as the
> > > arguments are later needed for cleanup (g_free/close) during
failure
> > >
> > > Switched to using OBJECT_DECLARE_{SIMPLE_TYPE, TYPE} macros in the
> > > following patches:
> > >   - [PATCH v16 05/20] multi-process: setup PCI host bridge for remote
device
> > >   - [PATCH v16 06/20] multi-process: setup a machine object for
remote device
> > >   process
> > >   - [PATCH v16 11/20] multi-process: Associate fd of a PCIDevice with
its object
> > >   - [PATCH v16 13/20] multi-process: introduce proxy object
> > >
> > > Updated copyright text to use the year 2021 in the files that show
them.
> > >
> > > To touch upon the history of this project, we posted the Proof Of
Concept
> > > patches before the BoF session in 2018. Subsequently, we have posted
15
> > > versions on the qemu-devel mailing list. You can find them by
following
> > > the links below ([1] - [15]). Following people contributed to the
design and
> > > implementation of this project:
> > > Jagannathan Raman 
> > > Elena Ufimtseva 
> > > John G Johnson 
> > > Stefan Hajnoczi 
> > > Konrad Wilk 
> > > Kanth Ghatraju 
> > >
> > > We would like to thank the QEMU community for your feedback in the
> > > design and implementation of this project. Qemu wiki page:
> > > https://wiki.qemu.org/Features/MultiProcessQEMU
> > >
> > > For the full concept writeup about QEMU multi-process, please
> > > refer to docs/devel/qemu-multiprocess.rst. Also, see
> > > docs/qemu-multiprocess.txt for usage information.
> > >
> > > Thank you for reviewing this series!
> > >
> > > [POC]:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg566538.html
> > > [1]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg602285.html
> > > [2]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg624877.html
> > > [3]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg642000.html
> > > [4]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg655118.html
> > > [5]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg682429.html
> > > [6]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg697484.html
> > > [7]:
https://patchew.org/QEMU/cover.1593273671.git.elena.ufimts...@oracle.com/
> > > [8]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg727007.html
> > > [9]: https://www.mail-archive.com/qemu-devel@nongnu.org/msg734275.html
> > > [10]:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg747638.html
> > > [11]:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg750972.html
> > > [12]:
https://patchew.org/QEMU/cover.1606853298.git.jag.ra...@oracle.com/
> > > [13]:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg766825.html
> > > [14]:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg768376.html
> > > [15]:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg769178.html
&

Re: [PATCH v16 00/20] Initial support for multi-process Qemu

2021-01-10 Thread Yonggang Luo
 multi-process: Retrieve PCI info from remote process
>
> John G Johnson (1):
>   multi-process: add the concept description to
> docs/devel/qemu-multiprocess
>
>  docs/devel/index.rst  |   1 +
>  docs/devel/multi-process.rst  | 966
++
>  docs/multi-process.rst|  64 ++
>  configure |  10 +
>  meson.build   |   5 +-
>  hw/remote/trace.h |   1 +
>  include/exec/memory.h |   2 +
>  include/exec/ram_addr.h   |   2 +-
>  include/hw/pci-host/remote.h  |  30 +
>  include/hw/pci/pci_ids.h  |   3 +
>  include/hw/remote/iohub.h |  42 ++
>  include/hw/remote/machine.h   |  38 ++
>  include/hw/remote/memory.h|  19 +
>  include/hw/remote/mpqemu-link.h   |  99 +++
>  include/hw/remote/proxy-memory-listener.h |  28 +
>  include/hw/remote/proxy.h |  48 ++
>  include/io/channel.h  |  76 +++
>  include/qemu/mmap-alloc.h |   4 +-
>  include/sysemu/iothread.h |   6 +
>  backends/hostmem-memfd.c  |   2 +-
>  hw/misc/ivshmem.c |   3 +-
>  hw/pci-host/remote.c  |  75 +++
>  hw/remote/iohub.c | 119 
>  hw/remote/machine.c   |  80 +++
>  hw/remote/memory.c|  65 ++
>  hw/remote/message.c   | 230 +++
>  hw/remote/mpqemu-link.c   | 267 +
>  hw/remote/proxy-memory-listener.c | 227 +++
>  hw/remote/proxy.c | 379 
>  hw/remote/remote-obj.c| 203 +++
>  io/channel.c  |  88 ++-
>  iothread.c|   6 +
>  softmmu/memory.c  |   3 +-
>  softmmu/physmem.c |  11 +-
>  util/mmap-alloc.c |   7 +-
>  util/oslib-posix.c|   2 +-
>  Kconfig.host  |   4 +
>  MAINTAINERS   |  24 +
>  hw/Kconfig|   1 +
>  hw/meson.build|   1 +
>  hw/pci-host/Kconfig   |   3 +
>  hw/pci-host/meson.build   |   1 +
>  hw/remote/Kconfig |   4 +
>  hw/remote/meson.build |  13 +
>  hw/remote/trace-events|   4 +
>  45 files changed, 3234 insertions(+), 32 deletions(-)
>  create mode 100644 docs/devel/multi-process.rst
>  create mode 100644 docs/multi-process.rst
>  create mode 100644 hw/remote/trace.h
>  create mode 100644 include/hw/pci-host/remote.h
>  create mode 100644 include/hw/remote/iohub.h
>  create mode 100644 include/hw/remote/machine.h
>  create mode 100644 include/hw/remote/memory.h
>  create mode 100644 include/hw/remote/mpqemu-link.h
>  create mode 100644 include/hw/remote/proxy-memory-listener.h
>  create mode 100644 include/hw/remote/proxy.h
>  create mode 100644 hw/pci-host/remote.c
>  create mode 100644 hw/remote/iohub.c
>  create mode 100644 hw/remote/machine.c
>  create mode 100644 hw/remote/memory.c
>  create mode 100644 hw/remote/message.c
>  create mode 100644 hw/remote/mpqemu-link.c
>  create mode 100644 hw/remote/proxy-memory-listener.c
>  create mode 100644 hw/remote/proxy.c
>  create mode 100644 hw/remote/remote-obj.c
>  create mode 100644 hw/remote/Kconfig
>  create mode 100644 hw/remote/meson.build
>  create mode 100644 hw/remote/trace-events
>
> --
> 1.8.3.1
>
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH] util/oslib-win32: Fix _aligned_malloc() arguments order

2021-01-10 Thread Yonggang Luo
On Sun, Jan 10, 2021 at 4:16 PM Philippe Mathieu-Daudé 
wrote:
>
> Commit dfbd0b873a8 inadvertently swapped the arguments
> of _aligned_malloc(), correct it to fix [*]:
>
>
G_TEST_SRCDIR=C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build/tests
>
G_TEST_BUILDDIR=C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build/build/tests
>   tests/test-qht.exe --tap -k
>   ERROR test-qht - too few tests run (expected 2, got 0)
>   make: *** [Makefile.mtest:256: run-test-30] Error 1
>
> [*] https://cirrus-ci.com/task/6055645751279616?command=test#L593
>
> Fixes: dfbd0b873a8 ("util/oslib-win32: Use _aligned_malloc for
qemu_try_memalign")
> Reported-by: Yonggang Luo 
> Reported-by: Volker Rümelin 
> Suggested-by: Volker Rümelin 
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  util/oslib-win32.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/util/oslib-win32.c b/util/oslib-win32.c
> index e6f83e10edb..f68b8012bb8 100644
> --- a/util/oslib-win32.c
> +++ b/util/oslib-win32.c
> @@ -59,7 +59,7 @@ void *qemu_try_memalign(size_t alignment, size_t size)
>
>  g_assert(size != 0);
>  g_assert(is_power_of_2(alignment));
> -ptr = _aligned_malloc(alignment, size);
> +ptr = _aligned_malloc(size, alignment);
>  trace_qemu_memalign(alignment, size, ptr);
>      return ptr;
>  }
> --
> 2.26.2
>

Oh, sorry, you 've fixed this. ignore my patch

Reviewed-by: Yonggang Luo 

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH] util/oslib-win32: Fixes Use _aligned_malloc for qemu_try_memalign

2021-01-10 Thread Yonggang Luo
In commit dfbd0b873a85021c083d9b4b84630c3732645963, the use of
_aligned_malloc are called with wrong parameter order, fixed it.

Signed-off-by: Yonggang Luo 
---
 util/oslib-win32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 83b8e89330..33af8e2506 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -59,7 +59,7 @@ void *qemu_try_memalign(size_t alignment, size_t size)
 
 g_assert(size != 0);
 g_assert(is_power_of_2(alignment));
-ptr = _aligned_malloc(alignment, size);
+ptr = _aligned_malloc(size, alignment);
 trace_qemu_memalign(alignment, size, ptr);
 return ptr;
 }
-- 
2.29.2.windows.3




Re: [PULL 04/47] util/oslib-win32: Use _aligned_malloc for qemu_try_memalign

2021-01-10 Thread Yonggang Luo
On Sun, Jan 10, 2021 at 3:19 PM Volker Rümelin  wrote:
>
> > We do not need or want to be allocating page sized quanta.
> >
> > Reviewed-by: Philippe Mathieu-Daudé 
> > Reviewed-by: Stefan Weil 
> > Message-Id: <20201018164836.1149452-1-richard.hender...@linaro.org>
> > Signed-off-by: Philippe Mathieu-Daudé 
> > Signed-off-by: Richard Henderson 
> > ---
> >  util/oslib-win32.c | 11 ---
> >  1 file changed, 4 insertions(+), 7 deletions(-)
> >
> > diff --git a/util/oslib-win32.c b/util/oslib-win32.c
> > index 01787df74c..8adc651259 100644
> > --- a/util/oslib-win32.c
> > +++ b/util/oslib-win32.c
> > @@ -39,6 +39,7 @@
> >  #include "trace.h"
> >  #include "qemu/sockets.h"
> >  #include "qemu/cutils.h"
> > +#include 
> >
> >  /* this must come after including "trace.h" */
> >  #include 
> > @@ -56,10 +57,8 @@ void *qemu_try_memalign(size_t alignment, size_t
size)
> >  {
> >  void *ptr;
> >
> > -if (!size) {
> > -abort();
> > -}
> > -ptr = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
> > +g_assert(size != 0);
> > +ptr = _aligned_malloc(alignment, size);
>
> Hi Richard,
>
> this doesn't work really well. The _aligned_malloc parameters are
swapped. ptr = _aligned_malloc(size, alignment) is correct.
>
> With best regards,
> Volker
>
> >  trace_qemu_memalign(alignment, size, ptr);
> >  return ptr;
> >  }
> > @@ -93,9 +92,7 @@ void *qemu_anon_ram_alloc(size_t size, uint64_t
*align, bool shared)
> >  void qemu_vfree(void *ptr)
> >  {
> >  trace_qemu_vfree(ptr);
> > -if (ptr) {
> > -VirtualFree(ptr, 0, MEM_RELEASE);
> > -}
> > +_aligned_free(ptr);
> >  }
> >
> >  void qemu_anon_ram_free(void *ptr, size_t size)
>
>

Dos this the cause of this failure?
https://cirrus-ci.com/task/6055645751279616?command=test#L593


MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))}
G_TEST_SRCDIR=C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build/tests
G_TEST_BUILDDIR=C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build/build/tests
tests/test-qht.exe --tap -k
ERROR test-qht - too few tests run (expected 2, got 0)
make: *** [Makefile.mtest:256: run-test-30] Error 1
--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL 00/23] target-arm queue

2021-01-10 Thread Yonggang Luo
On Sat, Jan 9, 2021 at 1:51 AM Peter Maydell 
wrote:
>
> On Fri, 8 Jan 2021 at 15:36, Peter Maydell 
wrote:
> >
> > Nothing too exciting, but does include the last bits of v8.1M support
work.
> >
> > -- PMM
> >
> > The following changes since commit
e79de63ab1bd1f6550e7b915e433bec1ad1a870a:
> >
> >   Merge remote-tracking branch
'remotes/rth-gitlab/tags/pull-tcg-20210107' into staging (2021-01-07
20:34:05 +)
> >
> > are available in the Git repository at:
> >
> >   https://git.linaro.org/people/pmaydell/qemu-arm.git
tags/pull-target-arm-20210108
> >
> > for you to fetch changes up to c9f8511ea8d2b80723af0fea1f716d752c1b5208:
> >
> >   docs/system: arm: Add sabrelite board description (2021-01-08
15:13:39 +)
> >
> > 
> > target-arm queue:
> >  * intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs
> >  * target/arm: Fix MTE0_ACTIVE
> >  * target/arm: Implement v8.1M and Cortex-M55 model
> >  * hw/arm/highbank: Drop dead KVM support code
> >  * util/qemu-timer: Make timer_free() imply timer_del()
> >  * various devices: Use ptimer_free() in finalize function
> >  * docs/system: arm: Add sabrelite board description
> >  * sabrelite: Minor fixes to allow booting U-Boot
>
>
> Applied, thanks.
>
> Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
> for any user-visible changes.
>
> -- PMM
>
Caused win32 CI failure

https://cirrus-ci.com/task/6055645751279616?command=test#L593


MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))}
G_TEST_SRCDIR=C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build/tests
G_TEST_BUILDDIR=C:/Users/ContainerAdministrator/AppData/Local/Temp/cirrus-ci-build/build/tests
tests/test-qht.exe --tap -k
ERROR test-qht - too few tests run (expected 2, got 0)
make: *** [Makefile.mtest:256: run-test-30] Error 1
--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: What's the correct way to implement rfi and related instruction.

2021-01-10 Thread Yonggang Luo
On Fri, Jan 8, 2021 at 2:02 AM Cédric Le Goater  wrote:
>
> On 1/8/21 5:21 AM, 罗勇刚(Yonggang Luo) wrote:
> >
> >
> > On Fri, Jan 8, 2021 at 5:54 AM Cédric Le Goater > wrote:
> >>
> >> On 1/7/21 8:14 PM, 罗勇刚(Yonggang Luo) wrote:
> >> > This is the first patch,:
> >> > It's store MSR bits differntly for different rfi instructions:
> >> > [Qemu-devel] [PATCH] target-ppc: fix RFI by clearing some bits of MSR
> >> > https://lists.gnu.org/archive/html/qemu-devel/2010-05/msg02999.html <
https://lists.gnu.org/archive/html/qemu-devel/2010-05/msg02999.html> <
https://lists.gnu.org/archive/html/qemu-devel/2010-05/msg02999.html <
https://lists.gnu.org/archive/html/qemu-devel/2010-05/msg02999.html>>
> >> > Comes from  target-ppc: fix RFI by clearing some bits of MSR
> >> > SHA-1: c3d420ead1aee9fcfd12be11cbdf6b1620134773
> >> >  target-ppc/op_helper.c | 6 +++---
> >> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >> > ```
> >> > diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
> >> > index 8f2ee986bb..3c3aa60bc3 100644
> >> > --- a/target-ppc/op_helper.c
> >> > +++ b/target-ppc/op_helper.c
> >> > @@ -1646,20 +1646,20 @@ static inline void do_rfi(target_ulong nip,
target_ulong msr,
> >> >  void helper_rfi (void)
> >> >  {
> >> >  do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],
> >> > -   ~((target_ulong)0x0), 1);
> >> > +   ~((target_ulong)0x783F), 1);
> >> >  }
> >> >
> >> >  #if defined(TARGET_PPC64)
> >> >  void helper_rfid (void)
> >> >  {
> >> >  do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],
> >> > -   ~((target_ulong)0x0), 0);
> >> > +   ~((target_ulong)0x783F), 0);
> >> >  }
> >> >
> >> >  void helper_hrfid (void)
> >> >  {
> >> >  do_rfi(env->spr[SPR_HSRR0], env->spr[SPR_HSRR1],
> >> > -   ~((target_ulong)0x0), 0);
> >> > +   ~((target_ulong)0x783F), 0);
> >> >  }
> >> >  #endif
> >> >  #endif
> >> > ```
> >> >
> >> > This is the second patch,:
> >> > it's remove the parameter  `target_ulong msrm, int keep_msrh`
> >> > Comes from ppc: Fix rfi/rfid/hrfi/... emulation
> >> > SHA-1: a2e71b28e832346409efc795ecd1f0a2bcb705a3
> >> > ```
> >> >  target-ppc/excp_helper.c | 51
+++-
> >> >  1 file changed, 20 insertions(+), 31 deletions(-)
> >> >
> >> > diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
> >> > index 30e960e30b..aa0b63f4b0 100644
> >> > --- a/target-ppc/excp_helper.c
> >> > +++ b/target-ppc/excp_helper.c
> >> > @@ -922,25 +922,20 @@ void helper_store_msr(CPUPPCState *env,
target_ulong val)
> >> >  }
> >> >  }
> >> >
> >> > -static inline void do_rfi(CPUPPCState *env, target_ulong nip,
target_ulong msr,
> >> > -  target_ulong msrm, int keep_msrh)
> >> > +static inline void do_rfi(CPUPPCState *env, target_ulong nip,
target_ulong msr)
> >> >  {
> >> >  CPUState *cs = CPU(ppc_env_get_cpu(env));
> >> >
> >> > +/* MSR:POW cannot be set by any form of rfi */
> >> > +msr &= ~(1ULL << MSR_POW);
> >> > +
> >> >  #if defined(TARGET_PPC64)
> >> > -if (msr_is_64bit(env, msr)) {
> >> > -nip = (uint64_t)nip;
> >> > -msr &= (uint64_t)msrm;
> >> > -} else {
> >> > +/* Switching to 32-bit ? Crop the nip */
> >> > +if (!msr_is_64bit(env, msr)) {
> >> >  nip = (uint32_t)nip;
> >> > -msr = (uint32_t)(msr & msrm);
> >> > -if (keep_msrh) {
> >> > -msr |= env->msr & ~((uint64_t)0x);
> >> > -}
> >> >  }
> >> >  #else
> >> >  nip = (uint32_t)nip;
> >> > -msr &= (uint32_t)msrm;
> >> >  #endif
> >> >  /* XXX: beware: this is false if VLE is supported */
> >> >  env->nip = nip & ~((target_ulong)0x0003);
> >> > @@ -959,26 +954,24 @@ static inline void do_rfi(CPUPPCState *env,
target_ulong nip, target_ulong msr,
> >> >
> >&g

Re: [PATCH v2] decodetree: Open files with encoding='utf-8'

2021-01-08 Thread Yonggang Luo
On Fri, Jan 8, 2021 at 10:58 AM Eduardo Habkost  wrote:
>
> On Fri, Jan 08, 2021 at 07:09:52PM +0100, Philippe Mathieu-Daudé wrote:
> > When decodetree.py was added in commit 568ae7efae7, QEMU was
> > using Python 2 which happily reads UTF-8 files in text mode.
> > Python 3 requires either UTF-8 locale or an explicit encoding
> > passed to open(). Now that Python 3 is required, explicit
> > UTF-8 encoding for decodetree source files.
> >
> > To avoid further problems with the user locale, also explicit
> > UTF-8 encoding for the generated C files.
> >
> > Explicit both input/output are plain text by using the 't' mode.
>
> I believe the 't' is unnecessary.  But it's harmless and makes it
> more explicit.
>
> >
> > This fixes:
> >
> >   $ /usr/bin/python3 scripts/decodetree.py test.decode
> >   Traceback (most recent call last):
> > File "scripts/decodetree.py", line 1397, in 
> >   main()
> > File "scripts/decodetree.py", line 1308, in main
> >   parse_file(f, toppat)
> > File "scripts/decodetree.py", line 994, in parse_file
> >   for line in f:
> > File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
> >   return codecs.ascii_decode(input, self.errors)[0]
> >   UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
80:
> >   ordinal not in range(128)
> >
> > Reported-by: Peter Maydell 
> > Signed-off-by: Philippe Mathieu-Daudé 
>
> Reviewed-by: Eduardo Habkost 
>
> However:
>
> > ---
> > v2: utf-8 output too (Peter)
> > explicit default text mode.
> > ---
> >  scripts/decodetree.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/decodetree.py b/scripts/decodetree.py
> > index 47aa9caf6d1..d3857066cfc 100644
> > --- a/scripts/decodetree.py
> > +++ b/scripts/decodetree.py
> > @@ -1304,7 +1304,7 @@ def main():
> >
> >  for filename in args:
> >  input_file = filename
> > -f = open(filename, 'r')
> > +f = open(filename, 'rt', encoding='utf-8')
> >  parse_file(f, toppat)
> >  f.close()
> >
> > @@ -1324,7 +1324,7 @@ def main():
> >  prop_size(stree)
> >
> >  if output_file:
> > -output_fd = open(output_file, 'w')
> > +output_fd = open(output_file, 'wt', encoding='utf-8')

I misunderstand the cause, this is a better way

> >  else:
> >  output_fd = sys.stdout
>
> This will still use the user locale encoding for sys.stdout.  Can
> be solved with:
>
> output_fd = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')

For output to console/terminal. I suggest to use
   sys.stdout = io.TextIOWrapper(sys.stdout.buffer,
encoding=sys.stdout.encoding, errors="ignore")
When the console/terminal encoding still can not represent the char in the
decodetree, still won't
cause script failure. And that failure can not be fixed by other means.
  errors="ignore" are important, from my experince, even there is `char`
can not represent
in utf8


>
> (Based on a suggestion from Yonggang Luo)
>
> --
> Eduardo
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH] decodetree: Open files with encoding='utf-8'

2021-01-08 Thread Yonggang Luo
On Sat, Jan 9, 2021 at 12:05 AM Peter Maydell 
wrote:
>
> On Fri, 8 Jan 2021 at 15:16, Philippe Mathieu-Daudé 
wrote:
> >
> > When decodetree.py was added in commit 568ae7efae7, QEMU was
> > using Python 2 which happily reads UTF-8 files in text mode.
> > Python 3 requires either UTF-8 locale or an explicit encoding
> > passed to open(). Now that Python 3 is required, explicit
> > UTF-8 encoding for decodetree sources.
> >
> > This fixes:
> >
> >   $ /usr/bin/python3 scripts/decodetree.py test.decode
> >   Traceback (most recent call last):
> > File "scripts/decodetree.py", line 1397, in 
> >   main()
> > File "scripts/decodetree.py", line 1308, in main
> >   parse_file(f, toppat)
> > File "scripts/decodetree.py", line 994, in parse_file
> >   for line in f:
> > File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
> >   return codecs.ascii_decode(input, self.errors)[0]
> >   UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
80:
> >   ordinal not in range(128)
> >
> > Reported-by: Peter Maydell 
> > Signed-off-by: Philippe Mathieu-Daudé 
> > ---
> >  scripts/decodetree.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/decodetree.py b/scripts/decodetree.py
> > index 47aa9caf6d1..fa40903cff1 100644
> > --- a/scripts/decodetree.py
> > +++ b/scripts/decodetree.py
> > @@ -1304,7 +1304,7 @@ def main():
> >
> >  for filename in args:
> >  input_file = filename
> > -f = open(filename, 'r')
> > +f = open(filename, 'r', encoding='utf-8')
> >  parse_file(f, toppat)
> >  f.close()
>
> Should we also be opening the output file explicitly as
> utf-8 ? (How do we say "write to sys.stdout as utf-8" for
> the case where we're doing that?)

Can be done with
```
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf8",
errors="ignore")
```

>
> thanks
> -- PMM
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH] decodetree: Open files with encoding='utf-8'

2021-01-08 Thread Yonggang Luo
On Fri, Jan 8, 2021 at 7:18 AM Philippe Mathieu-Daudé 
wrote:
>
> When decodetree.py was added in commit 568ae7efae7, QEMU was
> using Python 2 which happily reads UTF-8 files in text mode.
> Python 3 requires either UTF-8 locale or an explicit encoding
> passed to open(). Now that Python 3 is required, explicit
> UTF-8 encoding for decodetree sources.
>
> This fixes:
>
>   $ /usr/bin/python3 scripts/decodetree.py test.decode
>   Traceback (most recent call last):
> File "scripts/decodetree.py", line 1397, in 
>   main()
> File "scripts/decodetree.py", line 1308, in main
>   parse_file(f, toppat)
> File "scripts/decodetree.py", line 994, in parse_file
>   for line in f:
> File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
>   return codecs.ascii_decode(input, self.errors)[0]
>   UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 80:
>   ordinal not in range(128)
>
> Reported-by: Peter Maydell 
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  scripts/decodetree.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/decodetree.py b/scripts/decodetree.py
> index 47aa9caf6d1..fa40903cff1 100644
> --- a/scripts/decodetree.py
> +++ b/scripts/decodetree.py
> @@ -1304,7 +1304,7 @@ def main():
>
>  for filename in args:
>  input_file = filename
> -f = open(filename, 'r')
> +f = open(filename, 'r', encoding='utf-8')
>  parse_file(f, toppat)
>  f.close()
>
> --
> 2.26.2
>
>


Reviewed-by:  Yonggang Luo uoyongg...@gmail.com
>

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL 00/66] MIPS patches for 2021-01-07

2021-01-08 Thread Yonggang Luo
On Fri, Jan 8, 2021 at 3:31 AM Philippe Mathieu-Daudé 
wrote:
>
> Hi Peter,
>
> Le ven. 8 janv. 2021 11:35, Peter Maydell  a
écrit :
>>
>> On Thu, 7 Jan 2021 at 22:25, Philippe Mathieu-Daudé 
wrote:
>> >
>> > The following changes since commit
470dd6bd360782f5137f7e3376af6a44658eb1d3:
>> >
>> >   Merge remote-tracking branch
'remotes/stsquad/tags/pull-testing-060121-4' into staging (2021-01-06
22:18:36 +)
>> >
>> > are available in the Git repository at:
>> >
>> >   https://gitlab.com/philmd/qemu.git tags/mips-20210107
>> >
>> > for you to fetch changes up to
f97d339d612b86d8d336a11f01719a10893d6707:
>> >
>> >   docs/system: Remove deprecated 'fulong2e' machine alias (2021-01-07
22:57:49 +0100)
>> >
>> > 
>> > MIPS patches queue
>> >
>> > - Simplify CPU/ISA definitions
>> > - Various maintenance code movements in translate.c
>> > - Convert part of the MSA ASE instructions to decodetree
>> > - Convert some instructions removed from Release 6 to decodetree
>> > - Remove deprecated 'fulong2e' machine alias
>>
>> Hi; this failed to build on some of my hosts:
>>
>> [1/4674] Generating 'libqemu-mipsel-softmmu.fa.p/decode-mips64r6.c.inc'.
>> FAILED: libqemu-mipsel-softmmu.fa.p/decode-mips64r6.c.inc
>> /usr/bin/python3 /home/petmay01/qemu-for-merges/scripts/decodetree.py
>> ../../target/mips/mips64r6.decode --static-deco
>> de=decode_mips64r6 -o libqemu-mipsel-softmmu.fa.p/decode-mips64r6.c.inc
>> Traceback (most recent call last):
>>   File "/home/petmay01/qemu-for-merges/scripts/decodetree.py", line
>> 1397, in 
>> main()
>>   File "/home/petmay01/qemu-for-merges/scripts/decodetree.py", line
>> 1308, in main
>> parse_file(f, toppat)
>>   File "/home/petmay01/qemu-for-merges/scripts/decodetree.py", line
>> 994, in parse_file
>> for line in f:
>>   File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
>> return codecs.ascii_decode(input, self.errors)[0]
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
>> 80: ordinal not in range(128)
Can we always reading file in decodetree with utf8 encoding
And convert all decodetree to utf8 encoding, and the problem should
resolved.
```
 scripts/decodetree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 47aa9caf6d..8c9eb365ac 100644
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -1304,7 +1304,7 @@ def main():

 for filename in args:
 input_file = filename
-f = open(filename, 'r')
+f = open(filename, 'r', encoding="utf8")
 parse_file(f, toppat)
 f.close()

```
>
>
> My lastname in the copyright line =)
>
>> [2/4674] Generating 'libqemu-mipsel-softmmu.fa.p/decode-msa64.c.inc'.
>> FAILED: libqemu-mipsel-softmmu.fa.p/decode-msa64.c.inc
>> /usr/bin/python3 /home/petmay01/qemu-for-merges/scripts/decodetree.py
>> ../../target/mips/msa64.decode --static-decode=
>> decode_msa64 -o libqemu-mipsel-softmmu.fa.p/decode-msa64.c.inc
>> Traceback (most recent call last):
>>   File "/home/petmay01/qemu-for-merges/scripts/decodetree.py", line
>> 1397, in 
>> main()
>>   File "/home/petmay01/qemu-for-merges/scripts/decodetree.py", line
>> 1308, in main
>> parse_file(f, toppat)
>>   File "/home/petmay01/qemu-for-merges/scripts/decodetree.py", line
>> 994, in parse_file
>> for line in f:
>>   File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
>> return codecs.ascii_decode(input, self.errors)[0]
>> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
>> 93: ordinal not in range(128)
>>
>> etc.
>>
>> Looks like decodetree fails to cope with non-ASCII characters in
>> its input file -- probably this depends on the host locale settings:
>> I think these hosts run in the 'C' locale.
>
>
> Can you provide more information on your host so we can cover it in
Gitlab-CI?
>
> Thanks,
>
> Phil.



--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: What's the correct way to implement rfi and related instruction.

2021-01-07 Thread Yonggang Luo
On Fri, Jan 8, 2021 at 5:54 AM Cédric Le Goater  wrote:
>
> On 1/7/21 8:14 PM, 罗勇刚(Yonggang Luo) wrote:
> > This is the first patch,:
> > It's store MSR bits differntly for different rfi instructions:
> > [Qemu-devel] [PATCH] target-ppc: fix RFI by clearing some bits of MSR
> > https://lists.gnu.org/archive/html/qemu-devel/2010-05/msg02999.html <
https://lists.gnu.org/archive/html/qemu-devel/2010-05/msg02999.html>
> > Comes from  target-ppc: fix RFI by clearing some bits of MSR
> > SHA-1: c3d420ead1aee9fcfd12be11cbdf6b1620134773
> >  target-ppc/op_helper.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > ```
> > diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
> > index 8f2ee986bb..3c3aa60bc3 100644
> > --- a/target-ppc/op_helper.c
> > +++ b/target-ppc/op_helper.c
> > @@ -1646,20 +1646,20 @@ static inline void do_rfi(target_ulong nip,
target_ulong msr,
> >  void helper_rfi (void)
> >  {
> >  do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],
> > -   ~((target_ulong)0x0), 1);
> > +   ~((target_ulong)0x783F), 1);
> >  }
> >
> >  #if defined(TARGET_PPC64)
> >  void helper_rfid (void)
> >  {
> >  do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1],
> > -   ~((target_ulong)0x0), 0);
> > +   ~((target_ulong)0x783F), 0);
> >  }
> >
> >  void helper_hrfid (void)
> >  {
> >  do_rfi(env->spr[SPR_HSRR0], env->spr[SPR_HSRR1],
> > -   ~((target_ulong)0x0), 0);
> > +   ~((target_ulong)0x783F), 0);
> >  }
> >  #endif
> >  #endif
> > ```
> >
> > This is the second patch,:
> > it's remove the parameter  `target_ulong msrm, int keep_msrh`
> > Comes from ppc: Fix rfi/rfid/hrfi/... emulation
> > SHA-1: a2e71b28e832346409efc795ecd1f0a2bcb705a3
> > ```
> >  target-ppc/excp_helper.c | 51
+++-
> >  1 file changed, 20 insertions(+), 31 deletions(-)
> >
> > diff --git a/target-ppc/excp_helper.c b/target-ppc/excp_helper.c
> > index 30e960e30b..aa0b63f4b0 100644
> > --- a/target-ppc/excp_helper.c
> > +++ b/target-ppc/excp_helper.c
> > @@ -922,25 +922,20 @@ void helper_store_msr(CPUPPCState *env,
target_ulong val)
> >  }
> >  }
> >
> > -static inline void do_rfi(CPUPPCState *env, target_ulong nip,
target_ulong msr,
> > -  target_ulong msrm, int keep_msrh)
> > +static inline void do_rfi(CPUPPCState *env, target_ulong nip,
target_ulong msr)
> >  {
> >  CPUState *cs = CPU(ppc_env_get_cpu(env));
> >
> > +/* MSR:POW cannot be set by any form of rfi */
> > +msr &= ~(1ULL << MSR_POW);
> > +
> >  #if defined(TARGET_PPC64)
> > -if (msr_is_64bit(env, msr)) {
> > -nip = (uint64_t)nip;
> > -msr &= (uint64_t)msrm;
> > -} else {
> > +/* Switching to 32-bit ? Crop the nip */
> > +if (!msr_is_64bit(env, msr)) {
> >  nip = (uint32_t)nip;
> > -msr = (uint32_t)(msr & msrm);
> > -if (keep_msrh) {
> > -msr |= env->msr & ~((uint64_t)0x);
> > -}
> >  }
> >  #else
> >  nip = (uint32_t)nip;
> > -msr &= (uint32_t)msrm;
> >  #endif
> >  /* XXX: beware: this is false if VLE is supported */
> >  env->nip = nip & ~((target_ulong)0x0003);
> > @@ -959,26 +954,24 @@ static inline void do_rfi(CPUPPCState *env,
target_ulong nip, target_ulong msr,
> >
> >  void helper_rfi(CPUPPCState *env)
> >  {
> > -if (env->excp_model == POWERPC_EXCP_BOOKE) {
> > -do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1],
> > -   ~((target_ulong)0), 0);
> > -} else {
> > -do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1],
> > -   ~((target_ulong)0x783F), 1);
> > -}
> > +do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1] & 0xul);
> >  }
> >
> > +#define MSR_BOOK3S_MASK
> >  #if defined(TARGET_PPC64)
> >  void helper_rfid(CPUPPCState *env)
> >  {
> > -do_rfi(env, env->spr[SPR_SRR0], env->spr[SPR_SRR1],
> > -   ~((target_ulong)0x783F), 0);
> > +/* The architeture defines a number of rules for which bits
> > + * can change but in practice, we handle this in hreg_store_msr()
> > + * which will be called by do_rfi(), so there is no need to filter
> > + * here
> > + */
> >

What's the correct way to implement rfi and related instruction.

2021-01-07 Thread Yonggang Luo
nv->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1],
-   ~((target_ulong)0), 0);
+do_rfi(env, env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]);
 }
 #endif

@@ -1045,7 +1034,7 @@ void helper_td(CPUPPCState *env, target_ulong arg1,
target_ulong arg2,

 void helper_rfsvc(CPUPPCState *env)
 {
-do_rfi(env, env->lr, env->ctr, 0x, 0);
+do_rfi(env, env->lr, env->ctr & 0x);
 }

 /* Embedded.Processor Control */
```

And of cause, the second patch fixes some problem, but also cause new
problem, how to implement these instruction properly?



--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v4 5/5] whpx: move whpx_lapic_state from header to c file

2021-01-07 Thread Yonggang Luo
On Thu, Jan 7, 2021 at 2:55 AM Paolo Bonzini  wrote:
>
> On 07/01/21 11:28, Marc-André Lureau wrote:
> > Hi
> >
> > On Thu, Jan 7, 2021 at 2:26 PM Yonggang Luo  > <mailto:luoyongg...@gmail.com>> wrote:
> >
> > This struct only used in whpx-apic.c, there is no need
> > expose it in whpx.h.
> >
> > Signed-off-by: Yonggang Luo  > <mailto:luoyongg...@gmail.com>>
> >
> >
> > Similar patch pending:
> >
https://patchew.org/QEMU/20201219090637.1700900-1-pbonz...@redhat.com/20201219090637.1700900-3-pbonz...@redhat.com/
> > <
https://patchew.org/QEMU/20201219090637.1700900-1-pbonz...@redhat.com/20201219090637.1700900-3-pbonz...@redhat.com/
>
>
> This one could still be applied before or after mine, it makes sense.
>
> Paolo
>
OK, prefer yours:) I am trying to green the CI,

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH v4 5/5] whpx: move whpx_lapic_state from header to c file

2021-01-07 Thread Yonggang Luo
This struct only used in whpx-apic.c, there is no need
expose it in whpx.h.

Signed-off-by: Yonggang Luo 
---
 include/sysemu/whpx.h| 7 ---
 target/i386/whpx/whpx-apic.c | 7 +++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/sysemu/whpx.h b/include/sysemu/whpx.h
index 4f38784d7e..bfbcaa25d8 100644
--- a/include/sysemu/whpx.h
+++ b/include/sysemu/whpx.h
@@ -25,13 +25,6 @@ struct whpx_state {
 bool apic_in_platform;
 };
 
-struct whpx_lapic_state {
-struct {
-uint32_t data;
-uint32_t padding[3];
-} fields[256];
-};
-
 extern struct whpx_state whpx_global;
 int whpx_enabled(void);
 
diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c
index b127a3cb8a..dd60fb0996 100644
--- a/target/i386/whpx/whpx-apic.c
+++ b/target/i386/whpx/whpx-apic.c
@@ -20,6 +20,13 @@
 #include "sysemu/whpx.h"
 #include "whp-dispatch.h"
 
+struct whpx_lapic_state {
+struct {
+uint32_t data;
+uint32_t padding[3];
+} fields[256];
+};
+
 static void whpx_put_apic_state(APICCommonState *s,
 struct whpx_lapic_state *kapic)
 {
-- 
2.29.2.windows.3




[PATCH v4 4/5] whpx: Fixes include of whp-dispatch.h in whpx.h

2021-01-07 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 include/sysemu/whpx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/sysemu/whpx.h b/include/sysemu/whpx.h
index 9346fd92e9..4f38784d7e 100644
--- a/include/sysemu/whpx.h
+++ b/include/sysemu/whpx.h
@@ -15,7 +15,7 @@
 
 #ifdef CONFIG_WHPX
 
-#include "whp-dispatch.h"
+#include 
 
 struct whpx_state {
 uint64_t mem_quota;
-- 
2.29.2.windows.3




[PATCH v4 1/5] cirrus/msys2: Exit powershell with $LastExitCode

2021-01-07 Thread Yonggang Luo
Currently if we don't exit with $LastExitCode manually,
the cirrus would not report the build/testing failure.

Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 3907e036da..68b8a8fa9c 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -137,5 +137,7 @@ windows_msys2_task:
 - C:\tools\msys64\usr\bin\bash.exe -lc "mkdir build"
 - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure 
--python=python3"
 - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make -j8"
+- exit $LastExitCode
   test_script:
 - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make V=1 check"
+- exit $LastExitCode
-- 
2.29.2.windows.3




[PATCH v4 3/5] maintainers: Add me as Windows Hosted Continuous Integration maintainer

2021-01-07 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4be087b88e..4d9df874a1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3198,6 +3198,12 @@ S: Maintained
 F: .cirrus.yml
 W: https://cirrus-ci.com/github/qemu/qemu
 
+Windows Hosted Continuous Integration
+M: Yonggang Luo 
+S: Maintained
+F: .cirrus.yml
+W: https://cirrus-ci.com/github/qemu/qemu
+
 GitLab Continuous Integration
 M: Thomas Huth 
 M: Philippe Mathieu-Daudé 
-- 
2.29.2.windows.3




[PATCH v4 2/5] cirrus/msys2: Cache msys2 mingw in a better way.

2021-01-07 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 117 ++--
 1 file changed, 68 insertions(+), 49 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 68b8a8fa9c..bc40a0550d 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -64,23 +64,61 @@ windows_msys2_task:
 CIRRUS_SHELL: powershell
 MSYS: winsymlinks:nativestrict
 MSYSTEM: MINGW64
+MSYS2_URL: 
https://github.com/msys2/msys2-installer/releases/download/2021-01-05/msys2-base-x86_64-20210105.sfx.exe
+MSYS2_FINGERPRINT: 0
+MSYS2_PACKAGES: "
+  diffutils git grep make pkg-config sed
+  mingw-w64-x86_64-python
+  mingw-w64-x86_64-python-sphinx
+  mingw-w64-x86_64-toolchain
+  mingw-w64-x86_64-SDL2
+  mingw-w64-x86_64-SDL2_image
+  mingw-w64-x86_64-gtk3
+  mingw-w64-x86_64-glib2
+  mingw-w64-x86_64-ninja
+  mingw-w64-x86_64-jemalloc
+  mingw-w64-x86_64-lzo2
+  mingw-w64-x86_64-zstd
+  mingw-w64-x86_64-libjpeg-turbo
+  mingw-w64-x86_64-pixman
+  mingw-w64-x86_64-libgcrypt
+  mingw-w64-x86_64-libpng
+  mingw-w64-x86_64-libssh
+  mingw-w64-x86_64-libxml2
+  mingw-w64-x86_64-snappy
+  mingw-w64-x86_64-libusb
+  mingw-w64-x86_64-usbredir
+  mingw-w64-x86_64-libtasn1
+  mingw-w64-x86_64-nettle
+  mingw-w64-x86_64-cyrus-sasl
+  mingw-w64-x86_64-curl
+  mingw-w64-x86_64-gnutls
+  mingw-w64-x86_64-libnfs
+"
 CHERE_INVOKING: 1
-  setup_script:
-- choco install -y --no-progress 7zip
-- Write-Output $env:PATH
   msys2_cache:
 folder: C:\tools\archive
 reupload_on_changes: false
-fingerprint_script: cat .cirrus.yml
+# These env variables are used to generate fingerprint to trigger the 
cache procedure
+# If wanna to force re-populate msys2, increase MSYS2_FINGERPRINT
+fingerprint_script:
+  - |
+echo $env:CIRRUS_TASK_NAME
+echo $env:MSYS2_URL
+echo $env:MSYS2_FINGERPRINT
+echo $env:MSYS2_PACKAGES
 populate_script:
   - |
-md C:\tools
-md C:\tools\archive
+md -Force C:\tools\archive\pkg
 $start_time = Get-Date
+bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND $env:MSYS2_URL C:\tools\archive\base.exe
+Write-Output "Download time taken: $((Get-Date).Subtract($start_time))"
 cd C:\tools
-bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND 
https://github.com/msys2/msys2-installer/releases/download/2020-09-03/msys2-base-x86_64-20200903.sfx.exe
 C:\tools\base.exe
-Write-Output "Download time taken: 
$((Get-Date).Subtract($start_time).Seconds) second(s)"
-C:\tools\base.exe -y
+C:\tools\archive\base.exe -y
+del -Force C:\tools\archive\base.exe
+Write-Output "Base install time taken: 
$((Get-Date).Subtract($start_time))"
+$start_time = Get-Date
+
 ((Get-Content -path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace 
'--refresh-keys', '--version') | Set-Content -Path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post
 C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 
's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
 C:\tools\msys64\usr\bin\bash.exe -lc "export"
@@ -90,49 +128,30 @@ windows_msys2_task:
 tasklist
 C:\tools\msys64\usr\bin\bash.exe -lc "mv -f /etc/pacman.conf.pacnew 
/etc/pacman.conf || true"
 C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Suu 
--overwrite=*"
-C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -S --needed \
-  diffutils git grep make pkg-config sed \
-  mingw-w64-x86_64-python \
-  mingw-w64-x86_64-toolchain \
-  mingw-w64-x86_64-SDL2 \
-  mingw-w64-x86_64-SDL2_image \
-  mingw-w64-x86_64-gtk3 \
-  mingw-w64-x86_64-glib2 \
-  mingw-w64-x86_64-ninja \
-  mingw-w64-x86_64-jemalloc \
-  mingw-w64-x86_64-lzo2 \
-  mingw-w64-x86_64-zstd \
-  mingw-w64-x86_64-libjpeg-turbo \
-  mingw-w64-x86_64-pixman \
-  mingw-w64-x86_64-libgcrypt \
-  mingw-w64-x86_64-libpng \
-  mingw-w64-x86_64-libssh \
-  mingw-w64-x86_64-libxml2 \
-  mingw-w64-x86_64-snappy \
-  mingw-w64-x86_64-libusb \
-  mingw-w64-x86_64-usbredir \
-  mingw-w64-x86_64-libtasn1 \
-  mingw-w64-x86_64-nettle \
-  mingw-w64-x86_64-cyrus-sasl \
-  mingw-w64-x86_64-curl \
-  mingw-w64-x86_64-gnutls \
-  mingw-w64-x86_64-libnfs \
-  "
-bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND `
-  
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 `
-  C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.x

[PATCH v4 0/5] Misc meson fixes along test-vmstate fixes

2021-01-07 Thread Yonggang Luo
V1-V2
Fixes whpx: Fixes include of whp-dispatch.h in whpx.h by
  the suggestion of Philippe Mathieu-Daudé 
Add new patch whpx: move whpx_lapic_state from header to c file

The test-vmstate can be passed under win32 too
so enable it on win32,
This is based on Bonzini's upstream tag along

Yonggang Luo (5):
  cirrus/msys2: Exit powershell with $LastExitCode
  cirrus/msys2: Cache msys2 mingw in a better way.
  maintainers: Add me as Windows Hosted Continuous Integration
maintainer
  whpx: Fixes include of whp-dispatch.h in whpx.h
  whpx: move whpx_lapic_state from header to c file

 .cirrus.yml  | 119 ---
 MAINTAINERS  |   6 ++
 include/sysemu/whpx.h|   9 +--
 target/i386/whpx/whpx-apic.c |   7 +++
 4 files changed, 84 insertions(+), 57 deletions(-)

-- 
2.29.2.windows.3




[PATCH 4/4] maintainers: Add me as Windows Hosted Continuous Integration maintainer

2021-01-06 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4be087b88e..4d9df874a1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3198,6 +3198,12 @@ S: Maintained
 F: .cirrus.yml
 W: https://cirrus-ci.com/github/qemu/qemu
 
+Windows Hosted Continuous Integration
+M: Yonggang Luo 
+S: Maintained
+F: .cirrus.yml
+W: https://cirrus-ci.com/github/qemu/qemu
+
 GitLab Continuous Integration
 M: Thomas Huth 
 M: Philippe Mathieu-Daud?? 
-- 
2.29.2.windows.3




[PATCH 2/4] cirrus/msys2: Cache msys2 mingw in a better way.

2021-01-06 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 117 ++--
 1 file changed, 68 insertions(+), 49 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index ff6adabd0d..6f2a958472 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -58,23 +58,61 @@ windows_msys2_task:
 CIRRUS_SHELL: powershell
 MSYS: winsymlinks:nativestrict
 MSYSTEM: MINGW64
+MSYS2_URL: 
https://github.com/msys2/msys2-installer/releases/download/2021-01-05/msys2-base-x86_64-20210105.sfx.exe
+MSYS2_FINGERPRINT: 0
+MSYS2_PACKAGES: "
+  diffutils git grep make pkg-config sed
+  mingw-w64-x86_64-python
+  mingw-w64-x86_64-python-sphinx
+  mingw-w64-x86_64-toolchain
+  mingw-w64-x86_64-SDL2
+  mingw-w64-x86_64-SDL2_image
+  mingw-w64-x86_64-gtk3
+  mingw-w64-x86_64-glib2
+  mingw-w64-x86_64-ninja
+  mingw-w64-x86_64-jemalloc
+  mingw-w64-x86_64-lzo2
+  mingw-w64-x86_64-zstd
+  mingw-w64-x86_64-libjpeg-turbo
+  mingw-w64-x86_64-pixman
+  mingw-w64-x86_64-libgcrypt
+  mingw-w64-x86_64-libpng
+  mingw-w64-x86_64-libssh
+  mingw-w64-x86_64-libxml2
+  mingw-w64-x86_64-snappy
+  mingw-w64-x86_64-libusb
+  mingw-w64-x86_64-usbredir
+  mingw-w64-x86_64-libtasn1
+  mingw-w64-x86_64-nettle
+  mingw-w64-x86_64-cyrus-sasl
+  mingw-w64-x86_64-curl
+  mingw-w64-x86_64-gnutls
+  mingw-w64-x86_64-libnfs
+"
 CHERE_INVOKING: 1
-  setup_script:
-- choco install -y --no-progress 7zip
-- Write-Output $env:PATH
   msys2_cache:
 folder: C:\tools\archive
 reupload_on_changes: false
-fingerprint_script: cat .cirrus.yml
+# These env variables are used to generate fingerprint to trigger the 
cache procedure
+# If wanna to force re-populate msys2, increase MSYS2_FINGERPRINT
+fingerprint_script:
+  - |
+echo $env:CIRRUS_TASK_NAME
+echo $env:MSYS2_URL
+echo $env:MSYS2_FINGERPRINT
+echo $env:MSYS2_PACKAGES
 populate_script:
   - |
-md C:\tools
-md C:\tools\archive
+md -Force C:\tools\archive\pkg
 $start_time = Get-Date
+bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND $env:MSYS2_URL C:\tools\archive\base.exe
+Write-Output "Download time taken: $((Get-Date).Subtract($start_time))"
 cd C:\tools
-bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND 
https://github.com/msys2/msys2-installer/releases/download/2020-09-03/msys2-base-x86_64-20200903.sfx.exe
 C:\tools\base.exe
-Write-Output "Download time taken: 
$((Get-Date).Subtract($start_time).Seconds) second(s)"
-C:\tools\base.exe -y
+C:\tools\archive\base.exe -y
+del -Force C:\tools\archive\base.exe
+Write-Output "Base install time taken: 
$((Get-Date).Subtract($start_time))"
+$start_time = Get-Date
+
 ((Get-Content -path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace 
'--refresh-keys', '--version') | Set-Content -Path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post
 C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 
's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
 C:\tools\msys64\usr\bin\bash.exe -lc "export"
@@ -84,49 +122,30 @@ windows_msys2_task:
 tasklist
 C:\tools\msys64\usr\bin\bash.exe -lc "mv -f /etc/pacman.conf.pacnew 
/etc/pacman.conf || true"
 C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -Suu 
--overwrite=*"
-C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -S --needed \
-  diffutils git grep make pkg-config sed \
-  mingw-w64-x86_64-python \
-  mingw-w64-x86_64-toolchain \
-  mingw-w64-x86_64-SDL2 \
-  mingw-w64-x86_64-SDL2_image \
-  mingw-w64-x86_64-gtk3 \
-  mingw-w64-x86_64-glib2 \
-  mingw-w64-x86_64-ninja \
-  mingw-w64-x86_64-jemalloc \
-  mingw-w64-x86_64-lzo2 \
-  mingw-w64-x86_64-zstd \
-  mingw-w64-x86_64-libjpeg-turbo \
-  mingw-w64-x86_64-pixman \
-  mingw-w64-x86_64-libgcrypt \
-  mingw-w64-x86_64-libpng \
-  mingw-w64-x86_64-libssh \
-  mingw-w64-x86_64-libxml2 \
-  mingw-w64-x86_64-snappy \
-  mingw-w64-x86_64-libusb \
-  mingw-w64-x86_64-usbredir \
-  mingw-w64-x86_64-libtasn1 \
-  mingw-w64-x86_64-nettle \
-  mingw-w64-x86_64-cyrus-sasl \
-  mingw-w64-x86_64-curl \
-  mingw-w64-x86_64-gnutls \
-  mingw-w64-x86_64-libnfs \
-  "
-bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND `
-  
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 `
-  C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.x

[PATCH 3/4] whpx: Fixes include of whp-dispatch.h in whpx.h

2021-01-06 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 include/sysemu/whpx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/sysemu/whpx.h b/include/sysemu/whpx.h
index 9346fd92e9..0e6c9faaf6 100644
--- a/include/sysemu/whpx.h
+++ b/include/sysemu/whpx.h
@@ -15,7 +15,7 @@
 
 #ifdef CONFIG_WHPX
 
-#include "whp-dispatch.h"
+#include "target/i386/whpx/whp-dispatch.h"
 
 struct whpx_state {
 uint64_t mem_quota;
-- 
2.29.2.windows.3




[PATCH 1/4] cirrus/msys2: Exit powershell with $LastExitCode

2021-01-06 Thread Yonggang Luo
Currently if we don't exit with $LastExitCode manually,
the cirrus would not report the build/testing failure.

Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 62a9b57530..ff6adabd0d 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -131,5 +131,7 @@ windows_msys2_task:
 - C:\tools\msys64\usr\bin\bash.exe -lc "mkdir build"
 - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && ../configure 
--python=python3"
 - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make -j8"
+- exit $LastExitCode
   test_script:
 - C:\tools\msys64\usr\bin\bash.exe -lc "cd build && make V=1 check"
+- exit $LastExitCode
-- 
2.29.2.windows.3




[PATCH 0/4] Fixes whpx build and improve Windows host CI

2021-01-06 Thread Yonggang Luo
Exit powershell with $LastExitCode so that the CI
would report the build/testing failure
Fixes include of whp-dispatch.h
Cache msys2 mingw with a proper fingerprint so
that only when msys2 packages are changed need
trigger the re-populate the cache

Yonggang Luo (4):
  cirrus/msys2: Exit powershell with $LastExitCode
  cirrus/msys2: Cache msys2 mingw in a better way.
  whpx: Fixes include of whp-dispatch.h in whpx.h
  maintainers: Add me as Windows Hosted Continuous Integration
maintainer

 .cirrus.yml   | 119 +-
 MAINTAINERS   |   6 +++
 include/sysemu/whpx.h |   2 +-
 3 files changed, 77 insertions(+), 50 deletions(-)

-- 
2.29.2.windows.3




Re: [PATCH v2] meson: fix ncurses detection on macOS

2020-12-31 Thread Yonggang Luo
On Wed, Dec 30, 2020 at 2:17 PM Chris Hofstaedtler 
wrote:
>
> Without this, meson fails with "curses package not usable" when using
ncurses
> 6.2. Apparently the wide functions (addwstr, etc) are hidden behind the
extra
> define, and meson does not define it at that detection stage.
>
> Regression from b01a4fd3bd7d6f2 ("configure: Define NCURSES_WIDECHAR if
we're
> using curses"). The meson conversion has seen many iterations of the
curses
> check, so pinpointing the exact commit breaking this is not so easy.
>
> Signed-off-by: Chris Hofstaedtler 
> Cc: Peter Maydell 
> Cc: Philippe Mathieu-Daudé 
> Cc: Samuel Thibault 
> Cc: Yonggang Luo 
> ---
>  meson.build | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 372576f82c..fd74728674 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -500,16 +500,16 @@ if have_system and not
get_option('curses').disabled()
>  endif
>endforeach
>msg = get_option('curses').enabled() ? 'curses library not found' : ''
> +  curses_compile_args = ['-DNCURSES_WIDECHAR']
>if curses.found()
> -if cc.links(curses_test, dependencies: [curses])
> -  curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR',
dependencies: [curses])
> +if cc.links(curses_test, args: curses_compile_args, dependencies:
[curses])
> +  curses = declare_dependency(compile_args: curses_compile_args,
dependencies: [curses])
>  else
>msg = 'curses package not usable'
>curses = not_found
>  endif
>endif
>if not curses.found()
> -curses_compile_args = ['-DNCURSES_WIDECHAR']
>  has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
>      if targetos != 'windows' and not has_curses_h
>        message('Trying with /usr/include/ncursesw')
> --
> 2.29.2
>

Reviewed-by: Yonggang Luo 

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH] meson: fix ncurses detection on macOS

2020-12-28 Thread Yonggang Luo
On Mon, Dec 28, 2020 at 11:51 PM Chris Hofstaedtler 
wrote:
>
> Without this, meson fails with "curses package not usable"
> when using ncurses 6.2. Apparently the wide functions
> (addwstr, etc) are hidden behind the extra define, and
> meson does not define it at that detection stage.
>
> Signed-off-by: Chris Hofstaedtler 
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 9c152a85bd..7b9d92c14a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -510,7 +510,7 @@ if have_system and not get_option('curses').disabled()
>endforeach
>msg = get_option('curses').enabled() ? 'curses library not found' : ''
>if curses.found()
> -if cc.links(curses_test, dependencies: [curses])
> +if cc.links(curses_test, args: '-DNCURSES_WIDECHAR', dependencies:
[curses])
>curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR',
dependencies: [curses])
>  else
>msg = 'curses package not usable'
> --
> 2.29.2
>
>
Better to share  curses_compile_args

--- a/meson.build
+++ b/meson.build
@@ -504,16 +504,16 @@ if have_system and not get_option('curses').disabled()
 endif
   endforeach
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
+  curses_compile_args = ['-DNCURSES_WIDECHAR']
   if curses.found()
-if cc.links(curses_test, dependencies: [curses])
-  curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR',
dependencies: [curses])
+if cc.links(curses_test, args: curses_compile_args, dependencies:
[curses])
+  curses = declare_dependency(compile_args: curses_compile_args,
dependencies: [curses])
 else
   msg = 'curses package not usable'
   curses = not_found
 endif
   endif
   if not curses.found()
-curses_compile_args = ['-DNCURSES_WIDECHAR']
 has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
 if targetos != 'windows' and not has_curses_h
   message('Trying with /usr/include/ncursesw')
-- 
2.29.2.windows.3


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH 11/19] target/mips: Extract common helpers from helper.c to common_helper.c

2020-12-14 Thread Yonggang Luo
On Wed, Dec 9, 2020 at 6:09 AM Richard Henderson <
richard.hender...@linaro.org> wrote:
>
> On 12/6/20 5:39 PM, Philippe Mathieu-Daudé wrote:
> > The rest of helper.c is TLB related. Extract the non TLB
> > specific functions to a new file, so we can rename helper.c
> > as tlb_helper.c in the next commit.
> >
> > Signed-off-by: Philippe Mathieu-Daudé 
> > ---
> > Any better name? xxx_helper.c are usually TCG helpers.
>
> *shrug* perhaps cpu_common.c, no "helper" at all?
> Perhaps just move these bits to cpu.c?
>
>
> r~
>
Does these are general cpu bits or misp_cpu bits?
if only misp cpu related, prefer misp_cpu.c
or cpu.c under misp folder.

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [RFC PATCH] .cirrus.yml: bump timeout period for MacOS builds

2020-12-13 Thread Yonggang Luo
On Mon, Dec 14, 2020 at 2:36 AM Philippe Mathieu-Daudé 
wrote:
>
> On Wed, Nov 18, 2020 at 4:11 PM Thomas Huth  wrote:
> > On 18/11/2020 15.07, Alex Bennée wrote:
> > > These seem to trigger timeouts with some regularity.
> > >
> > > Signed-off-by: Alex Bennée 
> > > ---
> > >  .cirrus.yml | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/.cirrus.yml b/.cirrus.yml
> > > index f0209b7a3e..08db7c419f 100644
> > > --- a/.cirrus.yml
> > > +++ b/.cirrus.yml
> > > @@ -18,6 +18,7 @@ freebsd_12_task:
> > >  - gmake -j$(sysctl -n hw.ncpu) check V=1
> > >
> > >  macos_task:
> > > +  timeout_in: 90m
> > >osx_instance:
> > >  image: catalina-base
> > >install_script:
> > > @@ -32,6 +33,7 @@ macos_task:
> > >  - gmake check V=1
> > >
> > >  macos_xcode_task:
> > > +  timeout_in: 90m
> > >osx_instance:
> > >  # this is an alias for the latest Xcode
> > >  image: catalina-xcode
> > >
> >
> > Reviewed-by: Thomas Huth 
> >
> > ... we could maybe also split the --target-list between the two jobs if
they
> > take too long...
>
> Maybe it's time, 90min reached:
> https://cirrus-ci.com/task/5774549872541696
>
Even two hour doesn't working, don't know why

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH] meson: Fixes curses detection on msys2

2020-11-16 Thread Yonggang Luo
Fixes regression on curses detection in msys2
by commit#925a40df2828d32d3aaaf022282cba81082fb263

Signed-off-by: Yonggang Luo 
---
 meson.build | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index bbff0880f4..8695f7d1c2 100644
--- a/meson.build
+++ b/meson.build
@@ -494,10 +494,15 @@ if have_system and not get_option('curses').disabled()
   return 0;
 }'''
 
-  curses = dependency((targetos == 'windows' ? 'ncurses' : 'ncursesw'),
-  required: false,
-  method: 'pkg-config',
-  static: enable_static)
+  curses_dep_list = targetos == 'windows' ? ['ncurses', 'ncursesw'] : 
['ncursesw']
+  foreach curses_dep : curses_dep_list
+if not curses.found()
+  curses = dependency(curses_dep,
+  required: false,
+  method: 'pkg-config',
+  static: enable_static)
+endif
+  endforeach
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
   if curses.found()
 if cc.links(curses_test, dependencies: [curses])
-- 
2.28.0.windows.1




Re: [PATCH 3/4] configure: Add a proper check for sys/ioccom.h and use it in tpm_ioctl.h

2020-11-14 Thread Yonggang Luo
Can we check this in meson.build?

On Sun, Nov 15, 2020 at 12:53 AM Thomas Huth  wrote:
>
> On Solaris and Haiku, the _IO() macros are defined in .
> Add a proper check for this header to our configure scripts, and
> make sure to include the header in tpm_ioctl.h to fix a build failure
> on Solaris and Haiku.
>
> Signed-off-by: Thomas Huth 
> ---
>  backends/tpm/tpm_ioctl.h |  4 
>  configure| 11 ++-
>  nbd/nbd-internal.h   |  2 +-
>  3 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/backends/tpm/tpm_ioctl.h b/backends/tpm/tpm_ioctl.h
> index f5f5c553a9..bd6c12cb86 100644
> --- a/backends/tpm/tpm_ioctl.h
> +++ b/backends/tpm/tpm_ioctl.h
> @@ -12,6 +12,10 @@
>  #include 
>  #include 
>
> +#ifdef HAVE_SYS_IOCCOM_H
> +#include 
> +#endif
> +
>  /*
>   * Every response from a command involving a TPM command execution must
hold
>   * the ptm_res as the first element.
> diff --git a/configure b/configure
> index c0acda164d..764e903748 100755
> --- a/configure
> +++ b/configure
> @@ -3123,6 +3123,13 @@ if check_include "sys/signal.h" ; then
>have_sys_signal_h=yes
>  fi
>
> +#
> +# sys/ioccom.h check
> +have_sys_ioccom_h=no
> +if check_include "sys/ioccom.h" ; then
> +  have_sys_ioccom_h=yes
> +fi
> +
>  ##
>  # VTE probe
>
> @@ -6214,7 +6221,9 @@ fi
>  if test "$have_sys_signal_h" = "yes" ; then
>  echo "HAVE_SYS_SIGNAL_H=y" >> $config_host_mak
>  fi
> -
> +if test "$have_sys_ioccom_h" = "yes" ; then
> +echo "HAVE_SYS_IOCCOM_H=y" >> $config_host_mak
> +fi
>  # Work around a system header bug with some kernel/XFS header
>  # versions where they both try to define 'struct fsxattr':
>  # xfs headers will not try to redefine structs from linux headers
> diff --git a/nbd/nbd-internal.h b/nbd/nbd-internal.h
> index 60629ef160..1b2141ab4b 100644
> --- a/nbd/nbd-internal.h
> +++ b/nbd/nbd-internal.h
> @@ -19,7 +19,7 @@
>  #ifndef _WIN32
>  #include 
>  #endif
> -#if defined(__sun__) || defined(__HAIKU__)
> +#ifdef HAVE_SYS_IOCCOM_H
>  #include 
>  #endif
>
> --
> 2.18.4
>
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH v4 0/2] Fixes building nfs on msys2/mingw

2020-11-05 Thread Yonggang Luo
V3-V4
Use uint64_t instead of blkcnt_t
V2-V3
Revise the commit message of
* block: enable libnfs on msys2/mingw in cirrus.yml

V1-V2
Apply suggestion from  Peter Lieven

Yonggang Luo (2):
  block: Fixes nfs compiling error on msys2/mingw
  block: enable libnfs on msys2/mingw in cirrus.yml

 .cirrus.yml |  1 +
 block/nfs.c | 13 -
 2 files changed, 13 insertions(+), 1 deletion(-)

-- 
2.28.0.windows.1




Re: [PATCH v2 2/2] block: enable libnfs on msys2/mingw in cirrus.yml

2020-11-05 Thread Yonggang Luo
On Thu, Nov 5, 2020 at 7:43 PM Max Reitz  wrote:
>
> On 13.10.20 02:15, Yonggang Luo wrote:
> > At the begging libnfs are not enabled because of compiling error,
> > now it's fixed so enable it
> >
> > Signed-off-by: Yonggang Luo 
> > ---
> >   .cirrus.yml | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/.cirrus.yml b/.cirrus.yml
> > index f42ccb956a..2c6bf45e6d 100644
> > --- a/.cirrus.yml
> > +++ b/.cirrus.yml
> > @@ -109,6 +109,7 @@ windows_msys2_task:
> > mingw-w64-x86_64-cyrus-sasl \
> > mingw-w64-x86_64-curl \
> > mingw-w64-x86_64-gnutls \
> > +  mingw-w64-x86_64-libnfs \
> > "
> >   bitsadmin /transfer msys_download /dynamic /download
/priority FOREGROUND `
> >
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
`
>
> I’d love to test this, unfortunately git.qemu.org has some issues now
> and so I can’t run Cirrus tests. :/
>
> I suppose I’ll retry when git.qemu.org works again.
>
> Max
>
Maybe we arealdy switched to gitlab?

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v2 1/2] block: Fixes nfs compiling error on msys2/mingw

2020-11-05 Thread Yonggang Luo
Updated with fixes.

On Thu, Nov 5, 2020 at 8:11 PM Max Reitz  wrote:
>
> On 05.11.20 12:46, 罗勇刚(Yonggang Luo) wrote:
> >
> >
> > On Thu, Nov 5, 2020 at 7:44 PM Max Reitz  > <mailto:mre...@redhat.com>> wrote:
> >  >
> >  > On 05.11.20 12:32, 罗勇刚(Yonggang Luo) wrote:
> >  > >
> >  > >
> >  > > On Thu, Nov 5, 2020 at 7:29 PM Max Reitz  > <mailto:mre...@redhat.com>
> >  > > <mailto:mre...@redhat.com <mailto:mre...@redhat.com>>> wrote:
> >  > >  >
> >  > >  > On 13.10.20 02:15, Yonggang Luo wrote:
> >  > >  > > These compiling errors are fixed:
> >  > >  > > ../block/nfs.c:27:10: fatal error: poll.h: No such file or
> > directory
> >  > >  > > 27 | #include 
> >  > >  > >|  ^~~~
> >  > >  > > compilation terminated.
> >  > >  > >
> >  > >  > > ../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
> >  > >  > > 63 | blkcnt_t st_blocks;
> >  > >  > >| ^~~~
> >  > >  > > ../block/nfs.c: In function 'nfs_client_open':
> >  > >  > > ../block/nfs.c:550:27: error: 'struct _stat64' has no member
named
> >  > > 'st_blocks'
> >  > >  > >550 | client->st_blocks = st.st_blocks;
> >  > >  > >|   ^
> >  > >  > > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> >  > >  > > ../block/nfs.c:751:41: error: 'struct _stat64' has no member
named
> >  > > 'st_blocks'
> >  > >  > >751 | return (task.ret < 0 ? task.ret : st.st_blocks *
> > 512);
> >  > >  > >| ^
> >  > >  > > ../block/nfs.c: In function 'nfs_reopen_prepare':
> >  > >  > > ../block/nfs.c:805:31: error: 'struct _stat64' has no member
named
> >  > > 'st_blocks'
> >  > >  > >805 | client->st_blocks = st.st_blocks;
> >  > >  > >|   ^
> >  > >  > > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> >  > >  > > ../block/nfs.c:752:1: error: control reaches end of non-void
> >  > > function [-Werror=return-type]
> >  > >  > >752 | }
> >  > >  > >| ^
> >  > >  > >
> >  > >  > > On msys2/mingw, there is no st_blocks in struct _stat64 yet,
we
> >  > > disable the usage of it
> >  > >  > > on msys2/mingw, and create a typedef long long blkcnt_t; for
> >  > > further implementation
> >  > >  > >
> >  > >  > > Signed-off-by: Yonggang Luo  > <mailto:luoyongg...@gmail.com>
> >  > > <mailto:luoyongg...@gmail.com <mailto:luoyongg...@gmail.com>>>
> >  > >  > > ---
> >  > >  > >   block/nfs.c | 15 +++
> >  > >  > >   1 file changed, 15 insertions(+)
> >  > >  > >
> >  > >  > > diff --git a/block/nfs.c b/block/nfs.c
> >  > >  > > index f86e660374..cf8795fb49 100644
> >  > >  > > --- a/block/nfs.c
> >  > >  > > +++ b/block/nfs.c
> >  > >  >
> >  > >  > [...]
> >  > >  >
> >  > >  > > @@ -51,6 +53,10 @@
> >  > >  > >   #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
> >  > >  > >   #define QEMU_NFS_MAX_DEBUG_LEVEL 2
> >  > >  > >
> >  > >  > > +#if defined(_WIN32)
> >  > >  > > +typedef long long blkcnt_t;
> >  > >  >
> >  > >  > This makes me uneasy.  Is there a guarantee that this type will
> > never be
> >  > >  > defined in a mingw environment (which would then result in a new
> > compile
> >  > >  > error)?
> >  > > That's be sure, mingw is compat with msvcrt.dll, so blkcnt_t  are
> > always
> >  > > not defined.
> >  >
> >  > And there is no possibility of that being added in the future?
> > If that's the case, what's the better option.
>
> As I said, just making NFSClient.st_blocks a uint64_t.
>
> Max
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH v4 1/2] block: Fixes nfs compiling error on msys2/mingw

2020-11-05 Thread Yonggang Luo
These compiling errors are fixed:
../block/nfs.c:27:10: fatal error: poll.h: No such file or directory
   27 | #include 
  |  ^~~~
compilation terminated.

../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
   63 | blkcnt_t st_blocks;
  | ^~~~
../block/nfs.c: In function 'nfs_client_open':
../block/nfs.c:550:27: error: 'struct _stat64' has no member named 'st_blocks'
  550 | client->st_blocks = st.st_blocks;
  |   ^
../block/nfs.c: In function 'nfs_get_allocated_file_size':
../block/nfs.c:751:41: error: 'struct _stat64' has no member named 'st_blocks'
  751 | return (task.ret < 0 ? task.ret : st.st_blocks * 512);
  | ^
../block/nfs.c: In function 'nfs_reopen_prepare':
../block/nfs.c:805:31: error: 'struct _stat64' has no member named 'st_blocks'
  805 | client->st_blocks = st.st_blocks;
  |   ^
../block/nfs.c: In function 'nfs_get_allocated_file_size':
../block/nfs.c:752:1: error: control reaches end of non-void function 
[-Werror=return-type]
  752 | }
  | ^

On msys2/mingw, there is no st_blocks in struct _stat64 yet, we disable the 
usage of it
on msys2/mingw, and create a typedef long long blkcnt_t; for further 
implementation

Signed-off-by: Yonggang Luo 
---
 block/nfs.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/block/nfs.c b/block/nfs.c
index f86e660374..77905f516d 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -24,7 +24,9 @@
 
 #include "qemu/osdep.h"
 
+#if !defined(_WIN32)
 #include 
+#endif
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
@@ -58,7 +60,7 @@ typedef struct NFSClient {
 bool has_zero_init;
 AioContext *aio_context;
 QemuMutex mutex;
-blkcnt_t st_blocks;
+uint64_t st_blocks;
 bool cache_used;
 NFSServer *server;
 char *path;
@@ -545,7 +547,9 @@ static int64_t nfs_client_open(NFSClient *client, 
BlockdevOptionsNfs *opts,
 }
 
 ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE);
+#if !defined(_WIN32)
 client->st_blocks = st.st_blocks;
+#endif
 client->has_zero_init = S_ISREG(st.st_mode);
 *strp = '/';
 goto out;
@@ -706,6 +710,7 @@ static int nfs_has_zero_init(BlockDriverState *bs)
 return client->has_zero_init;
 }
 
+#if !defined(_WIN32)
 /* Called (via nfs_service) with QemuMutex held.  */
 static void
 nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data,
@@ -748,6 +753,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState 
*bs)
 
 return (task.ret < 0 ? task.ret : st.st_blocks * 512);
 }
+#endif
 
 static int coroutine_fn
 nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
@@ -800,7 +806,9 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
nfs_get_error(client->context));
 return ret;
 }
+#if !defined(_WIN32)
 client->st_blocks = st.st_blocks;
+#endif
 }
 
 return 0;
@@ -869,7 +877,10 @@ static BlockDriver bdrv_nfs = {
 .create_opts= _create_opts,
 
 .bdrv_has_zero_init = nfs_has_zero_init,
+/* libnfs does not provide the allocated filesize of a file on win32. */
+#if !defined(_WIN32)
 .bdrv_get_allocated_file_size   = nfs_get_allocated_file_size,
+#endif
 .bdrv_co_truncate   = nfs_file_co_truncate,
 
 .bdrv_file_open = nfs_file_open,
-- 
2.28.0.windows.1




[PATCH v4 2/2] block: enable libnfs on msys2/mingw in cirrus.yml

2020-11-05 Thread Yonggang Luo
Initially, libnfs has not been enabled, and now it's fixed, so enable it
on cirrus.

Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index 900437dd2a..f0209b7a3e 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -109,6 +109,7 @@ windows_msys2_task:
   mingw-w64-x86_64-cyrus-sasl \
   mingw-w64-x86_64-curl \
   mingw-w64-x86_64-gnutls \
+  mingw-w64-x86_64-libnfs \
   "
 bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND `
   
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 `
-- 
2.28.0.windows.1




Re: [PATCH v2 1/2] block: Fixes nfs compiling error on msys2/mingw

2020-11-05 Thread Yonggang Luo
On Thu, Nov 5, 2020 at 7:44 PM Max Reitz  wrote:
>
> On 05.11.20 12:32, 罗勇刚(Yonggang Luo) wrote:
> >
> >
> > On Thu, Nov 5, 2020 at 7:29 PM Max Reitz  > <mailto:mre...@redhat.com>> wrote:
> >  >
> >  > On 13.10.20 02:15, Yonggang Luo wrote:
> >  > > These compiling errors are fixed:
> >  > > ../block/nfs.c:27:10: fatal error: poll.h: No such file or
directory
> >  > > 27 | #include 
> >  > >|  ^~~~
> >  > > compilation terminated.
> >  > >
> >  > > ../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
> >  > > 63 | blkcnt_t st_blocks;
> >  > >| ^~~~
> >  > > ../block/nfs.c: In function 'nfs_client_open':
> >  > > ../block/nfs.c:550:27: error: 'struct _stat64' has no member named
> > 'st_blocks'
> >  > >550 | client->st_blocks = st.st_blocks;
> >  > >|   ^
> >  > > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> >  > > ../block/nfs.c:751:41: error: 'struct _stat64' has no member named
> > 'st_blocks'
> >  > >751 | return (task.ret < 0 ? task.ret : st.st_blocks * 512);
> >  > >| ^
> >  > > ../block/nfs.c: In function 'nfs_reopen_prepare':
> >  > > ../block/nfs.c:805:31: error: 'struct _stat64' has no member named
> > 'st_blocks'
> >  > >805 | client->st_blocks = st.st_blocks;
> >  > >|   ^
> >  > > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> >  > > ../block/nfs.c:752:1: error: control reaches end of non-void
> > function [-Werror=return-type]
> >  > >752 | }
> >  > >| ^
> >  > >
> >  > > On msys2/mingw, there is no st_blocks in struct _stat64 yet, we
> > disable the usage of it
> >  > > on msys2/mingw, and create a typedef long long blkcnt_t; for
> > further implementation
> >  > >
> >  > > Signed-off-by: Yonggang Luo  > <mailto:luoyongg...@gmail.com>>
> >  > > ---
> >  > >   block/nfs.c | 15 +++
> >  > >   1 file changed, 15 insertions(+)
> >  > >
> >  > > diff --git a/block/nfs.c b/block/nfs.c
> >  > > index f86e660374..cf8795fb49 100644
> >  > > --- a/block/nfs.c
> >  > > +++ b/block/nfs.c
> >  >
> >  > [...]
> >  >
> >  > > @@ -51,6 +53,10 @@
> >  > >   #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
> >  > >   #define QEMU_NFS_MAX_DEBUG_LEVEL 2
> >  > >
> >  > > +#if defined(_WIN32)
> >  > > +typedef long long blkcnt_t;
> >  >
> >  > This makes me uneasy.  Is there a guarantee that this type will
never be
> >  > defined in a mingw environment (which would then result in a new
compile
> >  > error)?
> > That's be sure, mingw is compat with msvcrt.dll, so blkcnt_t  are always
> > not defined.
>
> And there is no possibility of that being added in the future?
If that's the case, what's the better option.
>
> Max
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v2 1/2] block: Fixes nfs compiling error on msys2/mingw

2020-11-05 Thread Yonggang Luo
On Thu, Nov 5, 2020 at 7:29 PM Max Reitz  wrote:
>
> On 13.10.20 02:15, Yonggang Luo wrote:
> > These compiling errors are fixed:
> > ../block/nfs.c:27:10: fatal error: poll.h: No such file or directory
> > 27 | #include 
> >|  ^~~~
> > compilation terminated.
> >
> > ../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
> > 63 | blkcnt_t st_blocks;
> >| ^~~~
> > ../block/nfs.c: In function 'nfs_client_open':
> > ../block/nfs.c:550:27: error: 'struct _stat64' has no member named
'st_blocks'
> >550 | client->st_blocks = st.st_blocks;
> >|   ^
> > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> > ../block/nfs.c:751:41: error: 'struct _stat64' has no member named
'st_blocks'
> >751 | return (task.ret < 0 ? task.ret : st.st_blocks * 512);
> >| ^
> > ../block/nfs.c: In function 'nfs_reopen_prepare':
> > ../block/nfs.c:805:31: error: 'struct _stat64' has no member named
'st_blocks'
> >805 | client->st_blocks = st.st_blocks;
> >|   ^
> > ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> > ../block/nfs.c:752:1: error: control reaches end of non-void function
[-Werror=return-type]
> >752 | }
> >| ^
> >
> > On msys2/mingw, there is no st_blocks in struct _stat64 yet, we disable
the usage of it
> > on msys2/mingw, and create a typedef long long blkcnt_t; for further
implementation
> >
> > Signed-off-by: Yonggang Luo 
> > ---
> >   block/nfs.c | 15 +++
> >   1 file changed, 15 insertions(+)
> >
> > diff --git a/block/nfs.c b/block/nfs.c
> > index f86e660374..cf8795fb49 100644
> > --- a/block/nfs.c
> > +++ b/block/nfs.c
>
> [...]
>
> > @@ -51,6 +53,10 @@
> >   #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
> >   #define QEMU_NFS_MAX_DEBUG_LEVEL 2
> >
> > +#if defined(_WIN32)
> > +typedef long long blkcnt_t;
>
> This makes me uneasy.  Is there a guarantee that this type will never be
> defined in a mingw environment (which would then result in a new compile
> error)?
That's be sure, mingw is compat with msvcrt.dll, so  blkcnt_t  are always
not defined.

>
> Can’t we just give NFSClient.st_blocks a different type, i.e. uint64_t?
>
> Apart from that, looks good to me.
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL v8 062/152] meson: infrastructure for building emulators

2020-11-03 Thread Yonggang Luo
On Tue, Nov 3, 2020 at 10:25 PM Paolo Bonzini  wrote:
>
> On 03/11/20 15:19, 罗勇刚(Yonggang Luo) wrote:
> >> > +#include CONFIG_DEVICES
> > Mybe add config-devices.h back and detecting the target_cpu and include
> > it properly?
>
> We could add a one-line config-devices.h that contains "#include
> CONFIG_DEVICES" if desirable.
>
> Paolo
>
Make sense


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL v8 062/152] meson: infrastructure for building emulators

2020-11-03 Thread Yonggang Luo
On Tue, Nov 3, 2020 at 9:41 PM Philippe Mathieu-Daudé 
wrote:
>
> On 8/21/20 12:21 PM, Paolo Bonzini wrote:
> > Signed-off-by: Marc-André Lureau 
> > Signed-off-by: Paolo Bonzini 
> > ---
> >  Makefile   |  74 ++
> >  Makefile.target|  19 +++--
> >  configure  |   6 --
> >  hw/i386/fw_cfg.c   |   2 +-
> >  hw/i386/pc.c   |   2 +-
> >  hw/i386/pc_piix.c  |   2 +-
> >  hw/i386/x86.c  |   2 +-
> >  hw/vfio/pci-quirks.c   |   2 +-
> >  hw/virtio/virtio-mem.c |   2 +-
> >  include/qemu/osdep.h   |   2 +-
> >  meson.build| 166 -
> >  rules.mak  |   8 --
> >  scripts/create_config  |   2 +
> >  scripts/grepy.sh   |   3 +
> >  scripts/minikconf.py   |   0
> >  softmmu/qtest.c|   2 +-
> >  16 files changed, 192 insertions(+), 102 deletions(-)
> >  create mode 100755 scripts/grepy.sh
> >  mode change 100755 => 100644 scripts/minikconf.py
> ...
>
> > diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
> > index c55abfb01a..33441ad484 100644
> > --- a/hw/i386/fw_cfg.c
> > +++ b/hw/i386/fw_cfg.c
> > @@ -22,7 +22,7 @@
> >  #include "hw/nvram/fw_cfg.h"
> >  #include "e820_memory_layout.h"
> >  #include "kvm_i386.h"
> > -#include "config-devices.h"
> > +#include CONFIG_DEVICES
Mybe add config-devices.h back and detecting the target_cpu and include it
properly?
>
> Suggestion: add a comment to this include, because it is hard to
> figure out what it does (if you don't have minikconf + meson
> background). At least it was not obvious to me. (other
> occurrences in the codebase).
>
> Regards,
>
> Phil.
>
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL 00/17] Build system changes and misc fixes for QEMU 5.2 soft freeze

2020-10-26 Thread Yonggang Luo
On Tue, Oct 27, 2020 at 4:58 AM Paolo Bonzini  wrote:
>
>
>
> Il lun 26 ott 2020, 19:59 罗勇刚(Yonggang Luo)  ha
scritto:
>>
>> This pull request confused me, the windows msys2 build time slow down
from 40min to more than one hour.
>
>
> Probably just the cache being rebuilt. Cirrus CI times seem to vary a lot
but 40min and 1h5min seem to be the common cases before or after these
changes:
>
> https://cirrus-ci.com/task/5531259461959680
> With this PR: 35+2 (build+test)
>
> https://cirrus-ci.com/task/4570682912669696
> With this PR: 10+4
>
> https://cirrus-ci.com/task/6662289128423424
> With this PR: 35+2, +20 to rebuild cirrus cache
>
> https://cirrus-ci.com/task/5383432727429120
> Without this PR: 30+2, +18 to rebuild cirrus cache
>
> Paolo
That's correct, cirrus's building time are not stable. My own build are
already passed.
https://cirrus-ci.com/task/5357017537708032, if the cache are works, then
it's definitely won't exceed the time


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH 0/2] armv7m_systick: Rewrite to use ptimers

2020-10-26 Thread Yonggang Luo
On Tue, Oct 27, 2020 at 4:44 AM Peter Maydell 
wrote:
>
> Ping for review ?
>
Maybe nobody can review this, anyway, is that possible add a test case for
this?
I found https://github.com/oxidecomputer/qemu-systick-bug are simple enough.
> thanks
> -- PMM
>
> On Thu, 15 Oct 2020 at 16:18, Peter Maydell 
wrote:
> >
> > This patch series rewrites our implementation of the armv7m systick
> > timer to use ptimers.
> >
> > The armv7m systick timer is a 24-bit decrementing, wrap-on-zero,
> > clear-on-write counter.  Our current implementation has various bugs
> > and dubious workarounds in it (for instance see
> > https://bugs.launchpad.net/qemu/+bug/1872237).
> >
> > We have an implementation of a simple decrementing counter and we put
> > a lot of effort into making sure it handles the interesting corner
> > cases (like "spend a cycle at 0 before reloading"), so rather than
> > trying to fix these all over again in systick's hand-rolled countdown
> > code it's much simpler to just rewrite it to use a ptimer.
> >
> > Unfortunately this is a migration compatibility break, which will
> > affect all M-profile boards.
> >
> > Among other bugs, this fixes
> > https://bugs.launchpad.net/qemu/+bug/1872237 : now writes to SYST_CVR
> > when the timer is enabled correctly do nothing; when the timer is
> > enabled via SYST_CSR.ENABLE, the ptimer code will (because of
> > POLICY_NO_IMMEDIATE_RELOAD) arrange that after one timer tick the
> > counter is reloaded from SYST_RVR and then counts down from there, as
> > the architecture requires.
> >
> > Side note: the trace from the test program in LP1872237 won't look
> > quite like it does on the hardware: under QEMU the "waiting for 1000
> > ms" debug printing generally reports a SYST_CVR value of 0.  This is
> > because QEMU's emulated CPU is comparatively fast and our systick has a
> > hard-wired value of 1MHz for the frequency of the 'external reference
> > clock', which means that execution of the guest code reaches "read
> > SYST_CVR" before the first tick of the timer clock after enabling of
> > the timer (which is where the reload of SYST_CVR from SYST_RVR is
> > required).  The exception is the first iteration, where the time QEMU
> > takes to translate the guest code is enough that the timer tick
> > happens before the register read.  You can also get the timer tick to
> > win the race by fiddling around with the -icount option (which
> > effectively is slowing down the emulated CPU speed).
> >
> > Some day we should model both the 'system_clock_scale' (ie the CPU
> > clock frequency) and the 'external reference clock' as QEMU clock
> > source/sinks so that board code can specify the correct reference
> > clock frequency.
> >
> > Patch 1 is a minor tweak to the ptimer code to suppress a spurious
> > warning message for the "timer callback function disabled the ptimer"
> > case, which the systick timer uses.  Patch 2 is the actual
> > conversion.
> >
> > thanks
> > -- PMM
> >
> >
> > Peter Maydell (2):
> >   hw/core/ptimer: Support ptimer being disabled by timer callback
> >   hw/timer/armv7m_systick: Rewrite to use ptimers
> >
> >  include/hw/timer/armv7m_systick.h |   3 +-
> >  hw/core/ptimer.c  |   4 +
> >  hw/timer/armv7m_systick.c | 124 +-
> >  3 files changed, 58 insertions(+), 73 deletions(-)
> >
> > --
> > 2.20.1
> >
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


How about using a bot to guard the pull request can be apply? like rust compiler does.

2020-10-26 Thread Yonggang Luo
Peter can @bots try to apply pull request, if pull request apply and all ci
tests passed, then the bot automatically merge the pull request and push to
the mirrors.
We even doesn't need gitlab or other things, only need the bot to monitor
the instruction from Peter.

-- 
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL 00/17] Build system changes and misc fixes for QEMU 5.2 soft freeze

2020-10-26 Thread Yonggang Luo
This pull request confused me, the windows msys2 build time slow down from
40min to more than one hour.

On Tue, Oct 27, 2020 at 1:54 AM Peter Maydell 
wrote:
>
> On Mon, 26 Oct 2020 at 14:04, Paolo Bonzini  wrote:
> >
> > The following changes since commit
4c5b97bfd0dd54dc27717ae8d1cd10e14eef1430:
> >
> >   Merge remote-tracking branch
'remotes/kraxel/tags/modules-20201022-pull-request' into staging
(2020-10-22 12:33:21 +0100)
> >
> > are available in the Git repository at:
> >
> >   https://gitlab.com/bonzini/qemu.git tags/for-upstream
> >
> > for you to fetch changes up to 8b0e484c8bf82e07bb0439bff04e248c63cdc86a:
> >
> >   machine: move SMP initialization from vl.c (2020-10-26 07:08:40 -0400)
> >
> > 
> > * fix --disable-tcg builds (Claudio)
> > * Fixes for macOS --enable-modules build and OpenBSD curses/iconv
detection (myself)
> > * Start preparing for meson 0.56 (myself)
> > * Move directory configuration to meson (myself)
> > * Start untangling qemu_init (myself)
> > * Windows fixes (Sunil)
> > * Remove -no-kbm (Thomas)
> >
> > 
>
>
> Applied, thanks.
>
> Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
> for any user-visible changes.
>
> -- PMM
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH] meson: rewrite curses/iconv test

2020-10-19 Thread Yonggang Luo
)
> -  endif
> -  if libcurses.found()
> -if cc.links(curses_test, dependencies: [libcurses])
> -  curses = declare_dependency(compile_args:
'-DNCURSES_WIDECHAR', dependencies: [libcurses])
> -  break
> -endif
> -  endif
> -endforeach
> -  endif
> -  if not curses.found()
> -if iconv.found()
> -  if get_option('curses').enabled()
> -error('Cannot find curses')
> -  endif
> -elif get_option('curses').enabled()
> -  error('iconv required for curses UI but not available')
> +  if not curses.found() and msg != ''
> +if get_option('curses').enabled()
> +  error(msg)
>  else
> -  warning('iconv required for curses UI but not available,
disabling')
> +  warning(msg + ', disabling')
>  endif
>endif
>  endif
> --
> 2.26.2
>

Reviewed-by: Yonggang Luo uoyongg...@gmail.com>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v11] scripts: Convert qemu-version.sh to qemu-version.py

2020-10-17 Thread Yonggang Luo
On Sun, Oct 18, 2020 at 12:43 AM Yonggang Luo  wrote:
>
> The sh script are harder to maintain for compatible different
> xsh environment so convert it to python script
> Also incorporate the fixes in
>
https://patchew.org/QEMU/20200929143654.518157-1-marcandre.lur...@redhat.com/
>
> According to https://github.com/msys2/MSYS2-packages/issues/2176
> We need use CYGWIN=noglob and MSYS=noglob in the environment variable
> for disable wildcard expanding in msys or cygwin git, and setting the
shell=False
>
> Signed-off-by: Yonggang Luo 
> Message-Id: <20201006112139.700-1-luoyongg...@gmail.com>
> Signed-off-by: Paolo Bonzini 
> ---
>  meson.build |  2 +-
>  scripts/qemu-version.py | 37 +
>  scripts/qemu-version.sh | 25 -
>  3 files changed, 38 insertions(+), 26 deletions(-)
>  create mode 100644 scripts/qemu-version.py
>  delete mode 100755 scripts/qemu-version.sh
>
> diff --git a/meson.build b/meson.build
> index 05fb59a00b..b100b6d7be 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1240,7 +1240,7 @@ tracetool = [
> '--backend=' + config_host['TRACE_BACKENDS']
>  ]
>
> -qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
> +qemu_version_cmd = [find_program('scripts/qemu-version.py'),
>  meson.current_source_dir(),
>  config_host['PKGVERSION'], meson.project_version()]
>  qemu_version = custom_target('qemu-version.h',
> diff --git a/scripts/qemu-version.py b/scripts/qemu-version.py
> new file mode 100644
> index 00..cf97b2bbb5
> --- /dev/null
> +++ b/scripts/qemu-version.py
> @@ -0,0 +1,37 @@
> +#!/usr/bin/env python3
> +
> +#
> +# Script for retrieve qemu git version information
> +#
> +# Authors:
> +#  Yonggang Luo 
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2
> +# or, at your option, any later version.  See the COPYING file in
> +# the top-level directory.
> +
> +import sys
> +import subprocess
> +import os
> +import os.path
> +
> +def main(_program, dir, pkgversion, version, *unused):
> +os.chdir(dir)
> +if not pkgversion and os.path.exists('.git'):
> +pc = subprocess.run(
> +['git', 'describe', '--match', 'v*', '--dirty', '--always'],
> +env=dict(os.environ, CYGWIN="noglob", MSYS='noglob'),
Sorry for disturb, under msys2,  use   env=dict(os.environ,
CYGWIN="noglob", MSYS='noglob') we make sure
'v*‘ are passed into git without wildcard. So I send this patch again for
fixes this issue
> +stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
> +encoding='utf8', shell=False)
> +if pc.returncode == 0:
> +pkgversion = pc.stdout.strip()
> +
> +fullversion = version
> +if pkgversion:
> +fullversion = "{} ({})".format(version, pkgversion)
> +
> +print('#define QEMU_PKGVERSION "%s"' % pkgversion)
> +print('#define QEMU_FULL_VERSION "%s"' % fullversion)
> +
> +if __name__ == "__main__":
> +main(*sys.argv)
> diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh
> deleted file mode 100755
> index 3f6e7e6d41..00
> --- a/scripts/qemu-version.sh
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -#!/bin/sh
> -
> -set -eu
> -
> -dir="$1"
> -pkgversion="$2"
> -version="$3"
> -
> -if [ -z "$pkgversion" ]; then
> -cd "$dir"
> -if [ -e .git ]; then
> -pkgversion=$(git describe --match 'v*' --dirty) || :
> -fi
> -fi
> -
> -if [ -n "$pkgversion" ]; then
> -fullversion="$version ($pkgversion)"
> -else
> -fullversion="$version"
> -fi
> -
> -cat < -#define QEMU_PKGVERSION "$pkgversion"
> -#define QEMU_FULL_VERSION "$fullversion"
> -EOF
> --
> 2.28.0.windows.1
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH v11] scripts: Convert qemu-version.sh to qemu-version.py

2020-10-17 Thread Yonggang Luo
The sh script are harder to maintain for compatible different
xsh environment so convert it to python script
Also incorporate the fixes in
https://patchew.org/QEMU/20200929143654.518157-1-marcandre.lur...@redhat.com/

According to https://github.com/msys2/MSYS2-packages/issues/2176
We need use CYGWIN=noglob and MSYS=noglob in the environment variable
for disable wildcard expanding in msys or cygwin git, and setting the 
shell=False

Signed-off-by: Yonggang Luo 
Message-Id: <20201006112139.700-1-luoyongg...@gmail.com>
Signed-off-by: Paolo Bonzini 
---
 meson.build |  2 +-
 scripts/qemu-version.py | 37 +
 scripts/qemu-version.sh | 25 -
 3 files changed, 38 insertions(+), 26 deletions(-)
 create mode 100644 scripts/qemu-version.py
 delete mode 100755 scripts/qemu-version.sh

diff --git a/meson.build b/meson.build
index 05fb59a00b..b100b6d7be 100644
--- a/meson.build
+++ b/meson.build
@@ -1240,7 +1240,7 @@ tracetool = [
'--backend=' + config_host['TRACE_BACKENDS']
 ]
 
-qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
+qemu_version_cmd = [find_program('scripts/qemu-version.py'),
 meson.current_source_dir(),
 config_host['PKGVERSION'], meson.project_version()]
 qemu_version = custom_target('qemu-version.h',
diff --git a/scripts/qemu-version.py b/scripts/qemu-version.py
new file mode 100644
index 00..cf97b2bbb5
--- /dev/null
+++ b/scripts/qemu-version.py
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+#
+# Script for retrieve qemu git version information
+#
+# Authors:
+#  Yonggang Luo 
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or, at your option, any later version.  See the COPYING file in
+# the top-level directory.
+
+import sys
+import subprocess
+import os
+import os.path
+
+def main(_program, dir, pkgversion, version, *unused):
+os.chdir(dir)
+if not pkgversion and os.path.exists('.git'):
+pc = subprocess.run(
+['git', 'describe', '--match', 'v*', '--dirty', '--always'],
+env=dict(os.environ, CYGWIN="noglob", MSYS='noglob'),
+stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
+encoding='utf8', shell=False)
+if pc.returncode == 0:
+pkgversion = pc.stdout.strip()
+
+fullversion = version
+if pkgversion:
+fullversion = "{} ({})".format(version, pkgversion)
+
+print('#define QEMU_PKGVERSION "%s"' % pkgversion)
+print('#define QEMU_FULL_VERSION "%s"' % fullversion)
+
+if __name__ == "__main__":
+main(*sys.argv)
diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh
deleted file mode 100755
index 3f6e7e6d41..00
--- a/scripts/qemu-version.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-set -eu
-
-dir="$1"
-pkgversion="$2"
-version="$3"
-
-if [ -z "$pkgversion" ]; then
-cd "$dir"
-if [ -e .git ]; then
-pkgversion=$(git describe --match 'v*' --dirty) || :
-fi
-fi
-
-if [ -n "$pkgversion" ]; then
-fullversion="$version ($pkgversion)"
-else
-fullversion="$version"
-fi
-
-cat <

Re: [PULL v2 00/22] Build system + misc changes for 2020-10-16

2020-10-17 Thread Yonggang Luo
On Sat, Oct 17, 2020 at 11:37 PM Paolo Bonzini  wrote:
>
> On 17/10/20 16:39, Peter Maydell wrote:
> > On Sat, 17 Oct 2020 at 14:38, Paolo Bonzini  wrote:
> >> OpenBSD and NetBSD call the ninja package "ninja-build" unlike FreeBSD.
> >>  I'm sure I had used the right name but well I didn't.  I'll send a v3.
> >
> > OpenBSD built OK but meson produces this new warning:
> >
> > Library iconv found: NO
> > ../src/meson.build:531: WARNING: iconv required for curses UI but not
> > available, disabling
>
> Hrm, the curses test was not plainly converted from shell to meson (guys
> please do *one* thing per patch, things are already complex enough!);
Oh, sorry for that,
> and it is messed up in more ways than I had first noticed (of which the
> most blatant is using /usr/include/ncursesw as a library path).  I'll
> fix everything up and resend this pull request when I'm done.
>
> I'm not sure if that will remove the warning or not, but I'll check (and
> if it does remain, it'll be of the "useful" kind which documents some
> unexpected dependency between options).
>
> Paolo
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PULL 18/22] meson: Move the detection logic for sphinx to meson

2020-10-16 Thread Yonggang Luo
On Fri, Oct 16, 2020 at 7:48 PM Paolo Bonzini  wrote:
>
> From: Yonggang Luo 
>
> Signed-off-by: Yonggang Luo 
> Message-Id: <20201015220626.418-4-luoyongg...@gmail.com>
> Signed-off-by: Paolo Bonzini 
> ---
>  configure | 59 ---
>  docs/meson.build  | 46 
>  meson.build   | 30 
>  meson_options.txt |  4 
>  4 files changed, 64 insertions(+), 75 deletions(-)
>
> diff --git a/configure b/configure
> index 3edbdd2a24..68f097861d 100755
> --- a/configure
> +++ b/configure
> @@ -297,7 +297,7 @@ brlapi=""
>  curl=""
>  iconv="auto"
>  curses="auto"
> -docs=""
> +docs="auto"
>  fdt="auto"
>  netmap="no"
>  sdl="auto"
> @@ -820,15 +820,6 @@ do
>  fi
>  done
>
> -sphinx_build=
> -for binary in sphinx-build-3 sphinx-build
> -do
> -if has "$binary"
> -then
> -sphinx_build=$(command -v "$binary")
> -break
> -fi
> -done
>
>  # Check for ancillary tools used in testing
>  genisoimage=
> @@ -1228,9 +1219,9 @@ for opt do
>;;
>--disable-crypto-afalg) crypto_afalg="no"
>;;
> -  --disable-docs) docs="no"
> +  --disable-docs) docs="disabled"
>;;
> -  --enable-docs) docs="yes"
> +  --enable-docs) docs="enabled"
>;;
>--disable-vhost-net) vhost_net="no"
>;;
> @@ -4419,45 +4410,6 @@ if check_include linux/btrfs.h ; then
>  btrfs=yes
>  fi
>
> -# If we're making warnings fatal, apply this to Sphinx runs as well
> -sphinx_werror=""
> -if test "$werror" = "yes"; then
> -sphinx_werror="-W"
> -fi
> -
> -# Check we have a new enough version of sphinx-build
> -has_sphinx_build() {
> -# This is a bit awkward but works: create a trivial document and
> -# try to run it with our configuration file (which enforces a
> -# version requirement). This will fail if either
> -# sphinx-build doesn't exist at all or if it is too old.
> -mkdir -p "$TMPDIR1/sphinx"
> -touch "$TMPDIR1/sphinx/index.rst"
> -"$sphinx_build" $sphinx_werror -c "$source_path/docs" \
> --b html "$TMPDIR1/sphinx" \
> -"$TMPDIR1/sphinx/out"  >> config.log 2>&1
> -}
> -
> -# Check if tools are available to build documentation.
> -if test "$docs" != "no" ; then
> -  if has_sphinx_build; then
> -sphinx_ok=yes
> -  else
> -sphinx_ok=no
> -  fi
> -  if test "$sphinx_ok" = "yes"; then
> -docs=yes
> -  else
> -if test "$docs" = "yes" ; then
> -  if has $sphinx_build && test "$sphinx_ok" != "yes"; then
> -echo "Warning: $sphinx_build exists but it is either too old or
uses too old a Python version" >&2
> -  fi
> -  feature_not_found "docs" "Install a Python 3 version of
python-sphinx"
> -fi
> -docs=no
> -  fi
> -fi
> -
>  # Search for bswap_32 function
>  byteswap_h=no
>  cat > $TMPC << EOF
> @@ -6093,9 +6045,6 @@ qemu_version=$(head $source_path/VERSION)
>  echo "PKGVERSION=$pkgversion" >>$config_host_mak
>  echo "SRC_PATH=$source_path" >> $config_host_mak
>  echo "TARGET_DIRS=$target_list" >> $config_host_mak
> -if [ "$docs" = "yes" ] ; then
> -  echo "BUILD_DOCS=yes" >> $config_host_mak
> -fi
>  if test "$modules" = "yes"; then
># $shacmd can generate a hash started with digit, which the compiler
doesn't
># like as an symbol. So prefix it with an underscore
> @@ -6784,7 +6733,6 @@ fi
>  echo "ROMS=$roms" >> $config_host_mak
>  echo "MAKE=$make" >> $config_host_mak
>  echo "PYTHON=$python" >> $config_host_mak
> -echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
>  echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
>  echo "MESON=$meson" >> $config_host_mak
>  echo "NINJA=$ninja" >> $config_host_mak
> @@ -7066,6 +7014,7 @@ NINJA=$ninja $meson setup \
>  -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
>  -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
>  -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
> +-Ddocs=$docs -Dsphinx_build=$sphinx_bui

[PATCH v5 4/4] cirrus: Enable doc build on msys2/mingw

2020-10-16 Thread Yonggang Luo
Currently rST depends on old version sphinx-2.x.
Install it by downloading it.
Remove the need of university mirror, the main repo are recovered.

Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 9ccd2749ce..0481d99bb6 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -76,7 +76,6 @@ windows_msys2_task:
 ((Get-Content -path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace 
'--refresh-keys', '--version') | Set-Content -Path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post
 C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 
's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
 C:\tools\msys64\usr\bin\bash.exe -lc "export"
-C:\tools\msys64\usr\bin\bash.exe -lc "grep -rl 'repo.msys2.org/' 
/etc/pacman.d/mirrorlist.* | xargs sed -i 
's/repo.msys2.org\//mirrors.tuna.tsinghua.edu.cn\/msys2\//g'"
 C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Sy
 echo Y | C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Suu 
--overwrite=*
 taskkill /F /FI "MODULES eq msys-2.0.dll"
@@ -112,6 +111,11 @@ windows_msys2_task:
   mingw-w64-x86_64-gnutls \
   mingw-w64-x86_64-libnfs \
   "
+bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND `
+  
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 `
+  C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
+C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -U 
/c/tools/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz"
+del C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 C:\tools\msys64\usr\bin\bash.exe -lc "rm -rf /var/cache/pacman/pkg/*"
 cd C:\tools\msys64
 echo "Start archive"
-- 
2.28.0.windows.1




[PATCH v5 0/4] Fixes docs building on msys2/mingw

2020-10-16 Thread Yonggang Luo
V4-V5
Revise * docs: Fixes build docs on msys2/mingw
For easier to review.
Revise * meson: Move the detection logic for sphinx to meson
According Paolo's suggestion with fixes.

V3-V4
Quic fixes of
python style
if xxx:

tested locally

V2-V3
No need convert perl trick to python script anymore
after Paolo's removal of ninjatool.
Revise Meson: Move the detection logic for sphinx to meson
for pass other platform by letting SPHINX_ARGS to be empty
when build_docs are false

v1 - v2
Also move the docs configure part from
configure to meson, this also fixed the pending
ninjatool removal caused issue that docs  can
not be build under msys2/mingw

Yonggang Luo (4):
  docs: Fixes build docs on msys2/mingw
  configure: the docdir option should passed to meson as is.
  meson: Move the detection logic for sphinx to meson
  cirrus: Enable doc build on msys2/mingw

 .cirrus.yml   |  6 +++-
 configure | 62 +++
 docs/meson.build  |  4 +--
 docs/sphinx/kerneldoc.py  |  2 +-
 meson.build   | 52 +
 meson_options.txt |  5 ++-
 tests/qapi-schema/meson.build |  2 +-
 7 files changed, 64 insertions(+), 69 deletions(-)

-- 
2.28.0.windows.1




[PATCH v5 2/4] configure: the docdir option should passed to meson as is.

2020-10-16 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 configure | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index 78062fb091..432ea124e1 100755
--- a/configure
+++ b/configure
@@ -968,7 +968,7 @@ for opt do
   ;;
   --with-suffix=*) qemu_suffix="$optarg"
   ;;
-  --docdir=*) qemu_docdir="$optarg"
+  --docdir=*) docdir="$optarg"
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
@@ -5710,7 +5710,6 @@ fi
 qemu_confdir="$sysconfdir/$qemu_suffix"
 qemu_moddir="$libdir/$qemu_suffix"
 qemu_datadir="$datadir/$qemu_suffix"
-qemu_docdir="$docdir/$qemu_suffix"
 qemu_localedir="$datadir/locale"
 qemu_icondir="$datadir/icons"
 qemu_desktopdir="$datadir/applications"
-- 
2.28.0.windows.1




[PATCH v5 3/4] meson: Move the detection logic for sphinx to meson

2020-10-16 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 configure | 59 +++
 docs/meson.build  |  4 +--
 meson.build   | 52 ++
 meson_options.txt |  5 ++-
 tests/qapi-schema/meson.build |  2 +-
 5 files changed, 57 insertions(+), 65 deletions(-)

diff --git a/configure b/configure
index 432ea124e1..c499c968cb 100755
--- a/configure
+++ b/configure
@@ -297,7 +297,7 @@ brlapi=""
 curl=""
 iconv="auto"
 curses="auto"
-docs=""
+docs="auto"
 fdt="auto"
 netmap="no"
 sdl="auto"
@@ -819,15 +819,6 @@ do
 fi
 done
 
-sphinx_build=
-for binary in sphinx-build-3 sphinx-build
-do
-if has "$binary"
-then
-sphinx_build=$(command -v "$binary")
-break
-fi
-done
 
 # Check for ancillary tools used in testing
 genisoimage=
@@ -1223,9 +1214,9 @@ for opt do
   ;;
   --disable-crypto-afalg) crypto_afalg="no"
   ;;
-  --disable-docs) docs="no"
+  --disable-docs) docs="disabled"
   ;;
-  --enable-docs) docs="yes"
+  --enable-docs) docs="enabled"
   ;;
   --disable-vhost-net) vhost_net="no"
   ;;
@@ -4408,45 +4399,6 @@ if check_include linux/btrfs.h ; then
 btrfs=yes
 fi
 
-# If we're making warnings fatal, apply this to Sphinx runs as well
-sphinx_werror=""
-if test "$werror" = "yes"; then
-sphinx_werror="-W"
-fi
-
-# Check we have a new enough version of sphinx-build
-has_sphinx_build() {
-# This is a bit awkward but works: create a trivial document and
-# try to run it with our configuration file (which enforces a
-# version requirement). This will fail if either
-# sphinx-build doesn't exist at all or if it is too old.
-mkdir -p "$TMPDIR1/sphinx"
-touch "$TMPDIR1/sphinx/index.rst"
-"$sphinx_build" $sphinx_werror -c "$source_path/docs" \
--b html "$TMPDIR1/sphinx" \
-"$TMPDIR1/sphinx/out"  >> config.log 2>&1
-}
-
-# Check if tools are available to build documentation.
-if test "$docs" != "no" ; then
-  if has_sphinx_build; then
-sphinx_ok=yes
-  else
-sphinx_ok=no
-  fi
-  if test "$sphinx_ok" = "yes"; then
-docs=yes
-  else
-if test "$docs" = "yes" ; then
-  if has $sphinx_build && test "$sphinx_ok" != "yes"; then
-echo "Warning: $sphinx_build exists but it is either too old or uses 
too old a Python version" >&2
-  fi
-  feature_not_found "docs" "Install a Python 3 version of python-sphinx"
-fi
-docs=no
-  fi
-fi
-
 # Search for bswap_32 function
 byteswap_h=no
 cat > $TMPC << EOF
@@ -6027,9 +5979,6 @@ qemu_version=$(head $source_path/VERSION)
 echo "PKGVERSION=$pkgversion" >>$config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "TARGET_DIRS=$target_list" >> $config_host_mak
-if [ "$docs" = "yes" ] ; then
-  echo "BUILD_DOCS=yes" >> $config_host_mak
-fi
 if test "$modules" = "yes"; then
   # $shacmd can generate a hash started with digit, which the compiler doesn't
   # like as an symbol. So prefix it with an underscore
@@ -6702,7 +6651,6 @@ fi
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
 echo "PYTHON=$python" >> $config_host_mak
-echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
 echo "MESON=$meson" >> $config_host_mak
 echo "NINJA=$ninja" >> $config_host_mak
@@ -6984,6 +6932,7 @@ NINJA=$ninja $meson setup \
 -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
 -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
 -Diconv=$iconv -Dcurses=$curses \
+-Ddocs=$docs -Dsphinx_build=$sphinx_build \
 $cross_arg \
 "$PWD" "$source_path"
 
diff --git a/docs/meson.build b/docs/meson.build
index 0340d489ac..f566809a6a 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -37,7 +37,7 @@ if build_docs
 input: [files('conf.py'), files(manual / 'conf.py')],
 depfile: manual + '.d',
 depend_files: sphinx_extn_depends,
-command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@',
+command: SPHINX_ARGS + ['-Ddepfile=@DEPFILE@',
   '-Ddepfile_stamp=@OUTPUT0@',
   '-b', 'html', '-d', private_dir,
   input_dir, output_dir])
@@ -59,7 +59,7 @@ if build_docs
 

[PATCH v5 1/4] docs: Fixes build docs on msys2/mingw

2020-10-16 Thread Yonggang Luo
meson didn't support running ../scripts/kernel-do directly
Add the perl as the first parameter

Signed-off-by: Yonggang Luo 
---
 docs/sphinx/kerneldoc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py
index 3e87940206..af130d0939 100644
--- a/docs/sphinx/kerneldoc.py
+++ b/docs/sphinx/kerneldoc.py
@@ -67,7 +67,7 @@ class KernelDocDirective(Directive):
 
 def run(self):
 env = self.state.document.settings.env
-cmd = [env.config.kerneldoc_bin, '-rst', '-enable-lineno']
+cmd = ['perl', env.config.kerneldoc_bin, '-rst', '-enable-lineno']
 
 filename = env.config.kerneldoc_srctree + '/' + self.arguments[0]
 export_file_patterns = []
-- 
2.28.0.windows.1




Re: [PATCH v4 3/4] meson: Move the detection logic for sphinx to meson

2020-10-16 Thread Yonggang Luo
On Fri, Oct 16, 2020 at 4:05 PM Paolo Bonzini  wrote:
>
> On 16/10/20 09:57, Paolo Bonzini wrote:
> > On 16/10/20 09:52, 罗勇刚(Yonggang Luo) wrote:
> >>
> >>> build_docs = false
> >>> if sphinx_build.found()
> >>>   # This is a bit awkward but works: create a trivial document and
> >>>   # try to run it with our configuration file (which enforces a
> >>>   # version requirement). This will fail if sphinx-build is too old.
> >>>   run_command('mkdir', ['-p', tmpdir / 'sphinx'])
> >>>   run_command('touch', [tmpdir / 'sphinx/index.rst'])
> >>>   sphinx_build_test_out = run_command(SPHINX_ARGS + [
> >>> '-c', meson.current_source_dir() / 'docs',
> >>> '-b', 'html', tmpdir / 'sphinx',
> >>> tmpdir / 'sphinx/out'])
> >>>   build_docs = (sphinx_build_test_out.returncode() == 0)
> >>> endif
> >> There is subtle error here, when  sphinx_build not found, there is
> >> SPHINX_ARGS  should be [],
> >> otherwise, latter place using  SPHINX_ARGS  have not found sphinx_build
> >> will cause error by meson
> >> ..
> >> I'll add
> >>
> >> else
> >>   SPHINX_ARGS  = []
> >> endif
> >
> > All uses of SPHINX_ARGS are protected by build_docs, and in turn
> > build_docs is false if "not sphinx_build.found()".  Am I missing
something?
>
> Ah there are uses in tests/ too, those should all be under "if
> build_docs" too.
Yeap, I did it before, but that changes a lot and not easy to review, you
can do it in separate patch.
Anyway setting  SPHINX_ARGS  to [] are more robust.
>
> Paolo
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v4 3/4] meson: Move the detection logic for sphinx to meson

2020-10-16 Thread Yonggang Luo
On Fri, Oct 16, 2020 at 3:57 PM Paolo Bonzini  wrote:
>
> On 16/10/20 09:52, 罗勇刚(Yonggang Luo) wrote:
> >
> >> build_docs = false
> >> if sphinx_build.found()
> >>   # This is a bit awkward but works: create a trivial document and
> >>   # try to run it with our configuration file (which enforces a
> >>   # version requirement). This will fail if sphinx-build is too old.
> >>   run_command('mkdir', ['-p', tmpdir / 'sphinx'])
> >>   run_command('touch', [tmpdir / 'sphinx/index.rst'])
> >>   sphinx_build_test_out = run_command(SPHINX_ARGS + [
> >> '-c', meson.current_source_dir() / 'docs',
> >> '-b', 'html', tmpdir / 'sphinx',
> >> tmpdir / 'sphinx/out'])
> >>   build_docs = (sphinx_build_test_out.returncode() == 0)
> >> endif
> > There is subtle error here, when  sphinx_build not found, there is
> > SPHINX_ARGS  should be [],
> > otherwise, latter place using  SPHINX_ARGS  have not found sphinx_build
> > will cause error by meson
> > ..
> > I'll add
> >
> > else
> >   SPHINX_ARGS  = []
> > endif
>
> All uses of SPHINX_ARGS are protected by build_docs, and in turn
> build_docs is false if "not sphinx_build.found()".  Am I missing
something?
>
> Paolo
>
Rfer to
https://github.com/lygstate/qemu/runs/1261141240?check_suite_focus=true

--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v4 3/4] meson: Move the detection logic for sphinx to meson

2020-10-16 Thread Yonggang Luo
On Fri, Oct 16, 2020 at 3:57 PM Paolo Bonzini  wrote:
>
> On 16/10/20 09:52, 罗勇刚(Yonggang Luo) wrote:
> >
> >> build_docs = false
> >> if sphinx_build.found()
> >>   # This is a bit awkward but works: create a trivial document and
> >>   # try to run it with our configuration file (which enforces a
> >>   # version requirement). This will fail if sphinx-build is too old.
> >>   run_command('mkdir', ['-p', tmpdir / 'sphinx'])
> >>   run_command('touch', [tmpdir / 'sphinx/index.rst'])
> >>   sphinx_build_test_out = run_command(SPHINX_ARGS + [
> >> '-c', meson.current_source_dir() / 'docs',
> >> '-b', 'html', tmpdir / 'sphinx',
> >> tmpdir / 'sphinx/out'])
> >>   build_docs = (sphinx_build_test_out.returncode() == 0)
> >> endif
> > There is subtle error here, when  sphinx_build not found, there is
> > SPHINX_ARGS  should be [],
> > otherwise, latter place using  SPHINX_ARGS  have not found sphinx_build
> > will cause error by meson
> > ..
> > I'll add
> >
> > else
> >   SPHINX_ARGS  = []
> > endif
>
> All uses of SPHINX_ARGS are protected by build_docs, and in turn
> build_docs is false if "not sphinx_build.found()".  Am I missing
something?
Not all protected, missed in qapi/schema tests
>
> Paolo
>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v4 3/4] meson: Move the detection logic for sphinx to meson

2020-10-16 Thread Yonggang Luo
On Fri, Oct 16, 2020 at 3:46 PM Paolo Bonzini  wrote:
>
> Here is a better way to write the meson test:
>
> if get_option('sphinx_build') == ''
>   sphinx_build = find_program(['sphinx-build-3', 'sphinx-build'],
>   required: get_option('docs'))
> else
>   sphinx_build = find_program(get_option('sphinx_build'),
>   required: get_option('docs'))
> endif
>
> SPHINX_ARGS = [sphinx_build]
> # If we're making warnings fatal, apply this to Sphinx runs as well
> if get_option('werror')
>   SPHINX_TEST_ARGS += [ '-W' ]
> endif
>
> # Check if tools are available to build documentation.
> build_docs = false
> if sphinx_build.found()
>   # This is a bit awkward but works: create a trivial document and
>   # try to run it with our configuration file (which enforces a
>   # version requirement). This will fail if sphinx-build is too old.
>   run_command('mkdir', ['-p', tmpdir / 'sphinx'])
>   run_command('touch', [tmpdir / 'sphinx/index.rst'])
>   sphinx_build_test_out = run_command(SPHINX_ARGS + [
> '-c', meson.current_source_dir() / 'docs',
> '-b', 'html', tmpdir / 'sphinx',
> tmpdir / 'sphinx/out'])
>   build_docs = (sphinx_build_test_out.returncode() == 0)
> endif
There is subtle error here, when  sphinx_build not found, there is
SPHINX_ARGS  should be [],
otherwise, latter place using  SPHINX_ARGS  have not found sphinx_build
will cause error by meson
..
I'll add

else
  SPHINX_ARGS  = []
endif

>
> if not build_docs
>   if sphinx_build_option != ''
> warning('@0@ exists but it is either too old or uses too old a Python
version'.format(sphinx_build_option))
>   endif
>   if get_option('docs').enabled()
> error('Install a Python 3 version of python-sphinx')
>   endif
> endif
>
>
>
> On 16/10/20 00:06, Yonggang Luo wrote:
> > Signed-off-by: Yonggang Luo 
> > ---
> >  configure | 59 +++---
> >  docs/meson.build  |  4 +--
> >  meson.build   | 60 +++
> >  meson_options.txt |  5 ++-
> >  tests/qapi-schema/meson.build |  2 +-
> >  5 files changed, 64 insertions(+), 66 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 1ce31f97b4..ff593a8542 100755
> > --- a/configure
> > +++ b/configure
> > @@ -297,7 +297,7 @@ brlapi=""
> >  curl=""
> >  iconv="auto"
> >  curses="auto"
> > -docs=""
> > +docs="auto"
> >  fdt="auto"
> >  netmap="no"
> >  sdl="auto"
> > @@ -822,15 +822,6 @@ do
> >  fi
> >  done
> >
> > -sphinx_build=
> > -for binary in sphinx-build-3 sphinx-build
> > -do
> > -if has "$binary"
> > -then
> > -sphinx_build=$(command -v "$binary")
> > -break
> > -fi
> > -done
> >
> >  # Check for ancillary tools used in testing
> >  genisoimage=
> > @@ -1226,9 +1217,9 @@ for opt do
> >;;
> >--disable-crypto-afalg) crypto_afalg="no"
> >;;
> > -  --disable-docs) docs="no"
> > +  --disable-docs) docs="disabled"
> >;;
> > -  --enable-docs) docs="yes"
> > +  --enable-docs) docs="enabled"
> >;;
> >--disable-vhost-net) vhost_net="no"
> >;;
> > @@ -4413,45 +4404,6 @@ if check_include linux/btrfs.h ; then
> >  btrfs=yes
> >  fi
> >
> > -# If we're making warnings fatal, apply this to Sphinx runs as well
> > -sphinx_werror=""
> > -if test "$werror" = "yes"; then
> > -sphinx_werror="-W"
> > -fi
> > -
> > -# Check we have a new enough version of sphinx-build
> > -has_sphinx_build() {
> > -# This is a bit awkward but works: create a trivial document and
> > -# try to run it with our configuration file (which enforces a
> > -# version requirement). This will fail if either
> > -# sphinx-build doesn't exist at all or if it is too old.
> > -mkdir -p "$TMPDIR1/sphinx"
> > -touch "$TMPDIR1/sphinx/index.rst"
> > -"$sphinx_build" $sphinx_werror -c "$source_path/docs" \
> > --b html "$TMPDIR1/sphinx" \
> > -"$TMPDIR1/sphinx/out"  >> config.log 2>&1
> > -}
> > -
> > -# Check if tools are available to build documentation.
> > -if test "$doc

Re: [PATCH v4 1/4] docs: Fixes build docs on msys2/mingw

2020-10-15 Thread Yonggang Luo
On Fri, Oct 16, 2020 at 6:19 AM Paolo Bonzini  wrote:
>
>
>
> Il ven 16 ott 2020, 00:06 Yonggang Luo  ha scritto:
>>
>> meson didn't support running ../scripts/kernel-do directly
>
>
> Can you explain why this matters? Meson does not look at docs/conf.py.
>
> Paolo
>
>>
>> Signed-off-by: Yonggang Luo 
>> ---
>>  docs/conf.py | 2 +-
>>  docs/sphinx/kerneldoc.py | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/docs/conf.py b/docs/conf.py
>> index 00e1b750e2..e584f68393 100644
>> --- a/docs/conf.py
>> +++ b/docs/conf.py
>> @@ -241,7 +241,7 @@ texinfo_documents = [
>>  # We use paths starting from qemu_docdir here so that you can run
>>  # sphinx-build from anywhere and the kerneldoc extension can still
>>  # find everything.
>> -kerneldoc_bin = os.path.join(qemu_docdir, '../scripts/kernel-doc')
>> +kerneldoc_bin = ['perl', os.path.join(qemu_docdir,
'../scripts/kernel-doc')]
>>  kerneldoc_srctree = os.path.join(qemu_docdir, '..')
>>  hxtool_srctree = os.path.join(qemu_docdir, '..')
>>  qapidoc_srctree = os.path.join(qemu_docdir, '..')
>> diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py
>> index 3e87940206..3ac277d162 100644
>> --- a/docs/sphinx/kerneldoc.py
>> +++ b/docs/sphinx/kerneldoc.py
>> @@ -67,7 +67,7 @@ class KernelDocDirective(Directive):
>>
>>  def run(self):
>>  env = self.state.document.settings.env
>> -cmd = [env.config.kerneldoc_bin, '-rst', '-enable-lineno']
>> +cmd = env.config.kerneldoc_bin + ['-rst', '-enable-lineno']
  meson use the conf directly
>>
>>  filename = env.config.kerneldoc_srctree + '/' +
self.arguments[0]

>>  export_file_patterns = []
>> --
>> 2.28.0.windows.1
>>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH v4 3/4] meson: Move the detection logic for sphinx to meson

2020-10-15 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 configure | 59 +++---
 docs/meson.build  |  4 +--
 meson.build   | 60 +++
 meson_options.txt |  5 ++-
 tests/qapi-schema/meson.build |  2 +-
 5 files changed, 64 insertions(+), 66 deletions(-)

diff --git a/configure b/configure
index 1ce31f97b4..ff593a8542 100755
--- a/configure
+++ b/configure
@@ -297,7 +297,7 @@ brlapi=""
 curl=""
 iconv="auto"
 curses="auto"
-docs=""
+docs="auto"
 fdt="auto"
 netmap="no"
 sdl="auto"
@@ -822,15 +822,6 @@ do
 fi
 done
 
-sphinx_build=
-for binary in sphinx-build-3 sphinx-build
-do
-if has "$binary"
-then
-sphinx_build=$(command -v "$binary")
-break
-fi
-done
 
 # Check for ancillary tools used in testing
 genisoimage=
@@ -1226,9 +1217,9 @@ for opt do
   ;;
   --disable-crypto-afalg) crypto_afalg="no"
   ;;
-  --disable-docs) docs="no"
+  --disable-docs) docs="disabled"
   ;;
-  --enable-docs) docs="yes"
+  --enable-docs) docs="enabled"
   ;;
   --disable-vhost-net) vhost_net="no"
   ;;
@@ -4413,45 +4404,6 @@ if check_include linux/btrfs.h ; then
 btrfs=yes
 fi
 
-# If we're making warnings fatal, apply this to Sphinx runs as well
-sphinx_werror=""
-if test "$werror" = "yes"; then
-sphinx_werror="-W"
-fi
-
-# Check we have a new enough version of sphinx-build
-has_sphinx_build() {
-# This is a bit awkward but works: create a trivial document and
-# try to run it with our configuration file (which enforces a
-# version requirement). This will fail if either
-# sphinx-build doesn't exist at all or if it is too old.
-mkdir -p "$TMPDIR1/sphinx"
-touch "$TMPDIR1/sphinx/index.rst"
-"$sphinx_build" $sphinx_werror -c "$source_path/docs" \
--b html "$TMPDIR1/sphinx" \
-"$TMPDIR1/sphinx/out"  >> config.log 2>&1
-}
-
-# Check if tools are available to build documentation.
-if test "$docs" != "no" ; then
-  if has_sphinx_build; then
-sphinx_ok=yes
-  else
-sphinx_ok=no
-  fi
-  if test "$sphinx_ok" = "yes"; then
-docs=yes
-  else
-if test "$docs" = "yes" ; then
-  if has $sphinx_build && test "$sphinx_ok" != "yes"; then
-echo "Warning: $sphinx_build exists but it is either too old or uses 
too old a Python version" >&2
-  fi
-  feature_not_found "docs" "Install a Python 3 version of python-sphinx"
-fi
-docs=no
-  fi
-fi
-
 # Search for bswap_32 function
 byteswap_h=no
 cat > $TMPC << EOF
@@ -6087,9 +6039,6 @@ qemu_version=$(head $source_path/VERSION)
 echo "PKGVERSION=$pkgversion" >>$config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "TARGET_DIRS=$target_list" >> $config_host_mak
-if [ "$docs" = "yes" ] ; then
-  echo "BUILD_DOCS=yes" >> $config_host_mak
-fi
 if test "$modules" = "yes"; then
   # $shacmd can generate a hash started with digit, which the compiler doesn't
   # like as an symbol. So prefix it with an underscore
@@ -6794,7 +6743,6 @@ fi
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
 echo "PYTHON=$python" >> $config_host_mak
-echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
 echo "MESON=$meson" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
@@ -7076,6 +7024,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
 -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
 -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
 -Diconv=$iconv -Dcurses=$curses \
+-Ddocs=$docs -Dsphinx_build=$sphinx_build \
 $cross_arg \
 "$PWD" "$source_path"
 
diff --git a/docs/meson.build b/docs/meson.build
index 0340d489ac..f566809a6a 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -37,7 +37,7 @@ if build_docs
 input: [files('conf.py'), files(manual / 'conf.py')],
 depfile: manual + '.d',
 depend_files: sphinx_extn_depends,
-command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@',
+command: SPHINX_ARGS + ['-Ddepfile=@DEPFILE@',
   '-Ddepfile_stamp=@OUTPUT0@',
   '-b', 'html', '-d', private_dir,
   input_dir, output_dir])
@@ -59,7 +59,7 @@ i

[PATCH v4 4/4] cirrus: Enable doc build on msys2/mingw

2020-10-15 Thread Yonggang Luo
Currently rST depends on old version sphinx-2.x.
Install it by downloading it.
Remove the need of university mirror, the main repo are recovered.

Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 99d118239c..f42ccb956a 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -76,7 +76,6 @@ windows_msys2_task:
 ((Get-Content -path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace 
'--refresh-keys', '--version') | Set-Content -Path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post
 C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 
's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
 C:\tools\msys64\usr\bin\bash.exe -lc "export"
-C:\tools\msys64\usr\bin\bash.exe -lc "grep -rl 'repo.msys2.org/' 
/etc/pacman.d/mirrorlist.* | xargs sed -i 
's/repo.msys2.org\//mirrors.tuna.tsinghua.edu.cn\/msys2\//g'"
 C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Sy
 echo Y | C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Suu 
--overwrite=*
 taskkill /F /FI "MODULES eq msys-2.0.dll"
@@ -111,6 +110,11 @@ windows_msys2_task:
   mingw-w64-x86_64-curl \
   mingw-w64-x86_64-gnutls \
   "
+bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND `
+  
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 `
+  C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
+C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -U 
/c/tools/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz"
+del C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 C:\tools\msys64\usr\bin\bash.exe -lc "rm -rf /var/cache/pacman/pkg/*"
 cd C:\tools\msys64
 echo "Start archive"
-- 
2.28.0.windows.1




[PATCH v4 1/4] docs: Fixes build docs on msys2/mingw

2020-10-15 Thread Yonggang Luo
meson didn't support running ../scripts/kernel-do directly

Signed-off-by: Yonggang Luo 
---
 docs/conf.py | 2 +-
 docs/sphinx/kerneldoc.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 00e1b750e2..e584f68393 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -241,7 +241,7 @@ texinfo_documents = [
 # We use paths starting from qemu_docdir here so that you can run
 # sphinx-build from anywhere and the kerneldoc extension can still
 # find everything.
-kerneldoc_bin = os.path.join(qemu_docdir, '../scripts/kernel-doc')
+kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')]
 kerneldoc_srctree = os.path.join(qemu_docdir, '..')
 hxtool_srctree = os.path.join(qemu_docdir, '..')
 qapidoc_srctree = os.path.join(qemu_docdir, '..')
diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py
index 3e87940206..3ac277d162 100644
--- a/docs/sphinx/kerneldoc.py
+++ b/docs/sphinx/kerneldoc.py
@@ -67,7 +67,7 @@ class KernelDocDirective(Directive):
 
 def run(self):
 env = self.state.document.settings.env
-cmd = [env.config.kerneldoc_bin, '-rst', '-enable-lineno']
+cmd = env.config.kerneldoc_bin + ['-rst', '-enable-lineno']
 
 filename = env.config.kerneldoc_srctree + '/' + self.arguments[0]
 export_file_patterns = []
-- 
2.28.0.windows.1




[PATCH v4 0/4] Fixes docs building on msys2/mingw

2020-10-15 Thread Yonggang Luo
V3-V4
Quic fixes of
python style
if xxx:

tested locally

V2-V3
No need convert perl trick to python script anymore
after Paolo's removal of ninjatool.
Revise Meson: Move the detection logic for sphinx to meson
for pass other platform by letting SPHINX_ARGS to be empty
when build_docs are false

v1 - v2
Also move the docs configure part from
configure to meson, this also fixed the pending
ninjatool removal caused issue that docs  can
not be build under msys2/mingw

Yonggang Luo (4):
  docs: Fixes build docs on msys2/mingw
  configure: the docdir option should passed to meson as is.
  meson: Move the detection logic for sphinx to meson
  cirrus: Enable doc build on msys2/mingw

 .cirrus.yml   |  6 +++-
 configure | 62 +++
 docs/conf.py  |  2 +-
 docs/meson.build  |  4 +--
 docs/sphinx/kerneldoc.py  |  2 +-
 meson.build   | 60 +
 meson_options.txt |  5 ++-
 tests/qapi-schema/meson.build |  2 +-
 8 files changed, 72 insertions(+), 71 deletions(-)

-- 
2.28.0.windows.1




[PATCH v4 2/4] configure: the docdir option should passed to meson as is.

2020-10-15 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 configure | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index f839c2a557..1ce31f97b4 100755
--- a/configure
+++ b/configure
@@ -971,7 +971,7 @@ for opt do
   ;;
   --with-suffix=*) qemu_suffix="$optarg"
   ;;
-  --docdir=*) qemu_docdir="$optarg"
+  --docdir=*) docdir="$optarg"
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
@@ -5770,7 +5770,6 @@ fi
 qemu_confdir="$sysconfdir/$qemu_suffix"
 qemu_moddir="$libdir/$qemu_suffix"
 qemu_datadir="$datadir/$qemu_suffix"
-qemu_docdir="$docdir/$qemu_suffix"
 qemu_localedir="$datadir/locale"
 qemu_icondir="$datadir/icons"
 qemu_desktopdir="$datadir/applications"
-- 
2.28.0.windows.1




Re: [PATCH v2 0/4] Fixes docs building on msys2/mingw

2020-10-15 Thread Yonggang Luo
On Fri, Oct 16, 2020 at 5:53 AM Paolo Bonzini  wrote:
>
> Looks good, apart from the CR removal patch that can simply be dropped.
Resend with fixes, the CR removal patch composite two part.

>
> Paolo
>
> Il gio 15 ott 2020, 22:10 Yonggang Luo  ha scritto:
>>
>> v1 - v2
>> Also move the docs configure part from
>> configure to meson, this also fixed the pending
>> ninjatool removal caused issue that docs  can
>> not be build under msys2/mingw
>>
>> Yonggang Luo (4):
>>   docs: Fixes build docs on msys2/mingw
>>   configure: the docdir option should passed to meson as is.
>>   meson: Move the detection logic for sphinx to meson
>>   cirrus: Enable doc build on msys2/mingw
>>
>>  .cirrus.yml   |  6 +++-
>>  configure | 62 +++
>>  docs/conf.py  |  2 +-
>>  docs/meson.build  |  4 +--
>>  docs/sphinx/kerneldoc.py  |  2 +-
>>  meson.build   | 59 +
>>  meson_options.txt |  5 ++-
>>  scripts/rst-sanitize.py   | 21 
>>  tests/qapi-schema/meson.build |  7 ++--
>>  9 files changed, 95 insertions(+), 73 deletions(-)
>>  create mode 100644 scripts/rst-sanitize.py
>>
>> --
>> 2.28.0.windows.1
>>
>>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


[PATCH v3 3/4] meson: Move the detection logic for sphinx to meson

2020-10-15 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 configure | 59 +++
 docs/meson.build  |  4 +--
 meson.build   | 59 ++-
 meson_options.txt |  5 ++-
 tests/qapi-schema/meson.build |  2 +-
 5 files changed, 63 insertions(+), 66 deletions(-)

diff --git a/configure b/configure
index 1ce31f97b4..ff593a8542 100755
--- a/configure
+++ b/configure
@@ -297,7 +297,7 @@ brlapi=""
 curl=""
 iconv="auto"
 curses="auto"
-docs=""
+docs="auto"
 fdt="auto"
 netmap="no"
 sdl="auto"
@@ -822,15 +822,6 @@ do
 fi
 done
 
-sphinx_build=
-for binary in sphinx-build-3 sphinx-build
-do
-if has "$binary"
-then
-sphinx_build=$(command -v "$binary")
-break
-fi
-done
 
 # Check for ancillary tools used in testing
 genisoimage=
@@ -1226,9 +1217,9 @@ for opt do
   ;;
   --disable-crypto-afalg) crypto_afalg="no"
   ;;
-  --disable-docs) docs="no"
+  --disable-docs) docs="disabled"
   ;;
-  --enable-docs) docs="yes"
+  --enable-docs) docs="enabled"
   ;;
   --disable-vhost-net) vhost_net="no"
   ;;
@@ -4413,45 +4404,6 @@ if check_include linux/btrfs.h ; then
 btrfs=yes
 fi
 
-# If we're making warnings fatal, apply this to Sphinx runs as well
-sphinx_werror=""
-if test "$werror" = "yes"; then
-sphinx_werror="-W"
-fi
-
-# Check we have a new enough version of sphinx-build
-has_sphinx_build() {
-# This is a bit awkward but works: create a trivial document and
-# try to run it with our configuration file (which enforces a
-# version requirement). This will fail if either
-# sphinx-build doesn't exist at all or if it is too old.
-mkdir -p "$TMPDIR1/sphinx"
-touch "$TMPDIR1/sphinx/index.rst"
-"$sphinx_build" $sphinx_werror -c "$source_path/docs" \
--b html "$TMPDIR1/sphinx" \
-"$TMPDIR1/sphinx/out"  >> config.log 2>&1
-}
-
-# Check if tools are available to build documentation.
-if test "$docs" != "no" ; then
-  if has_sphinx_build; then
-sphinx_ok=yes
-  else
-sphinx_ok=no
-  fi
-  if test "$sphinx_ok" = "yes"; then
-docs=yes
-  else
-if test "$docs" = "yes" ; then
-  if has $sphinx_build && test "$sphinx_ok" != "yes"; then
-echo "Warning: $sphinx_build exists but it is either too old or uses 
too old a Python version" >&2
-  fi
-  feature_not_found "docs" "Install a Python 3 version of python-sphinx"
-fi
-docs=no
-  fi
-fi
-
 # Search for bswap_32 function
 byteswap_h=no
 cat > $TMPC << EOF
@@ -6087,9 +6039,6 @@ qemu_version=$(head $source_path/VERSION)
 echo "PKGVERSION=$pkgversion" >>$config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "TARGET_DIRS=$target_list" >> $config_host_mak
-if [ "$docs" = "yes" ] ; then
-  echo "BUILD_DOCS=yes" >> $config_host_mak
-fi
 if test "$modules" = "yes"; then
   # $shacmd can generate a hash started with digit, which the compiler doesn't
   # like as an symbol. So prefix it with an underscore
@@ -6794,7 +6743,6 @@ fi
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
 echo "PYTHON=$python" >> $config_host_mak
-echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
 echo "MESON=$meson" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
@@ -7076,6 +7024,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
 -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
 -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
 -Diconv=$iconv -Dcurses=$curses \
+-Ddocs=$docs -Dsphinx_build=$sphinx_build \
 $cross_arg \
 "$PWD" "$source_path"
 
diff --git a/docs/meson.build b/docs/meson.build
index 0340d489ac..f566809a6a 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -37,7 +37,7 @@ if build_docs
 input: [files('conf.py'), files(manual / 'conf.py')],
 depfile: manual + '.d',
 depend_files: sphinx_extn_depends,
-command: [SPHINX_ARGS, '-Ddepfile=@DEPFILE@',
+command: SPHINX_ARGS + ['-Ddepfile=@DEPFILE@',
   '-Ddepfile_stamp=@OUTPUT0@',
   '-b', 'html', '-d', private_dir,
   input_dir, output_dir])
@@ -59,7 +59,7 @@ i

[PATCH v3 4/4] cirrus: Enable doc build on msys2/mingw

2020-10-15 Thread Yonggang Luo
Currently rST depends on old version sphinx-2.x.
Install it by downloading it.
Remove the need of university mirror, the main repo are recovered.

Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 99d118239c..f42ccb956a 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -76,7 +76,6 @@ windows_msys2_task:
 ((Get-Content -path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post -Raw) -replace 
'--refresh-keys', '--version') | Set-Content -Path 
C:\tools\msys64\etc\\post-install\\07-pacman-key.post
 C:\tools\msys64\usr\bin\bash.exe -lc "sed -i 
's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
 C:\tools\msys64\usr\bin\bash.exe -lc "export"
-C:\tools\msys64\usr\bin\bash.exe -lc "grep -rl 'repo.msys2.org/' 
/etc/pacman.d/mirrorlist.* | xargs sed -i 
's/repo.msys2.org\//mirrors.tuna.tsinghua.edu.cn\/msys2\//g'"
 C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Sy
 echo Y | C:\tools\msys64\usr\bin\pacman.exe --noconfirm -Suu 
--overwrite=*
 taskkill /F /FI "MODULES eq msys-2.0.dll"
@@ -111,6 +110,11 @@ windows_msys2_task:
   mingw-w64-x86_64-curl \
   mingw-w64-x86_64-gnutls \
   "
+bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND `
+  
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 `
+  C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
+C:\tools\msys64\usr\bin\bash.exe -lc "pacman --noconfirm -U 
/c/tools/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz"
+del C:\tools\mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 C:\tools\msys64\usr\bin\bash.exe -lc "rm -rf /var/cache/pacman/pkg/*"
 cd C:\tools\msys64
 echo "Start archive"
-- 
2.28.0.windows.1




[PATCH v3 0/4] Fixes docs building on msys2/mingw

2020-10-15 Thread Yonggang Luo
V2-V3
No need convert perl trick to python script anymore
after Paolo's removal of ninjatool.
Revise Meson: Move the detection logic for sphinx to meson
for pass other platform by letting SPHINX_ARGS to be empty
when build_docs are false

v1 - v2
Also move the docs configure part from
configure to meson, this also fixed the pending
ninjatool removal caused issue that docs  can
not be build under msys2/mingw

Yonggang Luo (4):
  docs: Fixes build docs on msys2/mingw
  configure: the docdir option should passed to meson as is.
  meson: Move the detection logic for sphinx to meson
  cirrus: Enable doc build on msys2/mingw

 .cirrus.yml   |  6 +++-
 configure | 62 +++
 docs/conf.py  |  2 +-
 docs/meson.build  |  4 +--
 docs/sphinx/kerneldoc.py  |  2 +-
 meson.build   | 59 +
 meson_options.txt |  5 ++-
 tests/qapi-schema/meson.build |  2 +-
 8 files changed, 71 insertions(+), 71 deletions(-)

-- 
2.28.0.windows.1




[PATCH v3 2/4] configure: the docdir option should passed to meson as is.

2020-10-15 Thread Yonggang Luo
Signed-off-by: Yonggang Luo 
---
 configure | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/configure b/configure
index f839c2a557..1ce31f97b4 100755
--- a/configure
+++ b/configure
@@ -971,7 +971,7 @@ for opt do
   ;;
   --with-suffix=*) qemu_suffix="$optarg"
   ;;
-  --docdir=*) qemu_docdir="$optarg"
+  --docdir=*) docdir="$optarg"
   ;;
   --sysconfdir=*) sysconfdir="$optarg"
   ;;
@@ -5770,7 +5770,6 @@ fi
 qemu_confdir="$sysconfdir/$qemu_suffix"
 qemu_moddir="$libdir/$qemu_suffix"
 qemu_datadir="$datadir/$qemu_suffix"
-qemu_docdir="$docdir/$qemu_suffix"
 qemu_localedir="$datadir/locale"
 qemu_icondir="$datadir/icons"
 qemu_desktopdir="$datadir/applications"
-- 
2.28.0.windows.1




[PATCH v3 1/4] docs: Fixes build docs on msys2/mingw

2020-10-15 Thread Yonggang Luo
meson didn't support running ../scripts/kernel-do directly

Signed-off-by: Yonggang Luo 
---
 docs/conf.py | 2 +-
 docs/sphinx/kerneldoc.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 00e1b750e2..e584f68393 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -241,7 +241,7 @@ texinfo_documents = [
 # We use paths starting from qemu_docdir here so that you can run
 # sphinx-build from anywhere and the kerneldoc extension can still
 # find everything.
-kerneldoc_bin = os.path.join(qemu_docdir, '../scripts/kernel-doc')
+kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')]
 kerneldoc_srctree = os.path.join(qemu_docdir, '..')
 hxtool_srctree = os.path.join(qemu_docdir, '..')
 qapidoc_srctree = os.path.join(qemu_docdir, '..')
diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py
index 3e87940206..3ac277d162 100644
--- a/docs/sphinx/kerneldoc.py
+++ b/docs/sphinx/kerneldoc.py
@@ -67,7 +67,7 @@ class KernelDocDirective(Directive):
 
 def run(self):
 env = self.state.document.settings.env
-cmd = [env.config.kerneldoc_bin, '-rst', '-enable-lineno']
+cmd = env.config.kerneldoc_bin + ['-rst', '-enable-lineno']
 
 filename = env.config.kerneldoc_srctree + '/' + self.arguments[0]
 export_file_patterns = []
-- 
2.28.0.windows.1




Re: [PATCH v2 2/4] configure: the docdir option should passed to meson as is.

2020-10-15 Thread Yonggang Luo
Grep  qemu_docdir and docdir  in configure, you will know why,  qemu_docdir
not used at all in configure,

On Fri, Oct 16, 2020 at 5:24 AM Paolo Bonzini  wrote:
>
> Why?
>
> Paolo
>
> Il gio 15 ott 2020, 22:11 Yonggang Luo  ha scritto:
>>
>> Signed-off-by: Yonggang Luo 
>> ---
>>  configure | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/configure b/configure
>> index f839c2a557..1ce31f97b4 100755
>> --- a/configure
>> +++ b/configure
>> @@ -971,7 +971,7 @@ for opt do
>>;;
>>--with-suffix=*) qemu_suffix="$optarg"
>>;;
>> -  --docdir=*) qemu_docdir="$optarg"
>> +  --docdir=*) docdir="$optarg"
>>;;
>>--sysconfdir=*) sysconfdir="$optarg"
>>;;
>> @@ -5770,7 +5770,6 @@ fi
>>  qemu_confdir="$sysconfdir/$qemu_suffix"
>>  qemu_moddir="$libdir/$qemu_suffix"
>>  qemu_datadir="$datadir/$qemu_suffix"
>> -qemu_docdir="$docdir/$qemu_suffix"
>>  qemu_localedir="$datadir/locale"
>>  qemu_icondir="$datadir/icons"
>>  qemu_desktopdir="$datadir/applications"
>> --
>> 2.28.0.windows.1
>>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw

2020-10-15 Thread Yonggang Luo
It's tests, running by make

On Fri, Oct 16, 2020 at 5:23 AM Paolo Bonzini  wrote:
>
>
>
> Il gio 15 ott 2020, 22:30 Peter Maydell  ha
scritto:
>>
>> On Thu, 15 Oct 2020 at 21:13, Yonggang Luo  wrote:
>> >
>> > Signed-off-by: Yonggang Luo 
>> > ---
>> >  docs/conf.py  |  2 +-
>> >  docs/sphinx/kerneldoc.py  |  2 +-
>> >  scripts/rst-sanitize.py   | 21 +
>> >  tests/qapi-schema/meson.build |  5 +++--
>> >  4 files changed, 26 insertions(+), 4 deletions(-)
>> >  create mode 100644 scripts/rst-sanitize.py
>> >
>> > diff --git a/scripts/rst-sanitize.py b/scripts/rst-sanitize.py
>> > new file mode 100644
>> > index 00..26060f1208
>> > --- /dev/null
>> > +++ b/scripts/rst-sanitize.py
>> > @@ -0,0 +1,21 @@
>> > +#!/usr/bin/env python3
>> > +
>> > +#
>> > +# Script for remove cr line ending in file
>> > +#
>> > +# Authors:
>> > +#  Yonggang Luo 
>> > +#
>> > +# This work is licensed under the terms of the GNU GPL, version 2
>> > +# or, at your option, any later version.  See the COPYING file in
>> > +# the top-level directory.
>> > +
>> > +import sys
>> > +
>> > +def main(_program, file, *unused):
>> > +with open(file, 'rb') as content_file:
>> > +content = content_file.read()
>> > +sys.stdout.buffer.write(content.replace(b'\r', b''))
>> > +
>> > +if __name__ == "__main__":
>> > +main(*sys.argv)
>>
>> Why doesn't the perl rune work? Your commit message doesn't say.
>
>
> Ninjatool gets confused by Windows escapes. So it's a QEMU-ism and
switching to ninja fixes it. There's no need to use a separate script for
this.
>
> Paolo
>
>>
>> > diff --git a/tests/qapi-schema/meson.build
b/tests/qapi-schema/meson.build
>> > index 1f222a7a13..20a7641af8 100644
>> > --- a/tests/qapi-schema/meson.build
>> > +++ b/tests/qapi-schema/meson.build
>> > @@ -251,18 +251,19 @@ qapi_doc_out = custom_target('QAPI rST doc',
>> >  # using an explicit '\' character in the command arguments to
>> >  # a custom_target(), as Meson will unhelpfully replace it with a '/'
>> >  # (https://github.com/mesonbuild/meson/issues/1564)
>> > +rst_sanitize_cmd = [find_program('../../scripts/rst-sanitize.py'),
'@INPUT@']
>> >  qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
>> >output: ['doc-good.txt.nocr'],
>> >input: qapi_doc_out[0],
>> >build_by_default: build_docs,
>> > -  command: ['perl', '-pe', '$x = chr
13; s/$x$//', '@INPUT@'],
>> > +  command: rst_sanitize_cmd,
>> >capture: true)
>> >
>> >  qapi_doc_ref_nocr = custom_target('QAPI rST doc reference
newline-sanitized',
>> >output: ['doc-good.ref.nocr'],
>> >input: files('doc-good.txt'),
>> >build_by_default: build_docs,
>> > -  command: ['perl', '-pe', '$x = chr
13; s/$x$//', '@INPUT@'],
>> > +  command: rst_sanitize_cmd,
>> >capture: true)
>>
>> thanks
>> -- PMM
>>


--
 此致
礼
罗勇刚
Yours
sincerely,
Yonggang Luo


Re: [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw

2020-10-15 Thread Yonggang Luo
On Fri, Oct 16, 2020 at 4:30 AM Peter Maydell 
wrote:
>
> On Thu, 15 Oct 2020 at 21:13, Yonggang Luo  wrote:
> >
> > Signed-off-by: Yonggang Luo 
> > ---
> >  docs/conf.py  |  2 +-
> >  docs/sphinx/kerneldoc.py  |  2 +-
> >  scripts/rst-sanitize.py   | 21 +
> >  tests/qapi-schema/meson.build |  5 +++--
> >  4 files changed, 26 insertions(+), 4 deletions(-)
> >  create mode 100644 scripts/rst-sanitize.py
> >
> > diff --git a/scripts/rst-sanitize.py b/scripts/rst-sanitize.py
> > new file mode 100644
> > index 00..26060f1208
> > --- /dev/null
> > +++ b/scripts/rst-sanitize.py
> > @@ -0,0 +1,21 @@
> > +#!/usr/bin/env python3
> > +
> > +#
> > +# Script for remove cr line ending in file
> > +#
> > +# Authors:
> > +#  Yonggang Luo 
> > +#
> > +# This work is licensed under the terms of the GNU GPL, version 2
> > +# or, at your option, any later version.  See the COPYING file in
> > +# the top-level directory.
> > +
> > +import sys
> > +
> > +def main(_program, file, *unused):
> > +with open(file, 'rb') as content_file:
> > +content = content_file.read()
> > +sys.stdout.buffer.write(content.replace(b'\r', b''))
> > +
> > +if __name__ == "__main__":
> > +main(*sys.argv)
>
> Why doesn't the perl rune work? Your commit message doesn't say.


PASS 3 test-qdev-global-props /qdev/properties/dynamic/global
PASS 4 test-qdev-global-props /qdev/properties/global/subclass
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))}
 ../../../../../CI-Tools/msys64/usr/bin/sh.EXE
C:/work/xemu/qemu/build/../tests/decode/check.sh python3 -B
C:/work/xemu/qemu/build/../tests/../scripts/decodetree.py
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(( ${RANDOM:-0} % 255 + 1))}
PYTHONPATH=C:/work/xemu/qemu/scripts PYTHONIOENCODING=utf-8
../../../../CI-Tools/msys64/mingw64/bin/python3.exe
C:/work/xemu/qemu/build/../tests/qapi-schema/test-qapi.py
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-any.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-array.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-base.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-branch-if-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-clash.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-enum-bool.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-enum-int.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-bool-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-conflict-num-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-invalid-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-nested.json
C:/work/xemu/qemu/build/../tests/qapi-schema/alternate-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-alternate.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-any.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-array-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-array-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-bad-boxed.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-boxed-anon.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-boxed-string.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-int.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-invalid.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-member-array-bad.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-member-case.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-member-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-name-clash.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-union.json
C:/work/xemu/qemu/build/../tests/qapi-schema/args-unknown.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-base.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-data.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-ident.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-if.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-if-empty.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-if-empty-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-if-list.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-type-bool.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-type-dict.json
C:/work/xemu/qemu/build/../tests/qapi-schema/bad-type-int.json
C:/work/xemu/qemu/build/../tests/qapi-schema/base-cycle-direct.json
C:/work/xemu/qemu/build/../tests/qapi-schema/base-cycle-indirect.json
C:/work/xemu/qemu/

[PATCH v3 1/2] block: Fixes nfs compiling error on msys2/mingw

2020-10-15 Thread Yonggang Luo
These compiling errors are fixed:
../block/nfs.c:27:10: fatal error: poll.h: No such file or directory
   27 | #include 
  |  ^~~~
compilation terminated.

../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
   63 | blkcnt_t st_blocks;
  | ^~~~
../block/nfs.c: In function 'nfs_client_open':
../block/nfs.c:550:27: error: 'struct _stat64' has no member named 'st_blocks'
  550 | client->st_blocks = st.st_blocks;
  |   ^
../block/nfs.c: In function 'nfs_get_allocated_file_size':
../block/nfs.c:751:41: error: 'struct _stat64' has no member named 'st_blocks'
  751 | return (task.ret < 0 ? task.ret : st.st_blocks * 512);
  | ^
../block/nfs.c: In function 'nfs_reopen_prepare':
../block/nfs.c:805:31: error: 'struct _stat64' has no member named 'st_blocks'
  805 | client->st_blocks = st.st_blocks;
  |   ^
../block/nfs.c: In function 'nfs_get_allocated_file_size':
../block/nfs.c:752:1: error: control reaches end of non-void function 
[-Werror=return-type]
  752 | }
  | ^

On msys2/mingw, there is no st_blocks in struct _stat64 yet, we disable the 
usage of it
on msys2/mingw, and create a typedef long long blkcnt_t; for further 
implementation

Signed-off-by: Yonggang Luo 
---
 block/nfs.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/block/nfs.c b/block/nfs.c
index f86e660374..cf8795fb49 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -24,7 +24,9 @@
 
 #include "qemu/osdep.h"
 
+#if !defined(_WIN32)
 #include 
+#endif
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
@@ -51,6 +53,10 @@
 #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
 #define QEMU_NFS_MAX_DEBUG_LEVEL 2
 
+#if defined(_WIN32)
+typedef long long blkcnt_t;
+#endif
+
 typedef struct NFSClient {
 struct nfs_context *context;
 struct nfsfh *fh;
@@ -545,7 +551,9 @@ static int64_t nfs_client_open(NFSClient *client, 
BlockdevOptionsNfs *opts,
 }
 
 ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE);
+#if !defined(_WIN32)
 client->st_blocks = st.st_blocks;
+#endif
 client->has_zero_init = S_ISREG(st.st_mode);
 *strp = '/';
 goto out;
@@ -706,6 +714,7 @@ static int nfs_has_zero_init(BlockDriverState *bs)
 return client->has_zero_init;
 }
 
+#if !defined(_WIN32)
 /* Called (via nfs_service) with QemuMutex held.  */
 static void
 nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data,
@@ -748,6 +757,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState 
*bs)
 
 return (task.ret < 0 ? task.ret : st.st_blocks * 512);
 }
+#endif
 
 static int coroutine_fn
 nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool exact,
@@ -800,7 +810,9 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
nfs_get_error(client->context));
 return ret;
 }
+#if !defined(_WIN32)
 client->st_blocks = st.st_blocks;
+#endif
 }
 
 return 0;
@@ -869,7 +881,10 @@ static BlockDriver bdrv_nfs = {
 .create_opts= _create_opts,
 
 .bdrv_has_zero_init = nfs_has_zero_init,
+/* libnfs does not provide the allocated filesize of a file on win32. */
+#if !defined(_WIN32)
 .bdrv_get_allocated_file_size   = nfs_get_allocated_file_size,
+#endif
 .bdrv_co_truncate   = nfs_file_co_truncate,
 
 .bdrv_file_open = nfs_file_open,
-- 
2.28.0.windows.1




[PATCH v3 0/2] Fixes building nfs on msys2/mingw

2020-10-15 Thread Yonggang Luo
Revise the commit message of
* block: enable libnfs on msys2/mingw in cirrus.yml

V1-V2
Apply suggestion from  Peter Lieven

Yonggang Luo (2):
  block: Fixes nfs compiling error on msys2/mingw
  block: enable libnfs on msys2/mingw in cirrus.yml

 .cirrus.yml |  1 +
 block/nfs.c | 15 +++
 2 files changed, 16 insertions(+)

-- 
2.28.0.windows.1




[PATCH v3 2/2] block: enable libnfs on msys2/mingw in cirrus.yml

2020-10-15 Thread Yonggang Luo
Initially, libnfs has not been enabled, and now it's fixed, so enable it
on cirrus.

Signed-off-by: Yonggang Luo 
---
 .cirrus.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.cirrus.yml b/.cirrus.yml
index f42ccb956a..2c6bf45e6d 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -109,6 +109,7 @@ windows_msys2_task:
   mingw-w64-x86_64-cyrus-sasl \
   mingw-w64-x86_64-curl \
   mingw-w64-x86_64-gnutls \
+  mingw-w64-x86_64-libnfs \
   "
 bitsadmin /transfer msys_download /dynamic /download /priority 
FOREGROUND `
   
https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python-sphinx-2.3.1-1-any.pkg.tar.xz
 `
-- 
2.28.0.windows.1




  1   2   3   4   5   6   7   8   >