OSDN Git Service

qmiga/qemu.git
3 years agoscripts: kernel-doc: make it more compatible with Sphinx 3.x
Mauro Carvalho Chehab [Tue, 17 Nov 2020 16:52:59 +0000 (17:52 +0100)]
scripts: kernel-doc: make it more compatible with Sphinx 3.x

With Sphinx 3.x, the ".. c:type:" tag was changed to accept either:

.. c:type:: typedef-like declaration
.. c:type:: name

Using it for other types (including functions) don't work anymore.

So, there are newer tags for macro, enum, struct, union, and others,
which doesn't exist on older versions.

Add a check for the Sphinx version and change the produced tags
accordingly.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-17-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoRevert "kernel-doc: Use c:struct for Sphinx 3.0 and later"
Paolo Bonzini [Tue, 17 Nov 2020 16:52:58 +0000 (17:52 +0100)]
Revert "kernel-doc: Use c:struct for Sphinx 3.0 and later"

This reverts commit 152d1967f650f67b7ece3a5dda77d48069d72647.
We will replace the commit with the fix from Linux.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-16-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoRevert "scripts/kerneldoc: For Sphinx 3 use c:macro for macros with arguments"
Paolo Bonzini [Tue, 17 Nov 2020 16:52:57 +0000 (17:52 +0100)]
Revert "scripts/kerneldoc: For Sphinx 3 use c:macro for macros with arguments"

This reverts commit 92bb29f9b2c3d4a98eef5f0db935d4be291eec72.
We will replace the commit with the fix from Linux.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-15-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoscripts: kernel-doc: add support for typedef enum
Mauro Carvalho Chehab [Tue, 17 Nov 2020 16:52:56 +0000 (17:52 +0100)]
scripts: kernel-doc: add support for typedef enum

The PHY kernel-doc markup has gained support for documenting
a typedef enum.

However, right now the parser was not prepared for it.

So, add support for parsing it.

Fixes: 4069a572d423 ("net: phy: Document core PHY structures")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-14-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agokernel-doc: add support for ____cacheline_aligned attribute
Jonathan Cameron [Tue, 17 Nov 2020 16:52:55 +0000 (17:52 +0100)]
kernel-doc: add support for ____cacheline_aligned attribute

Subroutine dump_struct uses type attributes to check if the struct
syntax is valid. Then, it removes all attributes before using it for
output. `____cacheline_aligned` is an attribute that is
not included in both steps. Add it, since it is used by kernel structs.

Based on previous patch to add ____cacheline_aligned_in_smp.
Motivated by patches to reorder this attribute to before the
variable name.   Whilst we could do that in all cases, that would
be a massive change and it is more common in the kernel to place
this particular attribute after the variable name. A quick grep
suggests approximately 400 instances of which 341 have this
attribute just before a semicolon and hence after the variable name.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200910185415.653139-1-jic23@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-13-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agokernel-doc: include line numbers for function prototypes
Mauro Carvalho Chehab [Tue, 17 Nov 2020 16:52:54 +0000 (17:52 +0100)]
kernel-doc: include line numbers for function prototypes

This should solve bad error reports like this one:

./include/linux/iio/iio.h:0: WARNING: Unknown target name: "devm".

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/56eed0ba50cd726236acd12b11b55ce54854c5ea.1599660067.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-12-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoscripts/kernel-doc: optionally treat warnings as errors
Pierre-Louis Bossart [Tue, 17 Nov 2020 16:52:53 +0000 (17:52 +0100)]
scripts/kernel-doc: optionally treat warnings as errors

The kbuild bot recently added the W=1 option, which triggered
documentation cleanups to squelch hundreds of kernel-doc warnings.

To make sure new kernel contributions don't add regressions to
kernel-doc descriptors, this patch suggests an option to treat
warnings as errors in CI/automated tests.

A -Werror command-line option is added to the kernel-doc script. When
this option is set, the script will return the number of warnings
found. The caller can then treat this positive return value as an
error and stop the build.

Using this command line option is however not straightforward when the
kernel-doc script is called from other scripts. To align with typical
kernel compilation or documentation generation, the Werror option is
also set by checking the KCFLAGS environment variable, or if
KDOC_WERROR is defined, as in the following examples:

KCFLAGS="-Wall -Werror" make W=1 sound/
KCFLAGS="-Wall -Werror" make W=1 drivers/soundwire/
KDOC_WERROR=1 make htmldocs

Note that in the last example the documentation build does not stop,
only an additional log is provided.

Credits to Randy Dunlap for suggesting the use of environment variables.

Suggested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200728162040.92467-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-11-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoscripts/kernel-doc: handle function pointer prototypes
Mauro Carvalho Chehab [Tue, 17 Nov 2020 16:52:52 +0000 (17:52 +0100)]
scripts/kernel-doc: handle function pointer prototypes

There are some function pointer prototypes inside the net
includes, like this one:

int (*pcs_config)(struct phylink_config *config, unsigned int mode,
  phy_interface_t interface, const unsigned long *advertising);

There's nothing wrong using it with kernel-doc, but we need to
add a rule for it to parse such kind of prototype.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/fec520dd731a273013ae06b7653a19c7d15b9562.1592895969.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-10-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoscripts/kernel-doc: parse __ETHTOOL_DECLARE_LINK_MODE_MASK
Mauro Carvalho Chehab [Tue, 17 Nov 2020 16:52:51 +0000 (17:52 +0100)]
scripts/kernel-doc: parse __ETHTOOL_DECLARE_LINK_MODE_MASK

The __ETHTOOL_DECLARE_LINK_MODE_MASK macro is a variant of
DECLARE_BITMAP(), used by phylink.h. As we have already a
parser for DECLARE_BITMAP(), let's add one for this macro,
in order to avoid such warnings:

./include/linux/phylink.h:54: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising' not described in 'phylink_link_state'
./include/linux/phylink.h:54: warning: Function parameter or member '__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising' not described in 'phylink_link_state'

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/d1d1dea67a28117c0b0c33271b139c4455fef287.1592895969.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-9-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoReplace HTTP links with HTTPS ones: documentation
Alexander A. Klimov [Tue, 17 Nov 2020 16:52:50 +0000 (17:52 +0100)]
Replace HTTP links with HTTPS ones: documentation

Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
  For each line:
    If doesn't contain `\bxmlns\b`:
      For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
        If both the HTTP and HTTPS versions
        return 200 OK and serve the same content:
          Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Link: https://lore.kernel.org/r/20200526060544.25127-1-grandmaster@al2klimov.de
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-8-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoscripts: kernel-doc: accept blank lines on parameter description
Mauro Carvalho Chehab [Tue, 17 Nov 2020 16:52:49 +0000 (17:52 +0100)]
scripts: kernel-doc: accept blank lines on parameter description

Sphinx is very pedantic with respect to blank lines. Sometimes,
in order to make it to properly handle something, we need to
add a blank line. However, currently, any blank line inside a
kernel-doc comment like:

/*
 * @foo: bar
         *
 *       foobar
 *
 * some description

will be considered as if "foobar" was part of the description.

This patch changes kernel-doc behavior. After it, foobar will
be considered as part of the parameter text. The description
will only be considered as such if it starts with:

zero spaces after asterisk:

*foo

one space after asterisk:
* foo

or have a explicit Description section:

*   Description:

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/c07d2862792d75a2691d69c9eceb7b89a0164cc0.1586881715.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-7-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoscripts: kernel-doc: accept negation like !@var
Mauro Carvalho Chehab [Tue, 17 Nov 2020 16:52:48 +0000 (17:52 +0100)]
scripts: kernel-doc: accept negation like !@var

On a few places, it sometimes need to indicate a negation of a
parameter, like:

!@fshared

This pattern happens, for example, at:

kernel/futex.c

and it is perfectly valid. However, kernel-doc currently
transforms it into:

!**fshared**

This won't do what it would be expected.

Fortunately, fixing the script is a simple matter of storing
the "!" before "@" and adding it after the bold markup, like:

**!fshared**

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/0314b47f8c3e1f9db00d5375a73dc3cddd8a21f2.1586881715.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-6-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoscripts: kernel-doc: proper handle @foo->bar()
Mauro Carvalho Chehab [Tue, 17 Nov 2020 16:52:47 +0000 (17:52 +0100)]
scripts: kernel-doc: proper handle @foo->bar()

The pattern @foo->bar() is valid, as it can be used by a
function pointer inside a struct passed as a parameter.

Right now, it causes a warning:

./drivers/firewire/core-transaction.c:606: WARNING: Inline strong start-string without end-string.

In this specific case, the kernel-doc markup is:

/**
 * fw_core_remove_address_handler() - unregister an address handler
 * @handler: callback
 *
 * To be called in process context.
 *
 * When fw_core_remove_address_handler() returns, @handler->callback() is
 * guaranteed to not run on any CPU anymore.
 */

With seems valid on my eyes. So, instead of trying to hack
the kernel-doc markup, let's teach it about how to handle
such things. This should likely remove lots of other similar
warnings as well.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/48b46426d7bf6ff7529f20e5718fbf4e9758e62c.1586881715.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-5-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoscripts/kernel-doc: Add support for named variable macro arguments
Jonathan Neuschäfer [Tue, 17 Nov 2020 16:52:46 +0000 (17:52 +0100)]
scripts/kernel-doc: Add support for named variable macro arguments

Currently, when kernel-doc encounters a macro with a named variable
argument[1], such as this:

   #define hlist_for_each_entry_rcu(pos, head, member, cond...)

... it expects the variable argument to be documented as `cond...`,
rather than `cond`. This is semantically wrong, because the name (as
used in the macro body) is actually `cond`.

With this patch, kernel-doc will accept the name without dots (`cond`
in the example above) in doc comments, and warn if the name with dots
(`cond...`) is used and verbose mode[2] is enabled.

The support for the `cond...` syntax can be removed later, when the
documentation of all such macros has been switched to the new syntax.

Testing this patch on top of v5.4-rc6, `make htmldocs` shows a few
changes in log output and HTML output:

 1) The following warnings[3] are eliminated:

   ./include/linux/rculist.h:374: warning:
        Excess function parameter 'cond' description in 'list_for_each_entry_rcu'
   ./include/linux/rculist.h:651: warning:
        Excess function parameter 'cond' description in 'hlist_for_each_entry_rcu'

 2) For list_for_each_entry_rcu and hlist_for_each_entry_rcu, the
    correct description is shown

 3) Named variable arguments are shown without dots

[1]: https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
[2]: scripts/kernel-doc -v
[3]: See also https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/commit/?h=dev&id=5bc4bc0d6153617eabde275285b7b5a8137fdf3c

Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-4-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agokernel-doc: add support for ____cacheline_aligned_in_smp attribute
André Almeida [Tue, 17 Nov 2020 16:52:45 +0000 (17:52 +0100)]
kernel-doc: add support for ____cacheline_aligned_in_smp attribute

Subroutine dump_struct uses type attributes to check if the struct
syntax is valid. Then, it removes all attributes before using it for
output. `____cacheline_aligned_in_smp` is an attribute that is
not included in both steps. Add it, since it is used by kernel structs.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-3-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agokernel-doc: fix processing nested structs with attributes
André Almeida [Tue, 17 Nov 2020 16:52:44 +0000 (17:52 +0100)]
kernel-doc: fix processing nested structs with attributes

The current regular expression for strip attributes of structs (and
for nested ones as well) also removes all whitespaces that may
surround the attribute. After that, the code will split structs and
iterate for each symbol separated by comma at the end of struct
definition (e.g. "} alias1, alias2;"). However, if the nested struct
does not have any alias and has an attribute, it will result in a
empty string at the closing bracket (e.g "};"). This will make the
split return nothing and $newmember will keep uninitialized. Fix
that, by ensuring that the attribute substitution will leave at least
one whitespace.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-2-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodocs: temporarily disable the kernel-doc extension
Paolo Bonzini [Mon, 30 Nov 2020 12:16:11 +0000 (07:16 -0500)]
docs: temporarily disable the kernel-doc extension

Preserve bisectability while we update scripts/kernel-doc from Linux.
Without this patch, building with Sphinx 3 would break while we
revert our own Sphinx 3 support and replace it with Linux's.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoconfig-file: move -set implementation to vl.c
Paolo Bonzini [Thu, 12 Nov 2020 13:16:22 +0000 (08:16 -0500)]
config-file: move -set implementation to vl.c

We want to make it independent of QemuOpts.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: clean up -boot variables
Paolo Bonzini [Fri, 13 Nov 2020 07:41:38 +0000 (02:41 -0500)]
vl: clean up -boot variables

Move more of them into MachineState, in preparation for moving initialization
of the machine out of vl.c.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: remove serial_max_hds
Paolo Bonzini [Tue, 3 Nov 2020 08:26:05 +0000 (03:26 -0500)]
vl: remove serial_max_hds

serial_hd(i) is NULL if and only if i >= serial_max_hds().  Test
serial_hd(i) instead of bounding the loop at serial_max_hds(),
thus removing one more function that vl.c is expected to export.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: extract softmmu/rtc.c
Paolo Bonzini [Wed, 28 Oct 2020 11:36:57 +0000 (07:36 -0400)]
vl: extract softmmu/rtc.c

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: extract machine done notifiers
Paolo Bonzini [Wed, 28 Oct 2020 11:36:57 +0000 (07:36 -0400)]
vl: extract machine done notifiers

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: extract softmmu/datadir.c
Paolo Bonzini [Wed, 28 Oct 2020 11:36:57 +0000 (07:36 -0400)]
vl: extract softmmu/datadir.c

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohmp: introduce cmd_available
Paolo Bonzini [Tue, 27 Oct 2020 08:40:02 +0000 (04:40 -0400)]
hmp: introduce cmd_available

Combine the RUN_STATE_PRECONFIG and cmd_can_preconfig checks
into a single function, to avoid repeating the same expression
(or its negation after applying DeMorgan's rule) over and
over again.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: start VM via qmp_cont
Paolo Bonzini [Tue, 27 Oct 2020 12:42:04 +0000 (08:42 -0400)]
vl: start VM via qmp_cont

Complement the previous patch by starting the VM with a QMP command.
The plan is that the user will be able to do the same, invoking two
commands "finish-machine-init" and "cont" instead of
"x-exit-preconfig".

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomigration, vl: start migration via qmp_migrate_incoming
Paolo Bonzini [Tue, 27 Oct 2020 08:22:57 +0000 (04:22 -0400)]
migration, vl: start migration via qmp_migrate_incoming

Make qemu_start_incoming_migration local to migration/migration.c.
By using the runstate instead of a separate flag, vl need not do
anything to setup deferred incoming migration.

qmp_migrate_incoming also does not need the deferred_incoming flag
anymore, because "-incoming PROTOCOL" will clear the "once" flag
before the main loop starts.  Therefore, later invocations of
the migrate-incoming command will fail with the existing
"The incoming migration has already been started" error message.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: move -global check earlier
Paolo Bonzini [Tue, 27 Oct 2020 08:26:14 +0000 (04:26 -0400)]
vl: move -global check earlier

The check has the same effect here, it only matters that it is performed
once all devices, both builtin and user-specified, have been created.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: initialize displays before preconfig loop
Paolo Bonzini [Tue, 27 Oct 2020 08:07:30 +0000 (04:07 -0400)]
vl: initialize displays before preconfig loop

Displays should be available before the monitor starts, so that
it is possible to use the graphical console to interact with
the monitor itself.

This patch is quite ugly, but all this is temporary.  The double
call to qemu_init_displays will go away as soon we can unify machine
initialization between the preconfig and "normal" flows, and so will
the preconfig_exit_requested variable (that is only preconfig_requested
remains).

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: separate qemu_resolve_machine_memdev
Paolo Bonzini [Tue, 27 Oct 2020 15:16:18 +0000 (11:16 -0400)]
vl: separate qemu_resolve_machine_memdev

This is a bit nasty: the machine is storing a string and later
resolving it.  We probably want to remove the memdev property
and instead make this a memory-set command.  "-M memdev" can be
handled a legacy option that is special cased by
machine_set_property.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: separate qemu_apply_machine_options
Paolo Bonzini [Tue, 27 Oct 2020 15:08:04 +0000 (11:08 -0400)]
vl: separate qemu_apply_machine_options

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: separate qemu_create_machine
Paolo Bonzini [Tue, 27 Oct 2020 15:04:37 +0000 (11:04 -0400)]
vl: separate qemu_create_machine

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: separate qemu_create_late_backends
Paolo Bonzini [Tue, 27 Oct 2020 13:36:52 +0000 (09:36 -0400)]
vl: separate qemu_create_late_backends

"Late" backends are created after the machine.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: separate qemu_create_early_backends
Paolo Bonzini [Wed, 21 Oct 2020 14:41:18 +0000 (10:41 -0400)]
vl: separate qemu_create_early_backends

"Early" backends are created before the machine and can be used as
machine options.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: move CHECKPOINT_INIT after preconfig
Paolo Bonzini [Wed, 21 Oct 2020 11:19:34 +0000 (07:19 -0400)]
vl: move CHECKPOINT_INIT after preconfig

Move CHECKPOINT_INIT right before the machine initialization is
completed.  Everything before is essentially an extension of
command line parsing.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: extract default devices to separate functions
Paolo Bonzini [Wed, 21 Oct 2020 10:22:39 +0000 (06:22 -0400)]
vl: extract default devices to separate functions

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: load plugins as late as possible
Paolo Bonzini [Wed, 21 Oct 2020 14:25:06 +0000 (10:25 -0400)]
vl: load plugins as late as possible

There is no need to load plugins in the middle of default device processing,
move -plugin handling just before preconfig is entered.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: create "-net nic -net user" default earlier
Paolo Bonzini [Wed, 21 Oct 2020 10:01:30 +0000 (06:01 -0400)]
vl: create "-net nic -net user" default earlier

Create it together with other default backends, even though the processing is
done later.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoqemu-option: restrict qemu_opts_set to merge-lists QemuOpts
Paolo Bonzini [Mon, 9 Nov 2020 09:46:30 +0000 (04:46 -0500)]
qemu-option: restrict qemu_opts_set to merge-lists QemuOpts

qemu_opts_set is used to create default network backends and to
parse sugar options -kernel, -initrd, -append, -bios and -dtb.
These are very different uses:

I would *expect* a function named qemu_opts_set to set an option in a
merge-lists QemuOptsList, such as -kernel, and possibly to set an option
in a non-merge-lists QemuOptsList with non-NULL id, similar to -set.

However, it wouldn't *work* to use qemu_opts_set for the latter
because qemu_opts_set uses fail_if_exists==1. So, for non-merge-lists
QemuOptsList and non-NULL id, the semantics of qemu_opts_set (fail if the
(QemuOptsList, id) pair already exists) are debatable.

On the other hand, I would not expect qemu_opts_set to create a
non-merge-lists QemuOpts with a single option; which it does, though.
For this case of non-merge-lists QemuOptsList and NULL id, qemu_opts_set
hardly adds value over qemu_opts_parse.  It does skip some parsing and
unescaping, but that's not needed when creating default network
backends.

So qemu_opts_set has warty behavior for non-merge-lists QemuOptsList
if id is non-NULL, and it's mostly pointless if id is NULL.  My
solution to keeping the API as simple as possible is to limit
qemu_opts_set to merge-lists QemuOptsList.  For them, it's useful (we
don't want comma-unescaping for -kernel) *and* has sane semantics.
Network backend creation is switched to qemu_opts_parse.

qemu_opts_set is now only used on merge-lists QemuOptsList... except
in the testcase, which is changed to use a merge-list QemuOptsList.

With this change we can also remove the id parameter.  With the
parameter always NULL, we know that qemu_opts_create cannot fail
and can pass &error_abort to it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: extract various command line desugaring snippets to a new function
Paolo Bonzini [Wed, 21 Oct 2020 14:21:22 +0000 (10:21 -0400)]
vl: extract various command line desugaring snippets to a new function

Keep the machine initialization sequence free of miscellaneous command
line parsing actions.

The only difference is that preallocation will always be done with one
thread if -smp is not provided; previously it was using mc->default_cpus,
which is almost always 1 anyway.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: preconfig and loadvm are mutually exclusive
Paolo Bonzini [Wed, 21 Oct 2020 14:19:08 +0000 (10:19 -0400)]
vl: preconfig and loadvm are mutually exclusive

Just like -incoming.  Later we will add support for "-incoming defer
-preconfig", because there are cases (Xen, block layer) that want
to look at RUNSTATE_INMIGRATE.  -loadvm will remain mutually exclusive
with preconfig; the plan is to just do loadvm in the monitor, since
the user is already going to interact with it for preconfiguration.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: extract various command line validation snippets to a new function
Paolo Bonzini [Tue, 3 Nov 2020 08:45:26 +0000 (03:45 -0500)]
vl: extract various command line validation snippets to a new function

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: move prelaunch part of qemu_init to new functions
Paolo Bonzini [Fri, 23 Oct 2020 12:04:29 +0000 (08:04 -0400)]
vl: move prelaunch part of qemu_init to new functions

The final part of qemu_init, starting with the completion of
board init, is already relatively clean.  Split it out of
qemu_init so that qemu_init keeps only the messy parts.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: extract qemu_init_subsystems
Paolo Bonzini [Wed, 21 Oct 2020 09:33:40 +0000 (05:33 -0400)]
vl: extract qemu_init_subsystems

Group a bunch of subsystem initializations that can be done right
after command line parsing.  Remove initializations that can be done
simply as global variable initializers.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: move various initialization routines out of qemu_init
Paolo Bonzini [Wed, 21 Oct 2020 09:25:58 +0000 (05:25 -0400)]
vl: move various initialization routines out of qemu_init

Some very simple initialization routines can be nested in existing
subsystem-level functions, do that to simplify qemu_init.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: split various early command line options to a separate function
Paolo Bonzini [Wed, 21 Oct 2020 09:17:39 +0000 (05:17 -0400)]
vl: split various early command line options to a separate function

Various options affect the global state of QEMU including the rest of
qemu_init, and they need to be called very early.  Group them together
in a function that is called at the beginning.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: remove bogus check
Paolo Bonzini [Wed, 21 Oct 2020 10:07:55 +0000 (06:07 -0400)]
vl: remove bogus check

There is no reason to prevent -preconfig -daemonize.  Of course if
no monitor is defined there will be no way to start the VM,
but that is a user error.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: extract validation of -smp to machine.c
Paolo Bonzini [Wed, 21 Oct 2020 10:49:31 +0000 (06:49 -0400)]
vl: extract validation of -smp to machine.c

Once smp_parse is done, the validation operates on the MachineState.
There is no reason for that code to be in vl.c.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Tested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agotreewide: do not use short-form boolean options
Paolo Bonzini [Fri, 13 Nov 2020 08:10:52 +0000 (03:10 -0500)]
treewide: do not use short-form boolean options

They are going to be deprecated, avoid warnings on stdout while the
tests run.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohw/char/serial: Clean up unnecessary code
Philippe Mathieu-Daudé [Fri, 20 Nov 2020 16:19:33 +0000 (17:19 +0100)]
hw/char/serial: Clean up unnecessary code

Since commit 5ec3a23e6c8 ("serial: convert PIO to new memory
api read/write") we don't need to worry about accesses bigger
than 8-bit. Use the extract()/deposit() functions to access
the correct part of the 16-bit 'divider' register.

Reported-by: Jonathan D. Belanger <jbelanger1@rochester.rr.com>
Buglink: https://bugs.launchpad.net/qemu/+bug/1904331
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201120161933.2514089-1-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomake ram_size local to vl.c
Paolo Bonzini [Wed, 28 Oct 2020 10:24:22 +0000 (06:24 -0400)]
make ram_size local to vl.c

Use the machine properties for the leftovers too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agosparc64: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:14:33 +0000 (06:14 -0400)]
sparc64: do not use ram_size global

Use the machine properties instead.

Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agos390x: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:17:07 +0000 (06:17 -0400)]
s390x: do not use ram_size global

Use the machine properties instead.

Cc: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoriscv: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:16:22 +0000 (06:16 -0400)]
riscv: do not use ram_size global

Use the machine properties instead.

Cc: Alistair Francis <Alistair.Francis@wdc.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoppc: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:17:31 +0000 (06:17 -0400)]
ppc: do not use ram_size global

Use the machine properties instead.

Cc: qemu-ppc@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agonios2: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:25:06 +0000 (06:25 -0400)]
nios2: do not use ram_size global

Use the equivalent argument to the function instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomoxie: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:21:08 +0000 (06:21 -0400)]
moxie: do not use ram_size global

Use the loader parameters instead.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomips: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:20:52 +0000 (06:20 -0400)]
mips: do not use ram_size global

Use the machine properties or loader parameters instead.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomicroblaze: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:20:01 +0000 (06:20 -0400)]
microblaze: do not use ram_size global

Use the equivalent argument to the function instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agom68k: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:15:40 +0000 (06:15 -0400)]
m68k: do not use ram_size global

Use the machine properties instead.

Cc: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoi386: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:22:23 +0000 (06:22 -0400)]
i386: do not use ram_size global

Use the loader parameters instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohppa: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:19:23 +0000 (06:19 -0400)]
hppa: do not use ram_size global

Use the machine properties instead.

Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agocris: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:19:42 +0000 (06:19 -0400)]
cris: do not use ram_size global

Use the machine properties instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoarm: do not use ram_size global
Paolo Bonzini [Wed, 28 Oct 2020 10:18:20 +0000 (06:18 -0400)]
arm: do not use ram_size global

Use the machine properties instead.

Cc: qemu-ppc@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agovl: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:28 +0000 (10:30 -0400)]
vl: remove bios_name

bios_name was a legacy variable used by machine code, but it is
no more.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-16-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodigic: remove bios_name
Paolo Bonzini [Thu, 22 Oct 2020 14:50:02 +0000 (10:50 -0400)]
digic: remove bios_name

Pull defaults to digic4_board_init so that a MachineState is available.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agosparc: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:27 +0000 (10:30 -0400)]
sparc: remove bios_name

Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201026143028.3034018-15-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agosh4: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:26 +0000 (10:30 -0400)]
sh4: remove bios_name

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201026143028.3034018-14-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agos390: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:25 +0000 (10:30 -0400)]
s390: remove bios_name

Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201026143028.3034018-13-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agorx: move BIOS load from MCU to board
Paolo Bonzini [Thu, 22 Oct 2020 15:12:46 +0000 (11:12 -0400)]
rx: move BIOS load from MCU to board

The ROM loader state is global and not part of the MCU, and the
BIOS is in machine->firmware.  So just like the kernel case,
load it in the board.

Due to the ordering between CPU reset and ROM reset, the ROM
has to be registered before the CPU is realized, otherwise
the reset vector is loaded before the ROM is there.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoppc: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:23 +0000 (10:30 -0400)]
ppc: remove bios_name

Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-11-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomoxie: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:22 +0000 (10:30 -0400)]
moxie: remove bios_name

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-10-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agomips: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:21 +0000 (10:30 -0400)]
mips: remove bios_name

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-9-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agom68k: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:20 +0000 (10:30 -0400)]
m68k: remove bios_name

Cc: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201026143028.3034018-8-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agolm32: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:19 +0000 (10:30 -0400)]
lm32: remove bios_name

Cc: Michael Walle <michael@walle.cc>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-7-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoi386: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:18 +0000 (10:30 -0400)]
i386: remove bios_name

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-6-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohppa: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:17 +0000 (10:30 -0400)]
hppa: remove bios_name

Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201026143028.3034018-5-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoarm: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:16 +0000 (10:30 -0400)]
arm: remove bios_name

Get the firmware name from the MachineState object.

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201026143028.3034018-4-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoalpha: remove bios_name
Paolo Bonzini [Mon, 26 Oct 2020 14:30:14 +0000 (10:30 -0400)]
alpha: remove bios_name

Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201026143028.3034018-2-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohw/net/xilinx_axienet: Rename StreamSlave as StreamSink
Philippe Mathieu-Daudé [Thu, 10 Sep 2020 07:01:29 +0000 (09:01 +0200)]
hw/net/xilinx_axienet: Rename StreamSlave as StreamSink

In order to use inclusive terminology, rename 'slave stream'
as 'sink stream'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-Id: <20200910070131.435543-5-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohw/dma/xilinx_axidma: Rename StreamSlave as StreamSink
Philippe Mathieu-Daudé [Thu, 10 Sep 2020 07:01:28 +0000 (09:01 +0200)]
hw/dma/xilinx_axidma: Rename StreamSlave as StreamSink

In order to use inclusive terminology, rename 'slave stream'
as 'sink stream'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-Id: <20200910070131.435543-4-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohw/core/stream: Rename StreamSlave as StreamSink
Philippe Mathieu-Daudé [Thu, 10 Sep 2020 07:01:27 +0000 (09:01 +0200)]
hw/core/stream: Rename StreamSlave as StreamSink

In order to use inclusive terminology, rename 'slave stream'
as 'sink stream'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-Id: <20200910070131.435543-3-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohw/ssi: Rename SSI 'slave' as 'peripheral'
Philippe Mathieu-Daudé [Mon, 12 Oct 2020 12:49:55 +0000 (14:49 +0200)]
hw/ssi: Rename SSI 'slave' as 'peripheral'

In order to use inclusive terminology, rename SSI 'slave' as
'peripheral', following the specification resolution:
https://www.oshwa.org/a-resolution-to-redefine-spi-signal-names/

Patch created mechanically using:

  $ sed -i s/SSISlave/SSIPeripheral/ $(git grep -l SSISlave)
  $ sed -i s/SSI_SLAVE/SSI_PERIPHERAL/ $(git grep -l SSI_SLAVE)
  $ sed -i s/ssi-slave/ssi-peripheral/ $(git grep -l ssi-slave)
  $ sed -i s/ssi_slave/ssi_peripheral/ $(git grep -l ssi_slave)
  $ sed -i s/ssi_create_slave/ssi_create_peripheral/ \
                                $(git grep -l ssi_create_slave)

Then in VMStateDescription vmstate_ssi_peripheral we restored
the "SSISlave" migration stream name (to avoid breaking migration).

Finally the following files have been manually tweaked:
 - hw/ssi/pl022.c
 - hw/ssi/xilinx_spips.c

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201012124955.3409127-4-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohw/ssi: Update coding style to make checkpatch.pl happy
Philippe Mathieu-Daudé [Mon, 12 Oct 2020 12:49:54 +0000 (14:49 +0200)]
hw/ssi: Update coding style to make checkpatch.pl happy

To make the next commit easier to review, clean this code first.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201012124955.3409127-3-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agohw/ssi/aspeed_smc: Rename 'max_slaves' variable as 'max_peripherals'
Philippe Mathieu-Daudé [Mon, 12 Oct 2020 12:49:53 +0000 (14:49 +0200)]
hw/ssi/aspeed_smc: Rename 'max_slaves' variable as 'max_peripherals'

In order to use inclusive terminology, rename max_slaves
as max_peripherals.

Patch generated using:

  $ sed -i s/slave/peripheral/ \
        hw/ssi/aspeed_smc.c include/hw/ssi/aspeed_smc.h

One line in aspeed_smc_read() has been manually tweaked
to pass checkpatch.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201012124955.3409127-2-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agopci: Let pci_dma_write() propagate MemTxResult
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:23 +0000 (17:19 +0200)]
pci: Let pci_dma_write() propagate MemTxResult

pci_dma_rw() returns a MemTxResult type.
Do not discard it, return it to the caller.

Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-11-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agopci: Let pci_dma_read() propagate MemTxResult
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:22 +0000 (17:19 +0200)]
pci: Let pci_dma_read() propagate MemTxResult

pci_dma_rw() returns a MemTxResult type.
Do not discard it, return it to the caller.

Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-10-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agopci: Let pci_dma_rw() propagate MemTxResult
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:21 +0000 (17:19 +0200)]
pci: Let pci_dma_rw() propagate MemTxResult

dma_memory_rw() returns a MemTxResult type.
Do not discard it, return it to the caller.

Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-9-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodma: Let dma_memory_write() propagate MemTxResult
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:20 +0000 (17:19 +0200)]
dma: Let dma_memory_write() propagate MemTxResult

dma_memory_rw_relaxed() returns a MemTxResult type.
Do not discard it, return it to the caller.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-8-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodma: Let dma_memory_read() propagate MemTxResult
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:19 +0000 (17:19 +0200)]
dma: Let dma_memory_read() propagate MemTxResult

dma_memory_rw_relaxed() returns a MemTxResult type.
Do not discard it, return it to the caller.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-7-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodma: Let dma_memory_rw() propagate MemTxResult
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:18 +0000 (17:19 +0200)]
dma: Let dma_memory_rw() propagate MemTxResult

address_space_rw() returns a MemTxResult type.
Do not discard it, return it to the caller.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-6-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodma: Let dma_memory_set() propagate MemTxResult
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:17 +0000 (17:19 +0200)]
dma: Let dma_memory_set() propagate MemTxResult

address_space_write() returns a MemTxResult type.
Do not discard it, return it to the caller.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-5-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodma: Document address_space_map/address_space_unmap() prototypes
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:16 +0000 (17:19 +0200)]
dma: Document address_space_map/address_space_unmap() prototypes

Add documentation based on address_space_map / address_space_unmap.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-4-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoqom: eliminate identical functions
Paolo Bonzini [Tue, 27 Oct 2020 16:12:57 +0000 (12:12 -0400)]
qom: eliminate identical functions

Most property release functions in qom/object.c only free the opaque
value.  Combine all of them into a single function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agodocs/devel/loads-stores: Add regexp for DMA functions
Philippe Mathieu-Daudé [Fri, 23 Oct 2020 15:19:15 +0000 (17:19 +0200)]
docs/devel/loads-stores: Add regexp for DMA functions

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201023151923.3243652-3-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoWHPX: support for the kernel-irqchip on/off
Sunil Muthuswamy [Wed, 28 Oct 2020 02:23:19 +0000 (02:23 +0000)]
WHPX: support for the kernel-irqchip on/off

This patch adds support the kernel-irqchip option for
WHPX with on or off value. 'split' value is not supported
for the option. The option only works for the latest version
of Windows (ones that are coming out on Insiders). The
change maintains backward compatibility on older version of
Windows where this option is not supported.

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Message-Id: <SN4PR2101MB0880B13258DA9251F8459F4DC0170@SN4PR2101MB0880.namprd21.prod.outlook.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agotarget/i386: seg_helper: Correct segment selector nullification in the RET/IRET helper
Bin Meng [Fri, 13 Nov 2020 09:56:18 +0000 (17:56 +0800)]
target/i386: seg_helper: Correct segment selector nullification in the RET/IRET helper

Per the SDM, when returning to outer privilege level, for segment
registers (ES, FS, GS, and DS) if the check fails, the segment
selector becomes null, but QEMU clears the base/limit/flags as well
as nullifying the segment selector, which should be a spec violation.

Real hardware seems to be compliant with the spec, at least on one
Coffee Lake board I tested.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <1605261378-77971-1-git-send-email-bmeng.cn@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agotarget/i386: Support up to 32768 CPUs without IRQ remapping
David Woodhouse [Mon, 5 Oct 2020 14:18:19 +0000 (15:18 +0100)]
target/i386: Support up to 32768 CPUs without IRQ remapping

The IOAPIC has an 'Extended Destination ID' field in its RTE, which maps
to bits 11-4 of the MSI address. Since those address bits fall within a
given 4KiB page they were historically non-trivial to use on real hardware.

The Intel IOMMU uses the lowest bit to indicate a remappable format MSI,
and then the remaining 7 bits are part of the index.

Where the remappable format bit isn't set, we can actually use the other
seven to allow external (IOAPIC and MSI) interrupts to reach up to 32768
CPUs instead of just the 255 permitted on bare metal.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Message-Id: <78097f9218300e63e751e077a0a5ca029b56ba46.camel@infradead.org>
[Fix UBSAN warning. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agotarget/i386: fix operand order for PDEP and PEXT
Paolo Bonzini [Mon, 23 Nov 2020 12:17:47 +0000 (07:17 -0500)]
target/i386: fix operand order for PDEP and PEXT

For PDEP and PEXT, the mask is provided in the memory (mod+r/m)
operand, and therefore is loaded in s->T0 by gen_ldst_modrm.
The source is provided in the second source operand (VEX.vvvv)
and therefore is loaded in s->T1.  Fix the order in which
they are passed to the helpers.

Reported-by: Lenard Szolnoki <blog@lenardszolnoki.com>
Analyzed-by: Lenard Szolnoki <blog@lenardszolnoki.com>
Fixes: https://bugs.launchpad.net/qemu/+bug/1605123
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
3 years agoMerge remote-tracking branch 'remotes/legoater/tags/pull-aspeed-20201210' into staging
Peter Maydell [Thu, 10 Dec 2020 14:26:35 +0000 (14:26 +0000)]
Merge remote-tracking branch 'remotes/legoater/tags/pull-aspeed-20201210' into staging

Aspeed patches :

* New device model for EMC1413/EMC1414 temperature sensors (I2C)
* New g220a-bmc Aspeed machine
* couple of Aspeed cleanups

# gpg: Signature made Thu 10 Dec 2020 11:58:10 GMT
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <clg@kaod.org>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1

* remotes/legoater/tags/pull-aspeed-20201210:
  aspeed: g220a-bmc: Add an FRU
  aspeed/smc: Add support for address lane disablement
  ast2600: SRAM is 89KB
  aspeed: Add support for the g220a-bmc board
  hw/misc: add an EMC141{3,4} device model

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/kraxel/tags/microvm-20201210-pull-request'...
Peter Maydell [Thu, 10 Dec 2020 12:53:01 +0000 (12:53 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/microvm-20201210-pull-request' into staging

microvm: add support for second ioapic

# gpg: Signature made Thu 10 Dec 2020 12:13:42 GMT
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/microvm-20201210-pull-request:
  tests/acpi: disallow updates for expected data files
  tests/acpi: update expected data files
  tests/acpi: add ioapic2=on test for microvm
  tests/acpi: add data files for ioapic2 test variant
  tests/acpi: allow updates for expected data files
  microvm: add second ioapic
  microvm: drop microvm_gsi_handler()
  microvm: make pcie irq base runtime changeable
  microvm: make number of virtio transports runtime changeable
  x86: add support for second ioapic
  x86: rewrite gsi_handler()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>