OSDN Git Service

qmiga/qemu.git
3 years agohw/block/fdc: Remove the check_media_rate property
Thomas Huth [Wed, 3 Feb 2021 17:18:30 +0000 (18:18 +0100)]
hw/block/fdc: Remove the check_media_rate property

This was only required for the pc-1.0 and earlier machine types.
Now that these have been removed, we can also drop the corresponding
code from the FDC device.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
Message-Id: <20210203171832.483176-3-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agohw/i386/xen: Remove dead code
Philippe Mathieu-Daudé [Tue, 2 Feb 2021 15:56:44 +0000 (16:56 +0100)]
hw/i386/xen: Remove dead code

'drivers_blacklisted' is never accessed, remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Message-Id: <20210202155644.998812-1-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-02-18' into staging
Peter Maydell [Fri, 19 Feb 2021 17:22:42 +0000 (17:22 +0000)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-02-18' into staging

QAPI patches patches for 2021-02-18

# gpg: Signature made Thu 18 Feb 2021 18:51:35 GMT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2021-02-18:
  qapi/introspect.py: set _gen_tree's default ifcond argument to ()
  qapi/introspect.py: Type _gen_tree variants as Sequence[str]
  qapi/introspect.py: Update copyright and authors list
  qapi/introspect.py: Add docstrings to _gen_tree and _tree_to_qlit
  qapi/introspect.py: add type hint annotations
  qapi/introspect.py: remove _gen_variants helper
  qapi/introspect.py: improve readability of _tree_to_qlit
  qapi/introspect.py: improve _tree_to_qlit error message
  qapi/introspect.py: create a typed 'Annotated' data strutcure
  qapi/introspect.py: Introduce preliminary tree typing
  qapi/introspect.py: Always define all 'extra' dict keys
  qapi/introspect.py: replace 'extra' dict with 'comment' argument
  qapi/introspect.py: Unify return type of _make_tree()
  qapi/introspect.py: guard against ifcond/comment misuse
  qapi/introspect.py: add _gen_features helper
  qapi/introspect.py: use _make_tree for features nodes
  qapi/introspect.py: assert schema is not None
  qapi: Replace List[str] with Sequence[str] for ifcond

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2021-02-19' into...
Peter Maydell [Fri, 19 Feb 2021 14:54:52 +0000 (14:54 +0000)]
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2021-02-19' into staging

* Always build the container images in the gitlab-CI
* Some other small gitlab-CI improvements
* Some qtest fixes

# gpg: Signature made Fri 19 Feb 2021 06:10:20 GMT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2021-02-19:
  travis.yml: Limit simultaneous jobs to 3
  gitlab-ci.yml: Run check-tcg with TCI
  tests/qtest/boot-sector: Check that the guest did not panic
  gitlab-ci: Disable vhost-kernel in build-disable job
  scripts/checkpatch: Improve the check for authors mangled by the mailing list
  gitlab-ci: Display Avocado log content when tests timeout
  gitlab: fix inconsistent indentation
  gitlab: add fine grained job deps for all build jobs
  gitlab: always build container images
  tests/qtest/boot-serial-test: Test Virt machine with 'max'

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/ehabkost-gl/tags/machine-next-pull-request...
Peter Maydell [Fri, 19 Feb 2021 10:59:04 +0000 (10:59 +0000)]
Merge remote-tracking branch 'remotes/ehabkost-gl/tags/machine-next-pull-request' into staging

Machine and x86 queue, 2021-02-18

Feature:
* i386: Add the support for AMD EPYC 3rd generation processors
  (Babu Moger)

Bug fix:
* hostmem: Don't report pmem attribute if unsupported
  (Michal Privoznik)

Cleanup:
* device-crash-test: Remove problematic language
  (Eduardo Habkost)

# gpg: Signature made Thu 18 Feb 2021 23:34:58 GMT
# gpg:                using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6
# gpg:                issuer "ehabkost@redhat.com"
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost-gl/tags/machine-next-pull-request:
  hostmem: Don't report pmem attribute if unsupported
  device-crash-test: Remove problematic language
  i386: Add the support for AMD EPYC 3rd generation processors

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agotravis.yml: Limit simultaneous jobs to 3
Thomas Huth [Wed, 17 Feb 2021 12:19:31 +0000 (12:19 +0000)]
travis.yml: Limit simultaneous jobs to 3

Even though the host machines that run the Travis CI jobs have
quite a lot of CPUs (e.g. nproc in an aarch64 job reports 32), the
containers on Travis are still limited to 2 vCPUs according to:

 https://docs.travis-ci.com/user/reference/overview/#approx-boot-time

So we do not gain much when compiling with a job number based on
the output of "getconf _NPROCESSORS_ONLN" - quite the contrary, the
aarch64 containers are currently aborting quite often since they
are running out of memory. Thus let's rather use a fixed number
like 3 in the jobs here, so that e.g. two threads can actively run
while a third one might be waiting for I/O operations to complete.
This should hopefully fix the out-of-memory failures in the aarch64
CI jobs.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210217102531.1441557-1-thuth@redhat.com>
[AJB: add comment]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210217121932.19986-6-alex.bennee@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agogitlab-ci.yml: Run check-tcg with TCI
Thomas Huth [Wed, 27 Jan 2021 05:59:03 +0000 (06:59 +0100)]
gitlab-ci.yml: Run check-tcg with TCI

It's now possible to also run the non-x86 TCG tests with TCI.

Message-Id: <20210127055903.40148-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agotests/qtest/boot-sector: Check that the guest did not panic
Thomas Huth [Fri, 12 Feb 2021 11:31:41 +0000 (12:31 +0100)]
tests/qtest/boot-sector: Check that the guest did not panic

The s390-ccw bios code panics if it can not boot successfully. In
this case, it does not make sense that we wait the full 600 seconds
for the boot sector test to finish and can signal the failure
immediately, thus let's check the status of the guest with the
"query-status" QMP command here, too.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20210212113141.854871-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agogitlab-ci: Disable vhost-kernel in build-disable job
Philippe Mathieu-Daudé [Sun, 31 Jan 2021 10:46:21 +0000 (11:46 +0100)]
gitlab-ci: Disable vhost-kernel in build-disable job

Commit 299e6f19b3e ("vhost-net: revamp configure logic") added
the --enable-vhost-kernel option.
Disable it in the build-disable job.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20210131104621.221602-1-f4bug@amsat.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agoscripts/checkpatch: Improve the check for authors mangled by the mailing list
Thomas Huth [Tue, 16 Feb 2021 07:15:12 +0000 (08:15 +0100)]
scripts/checkpatch: Improve the check for authors mangled by the mailing list

There were recently some patches on the list which had their "From:"
line mangled like this:

 From: qemu_oss--- via <qemu-devel@nongnu.org>

Since our test in the checkpatch.pl script did not trigger here, the
patches finally also ended up in a pull request, with the wrong author
set. So let's improve the regular expression to also complain on
these new patterns, too.

Message-Id: <20210216071512.1199827-1-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agogitlab-ci: Display Avocado log content when tests timeout
Philippe Mathieu-Daudé [Mon, 15 Feb 2021 17:14:38 +0000 (18:14 +0100)]
gitlab-ci: Display Avocado log content when tests timeout

Since commit ba2232bae6d ("gitlab-ci: Refactor code that show logs
of failed acceptances") we display the log content of failing tests
(Avocado "FAIL" event).

Since we are also interested in tests timeouting, update our global
Avocado config to display log content for the "INTERRUPT" event,
"possible when the timeout is reached" (See [*]).

[*] https://avocado-framework.readthedocs.io/en/latest/guides/writer/chapters/writing.html#test-statuses

Suggested-by: Willian Rampazzo <willianr@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20210215171438.935665-1-philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agogitlab: fix inconsistent indentation
Daniel P. Berrangé [Tue, 16 Feb 2021 13:29:54 +0000 (13:29 +0000)]
gitlab: fix inconsistent indentation

The standard is to use 2 space indent, not 3.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210216132954.295906-4-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agogitlab: add fine grained job deps for all build jobs
Daniel P. Berrangé [Tue, 16 Feb 2021 13:29:53 +0000 (13:29 +0000)]
gitlab: add fine grained job deps for all build jobs

This allows the build jobs to start running as soon as their respective
container image is ready, instead of waiting for all container builds
to finish.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210216132954.295906-3-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agogitlab: always build container images
Daniel P. Berrangé [Tue, 16 Feb 2021 13:29:52 +0000 (13:29 +0000)]
gitlab: always build container images

Currently we attempt to skip building container images if the commits do
not involve changes to the dockerfiles or gitlab CI definitions.

Conceptually this makes sense, but there is a challenge in the real
world implementation of this in gitlab.

In the case of a CI pipeline triggered from a merge request, GitLab
knows the common ancestor of the merge request and the main git repo,
so it can trivially determine if any of the commits associated with
the MR change the dockerfiles.

In the case of a CI pipeline triggered from a push to a branch, it is
much more difficult. There is no concept of a common ancestor in this
case. Instead GitLab looks at the set of commits in the git push event.

On the surface this may sound reasonable, but it doesn't take into
account that a push event does not always contain the full set of
patches from a branch.

For example, consider pushing 5 commits, one of which contains a
dockerfile change. This will trigger a CI pipeline for the
containers. Now consider you do some more work on the branch and push 3
further commits, so you now have a branch of 8 commits. For the second
push GitLab will only look at the 3 most recent commits, the other 5
were already present. Thus GitLab will not realize that the branch has
dockerfile changes that need to trigger the container build.

This can cause real world problems:

 - Push 5 commits to branch "foo", including a dockerfile change

    => rebuilds the container images with content from "foo"
    => build jobs runs against containers from "foo"

 - Refresh your master branch with latest upstream master

    => rebuilds the container images with content from "master"
    => build jobs runs against containers from "master"

 - Push 3 more commits to branch "foo", with no dockerfile change

    => no container rebuild triggers
    => build jobs runs against containers from "master"

The "changes" conditional in gitlab is OK, *provided* your build
jobs are not relying on any external state from previous builds.

This is NOT the case in QEMU, because we are building container
images and these are cached. This is a scenario in which the
"changes" conditional is not usuable.

The only other way to avoid this problem would be to use the git
branch name as the container image tag, instead of always using
"latest". The downside of this approach is that the user's gitlab
registry will grow significantly until it starts to trigger
GitLab's automatic deletion policy.  Every time the user starts
a new branch they will have to trigger a rebuild of the container
images. Given this, we might as well just drop the conditional
and always build the container images. Most of the time docker
will be able to use the layer cache to avoid the most expensive
part of the rebuild process (installing all the RPMs/debs/etc)

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20210216132954.295906-2-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agotests/qtest/boot-serial-test: Test Virt machine with 'max'
Philippe Mathieu-Daudé [Fri, 5 Feb 2021 14:43:39 +0000 (15:43 +0100)]
tests/qtest/boot-serial-test: Test Virt machine with 'max'

When using KVM, using a specific cpu type will only work if the
host CPU really is that exact CPU type.

During testing we can simply use the 'max' CPU which will select
all the features available from the host.

This allow running this test on a Cavium CN8890 (ThunderX cores).

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210205144345.2068758-4-f4bug@amsat.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
3 years agohostmem: Don't report pmem attribute if unsupported
Michal Privoznik [Tue, 26 Jan 2021 07:48:25 +0000 (08:48 +0100)]
hostmem: Don't report pmem attribute if unsupported

When management applications (like Libvirt) want to check whether
memory-backend-file.pmem is supported they can list object
properties using 'qom-list-properties'. However, 'pmem' is
declared always (and thus reported always) and only at runtime
QEMU errors out if it was built without libpmem (and thus can not
guarantee write persistence). This is suboptimal since we have
ability to declare attributes at compile time.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1915216
Message-Id: <dfcc5dc7e2efc0283bc38e3036da2c0323621cdb.1611647111.git.mprivozn@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agodevice-crash-test: Remove problematic language
Eduardo Habkost [Tue, 2 Feb 2021 19:12:07 +0000 (14:12 -0500)]
device-crash-test: Remove problematic language

Replace "whitelist" in the device-crash-test script with
"rule list".

I'm using "rule list" instead of "allow list" or "pass list"
because the list is not used only for expected/allowed errors.
It also contain rules specifying which errors shouldn't be
ignored and/or should be fatal.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210202191207.4103973-1-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoi386: Add the support for AMD EPYC 3rd generation processors
Babu Moger [Tue, 9 Feb 2021 21:04:05 +0000 (15:04 -0600)]
i386: Add the support for AMD EPYC 3rd generation processors

Adds the support for AMD 3rd generation processors. The model
display for the new processor will be EPYC-Milan.

Adds the following new feature bits on top of the feature bits from
the first and second generation EPYC models.

pcid          : Process context identifiers support
ibrs          : Indirect Branch Restricted Speculation
ssbd          : Speculative Store Bypass Disable
erms          : Enhanced REP MOVSB/STOSB support
fsrm          : Fast Short REP MOVSB support
invpcid       : Invalidate processor context ID
pku           : Protection keys support
svme-addr-chk : SVM instructions address check for #GP handling

Depends on the following kernel commits:
14c2bf81fcd2 ("KVM: SVM: Fix #GP handling for doubly-nested virtualization")
3b9c723ed7cf ("KVM: SVM: Add support for SVM instruction address check change")
4aa2691dcbd3 ("8ce1c461188799d863398dd2865d KVM: x86: Factor out x86 instruction emulation with decoding")
4407a797e941 ("KVM: SVM: Enable INVPCID feature on AMD")
9715092f8d7e ("KVM: X86: Move handling of INVPCID types to x86")
3f3393b3ce38 ("KVM: X86: Rename and move the function vmx_handle_memory_failure to x86.c")
830bd71f2c06 ("KVM: SVM: Remove set_cr_intercept, clr_cr_intercept and is_cr_intercept")
4c44e8d6c193 ("KVM: SVM: Add new intercept word in vmcb_control_area")
c62e2e94b9d4 ("KVM: SVM: Modify 64 bit intercept field to two 32 bit vectors")
9780d51dc2af ("KVM: SVM: Modify intercept_exceptions to generic intercepts")
30abaa88382c ("KVM: SVM: Change intercept_dr to generic intercepts")
03bfeeb988a9 ("KVM: SVM: Change intercept_cr to generic intercepts")
c45ad7229d13 ("KVM: SVM: Introduce vmcb_(set_intercept/clr_intercept/_is_intercept)")
a90c1ed9f11d ("(pcid) KVM: nSVM: Remove unused field")
fa44b82eb831 ("KVM: x86: Move MPK feature detection to common code")
38f3e775e9c2 ("x86/Kconfig: Update config and kernel doc for MPK feature on AMD")
37486135d3a7 ("KVM: x86: Fix pkru save/restore when guest CR4.PKE=0, move it to x86.c")

Signed-off-by: Babu Moger <babu.moger@amd.com>
Message-Id: <161290460478.11352.8933244555799318236.stgit@bmoger-ubuntu>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoqapi/introspect.py: set _gen_tree's default ifcond argument to ()
John Snow [Tue, 16 Feb 2021 02:18:08 +0000 (21:18 -0500)]
qapi/introspect.py: set _gen_tree's default ifcond argument to ()

We don't need to create an empty, mutable list to pass to _gen_tree;
since it is now typed as a Sequence, we can use the empty tuple as a
default and omit the argument.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-19-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: Type _gen_tree variants as Sequence[str]
John Snow [Tue, 16 Feb 2021 02:18:07 +0000 (21:18 -0500)]
qapi/introspect.py: Type _gen_tree variants as Sequence[str]

Optional[List] is clunky; an empty sequence can more elegantly convey
"no variants". By downgrading "List" to "Sequence", we can also accept
tuples; this is useful for the empty tuple specifically, which we may
use as a default parameter because it is immutable.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-18-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Doc string touched up]
Reviewed-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: Update copyright and authors list
John Snow [Tue, 16 Feb 2021 02:18:06 +0000 (21:18 -0500)]
qapi/introspect.py: Update copyright and authors list

To reflect the work that went into strictly typing introspect.py,
punish myself by claiming credit.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-17-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: Add docstrings to _gen_tree and _tree_to_qlit
John Snow [Tue, 16 Feb 2021 02:18:05 +0000 (21:18 -0500)]
qapi/introspect.py: Add docstrings to _gen_tree and _tree_to_qlit

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-16-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Doc string improvements squashed in]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: add type hint annotations
John Snow [Tue, 16 Feb 2021 02:18:04 +0000 (21:18 -0500)]
qapi/introspect.py: add type hint annotations

NB: The type aliases (SchemaInfo et al) declare intent for some of the
"dictly-typed" objects we pass around in introspect.py. They do not
enforce the shape of those objects, and cannot, until Python 3.7 or
later. (And even then, it may not be "worth it".)

Annotations are also added to the QAPISchemaEntity __init__ method in
schema.py to allow mypy to statically prove the type of typ.name,
needed to prove the return type of
QAPISchemaGenIntrospectVisitor._use_type().

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-15-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Note on QAPISchemaEntity.__init__() squashed into commit message,
Comment wrapped to conform to PEP 8]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: remove _gen_variants helper
John Snow [Tue, 16 Feb 2021 02:18:03 +0000 (21:18 -0500)]
qapi/introspect.py: remove _gen_variants helper

It is easier to give a name to all of the dictly-typed objects we pass
around in introspect.py by removing this helper, as it does not return
an object that has any knowable type by itself.

Inline it into its only caller instead.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-14-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: improve readability of _tree_to_qlit
John Snow [Tue, 16 Feb 2021 02:18:02 +0000 (21:18 -0500)]
qapi/introspect.py: improve readability of _tree_to_qlit

Subjective, but I find getting rid of the comprehensions helps. Also,
divide the sections into scalar and non-scalar sections, and remove
old-style string formatting.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-13-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: improve _tree_to_qlit error message
John Snow [Tue, 16 Feb 2021 02:18:01 +0000 (21:18 -0500)]
qapi/introspect.py: improve _tree_to_qlit error message

Trivial; make the error message just a pinch more explicit in case we
trip this by accident in the future.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-12-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: create a typed 'Annotated' data strutcure
John Snow [Tue, 16 Feb 2021 02:18:00 +0000 (21:18 -0500)]
qapi/introspect.py: create a typed 'Annotated' data strutcure

Presently, we use a tuple to attach a dict containing annotations
(comments and compile-time conditionals) to a tree node. This is
undesirable because dicts are difficult to strongly type; promoting it
to a real class allows us to name the values and types of the
annotations we are expecting.

In terms of typing, the Annotated<T> type serves as a generic container
where the annotated node's type is preserved, allowing for greater
specificity than we'd be able to provide without a generic.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-11-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: Introduce preliminary tree typing
John Snow [Tue, 16 Feb 2021 02:17:59 +0000 (21:17 -0500)]
qapi/introspect.py: Introduce preliminary tree typing

The types will be used in forthcoming patches to add typing. These types
describe the layout and structure of the objects passed to
_tree_to_qlit, but lack the power to describe annotations until the next
commit.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-10-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: Always define all 'extra' dict keys
John Snow [Tue, 16 Feb 2021 02:17:58 +0000 (21:17 -0500)]
qapi/introspect.py: Always define all 'extra' dict keys

This mimics how a typed object works, where 'if' and 'comment' are
always set, regardless of if they have a value set or not.

It is safe to do this because of the way that _tree_to_qlit processes
these values (using dict.get with a default of None), resulting in no
change of output from _tree_to_qlit. There are no other users of this
data.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-9-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: replace 'extra' dict with 'comment' argument
John Snow [Tue, 16 Feb 2021 02:17:57 +0000 (21:17 -0500)]
qapi/introspect.py: replace 'extra' dict with 'comment' argument

This is only used to pass in a dictionary with a comment already set, so
skip the runaround and just accept the (optional) comment.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-8-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: Unify return type of _make_tree()
John Snow [Tue, 16 Feb 2021 02:17:56 +0000 (21:17 -0500)]
qapi/introspect.py: Unify return type of _make_tree()

Returning two different types conditionally can be complicated to
type. Return one type for consistency.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-7-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: guard against ifcond/comment misuse
John Snow [Tue, 16 Feb 2021 02:17:55 +0000 (21:17 -0500)]
qapi/introspect.py: guard against ifcond/comment misuse

_tree_to_qlit is called recursively on dict values (isolated from their
keys); at such a point in generating output it is too late to apply an
ifcond. Similarly, comments do not necessarily have a "tidy" place they
can be printed in such a circumstance.

Forbid this usage by renaming "suppress_first_indent" to "dict_value" to
emphasize that indents are suppressed only for the benefit of dict
values; then add an assertion assuring we do not pass ifcond/comments
in this case.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-6-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Comment wrapped to conform to PEP 8]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: add _gen_features helper
John Snow [Tue, 16 Feb 2021 02:17:54 +0000 (21:17 -0500)]
qapi/introspect.py: add _gen_features helper

_make_tree might receive a dict (a SchemaInfo object) or some other type
(usually, a string) for its obj parameter. Adding features information
should arguably be performed by the caller at such a time when we know
the type of the object and don't have to re-interrogate it.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-5-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: use _make_tree for features nodes
John Snow [Tue, 16 Feb 2021 02:17:53 +0000 (21:17 -0500)]
qapi/introspect.py: use _make_tree for features nodes

At present, we open-code this in _make_tree itself; but if the structure
of the tree changes, this is brittle. Use an explicit recursive call to
_make_tree when appropriate to help keep the interior node typing
consistent.

A consequence of doing this is that the 'ifcond' key of the features
dict will be omitted when ifcond is false-ish, just like it is omitted
in top-level calls to _make_tree. This also increases consistency in our
handling of this property.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-4-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoqapi/introspect.py: assert schema is not None
John Snow [Tue, 16 Feb 2021 02:17:52 +0000 (21:17 -0500)]
qapi/introspect.py: assert schema is not None

The introspect visitor is stateful, but expects that it will have a
schema to refer to. Add assertions that state this.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-3-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoMerge remote-tracking branch 'remotes/rth-gitlab/tags/pull-hex-20210218' into staging
Peter Maydell [Thu, 18 Feb 2021 16:33:36 +0000 (16:33 +0000)]
Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-hex-20210218' into staging

Initial commit for the Qualcomm Hexagon processor.

# gpg: Signature made Thu 18 Feb 2021 16:26:52 GMT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth-gitlab/tags/pull-hex-20210218: (35 commits)
  Hexagon build infrastructure
  Hexagon (tests/tcg/hexagon) TCG tests - floating point
  Hexagon (tests/tcg/hexagon) TCG tests - atomics/load/store/misc
  Hexagon (tests/tcg/hexagon) TCG tests - multiarch
  Hexagon (linux-user/hexagon) Linux user emulation
  Hexagon (target/hexagon) translation
  Hexagon (target/hexagon) TCG for floating point instructions
  Hexagon (target/hexagon) TCG for instructions with multiple definitions
  Hexagon (target/hexagon) TCG generation
  Hexagon (target/hexagon) instruction classes
  Hexagon (target/hexagon) macros
  Hexagon (target/hexagon) opcode data structures
  Hexagon (target/hexagon) generater phase 4 - decode tree
  Hexagon (target/hexagon) generator phase 3 - C preprocessor for decode tree
  Hexagon (target/hexagon) generator phase 2 - generate header files
  Hexagon (target/hexagon) generator phase 1 - C preprocessor for semantics
  Hexagon (target/hexagon/imported) arch import
  Hexagon (target/hexagon/fma_emu.[ch]) utility functions
  Hexagon (target/hexagon/conv_emu.[ch]) utility functions
  Hexagon (target/hexagon/arch.[ch]) utility functions
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoHexagon build infrastructure
Taylor Simpson [Mon, 8 Feb 2021 05:46:24 +0000 (23:46 -0600)]
Hexagon build infrastructure

Add file to default-configs
Add hexagon to meson.build
Add hexagon to target/meson.build
Add target/hexagon/meson.build
Change scripts/qemu-binfmt-conf.sh

We can build a hexagon-linux-user target and run programs on
the Hexagon scalar core.  With hexagon-linux-clang installed,
"make check-tcg" will pass.

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-35-git-send-email-tsimpson@quicinc.com>
[rth: Use top-level python variable]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoqapi: Replace List[str] with Sequence[str] for ifcond
John Snow [Tue, 16 Feb 2021 02:17:51 +0000 (21:17 -0500)]
qapi: Replace List[str] with Sequence[str] for ifcond

It does happen to be a list (as of now), but we can describe it in more
general terms with no loss in accuracy to allow tuples and other
constructs.

In the future, we can write "ifcond: Sequence[str] = ()" as a default
parameter, which we could not do safely with a Mutable type like a List.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-2-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
3 years agoHexagon (tests/tcg/hexagon) TCG tests - floating point
Taylor Simpson [Mon, 8 Feb 2021 05:46:23 +0000 (23:46 -0600)]
Hexagon (tests/tcg/hexagon) TCG tests - floating point

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-34-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (tests/tcg/hexagon) TCG tests - atomics/load/store/misc
Taylor Simpson [Mon, 8 Feb 2021 05:46:22 +0000 (23:46 -0600)]
Hexagon (tests/tcg/hexagon) TCG tests - atomics/load/store/misc

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-33-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (tests/tcg/hexagon) TCG tests - multiarch
Taylor Simpson [Mon, 8 Feb 2021 05:46:21 +0000 (23:46 -0600)]
Hexagon (tests/tcg/hexagon) TCG tests - multiarch

Enable multiarch tests for Hexagon
Modify tests/tcg/configure.sh
Add reference files to tests/tcg/hexagon

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1612763186-18161-32-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (linux-user/hexagon) Linux user emulation
Taylor Simpson [Mon, 8 Feb 2021 05:46:20 +0000 (23:46 -0600)]
Hexagon (linux-user/hexagon) Linux user emulation

Implementation of Linux user emulation for Hexagon
Some common files modified in addition to new files in linux-user/hexagon

Acked-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-31-git-send-email-tsimpson@quicinc.com>
[rth: Fix termbits.h on review by Laurent]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) translation
Taylor Simpson [Mon, 8 Feb 2021 05:46:19 +0000 (23:46 -0600)]
Hexagon (target/hexagon) translation

Read the instruction memory
Create a packet data structure
Generate TCG code for the start of the packet
Invoke the generate function for each instruction
Generate TCG code for the end of the packet

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-30-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) TCG for floating point instructions
Taylor Simpson [Mon, 8 Feb 2021 05:46:18 +0000 (23:46 -0600)]
Hexagon (target/hexagon) TCG for floating point instructions

The imported code uses host floating point.  We override them
to use qemu softfloat

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-29-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) TCG for instructions with multiple definitions
Taylor Simpson [Mon, 8 Feb 2021 05:46:17 +0000 (23:46 -0600)]
Hexagon (target/hexagon) TCG for instructions with multiple definitions

Helpers won't work if there are multiple definitions, so we override these
instructions using #define fGEN_TCG_<tag>.

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-28-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) TCG generation
Taylor Simpson [Mon, 8 Feb 2021 05:46:16 +0000 (23:46 -0600)]
Hexagon (target/hexagon) TCG generation

Include the generated files and set up the data structures

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-27-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) instruction classes
Taylor Simpson [Mon, 8 Feb 2021 05:46:15 +0000 (23:46 -0600)]
Hexagon (target/hexagon) instruction classes

Determine legal VLIW slots for each instruction

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-26-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) macros
Taylor Simpson [Mon, 8 Feb 2021 05:46:14 +0000 (23:46 -0600)]
Hexagon (target/hexagon) macros

macros to interface with the generator
macros referenced in instruction semantics

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-25-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) opcode data structures
Taylor Simpson [Mon, 8 Feb 2021 05:46:13 +0000 (23:46 -0600)]
Hexagon (target/hexagon) opcode data structures

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1612763186-18161-24-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) generater phase 4 - decode tree
Taylor Simpson [Mon, 8 Feb 2021 05:46:12 +0000 (23:46 -0600)]
Hexagon (target/hexagon) generater phase 4 - decode tree

Python script that emits the decode tree in dectree_generated.h.

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-23-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) generator phase 3 - C preprocessor for decode tree
Taylor Simpson [Mon, 8 Feb 2021 05:46:11 +0000 (23:46 -0600)]
Hexagon (target/hexagon) generator phase 3 - C preprocessor for decode tree

Run the C preprocessor across the instruction definition and encoding
files to expand macros and prepare the iset.py file.  The resulting
fill contains python data structures used to build the decode tree.

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-22-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) generator phase 2 - generate header files
Taylor Simpson [Mon, 8 Feb 2021 05:46:10 +0000 (23:46 -0600)]
Hexagon (target/hexagon) generator phase 2 - generate header files

Python scripts generate the following files
    helper_protos_generated.h.inc
        For each instruction we create DEF_HELPER function prototype
    helper_funcs_generated.c.inc
        For each instruction we create the helper function definition
    tcg_funcs_generated.c.inc
        For each instruction we create TCG code to generate call to helper
    tcg_func_table_generated.c.inc
        Table of function pointers indexed by opcode
    shortcode_generated.h.inc
        Generate a table of instruction "shortcode" semantics
    opcodes_def_generated.h.inc
        Gives a list of all the opcodes
    op_attribs_generated.h.inc
        Lists all the attributes associated with each instruction
    op_regs_generated.h.inc
        Lists the register and immediate operands for each instruction
    printinsn_generated.h.inc
        Data for printing (disassembling) each instruction (format
        string + operands)

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-21-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) generator phase 1 - C preprocessor for semantics
Taylor Simpson [Mon, 8 Feb 2021 05:46:09 +0000 (23:46 -0600)]
Hexagon (target/hexagon) generator phase 1 - C preprocessor for semantics

Run the C preprocessor across the instruction definition files and macro
definition file to expand macros and prepare the semantics_generated.pyinc
file.  The resulting file contains one entry with the semantics for each
instruction and one line with the instruction attributes associated with
each macro.

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-20-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon/imported) arch import
Taylor Simpson [Mon, 8 Feb 2021 05:46:08 +0000 (23:46 -0600)]
Hexagon (target/hexagon/imported) arch import

Imported from the Hexagon architecture library
    imported/macros.def
        The macro definitions specify instruction attributes that are applied
        to each instruction that references the macro. The generator will
        recursively apply attributes to each instruction that used the macro.
    imported/allidefs.def
        Top level instruction definition file
    imported/*.idef
        Instruction definition files
        These files are input to the first phase of the generator
        (gen_semantics.c) to create a python include file with the
        instruction semantics and attributes.  The python include
        file is fed to the second phase to generate various header files.
    imported/encode*.def
        Instruction encoding bit patterns for every instruction

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-19-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon/fma_emu.[ch]) utility functions
Taylor Simpson [Mon, 8 Feb 2021 05:46:07 +0000 (23:46 -0600)]
Hexagon (target/hexagon/fma_emu.[ch]) utility functions

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1612763186-18161-18-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon/conv_emu.[ch]) utility functions
Taylor Simpson [Mon, 8 Feb 2021 05:46:06 +0000 (23:46 -0600)]
Hexagon (target/hexagon/conv_emu.[ch]) utility functions

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-17-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon/arch.[ch]) utility functions
Taylor Simpson [Mon, 8 Feb 2021 05:46:05 +0000 (23:46 -0600)]
Hexagon (target/hexagon/arch.[ch]) utility functions

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-16-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) instruction printing
Taylor Simpson [Mon, 8 Feb 2021 05:46:04 +0000 (23:46 -0600)]
Hexagon (target/hexagon) instruction printing

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-15-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) instruction/packet decode
Taylor Simpson [Mon, 8 Feb 2021 05:46:03 +0000 (23:46 -0600)]
Hexagon (target/hexagon) instruction/packet decode

Take the words from instruction memory and build a packet_t for TCG code
generation

The following operations are performed
    Convert the .new encoded offset to the register number of the producer
    Reorder the packet so .new producer is before consumer
    Apply constant extenders
    Separate subinsn's into two instructions
    Break compare-jumps into two instructions
    Create instructions for :endloop

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-14-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) instruction attributes
Taylor Simpson [Mon, 8 Feb 2021 05:46:02 +0000 (23:46 -0600)]
Hexagon (target/hexagon) instruction attributes

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-13-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) register fields
Taylor Simpson [Mon, 8 Feb 2021 05:46:01 +0000 (23:46 -0600)]
Hexagon (target/hexagon) register fields

Declare bitfields within registers such as user status register (USR)

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-12-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) instruction and packet types
Taylor Simpson [Mon, 8 Feb 2021 05:46:00 +0000 (23:46 -0600)]
Hexagon (target/hexagon) instruction and packet types

The insn_t and packet_t are the interface between instruction decoding and
TCG code generation

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-11-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) architecture types
Taylor Simpson [Mon, 8 Feb 2021 05:45:59 +0000 (23:45 -0600)]
Hexagon (target/hexagon) architecture types

Define types used in files imported from the Hexagon architecture library

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1612763186-18161-10-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) GDB Stub
Taylor Simpson [Mon, 8 Feb 2021 05:45:58 +0000 (23:45 -0600)]
Hexagon (target/hexagon) GDB Stub

GDB register read and write routines

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1612763186-18161-9-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) scalar core helpers
Taylor Simpson [Mon, 8 Feb 2021 05:45:57 +0000 (23:45 -0600)]
Hexagon (target/hexagon) scalar core helpers

The majority of helpers are generated.  Define the helper functions needed
then include the generated file

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-8-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) register names
Taylor Simpson [Mon, 8 Feb 2021 05:45:56 +0000 (23:45 -0600)]
Hexagon (target/hexagon) register names

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1612763186-18161-7-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (disas) disassembler
Taylor Simpson [Mon, 8 Feb 2021 05:45:55 +0000 (23:45 -0600)]
Hexagon (disas) disassembler

Add hexagon to disas/meson.build
Add disas/hexagon.c
Add hexagon to include/disas/dis-asm.h

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1612763186-18161-6-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) scalar core definition
Taylor Simpson [Mon, 8 Feb 2021 05:45:54 +0000 (23:45 -0600)]
Hexagon (target/hexagon) scalar core definition

Add target state header, target definitions and initialization routines

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-5-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (include/elf.h) ELF machine definition
Taylor Simpson [Mon, 8 Feb 2021 05:45:53 +0000 (23:45 -0600)]
Hexagon (include/elf.h) ELF machine definition

Define EM_HEXAGON 164

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-4-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon (target/hexagon) README
Taylor Simpson [Mon, 8 Feb 2021 05:45:52 +0000 (23:45 -0600)]
Hexagon (target/hexagon) README

Gives an introduction and overview to the Hexagon target

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <1612763186-18161-3-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoHexagon Update MAINTAINERS file
Taylor Simpson [Mon, 8 Feb 2021 05:45:51 +0000 (23:45 -0600)]
Hexagon Update MAINTAINERS file

Add Taylor Simpson as the Hexagon target maintainer

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <1612763186-18161-2-git-send-email-tsimpson@quicinc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3 years agoqemu/int128: Add int128_or
Richard Henderson [Wed, 21 Oct 2020 04:51:35 +0000 (21:51 -0700)]
qemu/int128: Add int128_or

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20201021045149.1582203-2-richard.henderson@linaro.org>

3 years agoMerge remote-tracking branch 'remotes/kraxel/tags/usb-20210218-pull-request' into...
Peter Maydell [Thu, 18 Feb 2021 15:14:09 +0000 (15:14 +0000)]
Merge remote-tracking branch 'remotes/kraxel/tags/usb-20210218-pull-request' into staging

usb: two bugfixes.

# gpg: Signature made Thu 18 Feb 2021 11:51:44 GMT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# 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/usb-20210218-pull-request:
  usb/pcap: set flag_setup
  usb-host: use correct altsetting in usb_host_ep_update

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-plugin-updates-180221-1'...
Peter Maydell [Thu, 18 Feb 2021 13:27:03 +0000 (13:27 +0000)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-plugin-updates-180221-1' into staging

Plugin updates:

  - expose vdev name in PCI memory registration
  - new hwprofile plugin
  - bunch of style cleanups to contrib/plugins
  - fix call signature of inline instrumentation
  - re-factor the io_recompile code to push specialisation into hooks
  - add some acceptance tests for the plugins
  - clean-up and remove CF_NOCACHE handling from TCG
  - fix instrumentation of cpu_io_recompile sections
  - expand tests to check inline and cb count the same

# gpg: Signature made Thu 18 Feb 2021 08:24:57 GMT
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-plugin-updates-180221-1: (23 commits)
  tests/acceptance: add a memory callback check
  tests/plugin: allow memory plugin to do both inline and callbacks
  tests/acceptance: add a new tests to detect counting errors
  accel/tcg: allow plugin instrumentation to be disable via cflags
  accel/tcg: remove CF_NOCACHE and special cases
  accel/tcg: re-factor non-RAM execution code
  accel/tcg: cache single instruction TB on pending replay exception
  accel/tcg: actually cache our partial icount TB
  tests/acceptance: add a new set of tests to exercise plugins
  tests/plugin: expand insn test to detect duplicate instructions
  target/sh4: Create superh_io_recompile_replay_branch
  target/mips: Create mips_io_recompile_replay_branch
  accel/tcg: Create io_recompile_replay_branch hook
  exec: Move TranslationBlock typedef to qemu/typedefs.h
  accel/tcg/plugin-gen: fix the call signature for inline callbacks
  contrib: Open brace '{' following struct go on the same line
  contrib: space required after that ','
  contrib: Add spaces around operator
  contrib: Fix some code style problems, ERROR: "foo * bar" should be "foo *bar"
  contrib: Don't use '#' flag of printf format
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agotests/acceptance: add a memory callback check
Alex Bennée [Sat, 13 Feb 2021 13:03:25 +0000 (13:03 +0000)]
tests/acceptance: add a memory callback check

This test makes sure that the inline and callback based memory checks
count the same number of accesses.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210213130325.14781-24-alex.bennee@linaro.org>

3 years agotests/plugin: allow memory plugin to do both inline and callbacks
Alex Bennée [Sat, 13 Feb 2021 13:03:24 +0000 (13:03 +0000)]
tests/plugin: allow memory plugin to do both inline and callbacks

This is going to be useful for acceptance tests that check both types
are being called the same number of times, especially when icount is
enabled.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210213130325.14781-23-alex.bennee@linaro.org>

3 years agotests/acceptance: add a new tests to detect counting errors
Alex Bennée [Sat, 13 Feb 2021 13:03:23 +0000 (13:03 +0000)]
tests/acceptance: add a new tests to detect counting errors

The insn plugin has a simple heuristic to detect if an instruction is
detected running twice in a row. Check the plugin log after the run
and pass accordingly.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210213130325.14781-22-alex.bennee@linaro.org>

3 years agoaccel/tcg: allow plugin instrumentation to be disable via cflags
Alex Bennée [Sat, 13 Feb 2021 13:03:22 +0000 (13:03 +0000)]
accel/tcg: allow plugin instrumentation to be disable via cflags

When icount is enabled and we recompile an MMIO access we end up
double counting the instruction execution. To avoid this we introduce
the CF_MEMI cflag which only allows memory instrumentation for the
next TB (which won't yet have been counted). As this is part of the
hashed compile flags we will only execute the generated TB while
coming out of a cpu_io_recompile.

While we are at it delete the old TODO. We might as well keep the
translation handy as it's likely you will repeatedly hit it on each
MMIO access.

Reported-by: Aaron Lindsay <aaron@os.amperecomputing.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Aaron Lindsay <aaron@os.amperecomputing.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-21-alex.bennee@linaro.org>

3 years agoaccel/tcg: remove CF_NOCACHE and special cases
Alex Bennée [Sat, 13 Feb 2021 13:03:21 +0000 (13:03 +0000)]
accel/tcg: remove CF_NOCACHE and special cases

Now we no longer generate CF_NOCACHE blocks we can remove a bunch of
the special case handling for them. While we are at it we can remove
the unused tb->orig_tb field and save a few bytes on the TB structure.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-20-alex.bennee@linaro.org>

3 years agoaccel/tcg: re-factor non-RAM execution code
Alex Bennée [Sat, 13 Feb 2021 13:03:20 +0000 (13:03 +0000)]
accel/tcg: re-factor non-RAM execution code

There is no real need to use CF_NOCACHE here. As long as the TB isn't
linked to other TBs or included in the QHT or jump cache then it will
only get executed once.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-19-alex.bennee@linaro.org>

3 years agoaccel/tcg: cache single instruction TB on pending replay exception
Alex Bennée [Sat, 13 Feb 2021 13:03:19 +0000 (13:03 +0000)]
accel/tcg: cache single instruction TB on pending replay exception

Again there is no reason to jump through the nocache hoops to execute
a single instruction block. We do have to add an additional wrinkle to
the cpu_handle_interrupt case to ensure we let through a TB where we
have specifically disabled icount for the block.

As the last user of cpu_exec_nocache we can now remove the function.
Further clean-up will follow in subsequent patches.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-18-alex.bennee@linaro.org>

3 years agoaccel/tcg: actually cache our partial icount TB
Alex Bennée [Sat, 13 Feb 2021 13:03:18 +0000 (13:03 +0000)]
accel/tcg: actually cache our partial icount TB

When we exit a block under icount with instructions left to execute we
might need a shorter than normal block to take us to the next
deterministic event. Instead of creating a throwaway block on demand
we use the existing compile flags mechanism to ensure we fetch (or
compile and fetch) a block with exactly the number of instructions we
need.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-17-alex.bennee@linaro.org>

3 years agotests/acceptance: add a new set of tests to exercise plugins
Alex Bennée [Sat, 13 Feb 2021 13:03:17 +0000 (13:03 +0000)]
tests/acceptance: add a new set of tests to exercise plugins

This is just a simple test to count the instructions executed by a
kernel. However a later test will detect a failure condition when
icount is enabled.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210213130325.14781-16-alex.bennee@linaro.org>

3 years agotests/plugin: expand insn test to detect duplicate instructions
Alex Bennée [Sat, 13 Feb 2021 13:03:16 +0000 (13:03 +0000)]
tests/plugin: expand insn test to detect duplicate instructions

A duplicate insn is one that is appears to be executed twice in a row.
This is currently possible due to -icount and cpu_io_recompile()
causing a re-translation of a block. On it's own this won't trigger
any tests though.

The heuristics that the plugin use can't deal with the x86 rep
instruction which (validly) will look like executing the same
instruction several times. To avoid problems later we tweak the rules
for x86 to run the "inline" version of the plugin. This also has the
advantage of increasing coverage of the plugin code (see bugfix in
previous commit).

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-15-alex.bennee@linaro.org>

3 years agotarget/sh4: Create superh_io_recompile_replay_branch
Richard Henderson [Sat, 13 Feb 2021 13:03:15 +0000 (13:03 +0000)]
target/sh4: Create superh_io_recompile_replay_branch

Move the code from accel/tcg/translate-all.c to target/sh4/cpu.c.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210208233906.479571-5-richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-14-alex.bennee@linaro.org>

3 years agotarget/mips: Create mips_io_recompile_replay_branch
Richard Henderson [Sat, 13 Feb 2021 13:03:14 +0000 (13:03 +0000)]
target/mips: Create mips_io_recompile_replay_branch

Move the code from accel/tcg/translate-all.c to target/mips/cpu.c.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210208233906.479571-4-richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-13-alex.bennee@linaro.org>

3 years agoaccel/tcg: Create io_recompile_replay_branch hook
Richard Henderson [Sat, 13 Feb 2021 13:03:13 +0000 (13:03 +0000)]
accel/tcg: Create io_recompile_replay_branch hook

Create a hook in which to split out the mips and
sh4 ifdefs from cpu_io_recompile.

[AJB: s/stoped/stopped/]

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210208233906.479571-3-richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-12-alex.bennee@linaro.org>

3 years agoexec: Move TranslationBlock typedef to qemu/typedefs.h
Richard Henderson [Sat, 13 Feb 2021 13:03:12 +0000 (13:03 +0000)]
exec: Move TranslationBlock typedef to qemu/typedefs.h

This also means we don't need an extra declaration of
the structure in hw/core/cpu.h.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210208233906.479571-2-richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-11-alex.bennee@linaro.org>

3 years agoaccel/tcg/plugin-gen: fix the call signature for inline callbacks
Alex Bennée [Sat, 13 Feb 2021 13:03:11 +0000 (13:03 +0000)]
accel/tcg/plugin-gen: fix the call signature for inline callbacks

A recent change to the handling of constants in TCG changed the
pattern of ops emitted for a constant add. We no longer emit a mov and
the constant can be applied directly to the TCG_op_add arguments. This
was causing SEGVs when running the insn plugin with arg=inline. Fix
this by updating copy_add_i64 to do the right thing while also adding
a comment at the top of the append section as an aide memoir if
something like this happens again.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: Emilio G. Cota <cota@braap.org>
Message-Id: <20210213130325.14781-10-alex.bennee@linaro.org>

3 years agocontrib: Open brace '{' following struct go on the same line
zhouyang [Sat, 13 Feb 2021 13:03:10 +0000 (13:03 +0000)]
contrib: Open brace '{' following struct go on the same line

I found some style problems whil check the code using checkpatch.pl.
This commit fixs the issue below:
ERROR: that open brace { should be on the previous line

Signed-off-by: zhouyang <zhouyang789@huawei.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210118031004.1662363-6-zhouyang789@huawei.com>
Message-Id: <20210213130325.14781-9-alex.bennee@linaro.org>

3 years agocontrib: space required after that ','
zhouyang [Sat, 13 Feb 2021 13:03:09 +0000 (13:03 +0000)]
contrib: space required after that ','

I am reading contrib related code and found some style problems while
check the code using checkpatch.pl. This commit fixs the issue below:
ERROR: space required after that ','

Signed-off-by: zhouyang <zhouyang789@huawei.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210118031004.1662363-5-zhouyang789@huawei.com>
Message-Id: <20210213130325.14781-8-alex.bennee@linaro.org>

3 years agocontrib: Add spaces around operator
zhouyang [Sat, 13 Feb 2021 13:03:08 +0000 (13:03 +0000)]
contrib: Add spaces around operator

I am reading contrib related code and found some style problems while
check the code using checkpatch.pl. This commit fixs the issue below:
ERROR: spaces required around that '*'

Signed-off-by: zhouyang <zhouyang789@huawei.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210118031004.1662363-4-zhouyang789@huawei.com>
Message-Id: <20210213130325.14781-7-alex.bennee@linaro.org>

3 years agocontrib: Fix some code style problems, ERROR: "foo * bar" should be "foo *bar"
zhouyang [Sat, 13 Feb 2021 13:03:07 +0000 (13:03 +0000)]
contrib: Fix some code style problems, ERROR: "foo * bar" should be "foo *bar"

I am reading contrib related code and found some style problems while
check the code using checkpatch.pl. This commit fixs the issue below:
ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: zhouyang <zhouyang789@huawei.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210118031004.1662363-3-zhouyang789@huawei.com>
Message-Id: <20210213130325.14781-6-alex.bennee@linaro.org>

3 years agocontrib: Don't use '#' flag of printf format
zhouyang [Sat, 13 Feb 2021 13:03:06 +0000 (13:03 +0000)]
contrib: Don't use '#' flag of printf format

I am reading contrib related code and found some style problems while
check the code using checkpatch.pl. This commit fixs the misuse of
'#' flag of printf format

Signed-off-by: zhouyang <zhouyang789@huawei.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210118031004.1662363-2-zhouyang789@huawei.com>
Message-Id: <20210213130325.14781-5-alex.bennee@linaro.org>

3 years agoplugins: new hwprofile plugin
Alex Bennée [Sat, 13 Feb 2021 13:03:05 +0000 (13:03 +0000)]
plugins: new hwprofile plugin

This is a plugin intended to help with profiling access to various
bits of system hardware. It only really makes sense for system
emulation.

It takes advantage of the recently exposed helper API that allows us
to see the device name (memory region name) associated with a device.

You can specify arg=read or arg=write to limit the tracking to just
reads or writes (by default it does both).

The pattern option:

  -plugin ./tests/plugin/libhwprofile.so,arg=pattern

will allow you to see the access pattern to devices, eg:

  gic_cpu @ 0xffffffc010040000
    off:00000000, 8, 1, 8, 1
    off:00000000, 4, 1, 4, 1
    off:00000000, 2, 1, 2, 1
    off:00000000, 1, 1, 1, 1

The source option:

  -plugin ./tests/plugin/libhwprofile.so,arg=source

will track the virtual source address of the instruction making the
access:

  pl011 @ 0xffffffc010031000
    pc:ffffffc0104c785c, 1, 4, 0, 0
    pc:ffffffc0104c7898, 1, 4, 0, 0
    pc:ffffffc010512bcc, 2, 1867, 0, 0

You cannot mix source and pattern.

Finally the match option allow you to limit the tracking to just the
devices you care about.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Robert Foley <robert.foley@linaro.org>
Message-Id: <20210213130325.14781-4-alex.bennee@linaro.org>

3 years agoplugins: add API to return a name for a IO device
Alex Bennée [Sat, 13 Feb 2021 13:03:04 +0000 (13:03 +0000)]
plugins: add API to return a name for a IO device

This may well end up being anonymous but it should always be unique.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Clement Deschamps <clement.deschamps@greensocs.com>
Reviewed-by: Emilio G. Cota <cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210213130325.14781-3-alex.bennee@linaro.org>

3 years agohw/virtio/pci: include vdev name in registered PCI sections
Alex Bennée [Sat, 13 Feb 2021 13:03:03 +0000 (13:03 +0000)]
hw/virtio/pci: include vdev name in registered PCI sections

When viewing/debugging memory regions it is sometimes hard to figure
out which PCI device something belongs to. Make the names unique by
including the vdev name in the name string.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20210213130325.14781-2-alex.bennee@linaro.org>

3 years agoMerge remote-tracking branch 'remotes/dgilbert-gitlab/tags/pull-virtiofs-20210216...
Peter Maydell [Wed, 17 Feb 2021 14:44:18 +0000 (14:44 +0000)]
Merge remote-tracking branch 'remotes/dgilbert-gitlab/tags/pull-virtiofs-20210216' into staging

virtiofsd pull 2021-02-16

Vivek's support for new FUSE KILLPRIV_V2
and some smaller cleanups.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
# gpg: Signature made Tue 16 Feb 2021 18:34:32 GMT
# gpg:                using RSA key 45F5C71B4A0CB7FB977A9FA90516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>" [full]
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert-gitlab/tags/pull-virtiofs-20210216:
  virtiofsd: Do not use a thread pool by default
  viriofsd: Add support for FUSE_HANDLE_KILLPRIV_V2
  virtiofsd: Save error code early at the failure callsite
  tools/virtiofsd: Replace the word 'whitelist'
  virtiofsd: vu_dispatch locking should never fail
  virtiofsd: Allow to build it without the tools

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agousb/pcap: set flag_setup
Gerd Hoffmann [Tue, 16 Feb 2021 14:49:39 +0000 (15:49 +0100)]
usb/pcap: set flag_setup

Without that wireshark complains about invalid control setup data
for non-control transfers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20210216144939.841873-1-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
3 years agousb-host: use correct altsetting in usb_host_ep_update
Nick Rosbrook [Mon, 1 Feb 2021 21:30:21 +0000 (16:30 -0500)]
usb-host: use correct altsetting in usb_host_ep_update

In order to keep track of the alternate setting that should be used for
a given interface, the USBDevice struct keeps an array of alternate
setting values, which is indexed by the interface number. In
usb_host_set_interface, when this array is updated, usb_host_ep_update
is called as a result. However, when usb_host_ep_update accesses the
active libusb_config_descriptor, it indexes udev->altsetting with the
loop variable, rather than the interface number.

With the simple trace backend enable, this behavior can be seen:

  [...]

  usb_xhci_xfer_start 0.440 pid=1215 xfer=0x5596a4b85930 slotid=0x1 epid=0x1 streamid=0x0
  usb_packet_state_change 1.703 pid=1215 bus=0x1 port=b'1' ep=0x0 p=0x5596a4b85938 o=b'undef' n=b'setup'
  usb_host_req_control 2.269 pid=1215 bus=0x1 addr=0x5 p=0x5596a4b85938 req=0x10b value=0x1 index=0xd
  usb_host_set_interface 0.449 pid=1215 bus=0x1 addr=0x5 interface=0xd alt=0x1
  usb_host_parse_config 2542.648 pid=1215 bus=0x1 addr=0x5 value=0x2 active=0x1
  usb_host_parse_interface 1.804 pid=1215 bus=0x1 addr=0x5 num=0xc alt=0x0 active=0x1
  usb_host_parse_endpoint 2.012 pid=1215 bus=0x1 addr=0x5 ep=0x2 dir=b'in' type=b'int' active=0x1
  usb_host_parse_interface 1.598 pid=1215 bus=0x1 addr=0x5 num=0xd alt=0x0 active=0x1
  usb_host_req_emulated 3.593 pid=1215 bus=0x1 addr=0x5 p=0x5596a4b85938 status=0x0
  usb_packet_state_change 2.550 pid=1215 bus=0x1 port=b'1' ep=0x0 p=0x5596a4b85938 o=b'setup' n=b'complete'
  usb_xhci_xfer_success 4.298 pid=1215 xfer=0x5596a4b85930 bytes=0x0

  [...]

In particular, it is seen that although usb_host_set_interface sets the
alternate setting of interface 0xd to 0x1, usb_host_ep_update uses 0x0
as the alternate setting due to using the incorrect index to
udev->altsetting.

Fix this problem by getting the interface number from the active
libusb_config_descriptor, and then using that as the index to
udev->altsetting.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
Message-Id: <20210201213021.500277-1-rosbrookn@ainfosec.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>