Re: [PATCH-for-5.0 00/11] misc: Trivial static code analyzer fixes

2020-03-21 Thread Aleksandar Markovic
12:47 PM Sub, 21.03.2020. Philippe Mathieu-Daudé  је
написао/ла:
>
> Fix trivial warnings reported by the Clang static code analyzer.
>

Philippe,

It would be useful and customary for this type of fixes to provide here the
environment you used for obtaining the warnings (clang version, configure
parameters, and all needed elenents to repro the warnings).

Regards,
Aleksandar

> Philippe Mathieu-Daudé (11):
>   block: Remove dead assignment
>   blockdev: Remove dead assignment
>   hw/i2c/pm_smbus: Remove dead assignment
>   hw/input/adb-kbd: Remove dead assignment
>   hw/ide/sii3112: Remove dead assignment
>   hw/isa/i82378: Remove dead assignment
>   hw/gpio/aspeed_gpio: Remove dead assignment
>   hw/timer/exynos4210_mct: Remove dead assignments
>   hw/timer/stm32f2xx_timer: Remove dead assignment
>   hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning
>   hw/scsi/esp-pci: Remove dead assignment
>
>  block.c| 2 +-
>  blockdev.c | 2 +-
>  hw/gpio/aspeed_gpio.c  | 4 ++--
>  hw/i2c/pm_smbus.c  | 1 -
>  hw/ide/sii3112.c   | 2 +-
>  hw/input/adb-kbd.c | 1 -
>  hw/isa/i82378.c| 8 
>  hw/scsi/esp-pci.c  | 1 -
>  hw/timer/exynos4210_mct.c  | 3 ---
>  hw/timer/pxa2xx_timer.c| 1 +
>  hw/timer/stm32f2xx_timer.c | 1 -
>  11 files changed, 10 insertions(+), 16 deletions(-)
>
> --
> 2.21.1
>
>


Re: [PATCH-for-5.0 01/11] block: Remove dead assignment

2020-03-21 Thread Aleksandar Markovic
12:49 PM Sub, 21.03.2020. Philippe Mathieu-Daudé  је
написао/ла:
>
> Fix warning reported by Clang static code analyzer:
>
>   block.c:3167:5: warning: Value stored to 'ret' is never read
>   ret = bdrv_fill_options(&options, filename, &flags, &local_err);
>   ^ ~
>
> Reported-by: Clang Static Analyzer

Peter, and others,

Is this allowed use of "Reported-by:" mark?

I did not notice it being used this way before. And was under impression
that all similar tags/marks must be followed by a person, not a tool.

Regards,
Aleksandar

> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block.c b/block.c
> index a2542c977b..908c109a8c 100644
> --- a/block.c
> +++ b/block.c
> @@ -3164,7 +3164,7 @@ static BlockDriverState *bdrv_open_inherit(const
char *filename,
>  parent->open_flags, parent->options);
>  }
>
> -ret = bdrv_fill_options(&options, filename, &flags, &local_err);
> +bdrv_fill_options(&options, filename, &flags, &local_err);
>  if (local_err) {
>  goto fail;
>  }
> --
> 2.21.1
>
>


Re: [PATCH-for-5.0 05/11] hw/ide/sii3112: Remove dead assignment

2020-03-21 Thread Aleksandar Markovic
On Saturday, March 21, 2020, Philippe Mathieu-Daudé 
wrote:

> Fix warning reported by Clang static code analyzer:
>
> CC  hw/ide/sii3112.o
>   hw/ide/sii3112.c:204:9: warning: Value stored to 'val' is never read
>   val = 0;
>   ^ ~
>
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  hw/ide/sii3112.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
> index 06605d7af2..36f1905ddb 100644
> --- a/hw/ide/sii3112.c
> +++ b/hw/ide/sii3112.c
> @@ -125,7 +125,7 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr
> addr,
>  val = (uint32_t)d->regs[1].sien << 16;
>  break;
>  default:
> -val = 0;
> +break;


There is another function in the same file, having a similar switch
statement. There is no warning for that second tunction, since "val" is its
parameter, not a local varioble, like is the case here. This means that the
proposed change introduces inconsistency between two functions, therefore
it is better to remove the initialization of "val" to 0, than to remove
this line in "default" section.

Regards,
Aleksandar



>  }
>  trace_sii3112_read(size, addr, val);
>  return val;
> --
> 2.21.1
>
>
>


Re: [PATCH v3 1/4] scripts/simplebench: add simplebench.py

2020-03-17 Thread Aleksandar Markovic
On Mon, Mar 2, 2020 at 10:05 PM Aleksandar Markovic
 wrote:
>
>
>
>
> > >> +
> > >> +
> > >> +def ascii_one(result):
> > >> +"""Return ASCII representation of bench_one() returned dict."""
> > >> +if 'average' in result:
> > >> +s = '{:.2f} +- {:.2f}'.format(result['average'], 
> > >> result['delta'])
> > >> +if 'n-failed' in result:
> > >> +s += '\n({} failed)'.format(result['n-failed'])
> > >> +return s
> > >> +else:
> > >> +return 'FAILED'
> > >
> > > I think it would be visually clearer if "+-" was printed without any
> > > space between it and the following number, using something
> > > like this:
> > >
> > > s = ' {:.2f} +-{:.2f}'.format(result['average'], result['delta'])
> > >
> > > The resulting table would look like:
> > >
> > > --  -  -  -
> > >  backup-1   backup-2   mirror
> > > ssd -> ssd   0.43 +-0.004.48 +-0.064.38 +-0.02
> > > ssd -> hdd   10.60 +-0.08   10.69 +-0.18   10.57 +-0.05
> > > ssd -> nbd   33.81 +-0.37   10.67 +-0.17   10.07 +-0.07
> > > --  -  -  -
> > >
> > > But, this is just cosmetics.
> > >
> > > With or without the suggestion above:
> > >
> > > Reviewed-by: Aleksandar Markovic 
> >
> > Thanks for reviewing!
> >
> > Agree with this change, but I don't think it worth to resend the series for 
> > this one space)
> > Hope it may be applied with pull request..
> >
>
> I am an occasional Python programmer, and I felt comfortable
> reviewing your series, but I am not a maintainer of this directory,
> and I believe Eduardo or Cleber or other more active Python
> contributors would be better choice for selecting this series in
> their pull request.
>
> So, I can't send this series to Peter - Cleber, Eduardo, please
> see to it.
>

Eduardo, can you perhaps consider this series for selecting
into your pull request?

Thanks,
Aleksandar

> Yours,
> Aleksandar
>
> > >
> > >> +
> > >> +
> > >> +def bench(test_func, test_envs, test_cases, *args, **vargs):
> > >> +"""Fill benchmark table
> > >> +
> > >> +test_func -- benchmarking function, see bench_one for description
> > >> +test_envs -- list of test environments, see bench_one
> > >> +test_cases -- list of test cases, see bench_one
> > >> +args, vargs -- additional arguments for bench_one
> > >> +
> > >> +Returns dict with the following fields:
> > >> +'envs':  test_envs
> > >> +'cases': test_cases
> > >> +'tab':   filled 2D array, where cell [i][j] is bench_one result 
> > >> for
> > >> + test_cases[i] for test_envs[j] (i.e., rows are test 
> > >> cases and
> > >> + columns are test environments)
> > >> +"""
> > >> +tab = {}
> > >> +results = {
> > >> +'envs': test_envs,
> > >> +'cases': test_cases,
> > >> +'tab': tab
> > >> +}
> > >> +n = 1
> > >> +n_tests = len(test_envs) * len(test_cases)
> > >> +for env in test_envs:
> > >> +for case in test_cases:
> > >> +print('Testing {}/{}: {} :: {}'.format(n, n_tests,
> > >> +   env['id'], 
> > >> case['id']))
> > >> +if case['id'] not in tab:
> > >> +tab[case['id']] = {}
> > >> +tab[case['id']][env['id']] = bench_one(test_func, env, case,
> > >> +   *args, **vargs)
> > >> +n += 1
> > >> +
> > >> +print('Done')
> > >> +return results
> > >> +
> > >> +
> > >> +def ascii(results):
> > >> +"""Return ASCII representation of bench() returned dict."""
> > >> +from tabulate import tabulate
> > >> +
> > >> +tab = [[""] + [c['id'] for c in results['envs']]]
> > >> +for case in results['cases']:
> > >> +row = [case['id']]
> > >> +for env in results['envs']:
> > >> +row.append(ascii_one(results['tab'][case['id']][env['id']]))
> > >> +tab.append(row)
> > >> +
> > >> +return tabulate(tab)
> > >> --
> > >> 2.21.0
> > >>
> > >>
> >
> >
> > --
> > Best regards,
> > Vladimir



Re: [PATCH v2 1/8] target/i386: Restrict X86CPUFeatureWord to X86 targets

2020-03-15 Thread Aleksandar Markovic
On Monday, March 16, 2020, Philippe Mathieu-Daudé  wrote:

> Move out x86-specific structures from generic machine code.
>
>
Philippe,

I a kind of have hard time understanding what is achieved with this patch.
Is this pure code moving/reorganization? What is the logical connection
between this patch and the whole series (that is about removing unneeded
building for user mode)? How does this patch affect build time for user
mode?

Sincerely,
Aleksandar




> Acked-by: Richard Henderson 
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  qapi/machine-target.json   | 45 ++
>  qapi/machine.json  | 42 ---
>  target/i386/cpu.c  |  2 +-
>  target/i386/machine-stub.c | 22 +++
>  target/i386/Makefile.objs  |  3 ++-
>  5 files changed, 70 insertions(+), 44 deletions(-)
>  create mode 100644 target/i386/machine-stub.c
>
> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
> index f2c82949d8..fb7a4b7850 100644
> --- a/qapi/machine-target.json
> +++ b/qapi/machine-target.json
> @@ -3,6 +3,51 @@
>  # This work is licensed under the terms of the GNU GPL, version 2 or
> later.
>  # See the COPYING file in the top-level directory.
>
> +##
> +# @X86CPURegister32:
> +#
> +# A X86 32-bit register
> +#
> +# Since: 1.5
> +##
> +{ 'enum': 'X86CPURegister32',
> +  'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ],
> +  'if': 'defined(TARGET_I386)' }
> +
> +##
> +# @X86CPUFeatureWordInfo:
> +#
> +# Information about a X86 CPU feature word
> +#
> +# @cpuid-input-eax: Input EAX value for CPUID instruction for that
> feature word
> +#
> +# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
> +#   feature word
> +#
> +# @cpuid-register: Output register containing the feature bits
> +#
> +# @features: value of output register, containing the feature bits
> +#
> +# Since: 1.5
> +##
> +{ 'struct': 'X86CPUFeatureWordInfo',
> +  'data': { 'cpuid-input-eax': 'int',
> +'*cpuid-input-ecx': 'int',
> +'cpuid-register': 'X86CPURegister32',
> +'features': 'int' },
> +  'if': 'defined(TARGET_I386)' }
> +
> +##
> +# @DummyForceArrays:
> +#
> +# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
> +#
> +# Since: 2.5
> +##
> +{ 'struct': 'DummyForceArrays',
> +  'data': { 'unused': ['X86CPUFeatureWordInfo'] },
> +  'if': 'defined(TARGET_I386)' }
> +
>  ##
>  # @CpuModelInfo:
>  #
> diff --git a/qapi/machine.json b/qapi/machine.json
> index 6c11e3cf3a..de05730704 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -505,48 +505,6 @@
> 'dst': 'uint16',
> 'val': 'uint8' }}
>
> -##
> -# @X86CPURegister32:
> -#
> -# A X86 32-bit register
> -#
> -# Since: 1.5
> -##
> -{ 'enum': 'X86CPURegister32',
> -  'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
> -
> -##
> -# @X86CPUFeatureWordInfo:
> -#
> -# Information about a X86 CPU feature word
> -#
> -# @cpuid-input-eax: Input EAX value for CPUID instruction for that
> feature word
> -#
> -# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
> -#   feature word
> -#
> -# @cpuid-register: Output register containing the feature bits
> -#
> -# @features: value of output register, containing the feature bits
> -#
> -# Since: 1.5
> -##
> -{ 'struct': 'X86CPUFeatureWordInfo',
> -  'data': { 'cpuid-input-eax': 'int',
> -'*cpuid-input-ecx': 'int',
> -'cpuid-register': 'X86CPURegister32',
> -'features': 'int' } }
> -
> -##
> -# @DummyForceArrays:
> -#
> -# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
> -#
> -# Since: 2.5
> -##
> -{ 'struct': 'DummyForceArrays',
> -  'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
> -
>  ##
>  # @NumaCpuOptions:
>  #
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index a84553e50c..0753fe4935 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -37,7 +37,7 @@
>  #include "qemu/option.h"
>  #include "qemu/config-file.h"
>  #include "qapi/error.h"
> -#include "qapi/qapi-visit-machine.h"
> +#include "qapi/qapi-visit-machine-target.h"
>  #include "qapi/qapi-visit-run-state.h"
>  #include "qapi/qmp/qdict.h"
>  #include "qapi/qmp/qerror.h"
> diff --git a/target/i386/machine-stub.c b/target/i386/machine-stub.c
> new file mode 100644
> index 00..cb301af057
> --- /dev/null
> +++ b/target/i386/machine-stub.c
> @@ -0,0 +1,22 @@
> +/*
> + * QAPI x86 CPU features stub
> + *
> + * Copyright (c) 2020 Red Hat, Inc.
> + *
> + * Author:
> + *   Philippe Mathieu-Daudé 
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or
> later.
> + * See the COPYING file in the top-level directory.
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qapi/error.h"
> +#include "qapi/qapi-visit-machine-target.h"
> +
> +void visit_type_X86CPUFeatureWordInfoList(Visitor *v, const c

Re: [PATCH v2 1/8] target/i386: Restrict X86CPUFeatureWord to X86 targets

2020-03-15 Thread Aleksandar Markovic
On Monday, March 16, 2020, Aleksandar Markovic 
wrote:

>
>
> On Monday, March 16, 2020, Philippe Mathieu-Daudé 
> wrote:
>
>> Move out x86-specific structures from generic machine code.
>>
>>
> Philippe,
>
> I a kind of have hard time understanding what is achieved with this patch.
> Is this pure code moving/reorganization? What is the logical connection
> between this patch and the whole series (that is about removing unneeded
> building for user mode)? How does this patch affect build time for user
> mode?
>
> Sincerely,
> Aleksandar
>
>
Ugh, I think I mixed up your two series. You write too much code. :) ;)


>
>
>> Acked-by: Richard Henderson 
>> Signed-off-by: Philippe Mathieu-Daudé 
>> ---
>>  qapi/machine-target.json   | 45 ++
>>  qapi/machine.json  | 42 ---
>>  target/i386/cpu.c  |  2 +-
>>  target/i386/machine-stub.c | 22 +++
>>  target/i386/Makefile.objs  |  3 ++-
>>  5 files changed, 70 insertions(+), 44 deletions(-)
>>  create mode 100644 target/i386/machine-stub.c
>>
>> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
>> index f2c82949d8..fb7a4b7850 100644
>> --- a/qapi/machine-target.json
>> +++ b/qapi/machine-target.json
>> @@ -3,6 +3,51 @@
>>  # This work is licensed under the terms of the GNU GPL, version 2 or
>> later.
>>  # See the COPYING file in the top-level directory.
>>
>> +##
>> +# @X86CPURegister32:
>> +#
>> +# A X86 32-bit register
>> +#
>> +# Since: 1.5
>> +##
>> +{ 'enum': 'X86CPURegister32',
>> +  'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ],
>> +  'if': 'defined(TARGET_I386)' }
>> +
>> +##
>> +# @X86CPUFeatureWordInfo:
>> +#
>> +# Information about a X86 CPU feature word
>> +#
>> +# @cpuid-input-eax: Input EAX value for CPUID instruction for that
>> feature word
>> +#
>> +# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
>> +#   feature word
>> +#
>> +# @cpuid-register: Output register containing the feature bits
>> +#
>> +# @features: value of output register, containing the feature bits
>> +#
>> +# Since: 1.5
>> +##
>> +{ 'struct': 'X86CPUFeatureWordInfo',
>> +  'data': { 'cpuid-input-eax': 'int',
>> +'*cpuid-input-ecx': 'int',
>> +'cpuid-register': 'X86CPURegister32',
>> +'features': 'int' },
>> +  'if': 'defined(TARGET_I386)' }
>> +
>> +##
>> +# @DummyForceArrays:
>> +#
>> +# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList
>> internally
>> +#
>> +# Since: 2.5
>> +##
>> +{ 'struct': 'DummyForceArrays',
>> +  'data': { 'unused': ['X86CPUFeatureWordInfo'] },
>> +  'if': 'defined(TARGET_I386)' }
>> +
>>  ##
>>  # @CpuModelInfo:
>>  #
>> diff --git a/qapi/machine.json b/qapi/machine.json
>> index 6c11e3cf3a..de05730704 100644
>> --- a/qapi/machine.json
>> +++ b/qapi/machine.json
>> @@ -505,48 +505,6 @@
>> 'dst': 'uint16',
>> 'val': 'uint8' }}
>>
>> -##
>> -# @X86CPURegister32:
>> -#
>> -# A X86 32-bit register
>> -#
>> -# Since: 1.5
>> -##
>> -{ 'enum': 'X86CPURegister32',
>> -  'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
>> -
>> -##
>> -# @X86CPUFeatureWordInfo:
>> -#
>> -# Information about a X86 CPU feature word
>> -#
>> -# @cpuid-input-eax: Input EAX value for CPUID instruction for that
>> feature word
>> -#
>> -# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
>> -#   feature word
>> -#
>> -# @cpuid-register: Output register containing the feature bits
>> -#
>> -# @features: value of output register, containing the feature bits
>> -#
>> -# Since: 1.5
>> -##
>> -{ 'struct': 'X86CPUFeatureWordInfo',
>> -  'data': { 'cpuid-input-eax': 'int',
>> -'

Re: [EXTERNAL][PATCH 0/7] via-ide: fixes and improvements

2020-03-13 Thread Aleksandar Markovic

> From: Mark Cave-Ayland 
> This patchset effectively updates the VIA IDE PCI device to follow the
> behaviour in the datasheet in two ways: fixing some PCI configuration
> space register defaults and behaviours, and always using legacy IRQ 14/15
> routing, and once applied allows all our known test images to boot
> correctly.
> 

Hi, Mark, could you just enumerate those test images, download
locations, etc. and whatever else is needed to reproduce the boot
processes in question - it would be useful not only for this patch
set, but for possible future work, wouldn't it?

Sorry in advance if that info in possibly in another message, and
was missed by me.

Many thanks,
Aleksandar



Re: [PATCH v3 1/4] scripts/simplebench: add simplebench.py

2020-03-02 Thread Aleksandar Markovic
> >> +
> >> +
> >> +def ascii_one(result):
> >> +"""Return ASCII representation of bench_one() returned dict."""
> >> +if 'average' in result:
> >> +s = '{:.2f} +- {:.2f}'.format(result['average'],
result['delta'])
> >> +if 'n-failed' in result:
> >> +s += '\n({} failed)'.format(result['n-failed'])
> >> +return s
> >> +else:
> >> +return 'FAILED'
> >
> > I think it would be visually clearer if "+-" was printed without any
> > space between it and the following number, using something
> > like this:
> >
> > s = ' {:.2f} +-{:.2f}'.format(result['average'], result['delta'])
> >
> > The resulting table would look like:
> >
> > --  -  -  -
> >  backup-1   backup-2   mirror
> > ssd -> ssd   0.43 +-0.00    4.48 +-0.064.38 +-0.02
> > ssd -> hdd   10.60 +-0.08   10.69 +-0.18   10.57 +-0.05
> > ssd -> nbd   33.81 +-0.37   10.67 +-0.17   10.07 +-0.07
> > --  -  -  -
> >
> > But, this is just cosmetics.
> >
> > With or without the suggestion above:
> >
> > Reviewed-by: Aleksandar Markovic 
>
> Thanks for reviewing!
>
> Agree with this change, but I don't think it worth to resend the series
for this one space)
> Hope it may be applied with pull request..
>

I am an occasional Python programmer, and I felt comfortable
reviewing your series, but I am not a maintainer of this directory,
and I believe Eduardo or Cleber or other more active Python
contributors would be better choice for selecting this series in
their pull request.

So, I can't send this series to Peter - Cleber, Eduardo, please
see to it.

Yours,
Aleksandar

> >
> >> +
> >> +
> >> +def bench(test_func, test_envs, test_cases, *args, **vargs):
> >> +"""Fill benchmark table
> >> +
> >> +test_func -- benchmarking function, see bench_one for description
> >> +test_envs -- list of test environments, see bench_one
> >> +test_cases -- list of test cases, see bench_one
> >> +args, vargs -- additional arguments for bench_one
> >> +
> >> +Returns dict with the following fields:
> >> +'envs':  test_envs
> >> +'cases': test_cases
> >> +'tab':   filled 2D array, where cell [i][j] is bench_one
result for
> >> + test_cases[i] for test_envs[j] (i.e., rows are test
cases and
> >> + columns are test environments)
> >> +"""
> >> +tab = {}
> >> +results = {
> >> +'envs': test_envs,
> >> +'cases': test_cases,
> >> +'tab': tab
> >> +}
> >> +n = 1
> >> +n_tests = len(test_envs) * len(test_cases)
> >> +for env in test_envs:
> >> +for case in test_cases:
> >> +print('Testing {}/{}: {} :: {}'.format(n, n_tests,
> >> +   env['id'],
case['id']))
> >> +if case['id'] not in tab:
> >> +tab[case['id']] = {}
> >> +tab[case['id']][env['id']] = bench_one(test_func, env,
case,
> >> +   *args, **vargs)
> >> +n += 1
> >> +
> >> +print('Done')
> >> +return results
> >> +
> >> +
> >> +def ascii(results):
> >> +"""Return ASCII representation of bench() returned dict."""
> >> +from tabulate import tabulate
> >> +
> >> +tab = [[""] + [c['id'] for c in results['envs']]]
> >> +for case in results['cases']:
> >> +row = [case['id']]
> >> +for env in results['envs']:
> >> +
 row.append(ascii_one(results['tab'][case['id']][env['id']]))
> >> +tab.append(row)
> >> +
> >> +return tabulate(tab)
> >> --
> >> 2.21.0
> >>
> >>
>
>
> --
> Best regards,
> Vladimir


Re: [PATCH v3 3/4] scripts/simplebench: add example usage of simplebench

2020-02-28 Thread Aleksandar Markovic
On Fri, Feb 28, 2020 at 8:21 AM Vladimir Sementsov-Ogievskiy
 wrote:
>
> This example may be used as a template for custom benchmark.
> It illustrates three things to prepare:
>  - define bench_func
>  - define test environments (columns)
>  - define test cases (rows)
> And final call of simplebench API.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---

In future, it would be perhaps useful to add option to output results
in the format of csv (comma separated values) (or similar) - it would
simplify import to other data presentation tools. In any case:

Reviewed-by: Aleksandar Markovic 

>  scripts/simplebench/bench-example.py | 80 
>  1 file changed, 80 insertions(+)
>  create mode 100644 scripts/simplebench/bench-example.py
>
> diff --git a/scripts/simplebench/bench-example.py 
> b/scripts/simplebench/bench-example.py
> new file mode 100644
> index 00..c642a5b891
> --- /dev/null
> +++ b/scripts/simplebench/bench-example.py
> @@ -0,0 +1,80 @@
> +#!/usr/bin/env python3
> +#
> +# Benchmark example
> +#
> +# Copyright (c) 2019 Virtuozzo International GmbH.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +import simplebench
> +from bench_block_job import bench_block_copy, drv_file, drv_nbd
> +
> +
> +def bench_func(env, case):
> +""" Handle one "cell" of benchmarking table. """
> +return bench_block_copy(env['qemu_binary'], env['cmd'],
> +case['source'], case['target'])
> +
> +
> +# You may set the following five variables to correct values, to turn this
> +# example to real benchmark.
> +ssd_source = '/path-to-raw-source-image-at-ssd'
> +ssd_target = '/path-to-raw-target-image-at-ssd'
> +hdd_target = '/path-to-raw-source-image-at-hdd'
> +nbd_ip = 'nbd-ip-addr'
> +nbd_port = 'nbd-port-number'
> +
> +# Test-cases are "rows" in benchmark resulting table, 'id' is a caption for
> +# the row, other fields are handled by bench_func.
> +test_cases = [
> +{
> +'id': 'ssd -> ssd',
> +'source': drv_file(ssd_source),
> +'target': drv_file(ssd_target)
> +},
> +{
> +'id': 'ssd -> hdd',
> +'source': drv_file(ssd_source),
> +'target': drv_file(hdd_target)
> +},
> +{
> +'id': 'ssd -> nbd',
> +'source': drv_file(ssd_source),
> +'target': drv_nbd(nbd_ip, nbd_port)
> +},
> +]
> +
> +# Test-envs are "columns" in benchmark resulting table, 'id is a caption for
> +# the column, other fields are handled by bench_func.
> +test_envs = [
> +{
> +'id': 'backup-1',
> +'cmd': 'blockdev-backup',
> +'qemu_binary': '/path-to-qemu-binary-1'
> +},
> +{
> +'id': 'backup-2',
> +'cmd': 'blockdev-backup',
> +'qemu_binary': '/path-to-qemu-binary-2'
> +},
> +{
> +'id': 'mirror',
> +'cmd': 'blockdev-mirror',
> +'qemu_binary': '/path-to-qemu-binary-1'
> +}
> +]
> +
> +result = simplebench.bench(bench_func, test_envs, test_cases, count=3)
> +print(simplebench.ascii(result))
> --
> 2.21.0
>
>



Re: [PATCH v3 4/4] MAINTAINERS: add simplebench

2020-02-28 Thread Aleksandar Markovic
On Fri, Feb 28, 2020 at 8:19 AM Vladimir Sementsov-Ogievskiy
 wrote:
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---

Reviewed-by: Aleksandar Markovic 

>  MAINTAINERS | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 5e5e3e52d6..16d069adc5 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2038,6 +2038,11 @@ F: python/qemu/*py
>  F: scripts/*.py
>  F: tests/*.py
>
> +Benchmark util
> +M: Vladimir Sementsov-Ogievskiy 
> +S: Maintained
> +F: scripts/simplebench/
> +
>  QAPI
>  M: Markus Armbruster 
>  M: Michael Roth 
> --
> 2.21.0
>
>



Re: [PATCH v3 2/4] scripts/simplebench: add qemu/bench_block_job.py

2020-02-28 Thread Aleksandar Markovic
On Fri, Feb 28, 2020 at 8:19 AM Vladimir Sementsov-Ogievskiy
 wrote:
>
> Add block-job benchmarking helper functions.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---

Reviewed-by: Aleksandar Markovic 

>  scripts/simplebench/bench_block_job.py | 119 +
>  1 file changed, 119 insertions(+)
>  create mode 100755 scripts/simplebench/bench_block_job.py
>
> diff --git a/scripts/simplebench/bench_block_job.py 
> b/scripts/simplebench/bench_block_job.py
> new file mode 100755
> index 00..9808d696cf
> --- /dev/null
> +++ b/scripts/simplebench/bench_block_job.py
> @@ -0,0 +1,119 @@
> +#!/usr/bin/env python
> +#
> +# Benchmark block jobs
> +#
> +# Copyright (c) 2019 Virtuozzo International GmbH.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +
> +import sys
> +import os
> +import socket
> +import json
> +
> +sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 
> 'python'))
> +from qemu.machine import QEMUMachine
> +from qemu.qmp import QMPConnectError
> +
> +
> +def bench_block_job(cmd, cmd_args, qemu_args):
> +"""Benchmark block-job
> +
> +cmd   -- qmp command to run block-job (like blockdev-backup)
> +cmd_args  -- dict of qmp command arguments
> +qemu_args -- list of Qemu command line arguments, including path to Qemu
> + binary
> +
> +Returns {'seconds': int} on success and {'error': str} on failure, dict 
> may
> +contain addional 'vm-log' field. Return value is compatible with
> +simplebench lib.
> +"""
> +
> +vm = QEMUMachine(qemu_args[0], args=qemu_args[1:])
> +
> +try:
> +vm.launch()
> +except OSError as e:
> +return {'error': 'popen failed: ' + str(e)}
> +except (QMPConnectError, socket.timeout):
> +return {'error': 'qemu failed: ' + str(vm.get_log())}
> +
> +try:
> +res = vm.qmp(cmd, **cmd_args)
> +if res != {'return': {}}:
> +vm.shutdown()
> +return {'error': '"{}" command failed: {}'.format(cmd, str(res))}
> +
> +e = vm.event_wait('JOB_STATUS_CHANGE')
> +assert e['data']['status'] == 'created'
> +start_ms = e['timestamp']['seconds'] * 100 + \
> +e['timestamp']['microseconds']
> +
> +e = vm.events_wait((('BLOCK_JOB_READY', None),
> +('BLOCK_JOB_COMPLETED', None),
> +('BLOCK_JOB_FAILED', None)), timeout=True)
> +if e['event'] not in ('BLOCK_JOB_READY', 'BLOCK_JOB_COMPLETED'):
> +vm.shutdown()
> +return {'error': 'block-job failed: ' + str(e),
> +'vm-log': vm.get_log()}
> +end_ms = e['timestamp']['seconds'] * 100 + \
> +e['timestamp']['microseconds']
> +finally:
> +vm.shutdown()
> +
> +return {'seconds': (end_ms - start_ms) / 100.0}
> +
> +
> +# Bench backup or mirror
> +def bench_block_copy(qemu_binary, cmd, source, target):
> +"""Helper to run bench_block_job() for mirror or backup"""
> +assert cmd in ('blockdev-backup', 'blockdev-mirror')
> +
> +source['node-name'] = 'source'
> +target['node-name'] = 'target'
> +
> +return bench_block_job(cmd,
> +   {'job-id': 'job0', 'device': 'source',
> +'target': 'target', 'sync': 'full'},
> +   [qemu_binary,
> +'-blockdev', json.dumps(source),
> +'-blockdev', json.dumps(target)])
> +
> +
> +def drv_file(filename):
> +return {'driver': 'file', 'filename': filename,
> +'cache': {'direct': True}, 'aio': 'native'}
> +
> +
> +def drv_nbd(host, port):
> +return {'driver': 'nbd',
> +'server': {'type': 'inet', 'host': host, 'port': port}}
> +
> +
> +if __name__ == '__main__':
> +import sys
> +
> +if len(sys.argv) < 4:
> +print('USAGE: {}  '
> +  ' '
> +  ''.format(sys.argv[0]))
> +exit(1)
> +
> +res = bench_block_job(sys.argv[1], json.loads(sys.argv[2]), sys.argv[3:])
> +if 'seconds' in res:
> +print('{:.2f}'.format(res['seconds']))
> +else:
> +print(res)
> --
> 2.21.0
>
>



Re: [PATCH v3 1/4] scripts/simplebench: add simplebench.py

2020-02-28 Thread Aleksandar Markovic
On Fri, Feb 28, 2020 at 8:19 AM Vladimir Sementsov-Ogievskiy
 wrote:
>
> Add simple benchmark table creator.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---
>  scripts/simplebench/simplebench.py | 128 +
>  1 file changed, 128 insertions(+)
>  create mode 100644 scripts/simplebench/simplebench.py
>
> diff --git a/scripts/simplebench/simplebench.py 
> b/scripts/simplebench/simplebench.py
> new file mode 100644
> index 00..59e7314ff6
> --- /dev/null
> +++ b/scripts/simplebench/simplebench.py
> @@ -0,0 +1,128 @@
> +#!/usr/bin/env python
> +#
> +# Simple benchmarking framework
> +#
> +# Copyright (c) 2019 Virtuozzo International GmbH.
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +
> +def bench_one(test_func, test_env, test_case, count=5, initial_run=True):
> +"""Benchmark one test-case
> +
> +test_func   -- benchmarking function with prototype
> +   test_func(env, case), which takes test_env and test_case
> +   arguments and returns {'seconds': int} (which is benchmark
> +   result) on success and {'error': str} on error. Returned
> +   dict may contain any other additional fields.
> +test_env-- test environment - opaque first argument for test_func
> +test_case   -- test case - opaque second argument for test_func
> +count   -- how many times to call test_func, to calculate average
> +initial_run -- do initial run of test_func, which don't get into result
> +
> +Returns dict with the following fields:
> +'runs': list of test_func results
> +'average':  average seconds per run (exists only if at least one run
> +succeeded)
> +'delta':maximum delta between test_func result and the average
> +(exists only if at least one run succeeded)
> +'n-failed': number of failed runs (exists only if at least one run
> +failed)
> +"""
> +if initial_run:
> +print('  #initial run:')
> +print('   ', test_func(test_env, test_case))
> +
> +runs = []
> +for i in range(count):
> +print('  #run {}'.format(i+1))
> +res = test_func(test_env, test_case)
> +print('   ', res)
> +runs.append(res)
> +
> +result = {'runs': runs}
> +
> +successed = [r for r in runs if ('seconds' in r)]
> +if successed:
> +avg = sum(r['seconds'] for r in successed) / len(successed)
> +result['average'] = avg
> +result['delta'] = max(abs(r['seconds'] - avg) for r in successed)
> +
> +if len(successed) < count:
> +result['n-failed'] = count - len(successed)
> +
> +return result
> +
> +
> +def ascii_one(result):
> +"""Return ASCII representation of bench_one() returned dict."""
> +if 'average' in result:
> +s = '{:.2f} +- {:.2f}'.format(result['average'], result['delta'])
> +if 'n-failed' in result:
> +s += '\n({} failed)'.format(result['n-failed'])
> +return s
> +else:
> +return 'FAILED'

I think it would be visually clearer if "+-" was printed without any
space between it and the following number, using something
like this:

s = ' {:.2f} +-{:.2f}'.format(result['average'], result['delta'])

The resulting table would look like:

--  -  -  -
backup-1   backup-2   mirror
ssd -> ssd   0.43 +-0.004.48 +-0.064.38 +-0.02
ssd -> hdd   10.60 +-0.08   10.69 +-0.18   10.57 +-0.05
ssd -> nbd   33.81 +-0.37   10.67 +-0.17   10.07 +-0.07
--  -  -  -

But, this is just cosmetics.

Wit

Re: [PATCH RESEND v2 07/32] hw/mips: Use memory_region_init_rom() with read-only regions

2020-02-26 Thread Aleksandar Markovic
On Monday, February 24, 2020, Philippe Mathieu-Daudé 
wrote:

> This commit was produced with the Coccinelle script
> scripts/coccinelle/memory-region-housekeeping.cocci.
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---


Reviewed-by: Aleksandar Markovic 

Will be applied to the next MIPS queue, planned to be sent in next few days.


>  hw/mips/mips_fulong2e.c | 3 +--
>  hw/mips/mips_jazz.c | 6 ++
>  hw/mips/mips_mipssim.c  | 3 +--
>  hw/mips/mips_r4k.c  | 3 +--
>  4 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
> index 2e043cbb98..547a7d3a45 100644
> --- a/hw/mips/mips_fulong2e.c
> +++ b/hw/mips/mips_fulong2e.c
> @@ -319,9 +319,8 @@ static void mips_fulong2e_init(MachineState *machine)
>
>  /* allocate RAM */
>  memory_region_allocate_system_memory(ram, NULL, "fulong2e.ram",
> ram_size);
> -memory_region_init_ram(bios, NULL, "fulong2e.bios", BIOS_SIZE,
> +memory_region_init_rom(bios, NULL, "fulong2e.bios", BIOS_SIZE,
> &error_fatal);
> -memory_region_set_readonly(bios, true);
>
>  memory_region_add_subregion(address_space_mem, 0, ram);
>  memory_region_add_subregion(address_space_mem, 0x1fc0LL, bios);
> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> index 66fd4d867d..cf47335ea5 100644
> --- a/hw/mips/mips_jazz.c
> +++ b/hw/mips/mips_jazz.c
> @@ -195,9 +195,8 @@ static void mips_jazz_init(MachineState *machine,
>   machine->ram_size);
>  memory_region_add_subregion(address_space, 0, ram);
>
> -memory_region_init_ram(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE,
> +memory_region_init_rom(bios, NULL, "mips_jazz.bios", MAGNUM_BIOS_SIZE,
> &error_fatal);
> -memory_region_set_readonly(bios, true);
>  memory_region_init_alias(bios2, NULL, "mips_jazz.bios", bios,
>   0, MAGNUM_BIOS_SIZE);
>  memory_region_add_subregion(address_space, 0x1fc0LL, bios);
> @@ -263,9 +262,8 @@ static void mips_jazz_init(MachineState *machine,
>  {
>  /* Simple ROM, so user doesn't have to provide one */
>  MemoryRegion *rom_mr = g_new(MemoryRegion, 1);
> -memory_region_init_ram(rom_mr, NULL, "g364fb.rom", 0x8,
> +memory_region_init_rom(rom_mr, NULL, "g364fb.rom", 0x8,
> &error_fatal);
> -memory_region_set_readonly(rom_mr, true);
>  uint8_t *rom = memory_region_get_ram_ptr(rom_mr);
>  memory_region_add_subregion(address_space, 0x6000,
> rom_mr);
>  rom[0] = 0x10; /* Mips G364 */
> diff --git a/hw/mips/mips_mipssim.c b/hw/mips/mips_mipssim.c
> index b934ca9d51..3fdbb21680 100644
> --- a/hw/mips/mips_mipssim.c
> +++ b/hw/mips/mips_mipssim.c
> @@ -169,9 +169,8 @@ mips_mipssim_init(MachineState *machine)
>  /* Allocate RAM. */
>  memory_region_allocate_system_memory(ram, NULL, "mips_mipssim.ram",
>   ram_size);
> -memory_region_init_ram(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,
> +memory_region_init_rom(bios, NULL, "mips_mipssim.bios", BIOS_SIZE,
> &error_fatal);
> -memory_region_set_readonly(bios, true);
>
>  memory_region_add_subregion(address_space_mem, 0, ram);
>
> diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
> index b2aec434c3..54b286ceee 100644
> --- a/hw/mips/mips_r4k.c
> +++ b/hw/mips/mips_r4k.c
> @@ -241,9 +241,8 @@ void mips_r4k_init(MachineState *machine)
>  dinfo = drive_get(IF_PFLASH, 0, 0);
>  if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
>  bios = g_new(MemoryRegion, 1);
> -memory_region_init_ram(bios, NULL, "mips_r4k.bios", BIOS_SIZE,
> +memory_region_init_rom(bios, NULL, "mips_r4k.bios", BIOS_SIZE,
> &error_fatal);
> -memory_region_set_readonly(bios, true);
>  memory_region_add_subregion(get_system_memory(), 0x1fc0,
> bios);
>
>  load_image_targphys(filename, 0x1fc0, BIOS_SIZE);
> --
> 2.21.1
>
>
>


Re: [PATCH v2] configure: Avoid compiling system tools on user build by default

2020-02-17 Thread Aleksandar Markovic
11:00 AM Pon, 17.02.2020. Philippe Mathieu-Daudé  је
написао/ла:
>
> From: Philippe Mathieu-Daudé 
>
> User-mode does not need the sytem tools.

system

> Do not build them by
> default if user specified --disable-system.

specifies

>
> This disables building the following binary on a user-only build:

binaries

>
> - elf2dmp
> - qemu-edid
> - qemu-ga
> - qemu-img
> - qemu-io
> - qemu-nbd
> - ivshmem-client
> - ivshmem-server
>
> The qemu-user binary is not affected by this change.

binaries are

>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
> v2:
> - use simpler if/else statement (therefore not adding Richard R-b)
> - improved description (Aleksandar)
> ---
>  configure | 12 +++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 16f94cd96b..d1877a60f5 100755
> --- a/configure
> +++ b/configure
> @@ -455,7 +455,7 @@ guest_agent_ntddscsi="no"
>  guest_agent_msi=""
>  vss_win32_sdk=""
>  win_sdk="no"
> -want_tools="yes"
> +want_tools=""
>  libiscsi=""
>  libnfs=""
>  coroutine=""
> @@ -2199,6 +2199,16 @@ else
>  echo big/little test failed
>  fi
>
> +##
> +# system tools
> +if test -z "$want_tools"; then
> +if test "$softmmu" = "no"; then
> +want_tools=no
> +else
> +want_tools=yes
> +fi
> +fi
> +
>  ##
>  # cocoa implies not SDL or GTK
>  # (the cocoa UI code currently assumes it is always the active UI
> --
> 2.21.1
>


Re: [PATCH] configure: Avoid compiling system tools on user build by default

2020-02-16 Thread Aleksandar Markovic
5:23 PM Sub, 15.02.2020. Philippe Mathieu-Daudé  је
написао/ла:
>
> User-mode does not need the sytem tools. Do not build them by
> default if user specified --disable-system.
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  configure | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>

It would be nice if somebody comes up with more detailed analysis on what
is built for --disable-system, but in fact not needed at all.

How does your change affect the size of the executable?

> diff --git a/configure b/configure
> index 16f94cd96b..557ca4bd04 100755
> --- a/configure
> +++ b/configure
> @@ -455,7 +455,7 @@ guest_agent_ntddscsi="no"
>  guest_agent_msi=""
>  vss_win32_sdk=""
>  win_sdk="no"
> -want_tools="yes"
> +want_tools=""
>  libiscsi=""
>  libnfs=""
>  coroutine=""
> @@ -2199,6 +2199,15 @@ else
>  echo big/little test failed
>  fi
>
> +##
> +# system tools
> +if test "$want_tools" != "yes" && test "$softmmu" = "no"; then
> +want_tools=no
> +fi
> +if test -z "$want_tools"; then
> +want_tools=yes
> +fi
> +
>  ##
>  # cocoa implies not SDL or GTK
>  # (the cocoa UI code currently assumes it is always the active UI
> --
> 2.21.1
>
>


Re: Can we retire Python 2 now?

2019-12-21 Thread Aleksandar Markovic
On Saturday, December 21, 2019, Paolo Bonzini  wrote:

> On 20/12/19 17:29, Markus Armbruster wrote:
> > Python 2 EOL is only a few days away[*].  We made configure bitch about
> > it in commit e5abf59eae "Deprecate Python 2 support", 2019-07-01.  Any
> > objections to retiring it now, i.e. in 5.0?
> >
> > Cc'ing everyone who appears to be maintaining something that looks like
> > a Python script.
> >
> > [*] https://pythonclock.org/
>
> Fortunately Betteridge's law of headlines is not always true.  :)
>
>
Perhaps we can formulate a new law that says:

"Any person who says that he/she is pretty sure he/she is not a maintainer
of something at all, is, in fact, and for sure, the maintainer of that
thing."

:)

Aleksandar

Paolo
>
>
>


Re: [PATCH for-5.0 v2 0/3] benchmark util

2019-11-27 Thread Aleksandar Markovic
On Tue, Nov 26, 2019 at 4:49 PM Vladimir Sementsov-Ogievskiy
 wrote:
>
> Hi all!
>
> Here is simple benchmarking utility, to generate performance
> comparison tables, like the following:
>
> --  -  -  -
> backup-1   backup-2   mirror
> ssd -> ssd  0.43 +- 0.00   4.48 +- 0.06   4.38 +- 0.02
> ssd -> hdd  10.60 +- 0.08  10.69 +- 0.18  10.57 +- 0.05
> ssd -> nbd  33.81 +- 0.37  10.67 +- 0.17  10.07 +- 0.07
> --  -  -  -
>
> This is a v2, as v1 was inside
>  "[RFC 00/24] backup performance: block_status + async"
>
> I'll use this benchmark in other series, hope someone
> will like it.
>

Vladimir,

I really like this idea, even though I am interested in benchmarks of
different nature. Certainly a beautiful and handy tool for doing
detection of performance regressions (and also confirmation of
performance optimizations).

Did you run the tool on the previous QEMU versions, to detect change
in numbers between QEMU versions? Do you have the results of the same
benchmark for QEMU 2.12, 3.0, 4.0,... ?

What are units used in the table? Seconds, minutes? Hopefully, not hours?

Yours,
Aleksandar

> Vladimir Sementsov-Ogievskiy (3):
>   python: add simplebench.py
>   python: add qemu/bench_block_job.py
>   python: add example usage of simplebench
>
>  python/bench-example.py|  80 +
>  python/qemu/bench_block_job.py | 115 +
>  python/simplebench.py  | 128 +
>  3 files changed, 323 insertions(+)
>  create mode 100644 python/bench-example.py
>  create mode 100755 python/qemu/bench_block_job.py
>  create mode 100644 python/simplebench.py
>
> --
> 2.18.0
>
>



Re: [PULL for-4.2-rc2 0/2] Tracing patches

2019-11-19 Thread Aleksandar Markovic
On Tue, Nov 19, 2019 at 10:14 PM Aleksandar Markovic
 wrote:
>
> On Tue, Nov 19, 2019 at 9:46 PM Stefan Hajnoczi  wrote:
> >
> > The following changes since commit f086f22d6c068ba151b0f6e81e75a64f130df712:
> >
> >   Merge remote-tracking branch 
> > 'remotes/awilliam/tags/vfio-fixes-20191118.0' into staging (2019-11-18 
> > 21:35:48 +)
> >
> > are available in the Git repository at:
> >
> >   https://github.com/stefanha/qemu.git tags/tracing-pull-request
> >
> > for you to fetch changes up to 6b904f1a528a6d8c21f7fbdeab13b9603d1b6df7:
> >
> >   hw/mips/gt64xxx: Remove dynamic field width from trace events (2019-11-19 
> > 16:17:05 +)
> >
> > 
> > Pull request
> >
> > Tracing fixes for MIPS.
> >
> > 
> >
>
> Hello, Stefan, Philippe, Peter.
>
> This appears to be a duplicate of the pull request sent today by Philippe
> (and already applied by Peter just hours ago):
>
> https://lists.gnu.org/archive/html/qemu-devel/2019-11/msg02894.html
>
> The patches from the two pull requests appear to be identical, except
> some minor details in commit messages: Stefan's versions contain
> "Message-Id:" identifiers, while Philippe's don't (my suggestion to
> Philippe is to include "Message-Id:" for all patches that are part of any
> pull request in future; this can be achieved effortlessly/automatically
> by applying patches using patchwork).
>
> In summary, for this very situation, it looks to me we are all set, no need
> for Peter to process this pull request.
>

And just another really friendly advice for Philippe: When you apply
some patches or a series to your pull request, just inform others
about that by replying to the patches or a series: "I applied XXX to
my queue/pull request" - this helps avoiding duplicate efforts like
it happened here. This is also reminder to me too, I didn't do it in
all cases of my applying to my my pull requests, and I should have,
but I will improve too.

Thanks for these fixes!

Aleksandar

> Regards,
> Aleksandar
>
> > Philippe Mathieu-Daudé (2):
> >   hw/block/pflash: Remove dynamic field width from trace events
> >   hw/mips/gt64xxx: Remove dynamic field width from trace events
> >
> >  hw/block/pflash_cfi01.c |  8 
> >  hw/block/pflash_cfi02.c |  8 
> >  hw/block/trace-events   |  8 
> >  hw/mips/gt64xxx_pci.c   | 16 
> >  hw/mips/trace-events|  4 ++--
> >  5 files changed, 22 insertions(+), 22 deletions(-)
> >
> > --
> > 2.23.0
> >
> >



Re: [PULL for-4.2-rc2 0/2] Tracing patches

2019-11-19 Thread Aleksandar Markovic
On Tue, Nov 19, 2019 at 9:46 PM Stefan Hajnoczi  wrote:
>
> The following changes since commit f086f22d6c068ba151b0f6e81e75a64f130df712:
>
>   Merge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20191118.0' 
> into staging (2019-11-18 21:35:48 +)
>
> are available in the Git repository at:
>
>   https://github.com/stefanha/qemu.git tags/tracing-pull-request
>
> for you to fetch changes up to 6b904f1a528a6d8c21f7fbdeab13b9603d1b6df7:
>
>   hw/mips/gt64xxx: Remove dynamic field width from trace events (2019-11-19 
> 16:17:05 +)
>
> 
> Pull request
>
> Tracing fixes for MIPS.
>
> 
>

Hello, Stefan, Philippe, Peter.

This appears to be a duplicate of the pull request sent today by Philippe
(and already applied by Peter just hours ago):

https://lists.gnu.org/archive/html/qemu-devel/2019-11/msg02894.html

The patches from the two pull requests appear to be identical, except
some minor details in commit messages: Stefan's versions contain
"Message-Id:" identifiers, while Philippe's don't (my suggestion to
Philippe is to include "Message-Id:" for all patches that are part of any
pull request in future; this can be achieved effortlessly/automatically
by applying patches using patchwork).

In summary, for this very situation, it looks to me we are all set, no need
for Peter to process this pull request.

Regards,
Aleksandar

> Philippe Mathieu-Daudé (2):
>   hw/block/pflash: Remove dynamic field width from trace events
>   hw/mips/gt64xxx: Remove dynamic field width from trace events
>
>  hw/block/pflash_cfi01.c |  8 
>  hw/block/pflash_cfi02.c |  8 
>  hw/block/trace-events   |  8 
>  hw/mips/gt64xxx_pci.c   | 16 
>  hw/mips/trace-events|  4 ++--
>  5 files changed, 22 insertions(+), 22 deletions(-)
>
> --
> 2.23.0
>
>



Re: [RFC v5 026/126] python: add commit-per-subsystem.py

2019-11-11 Thread Aleksandar Markovic
On Friday, October 11, 2019, Vladimir Sementsov-Ogievskiy <
vsement...@virtuozzo.com> wrote:

> Add script to automatically commit tree-wide changes per-subsystem.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---


Great idea!

Can you just add a comment somewhere close to the top of the file on script
usage? Or "--help" option? If you would like to be the script maintainer,
please change the MAINTAINERS too.

Reviewed-by: Aleksandar Markovic 


>
> CC: Gerd Hoffmann 
> CC: "Gonglei (Arei)" 
> CC: Eduardo Habkost 
> CC: Igor Mammedov 
> CC: Laurent Vivier 
> CC: Amit Shah 
> CC: Kevin Wolf 
> CC: Max Reitz 
> CC: John Snow 
> CC: Ari Sundholm 
> CC: Pavel Dovgalyuk 
> CC: Paolo Bonzini 
> CC: Stefan Hajnoczi 
> CC: Fam Zheng 
> CC: Stefan Weil 
> CC: Ronnie Sahlberg 
> CC: Peter Lieven 
> CC: Eric Blake 
> CC: "Denis V. Lunev" 
> CC: Markus Armbruster 
> CC: Alberto Garcia 
> CC: Jason Dillaman 
> CC: Wen Congyang 
> CC: Xie Changlong 
> CC: Liu Yuan 
> CC: "Richard W.M. Jones" 
> CC: Jeff Cody 
> CC: "Marc-André Lureau" 
> CC: "Daniel P. Berrangé" 
> CC: Richard Henderson 
> CC: Greg Kurz 
> CC: "Michael S. Tsirkin" 
> CC: Marcel Apfelbaum 
> CC: Beniamino Galvani 
> CC: Peter Maydell 
> CC: "Cédric Le Goater" 
> CC: Andrew Jeffery 
> CC: Joel Stanley 
> CC: Andrew Baumann 
> CC: "Philippe Mathieu-Daudé" 
> CC: Antony Pavlov 
> CC: Jean-Christophe Dubois 
> CC: Peter Chubb 
> CC: Subbaraya Sundeep 
> CC: Eric Auger 
> CC: Alistair Francis 
> CC: "Edgar E. Iglesias" 
> CC: Stefano Stabellini 
> CC: Anthony Perard 
> CC: Paul Durrant 
> CC: Paul Burton 
> CC: Aleksandar Rikalo 
> CC: Chris Wulff 
> CC: Marek Vasut 
> CC: David Gibson 
> CC: Cornelia Huck 
> CC: Halil Pasic 
> CC: Christian Borntraeger 
> CC: "Hervé Poussineau" 
> CC: Xiao Guangrong 
> CC: Aurelien Jarno 
> CC: Aleksandar Markovic 
> CC: Mark Cave-Ayland 
> CC: Jason Wang 
> CC: Laszlo Ersek 
> CC: Yuval Shaia 
> CC: Palmer Dabbelt 
> CC: Sagar Karandikar 
> CC: Bastian Koppelmann 
> CC: David Hildenbrand 
> CC: Thomas Huth 
> CC: Eric Farman 
> CC: Matthew Rosato 
> CC: Hannes Reinecke 
> CC: Michael Walle 
> CC: Artyom Tarasenko 
> CC: Stefan Berger 
> CC: Samuel Thibault 
> CC: Alex Williamson 
> CC: Tony Krowiak 
> CC: Pierre Morel 
> CC: Michael Roth 
> CC: Hailiang Zhang 
> CC: Juan Quintela 
> CC: "Dr. David Alan Gilbert" 
> CC: Luigi Rizzo 
> CC: Giuseppe Lettieri 
> CC: Vincenzo Maffione 
> CC: Jan Kiszka 
> CC: Anthony Green 
> CC: Stafford Horne 
> CC: Guan Xuetao 
> CC: Max Filippov 
> CC: qemu-block@nongnu.org
> CC: integrat...@gluster.org
> CC: sheep...@lists.wpkg.org
> CC: qemu-...@nongnu.org
> CC: xen-de...@lists.xenproject.org
> CC: qemu-...@nongnu.org
> CC: qemu-s3...@nongnu.org
> CC: qemu-ri...@nongnu.org
>
>  python/commit-per-subsystem.py | 204 +
>  1 file changed, 204 insertions(+)
>  create mode 100755 python/commit-per-subsystem.py
>
> diff --git a/python/commit-per-subsystem.py b/python/commit-per-subsystem.
> py
> new file mode 100755
> index 00..2ccf84cb15
> --- /dev/null
> +++ b/python/commit-per-subsystem.py
> @@ -0,0 +1,204 @@
> +#!/usr/bin/env python3
> +#
> +# Copyright (c) 2019 Virtuozzo International GmbH
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +import subprocess
> +import sys
> +import os
> +import glob
> +
> +
> +def git_add(pattern):
> +subprocess.run(['git', 'add', pattern])
> +
> +
> +def git_commit(msg):
> +subprocess.run(['git', 'commit', '-m', msg], capture_output=True)
> +
> +
> +def git_changed_files():
> +ret = subprocess.check_output(['git', 'diff', '--name-only'],
> encoding='utf-8').split('\n')
> +if ret[-1] == '

Re: [Qemu-block] [Qemu-devel] [PATCH v9 8/9] hw/m68k: add a dummy SWIM floppy controller

2019-09-09 Thread Aleksandar Markovic
09.09.2019. 18.32, "Aleksandar Markovic"  је
написао/ла:
>
>
> 09.09.2019. 18.03, "Laurent Vivier"  је написао/ла:
> >
> > Co-developed-by: Mark Cave-Ayland 
> > Signed-off-by: Mark Cave-Ayland 
> > Signed-off-by: Laurent Vivier 
> > Reviewed-by: Hervé Poussineau 
> > ---
>
> Laurent, hi!
>
> I am not sure how "Co-developed-by:" fits in our workflow. There was some
recent talk on restricting those marks to only a handful of them, and
preventing new ones from introducing (the starter example was something
like "Regression-tested-by:"). Perhaps a final sentence "This patch was
co-developed with Mark..." would be better?
>
> Aleksandar

Laurent,

I noticed I overlooked that there is a paragraph on "Co-developed-by:" in
the Linux kernel "how to submit a patch", so it is fine.

Sorry about noise.

Aleksandar

> >  hw/block/Kconfig|   3 +
> >  hw/block/Makefile.objs  |   1 +
> >  hw/block/swim.c | 421 
> >  include/hw/block/swim.h |  76 
> >  4 files changed, 501 insertions(+)
> >  create mode 100644 hw/block/swim.c
> >  create mode 100644 include/hw/block/swim.h
> >
> > diff --git a/hw/block/Kconfig b/hw/block/Kconfig
> > index df96dc5dcc..2d17f481ad 100644
> > --- a/hw/block/Kconfig
> > +++ b/hw/block/Kconfig
> > @@ -37,3 +37,6 @@ config VHOST_USER_BLK
> >  # Only PCI devices are provided for now
> >  default y if VIRTIO_PCI
> >  depends on VIRTIO && VHOST_USER && LINUX
> > +
> > +config SWIM
> > +bool
> > diff --git a/hw/block/Makefile.objs b/hw/block/Makefile.objs
> > index f5f643f0cc..28c2495a00 100644
> > --- a/hw/block/Makefile.objs
> > +++ b/hw/block/Makefile.objs
> > @@ -8,6 +8,7 @@ common-obj-$(CONFIG_XEN) += xen-block.o
> >  common-obj-$(CONFIG_ECC) += ecc.o
> >  common-obj-$(CONFIG_ONENAND) += onenand.o
> >  common-obj-$(CONFIG_NVME_PCI) += nvme.o
> > +common-obj-$(CONFIG_SWIM) += swim.o
> >
> >  obj-$(CONFIG_SH4) += tc58128.o
> >
> > diff --git a/hw/block/swim.c b/hw/block/swim.c
> > new file mode 100644
> > index 00..6e26915238
> > --- /dev/null
> > +++ b/hw/block/swim.c
> > @@ -0,0 +1,421 @@
> > +/*
> > + * QEMU Macintosh floppy disk controller emulator (SWIM)
> > + *
> > + * Copyright (c) 2014-2018 Laurent Vivier 
> > + *
> > + * This work is licensed under the terms of the GNU GPL, version 2.
See
> > + * the COPYING file in the top-level directory.
> > + *
> > + */
> > +
> > +#include "qemu/osdep.h"
> > +#include "qemu/main-loop.h"
> > +#include "qapi/error.h"
> > +#include "sysemu/block-backend.h"
> > +#include "hw/sysbus.h"
> > +#include "hw/block/block.h"
> > +#include "hw/block/swim.h"
> > +#include "hw/qdev-properties.h"
> > +
> > +/* IWM registers */
> > +
> > +#define IWM_PH0L0
> > +#define IWM_PH0H1
> > +#define IWM_PH1L2
> > +#define IWM_PH1H3
> > +#define IWM_PH2L4
> > +#define IWM_PH2H5
> > +#define IWM_PH3L6
> > +#define IWM_PH3H7
> > +#define IWM_MTROFF  8
> > +#define IWM_MTRON   9
> > +#define IWM_INTDRIVE10
> > +#define IWM_EXTDRIVE11
> > +#define IWM_Q6L 12
> > +#define IWM_Q6H 13
> > +#define IWM_Q7L 14
> > +#define IWM_Q7H 15
> > +
> > +/* SWIM registers */
> > +
> > +#define SWIM_WRITE_DATA 0
> > +#define SWIM_WRITE_MARK 1
> > +#define SWIM_WRITE_CRC  2
> > +#define SWIM_WRITE_PARAMETER3
> > +#define SWIM_WRITE_PHASE4
> > +#define SWIM_WRITE_SETUP5
> > +#define SWIM_WRITE_MODE06
> > +#define SWIM_WRITE_MODE17
> > +
> > +#define SWIM_READ_DATA  8
> > +#define SWIM_READ_MARK  9
> > +#define SWIM_READ_ERROR 10
> > +#define SWIM_READ_PARAMETER 11
> > +#define SWIM_READ_PHASE 12
> > +#define SWIM_READ_SETUP 13
> > +#define SWIM_READ_STATUS14
> > +#define SWIM_READ_HANDSHAKE 15
> > +
> > +#define REG_SHIFT   9
> > +
> > +#define SWIM_MODE_IWM  0
> > +#define SWIM_MODE_SWIM 1
> > +
> > +/* bits in phase register */

Re: [Qemu-block] [Qemu-devel] [PATCH v9 8/9] hw/m68k: add a dummy SWIM floppy controller

2019-09-09 Thread Aleksandar Markovic
09.09.2019. 18.03, "Laurent Vivier"  је написао/ла:
>
> Co-developed-by: Mark Cave-Ayland 
> Signed-off-by: Mark Cave-Ayland 
> Signed-off-by: Laurent Vivier 
> Reviewed-by: Hervé Poussineau 
> ---

Laurent, hi!

I am not sure how "Co-developed-by:" fits in our workflow. There was some
recent talk on restricting those marks to only a handful of them, and
preventing new ones from introducing (the starter example was something
like "Regression-tested-by:"). Perhaps a final sentence "This patch was
co-developed with Mark..." would be better?

Aleksandar

>  hw/block/Kconfig|   3 +
>  hw/block/Makefile.objs  |   1 +
>  hw/block/swim.c | 421 
>  include/hw/block/swim.h |  76 
>  4 files changed, 501 insertions(+)
>  create mode 100644 hw/block/swim.c
>  create mode 100644 include/hw/block/swim.h
>
> diff --git a/hw/block/Kconfig b/hw/block/Kconfig
> index df96dc5dcc..2d17f481ad 100644
> --- a/hw/block/Kconfig
> +++ b/hw/block/Kconfig
> @@ -37,3 +37,6 @@ config VHOST_USER_BLK
>  # Only PCI devices are provided for now
>  default y if VIRTIO_PCI
>  depends on VIRTIO && VHOST_USER && LINUX
> +
> +config SWIM
> +bool
> diff --git a/hw/block/Makefile.objs b/hw/block/Makefile.objs
> index f5f643f0cc..28c2495a00 100644
> --- a/hw/block/Makefile.objs
> +++ b/hw/block/Makefile.objs
> @@ -8,6 +8,7 @@ common-obj-$(CONFIG_XEN) += xen-block.o
>  common-obj-$(CONFIG_ECC) += ecc.o
>  common-obj-$(CONFIG_ONENAND) += onenand.o
>  common-obj-$(CONFIG_NVME_PCI) += nvme.o
> +common-obj-$(CONFIG_SWIM) += swim.o
>
>  obj-$(CONFIG_SH4) += tc58128.o
>
> diff --git a/hw/block/swim.c b/hw/block/swim.c
> new file mode 100644
> index 00..6e26915238
> --- /dev/null
> +++ b/hw/block/swim.c
> @@ -0,0 +1,421 @@
> +/*
> + * QEMU Macintosh floppy disk controller emulator (SWIM)
> + *
> + * Copyright (c) 2014-2018 Laurent Vivier 
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2.  See
> + * the COPYING file in the top-level directory.
> + *
> + */
> +
> +#include "qemu/osdep.h"
> +#include "qemu/main-loop.h"
> +#include "qapi/error.h"
> +#include "sysemu/block-backend.h"
> +#include "hw/sysbus.h"
> +#include "hw/block/block.h"
> +#include "hw/block/swim.h"
> +#include "hw/qdev-properties.h"
> +
> +/* IWM registers */
> +
> +#define IWM_PH0L0
> +#define IWM_PH0H1
> +#define IWM_PH1L2
> +#define IWM_PH1H3
> +#define IWM_PH2L4
> +#define IWM_PH2H5
> +#define IWM_PH3L6
> +#define IWM_PH3H7
> +#define IWM_MTROFF  8
> +#define IWM_MTRON   9
> +#define IWM_INTDRIVE10
> +#define IWM_EXTDRIVE11
> +#define IWM_Q6L 12
> +#define IWM_Q6H 13
> +#define IWM_Q7L 14
> +#define IWM_Q7H 15
> +
> +/* SWIM registers */
> +
> +#define SWIM_WRITE_DATA 0
> +#define SWIM_WRITE_MARK 1
> +#define SWIM_WRITE_CRC  2
> +#define SWIM_WRITE_PARAMETER3
> +#define SWIM_WRITE_PHASE4
> +#define SWIM_WRITE_SETUP5
> +#define SWIM_WRITE_MODE06
> +#define SWIM_WRITE_MODE17
> +
> +#define SWIM_READ_DATA  8
> +#define SWIM_READ_MARK  9
> +#define SWIM_READ_ERROR 10
> +#define SWIM_READ_PARAMETER 11
> +#define SWIM_READ_PHASE 12
> +#define SWIM_READ_SETUP 13
> +#define SWIM_READ_STATUS14
> +#define SWIM_READ_HANDSHAKE 15
> +
> +#define REG_SHIFT   9
> +
> +#define SWIM_MODE_IWM  0
> +#define SWIM_MODE_SWIM 1
> +
> +/* bits in phase register */
> +
> +#define SWIM_SEEK_NEGATIVE   0x074
> +#define SWIM_STEP0x071
> +#define SWIM_MOTOR_ON0x072
> +#define SWIM_MOTOR_OFF   0x076
> +#define SWIM_INDEX   0x073
> +#define SWIM_EJECT   0x077
> +#define SWIM_SETMFM  0x171
> +#define SWIM_SETGCR  0x175
> +#define SWIM_RELAX   0x033
> +#define SWIM_LSTRB   0x008
> +#define SWIM_CA_MASK 0x077
> +
> +/* Select values for swim_select and swim_readbit */
> +
> +#define SWIM_READ_DATA_0 0x074
> +#define SWIM_TWOMEG_DRIVE0x075
> +#define SWIM_SINGLE_SIDED0x076
> +#define SWIM_DRIVE_PRESENT   0x077
> +#define SWIM_DISK_IN 0x170
> +#define SWIM_WRITE_PROT  0x171
> +#define SWIM_TRACK_ZERO  0x172
> +#define SWIM_TACHO   0x173
> +#define SWIM_READ_DATA_1 0x174
> +#define SWIM_MFM_MODE0x175
> +#define SWIM_SEEK_COMPLETE   0x176
> +#define SWIM_ONEMEG_MEDIA0x177
> +
> +/* Bits in handshake register */
> +
> +#define SWIM_MARK_BYTE   0x01
> +#define SWIM_CRC_ZERO0x02
> +#define SWIM_RDDATA  0x04
> +#define SWIM_SENSE   0x08
> +#define SWIM_MOTEN   0x10
> +#define SWIM_ERROR   0x20
> +#define SWIM_DAT2BYTE0x40
> +#define SWIM_DAT1BYTE0x80
> +
> +/* bit

Re: [Qemu-block] [Qemu-devel] [PATCH v7 10/10] hw/m68k: define Macintosh Quadra 800

2019-05-27 Thread Aleksandar Markovic
On May 27, 2019 3:32 PM, "Aleksandar Markovic" 
wrote:
>
>
> On May 26, 2019 1:07 AM, "Laurent Vivier"  wrote:
> >
> > If you want to test the machine, it doesn't yet boot a MacROM, but you
can
> > boot a linux kernel from the command line.
> >
> > You can install your own disk using debian-installer with:
> >
> > ./qemu-system-m68k \
> > -M q800 \
> > -serial none -serial mon:stdio \
> > -m 1000M -drive file=m68k.qcow2,format=qcow2 \
> > -net nic,model=dp83932,addr=09:00:07:12:34:57 \
> > -append "console=ttyS0 vga=off" \
> > -kernel vmlinux-4.15.0-2-m68k \
> > -initrd initrd.gz \
> > -drive file=debian-9.0-m68k-NETINST-1.iso \
> > -drive file=m68k.qcow2,format=qcow2 \
> > -nographic
> >
>
> Hello Laurent,
>
> How does one obtain vmlinux-4.15.0-2-m68 and init.rd?
>
> Greetings, Aleksandar
>

And the same for Debian iso.

Thanks in advance, Aleksandar

> > If you use a graphic adapter instead of "-nographic", you can use "-g"
to set the
> > size of the display (I use "-g 1600x800x24").
> >
> > Co-developed-by: Mark Cave-Ayland 
> > Signed-off-by: Mark Cave-Ayland 
> > Signed-off-by: Laurent Vivier 
> > ---
> >  MAINTAINERS  |  14 ++
> >  default-configs/m68k-softmmu.mak |   1 +
> >  hw/m68k/Kconfig  |  12 +
> >  hw/m68k/Makefile.objs|   1 +
> >  hw/m68k/bootinfo.h   | 100 +
> >  hw/m68k/q800.c   | 369 +++
> >  6 files changed, 497 insertions(+)
> >  create mode 100644 hw/m68k/bootinfo.h
> >  create mode 100644 hw/m68k/q800.c
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 3cacd751bf..274dfd6e19 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -906,6 +906,20 @@ F: hw/char/mcf_uart.c
> >  F: hw/net/mcf_fec.c
> >  F: include/hw/m68k/mcf*.h
> >
> > +q800
> > +M: Laurent Vivier 
> > +S: Maintained
> > +F: hw/block/swim.c
> > +F: hw/m68k/bootinfo.h
> > +F: hw/display/macfb.c
> > +F: hw/m68k/q800.c
> > +F: hw/misc/mac_via.c
> > +F: hw/nubus/*
> > +F: include/hw/block/swim.h
> > +F: include/hw/display/macfb.h
> > +F: include/hw/misc/mac_via.h
> > +F: include/hw/nubus/*
> > +
> >  MicroBlaze Machines
> >  ---
> >  petalogix_s3adsp1800
> > diff --git a/default-configs/m68k-softmmu.mak
b/default-configs/m68k-softmmu.mak
> > index e17495e2a0..7e3649c1b8 100644
> > --- a/default-configs/m68k-softmmu.mak
> > +++ b/default-configs/m68k-softmmu.mak
> > @@ -4,3 +4,4 @@
> >  #
> >  CONFIG_AN5206=y
> >  CONFIG_MCF5208=y
> > +CONFIG_Q800=y
> > diff --git a/hw/m68k/Kconfig b/hw/m68k/Kconfig
> > index 49ef0b3f6d..ffa8e48fd8 100644
> > --- a/hw/m68k/Kconfig
> > +++ b/hw/m68k/Kconfig
> > @@ -7,3 +7,15 @@ config MCF5208
> >  bool
> >  select COLDFIRE
> >  select PTIMER
> > +
> > +config Q800
> > +bool
> > +select FRAMEBUFFER
> > +select ADB
> > +select MAC_VIA
> > +select ESCC
> > +select ESP
> > +select MACFB
> > +select NUBUS
> > +select DP8393X
> > +select SWIM
> > diff --git a/hw/m68k/Makefile.objs b/hw/m68k/Makefile.objs
> > index 482f8477b4..cfd13fae53 100644
> > --- a/hw/m68k/Makefile.objs
> > +++ b/hw/m68k/Makefile.objs
> > @@ -1,2 +1,3 @@
> >  obj-$(CONFIG_AN5206) += an5206.o mcf5206.o
> >  obj-$(CONFIG_MCF5208) += mcf5208.o mcf_intc.o
> > +obj-$(CONFIG_Q800) += q800.o
> > diff --git a/hw/m68k/bootinfo.h b/hw/m68k/bootinfo.h
> > new file mode 100644
> > index 00..6584775f6d
> > --- /dev/null
> > +++ b/hw/m68k/bootinfo.h
> > @@ -0,0 +1,100 @@
> > +struct bi_record {
> > +uint16_t tag;/* tag ID */
> > +uint16_t size;   /* size of record */
> > +uint32_t data[0];/* data */
> > +};
> > +
> > +/* machine independent tags */
> > +
> > +#define BI_LAST 0x /* last record */
> > +#define BI_MACHTYPE 0x0001 /* machine type (u_long) */
> > +#define BI_CPUTYPE  0x0002 /* cpu type (u_long) */
> > +#define BI_FPUTYPE  0x0003 /* fpu type (u_long) */
> > +#define BI_MMUTYPE  0x0004 /* mmu type (u_long) */
> > +#define BI_MEMCHUNK 0x0005 /* memory chunk address and size */
> > +   /* (struct mem_info) */
> > +#de

Re: [Qemu-block] [Qemu-devel] [PATCH v7 10/10] hw/m68k: define Macintosh Quadra 800

2019-05-27 Thread Aleksandar Markovic
On May 26, 2019 1:07 AM, "Laurent Vivier"  wrote:
>
> If you want to test the machine, it doesn't yet boot a MacROM, but you can
> boot a linux kernel from the command line.
>
> You can install your own disk using debian-installer with:
>
> ./qemu-system-m68k \
> -M q800 \
> -serial none -serial mon:stdio \
> -m 1000M -drive file=m68k.qcow2,format=qcow2 \
> -net nic,model=dp83932,addr=09:00:07:12:34:57 \
> -append "console=ttyS0 vga=off" \
> -kernel vmlinux-4.15.0-2-m68k \
> -initrd initrd.gz \
> -drive file=debian-9.0-m68k-NETINST-1.iso \
> -drive file=m68k.qcow2,format=qcow2 \
> -nographic
>

Hello Laurent,

How does one obtain vmlinux-4.15.0-2-m68 and init.rd?

Greetings, Aleksandar

> If you use a graphic adapter instead of "-nographic", you can use "-g" to
set the
> size of the display (I use "-g 1600x800x24").
>
> Co-developed-by: Mark Cave-Ayland 
> Signed-off-by: Mark Cave-Ayland 
> Signed-off-by: Laurent Vivier 
> ---
>  MAINTAINERS  |  14 ++
>  default-configs/m68k-softmmu.mak |   1 +
>  hw/m68k/Kconfig  |  12 +
>  hw/m68k/Makefile.objs|   1 +
>  hw/m68k/bootinfo.h   | 100 +
>  hw/m68k/q800.c   | 369 +++
>  6 files changed, 497 insertions(+)
>  create mode 100644 hw/m68k/bootinfo.h
>  create mode 100644 hw/m68k/q800.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3cacd751bf..274dfd6e19 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -906,6 +906,20 @@ F: hw/char/mcf_uart.c
>  F: hw/net/mcf_fec.c
>  F: include/hw/m68k/mcf*.h
>
> +q800
> +M: Laurent Vivier 
> +S: Maintained
> +F: hw/block/swim.c
> +F: hw/m68k/bootinfo.h
> +F: hw/display/macfb.c
> +F: hw/m68k/q800.c
> +F: hw/misc/mac_via.c
> +F: hw/nubus/*
> +F: include/hw/block/swim.h
> +F: include/hw/display/macfb.h
> +F: include/hw/misc/mac_via.h
> +F: include/hw/nubus/*
> +
>  MicroBlaze Machines
>  ---
>  petalogix_s3adsp1800
> diff --git a/default-configs/m68k-softmmu.mak
b/default-configs/m68k-softmmu.mak
> index e17495e2a0..7e3649c1b8 100644
> --- a/default-configs/m68k-softmmu.mak
> +++ b/default-configs/m68k-softmmu.mak
> @@ -4,3 +4,4 @@
>  #
>  CONFIG_AN5206=y
>  CONFIG_MCF5208=y
> +CONFIG_Q800=y
> diff --git a/hw/m68k/Kconfig b/hw/m68k/Kconfig
> index 49ef0b3f6d..ffa8e48fd8 100644
> --- a/hw/m68k/Kconfig
> +++ b/hw/m68k/Kconfig
> @@ -7,3 +7,15 @@ config MCF5208
>  bool
>  select COLDFIRE
>  select PTIMER
> +
> +config Q800
> +bool
> +select FRAMEBUFFER
> +select ADB
> +select MAC_VIA
> +select ESCC
> +select ESP
> +select MACFB
> +select NUBUS
> +select DP8393X
> +select SWIM
> diff --git a/hw/m68k/Makefile.objs b/hw/m68k/Makefile.objs
> index 482f8477b4..cfd13fae53 100644
> --- a/hw/m68k/Makefile.objs
> +++ b/hw/m68k/Makefile.objs
> @@ -1,2 +1,3 @@
>  obj-$(CONFIG_AN5206) += an5206.o mcf5206.o
>  obj-$(CONFIG_MCF5208) += mcf5208.o mcf_intc.o
> +obj-$(CONFIG_Q800) += q800.o
> diff --git a/hw/m68k/bootinfo.h b/hw/m68k/bootinfo.h
> new file mode 100644
> index 00..6584775f6d
> --- /dev/null
> +++ b/hw/m68k/bootinfo.h
> @@ -0,0 +1,100 @@
> +struct bi_record {
> +uint16_t tag;/* tag ID */
> +uint16_t size;   /* size of record */
> +uint32_t data[0];/* data */
> +};
> +
> +/* machine independent tags */
> +
> +#define BI_LAST 0x /* last record */
> +#define BI_MACHTYPE 0x0001 /* machine type (u_long) */
> +#define BI_CPUTYPE  0x0002 /* cpu type (u_long) */
> +#define BI_FPUTYPE  0x0003 /* fpu type (u_long) */
> +#define BI_MMUTYPE  0x0004 /* mmu type (u_long) */
> +#define BI_MEMCHUNK 0x0005 /* memory chunk address and size */
> +   /* (struct mem_info) */
> +#define BI_RAMDISK  0x0006 /* ramdisk address and size */
> +   /* (struct mem_info) */
> +#define BI_COMMAND_LINE 0x0007 /* kernel command line parameters */
> +   /* (string) */
> +
> +/*  Macintosh-specific tags (all u_long) */
> +
> +#define BI_MAC_MODEL0x8000  /* Mac Gestalt ID (model type) */
> +#define BI_MAC_VADDR0x8001  /* Mac video base address */
> +#define BI_MAC_VDEPTH   0x8002  /* Mac video depth */
> +#define BI_MAC_VROW 0x8003  /* Mac video rowbytes */
> +#define BI_MAC_VDIM 0x8004  /* Mac video dimensions */
> +#define BI_MAC_VLOGICAL 0x8005  /* Mac video logical base */
> +#define BI_MAC_SCCBASE  0x8006  /* Mac SCC base address */
> +#define BI_MAC_BTIME0x8007  /* Mac boot time */
> +#define BI_MAC_GMTBIAS  0x8008  /* Mac GMT timezone offset */
> +#define BI_MAC_MEMSIZE  0x8009  /* Mac RAM size (sanity check) */
> +#define BI_MAC_CPUID0x800a  /* Mac CPU type (sanity check) */
> +#define BI_MAC_ROMBASE  0x800b  /* Mac system ROM base address */
> +
> +/*  Macintosh hardware profile data */
> +
> +#define BI_MAC_VIA1BASE 0x8010  /* Mac VIA1 base address (always
presen