]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
5 years agouhci: check device is not NULL before calling usb_ep_get()
Liam Merwick [Wed, 6 Feb 2019 13:36:53 +0000 (13:36 +0000)]
uhci: check device is not NULL before calling usb_ep_get()

In uhci_handle_td(), the call to ehci_find_device() can return NULL
if it doesn't find a device matching 'addr' so explicitly check
the return value before passing it to usb_ep_get().

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Message-id: 1549460216-25808-7-git-send-email-liam.merwick@oracle.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoohci: check device is not NULL before calling usb_ep_get()
Liam Merwick [Wed, 6 Feb 2019 13:36:52 +0000 (13:36 +0000)]
ohci: check device is not NULL before calling usb_ep_get()

A call to ohci_find_device() can return NULL if it doesn't find a
device matching 'addr' so for the two callers, explicitly check
the return value before passing it to usb_ep_get().

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Message-id: 1549460216-25808-6-git-send-email-liam.merwick@oracle.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoehci: check device is not NULL before calling usb_ep_get()
Liam Merwick [Wed, 6 Feb 2019 13:36:51 +0000 (13:36 +0000)]
ehci: check device is not NULL before calling usb_ep_get()

In ehci_process_itd(), the call to ehci_find_device() can return NULL
if it doesn't find a device matching 'devaddr' so explicitly check
the return value before passing it to usb_ep_get().

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Message-id: 1549460216-25808-5-git-send-email-liam.merwick@oracle.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoxhci: check device is not NULL before calling usb_ep_get()
Liam Merwick [Wed, 6 Feb 2019 13:36:50 +0000 (13:36 +0000)]
xhci: check device is not NULL before calling usb_ep_get()

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Message-id: 1549460216-25808-4-git-send-email-liam.merwick@oracle.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoxhci: add asserts to help with static code analysis
Liam Merwick [Wed, 6 Feb 2019 13:36:49 +0000 (13:36 +0000)]
xhci: add asserts to help with static code analysis

Most callers of xhci_port_update() and xhci_wakeup() pass in a pointer
to an array entry and can never be NULL but add two defensive asserts
to protect against future changes (e.g. adding a new port speed, etc.)
adding a path through xhci_lookup_port() that could result in the
return of a NULL XHCIPort.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Message-id: 1549460216-25808-3-git-send-email-liam.merwick@oracle.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agousb: rearrange usb_ep_get()
Liam Merwick [Wed, 6 Feb 2019 13:36:48 +0000 (13:36 +0000)]
usb: rearrange usb_ep_get()

There is no need to calculate the 'eps' variable in usb_ep_get()
if 'ep' is the control endpoint.  Instead the calculation should
be done after validating the input before returning an entry
indexed by the endpoint 'ep'.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Darren Kenny <Darren.Kenny@oracle.com>
Reviewed-by: Mark Kanda <Mark.Kanda@oracle.com>
Reviewed-by: Ameya More <ameya.more@oracle.com>
Message-id: 1549460216-25808-2-git-send-email-liam.merwick@oracle.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190219' into staging
Peter Maydell [Mon, 18 Feb 2019 16:20:13 +0000 (16:20 +0000)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190219' into staging

ppc patch queue 2019-02-19

Here's the next batch of ppc and spapr patches.  Higlights are:

 * A bunch of improvements to TCG handling of vector instructions from
   Richard Henderson and Marc Cave-Ayland

 * Cleanup to the XICS interrupt controller from Greg Kurz, removing
   the special KVM subclasses which were a bad idea

 * Some refinements to the XIVE interrupt controller from Cédric Le
   Goater

 * Fix from Fabiano Rosas for a really dumb buffer overflow in the
   device tree code for memory hotplug

 * Code for allowing access to SPRs from the gdb stub from Fabiano
   Rosas

 * Assorted minor fixes and cleanups

# gpg: Signature made Mon 18 Feb 2019 13:47:54 GMT
# gpg:                using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>" [full]
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>" [full]
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>" [full]
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>" [unknown]
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-4.0-20190219: (43 commits)
  target/ppc: convert vmin* and vmax* to vector operations
  target/ppc: convert vadd*s and vsub*s to vector operations
  target/ppc: Split out VSCR_SAT to a vector field
  target/ppc: Add set_vscr_sat
  target/ppc: Use mtvscr/mfvscr for vmstate
  target/ppc: Add helper_mfvscr
  target/ppc: Remove vscr_nj and vscr_sat
  target/ppc: Use helper_mtvscr for reset and gdb
  target/ppc: Pass integer to helper_mtvscr
  target/ppc: convert xxsel to vector operations
  target/ppc: convert xxspltw to vector operations
  target/ppc: convert xxspltib to vector operations
  target/ppc: convert VSX logical operations to vector operations
  target/ppc: convert vsplt[bhw] to use vector operations
  target/ppc: convert vspltis[bhw] to use vector operations
  target/ppc: convert vaddu[b,h,w,d] and vsubu[b,h,w,d] over to use vector operations
  target/ppc: convert VMX logical instructions to use vector operations
  xics: Drop the KVM ICS class
  spapr/irq: Use the "simple" ICS class for KVM
  xics: Handle KVM interrupt presentation from "simple" ICS code
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-02-18' into staging
Peter Maydell [Mon, 18 Feb 2019 14:23:13 +0000 (14:23 +0000)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-02-18' into staging

QAPI patches for 2019-02-18

# gpg: Signature made Mon 18 Feb 2019 13:44:30 GMT
# gpg:                using RSA key 3870B400EB918653
# 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-2019-02-18:
  qapi: move RTC_CHANGE to the target schema
  qmp: Deprecate query-events in favor of query-qmp-schema
  Revert "qapi-events: add 'if' condition to implicit event enum"
  qapi: remove qmp_unregister_command()
  qapi: make query-cpu-definitions depend on specific targets
  qapi: make query-cpu-model-expansion depend on s390 or x86
  qapi: make query-gic-capabilities depend on TARGET_ARM
  target.json: add a note about query-cpu* not being s390x-specific
  qapi: make s390 commands depend on TARGET_S390X
  qapi: make rtc-reset-reinjection and SEV depend on TARGET_I386
  qapi: New module target.json
  build: Deal with all of QAPI's .o in qapi/Makefile.objs
  build-sys: move qmp-introspect per target
  qapi: Generate QAPIEvent stuff into separate files
  qapi: Prepare for system modules other than 'builtin'
  qapi: Clean up modular built-in code generation a bit
  qapi: Fix up documentation for recent commit a95291007b2
  qapi: Belatedly document modular code generation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoqapi: move RTC_CHANGE to the target schema
Marc-André Lureau [Thu, 14 Feb 2019 15:22:51 +0000 (16:22 +0100)]
qapi: move RTC_CHANGE to the target schema

A few targets don't emit RTC_CHANGE, we could restrict the event to
the tagets that do emit it.

Note: There is a lot more of events & commands that we could restrict
to capable targets, with the cost of some additional complexity, but
the benefit of added correctness and better introspection.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-19-armbru@redhat.com>

5 years agoqmp: Deprecate query-events in favor of query-qmp-schema
Markus Armbruster [Thu, 14 Feb 2019 15:22:50 +0000 (16:22 +0100)]
qmp: Deprecate query-events in favor of query-qmp-schema

query-events doesn't reflect compile-time configuration.  Instead of
fixing that, deprecate the command in favor of query-qmp-schema.

Libvirt prefers query-qmp-schema as of commit 22d7222ec0 "qemu: caps:
Don't call 'query-events' when we probe events from QMP schema".
It'll be in the next release.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-18-armbru@redhat.com>

5 years agoRevert "qapi-events: add 'if' condition to implicit event enum"
Markus Armbruster [Thu, 14 Feb 2019 15:22:49 +0000 (16:22 +0100)]
Revert "qapi-events: add 'if' condition to implicit event enum"

This reverts commit 7bd263490590ee6fcf34ecb6203437e22f6e5a9c.

The commit applied the events' conditions to the members of enum
QAPIEvent.  Awkward, because it renders QAPIEvent unusable in
target-independent code as soon as we make an event target-dependent.
Reverting this has the following effects:

* ui/vnc.c can remain target independent.

* monitor_qapi_event_conf[] doesn't have to muck around with #ifdef.

* query-events again doesn't reflect conditionals.  I'm going to
  deprecate it in favor of query-qmp-schema.

Another option would be to split target-dependent parts off enum
QAPIEvent into a target-dependent enum.  Doesn't seem worthwhile right
now.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-17-armbru@redhat.com>

5 years agoqapi: remove qmp_unregister_command()
Marc-André Lureau [Thu, 14 Feb 2019 15:22:48 +0000 (16:22 +0100)]
qapi: remove qmp_unregister_command()

This command is no longer needed, the schema has compile-time
configuration conditions.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-16-armbru@redhat.com>

5 years agoqapi: make query-cpu-definitions depend on specific targets
Marc-André Lureau [Thu, 14 Feb 2019 15:22:47 +0000 (16:22 +0100)]
qapi: make query-cpu-definitions depend on specific targets

It depends on TARGET_PPC || TARGET_ARM || TARGET_I386 || TARGET_S390X.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-15-armbru@redhat.com>

5 years agoqapi: make query-cpu-model-expansion depend on s390 or x86
Marc-André Lureau [Thu, 14 Feb 2019 15:22:46 +0000 (16:22 +0100)]
qapi: make query-cpu-model-expansion depend on s390 or x86

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-14-armbru@redhat.com>

5 years agoqapi: make query-gic-capabilities depend on TARGET_ARM
Marc-André Lureau [Thu, 14 Feb 2019 15:22:45 +0000 (16:22 +0100)]
qapi: make query-gic-capabilities depend on TARGET_ARM

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-13-armbru@redhat.com>

5 years agotarget.json: add a note about query-cpu* not being s390x-specific
Marc-André Lureau [Thu, 14 Feb 2019 15:22:44 +0000 (16:22 +0100)]
target.json: add a note about query-cpu* not being s390x-specific

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-12-armbru@redhat.com>

5 years agoqapi: make s390 commands depend on TARGET_S390X
Marc-André Lureau [Thu, 14 Feb 2019 15:22:43 +0000 (16:22 +0100)]
qapi: make s390 commands depend on TARGET_S390X

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-11-armbru@redhat.com>

5 years agoqapi: make rtc-reset-reinjection and SEV depend on TARGET_I386
Marc-André Lureau [Thu, 14 Feb 2019 15:22:42 +0000 (16:22 +0100)]
qapi: make rtc-reset-reinjection and SEV depend on TARGET_I386

Move rtc-reset-reinjection and SEV in target.json and make them
conditional on TARGET_I386.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-10-armbru@redhat.com>

5 years agoqapi: New module target.json
Markus Armbruster [Thu, 14 Feb 2019 15:22:41 +0000 (16:22 +0100)]
qapi: New module target.json

We can't add appropriate target-specific conditionals to misc.json,
because that would make all of misc.json unusable in
target-independent code.  To keep misc.json target-independent, we
need to split off target-dependent target.json.

This commit doesn't actually split off anything, it merely creates the
empty module.  The next few patches will move stuff from misc.json
there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-9-armbru@redhat.com>

5 years agobuild: Deal with all of QAPI's .o in qapi/Makefile.objs
Markus Armbruster [Thu, 14 Feb 2019 15:22:40 +0000 (16:22 +0100)]
build: Deal with all of QAPI's .o in qapi/Makefile.objs

Adding QAPI's .o to util-obj-y, common-obj-y and obj-y is spread over
three places: Makefile.objs takes care of target-independent generated
code, Makefile.target of target-dependent generated code, and
qapi/Makefile.objs of (target-independent) hand-written code.

Do everything in qapi/Makefile.objs.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-8-armbru@redhat.com>

5 years agobuild-sys: move qmp-introspect per target
Marc-André Lureau [Thu, 14 Feb 2019 15:22:39 +0000 (16:22 +0100)]
build-sys: move qmp-introspect per target

The following patches are going to introduce per-target #ifdef in the
schemas.

The introspection data is statically generated once, and must thus be
built per-target to reflect target-specific configuration.

Drop "do_test_visitor_in_qmp_introspect(&qmp_schema_qlit)" since the
schema is no longer in a common object. It is covered by the per-target
query-qmp-schema test instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190214152251.2073-7-armbru@redhat.com>

5 years agoqapi: Generate QAPIEvent stuff into separate files
Markus Armbruster [Thu, 14 Feb 2019 15:22:38 +0000 (16:22 +0100)]
qapi: Generate QAPIEvent stuff into separate files

Having to include qapi-events.h just for QAPIEvent is suboptimal, but
quite tolerable now.  It'll become problematic when we have events
conditional on the target, because then qapi-events.h won't be usable
from target-independent code anymore.  Avoid that by generating it
into separate files.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-6-armbru@redhat.com>

5 years agoqapi: Prepare for system modules other than 'builtin'
Markus Armbruster [Thu, 14 Feb 2019 15:22:37 +0000 (16:22 +0100)]
qapi: Prepare for system modules other than 'builtin'

The next commit wants to generate qapi-emit-events.{c.h}.  To enable
that, extend QAPISchemaModularCVisitor to support additional "system
modules", i.e. modules that don't correspond to a (user-defined) QAPI
schema module.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-5-armbru@redhat.com>

5 years agoqapi: Clean up modular built-in code generation a bit
Markus Armbruster [Thu, 14 Feb 2019 15:22:36 +0000 (16:22 +0100)]
qapi: Clean up modular built-in code generation a bit

We neglect to call .visit_module() for the special module we use for
built-ins.  Harmless, but clean it up anyway.  The
tests/qapi-schema/*.out now show the built-in module as 'module None'.

Subclasses of QAPISchemaModularCVisitor need to ._add_module() this
special module to enable code generation for built-ins.  When this
hasn't been done, QAPISchemaModularCVisitor.visit_module() does
nothing for the special module.  That looks like built-ins could
accidentally be generated into the wrong module when a subclass
neglects to call ._add_module().  Can't happen, because built-ins are
all visited before any other module.  But that's non-obvious.  Switch
off code generation explicitly.

Rename QAPISchemaModularCVisitor._begin_module() to
._begin_user_module().

New QAPISchemaModularCVisitor._is_builtin_module(), for clarity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-4-armbru@redhat.com>

5 years agoqapi: Fix up documentation for recent commit a95291007b2
Markus Armbruster [Thu, 14 Feb 2019 15:22:35 +0000 (16:22 +0100)]
qapi: Fix up documentation for recent commit a95291007b2

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-3-armbru@redhat.com>

5 years agoqapi: Belatedly document modular code generation
Markus Armbruster [Thu, 14 Feb 2019 15:22:34 +0000 (16:22 +0100)]
qapi: Belatedly document modular code generation

We generate code for built-ins and sub-modules into separate files
since commit cdb6610ae42 and 252dc3105fc (v2.12.0).  Both commits
neglected to update documentation.  Do that now.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190214152251.2073-2-armbru@redhat.com>

5 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20190218' into staging
Peter Maydell [Mon, 18 Feb 2019 11:32:00 +0000 (11:32 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20190218' into staging

s390x updates:
- tcg: implement STCK and friends for CONFIG_USER_ONLY
- add zpci to qemu cpu model, as pci is now always built
- add mepoch to default z14 cpu model
- add cpu model for z14 GA2
- various improvements

# gpg: Signature made Mon 18 Feb 2019 11:06:23 GMT
# gpg:                using RSA key C3D0D66DC3624FF6A8C018CEDECF6B93C6F02FAF
# gpg:                issuer "cohuck@redhat.com"
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" [unknown]
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" [full]
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>" [full]
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>" [unknown]
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>" [unknown]
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20190218:
  s390x: upgrade status of KVM cores to "supported"
  s390x/kvm: add tracepoint to ioeventfd interface
  s390x/cpumodel: add z14 GA2 model
  s390x/cpumodel: default enable mepoch for z14 and later
  s390x/cpumodel: mepochptff: warn when no mepoch and re-align group init
  s390x: add zPCI feature to "qemu" CPU model
  target/s390x: Implement STCK et al for CONFIG_USER_ONLY
  target/s390x: Split out s390-tod.h
  s390x: always provide pci support
  s390x: Fix the confusing contributions-after-2012 license statements

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agos390x: upgrade status of KVM cores to "supported"
Cornelia Huck [Wed, 13 Feb 2019 10:31:59 +0000 (11:31 +0100)]
s390x: upgrade status of KVM cores to "supported"

We are actually paid to look after this.

Message-Id: <20190213103519.32585-1-cohuck@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/kvm: add tracepoint to ioeventfd interface
Cornelia Huck [Tue, 12 Feb 2019 14:50:00 +0000 (15:50 +0100)]
s390x/kvm: add tracepoint to ioeventfd interface

Trace when assigning/unassigning.

Message-Id: <20190212153025.25425-1-cohuck@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/cpumodel: add z14 GA2 model
Collin Walling [Tue, 12 Feb 2019 01:16:57 +0000 (20:16 -0500)]
s390x/cpumodel: add z14 GA2 model

Introduce the z14 GA2 cpu model for QEMU. There are no new features
introduced with this model, and will inherit the same feature set as
z14 GA1.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190212011657.18324-3-walling@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/cpumodel: default enable mepoch for z14 and later
Collin Walling [Tue, 12 Feb 2019 01:16:56 +0000 (20:16 -0500)]
s390x/cpumodel: default enable mepoch for z14 and later

Latest systems and host kernels support mepoch, which is a
feature that was meant to be supported for z14 GA1 from the
get-go. Let's copy it to the z14 GA1 default CPU model.

Machines s390-ccw-virtio-3.1 and older will retain the old CPU
models and will not provide this bit nor the extended PTFF
functions in the default model.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <20190212011657.18324-2-walling@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x/cpumodel: mepochptff: warn when no mepoch and re-align group init
Collin Walling [Tue, 12 Feb 2019 01:16:55 +0000 (20:16 -0500)]
s390x/cpumodel: mepochptff: warn when no mepoch and re-align group init

The extended PTFF features (qsie, qtoue, stoe, stoue) are dependent
on the multiple-epoch facility (mepoch). Let's print a warning if these
features are enabled without mepoch.

While we're at it, let's move the FEAT_GROUP_INIT for mepochptff down
the s390_feature_groups list so it can be properly indexed with its
generated S390FeatGroup enum.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Message-Id: <20190212011657.18324-1-walling@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x: add zPCI feature to "qemu" CPU model
David Hildenbrand [Tue, 12 Feb 2019 11:23:23 +0000 (12:23 +0100)]
s390x: add zPCI feature to "qemu" CPU model

As we now always have PCI support, let's add it to the "qemu" CPU model,
taking care of backwards compatibility.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190212112323.15904-1-david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agotarget/s390x: Implement STCK et al for CONFIG_USER_ONLY
Richard Henderson [Tue, 12 Feb 2019 05:30:44 +0000 (21:30 -0800)]
target/s390x: Implement STCK et al for CONFIG_USER_ONLY

This is a non-privileged instruction that was only implemented
for system mode.  However, the stck instruction is used by glibc,
so this was causing SIGILL for programs run under debian stretch.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20190212053044.29015-3-richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agotarget/s390x: Split out s390-tod.h
Richard Henderson [Tue, 12 Feb 2019 05:30:43 +0000 (21:30 -0800)]
target/s390x: Split out s390-tod.h

We will need these from CONFIG_USER_ONLY as well,
which cannot access include/hw/.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20190212053044.29015-2-richard.henderson@linaro.org>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x: always provide pci support
Cornelia Huck [Mon, 11 Feb 2019 11:32:55 +0000 (12:32 +0100)]
s390x: always provide pci support

We tried to make pci support optional on s390x in the past;
unfortunately, we still require the s390 phb to be created
unconditionally due to backwards compatibility issues.

Instead of sinking more effort into this (including compat
handling for older machines etc.) for non-obvious gains, let's
just make CONFIG_PCI something that is always set on s390x.

Note that you can still fence off pci for the _guest_ if you
provide a cpu model without the zpci feature.

Message-Id: <20190211113255.3837-1-cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agos390x: Fix the confusing contributions-after-2012 license statements
Thomas Huth [Wed, 6 Feb 2019 12:41:33 +0000 (13:41 +0100)]
s390x: Fix the confusing contributions-after-2012 license statements

The license information in these files is rather confusing. The text
declares LGPL first, but then says that contributions after 2012 are
licensed under the GPL instead. How should the average user who just
downloaded the release tarball know which part is now GPL and which
is LGPL?

Looking at the text of the LGPL (see COPYING.LIB in the top directory),
the license clearly states how this should be done instead:

"3. You may opt to apply the terms of the ordinary GNU General Public
 License instead of this License to a given copy of the Library. To do
 this, you must alter all the notices that refer to this License, so
 that they refer to the ordinary GNU General Public License, version 2,
 instead of to this License."

Thus let's clean up the confusing statements and use the proper GPL
text only.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1549456893-16589-1-git-send-email-thuth@redhat.com>
Acked-by: Laurent Vivier <laurent@vivier.eu>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
5 years agotarget/ppc: convert vmin* and vmax* to vector operations
Richard Henderson [Fri, 15 Feb 2019 10:00:58 +0000 (10:00 +0000)]
target/ppc: convert vmin* and vmax* to vector operations

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-18-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert vadd*s and vsub*s to vector operations
Richard Henderson [Fri, 15 Feb 2019 10:00:57 +0000 (10:00 +0000)]
target/ppc: convert vadd*s and vsub*s to vector operations

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-17-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Split out VSCR_SAT to a vector field
Richard Henderson [Fri, 15 Feb 2019 10:00:56 +0000 (10:00 +0000)]
target/ppc: Split out VSCR_SAT to a vector field

Change the representation of VSCR_SAT such that it is easy
to set from vector code.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-16-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Add set_vscr_sat
Richard Henderson [Fri, 15 Feb 2019 10:00:55 +0000 (10:00 +0000)]
target/ppc: Add set_vscr_sat

This is required before changing the representation of the register.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-15-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Use mtvscr/mfvscr for vmstate
Richard Henderson [Fri, 15 Feb 2019 10:00:54 +0000 (10:00 +0000)]
target/ppc: Use mtvscr/mfvscr for vmstate

This is required before changing the representation of the register.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-14-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Add helper_mfvscr
Richard Henderson [Fri, 15 Feb 2019 10:00:53 +0000 (10:00 +0000)]
target/ppc: Add helper_mfvscr

This is required before changing the representation of the register.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-13-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Remove vscr_nj and vscr_sat
Richard Henderson [Fri, 15 Feb 2019 10:00:52 +0000 (10:00 +0000)]
target/ppc: Remove vscr_nj and vscr_sat

These macros are no longer used.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-12-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Use helper_mtvscr for reset and gdb
Richard Henderson [Fri, 15 Feb 2019 10:00:51 +0000 (10:00 +0000)]
target/ppc: Use helper_mtvscr for reset and gdb

Not setting flush_to_zero from gdb_set_avr_reg was a bug.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-11-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Pass integer to helper_mtvscr
Richard Henderson [Fri, 15 Feb 2019 10:00:50 +0000 (10:00 +0000)]
target/ppc: Pass integer to helper_mtvscr

We can re-use this helper elsewhere if we're not passing
in an entire vector register.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-10-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert xxsel to vector operations
Richard Henderson [Fri, 15 Feb 2019 10:00:49 +0000 (10:00 +0000)]
target/ppc: convert xxsel to vector operations

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-9-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert xxspltw to vector operations
Richard Henderson [Fri, 15 Feb 2019 10:00:48 +0000 (10:00 +0000)]
target/ppc: convert xxspltw to vector operations

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-8-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert xxspltib to vector operations
Richard Henderson [Fri, 15 Feb 2019 10:00:47 +0000 (10:00 +0000)]
target/ppc: convert xxspltib to vector operations

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-7-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert VSX logical operations to vector operations
Richard Henderson [Fri, 15 Feb 2019 10:00:46 +0000 (10:00 +0000)]
target/ppc: convert VSX logical operations to vector operations

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-6-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert vsplt[bhw] to use vector operations
Richard Henderson [Fri, 15 Feb 2019 10:00:45 +0000 (10:00 +0000)]
target/ppc: convert vsplt[bhw] to use vector operations

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-5-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert vspltis[bhw] to use vector operations
Richard Henderson [Fri, 15 Feb 2019 10:00:44 +0000 (10:00 +0000)]
target/ppc: convert vspltis[bhw] to use vector operations

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20190215100058.20015-4-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert vaddu[b,h,w,d] and vsubu[b,h,w,d] over to use vector operations
Mark Cave-Ayland [Fri, 15 Feb 2019 10:00:43 +0000 (10:00 +0000)]
target/ppc: convert vaddu[b,h,w,d] and vsubu[b,h,w,d] over to use vector operations

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-3-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: convert VMX logical instructions to use vector operations
Mark Cave-Ayland [Fri, 15 Feb 2019 10:00:42 +0000 (10:00 +0000)]
target/ppc: convert VMX logical instructions to use vector operations

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20190215100058.20015-2-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxics: Drop the KVM ICS class
Greg Kurz [Fri, 15 Feb 2019 11:40:41 +0000 (12:40 +0100)]
xics: Drop the KVM ICS class

The KVM ICS class isn't used anymore. Drop it.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023084177.1011724.14693955932559990358.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agospapr/irq: Use the "simple" ICS class for KVM
Greg Kurz [Fri, 15 Feb 2019 11:40:35 +0000 (12:40 +0100)]
spapr/irq: Use the "simple" ICS class for KVM

The "simple" ICS class knows how to interract with KVM. Adapt sPAPR to use
it instead of the ICS KVM class.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023083585.1011724.2868047424353921455.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxics: Handle KVM interrupt presentation from "simple" ICS code
Greg Kurz [Fri, 15 Feb 2019 11:40:30 +0000 (12:40 +0100)]
xics: Handle KVM interrupt presentation from "simple" ICS code

We want to use the "simple" ICS type in both KVM and non-KVM setups.
Teach the "simple" ICS how to present interrupts to KVM and adapt
sPAPR accordingly.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023082996.1011724.16237920586343905010.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxics: Handle KVM ICS reset from the "simple" ICS code
Greg Kurz [Fri, 15 Feb 2019 11:40:24 +0000 (12:40 +0100)]
xics: Handle KVM ICS reset from the "simple" ICS code

The KVM ICS reset handler simply writes the ICS state to KVM. This
doesn't need the overkill parent_reset logic we have today. Also
we want to use the same ICS type for the KVM and non-KVM case with
pseries.

Call icp_set_kvm_state() from the "simple" ICS reset function.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023082407.1011724.1983100830860273401.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxics: Explicitely call KVM ICS methods from the common code
Greg Kurz [Fri, 15 Feb 2019 11:40:18 +0000 (12:40 +0100)]
xics: Explicitely call KVM ICS methods from the common code

The pre_save(), post_load() and synchronize_state() methods of the
ICSStateClass type are really KVM only things. Make that obvious
by dropping the indirections and directly calling the KVM functions
instead.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023081817.1011724.14078777320394028836.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxics: Drop the KVM ICP class
Greg Kurz [Fri, 15 Feb 2019 11:40:12 +0000 (12:40 +0100)]
xics: Drop the KVM ICP class

The KVM ICP class isn't used anymore. Drop it.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023081228.1011724.12474992370439652538.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agospapr/irq: Use the base ICP class for KVM
Greg Kurz [Fri, 15 Feb 2019 11:40:06 +0000 (12:40 +0100)]
spapr/irq: Use the base ICP class for KVM

The base ICP class knows how to interact with KVM. Adapt sPAPR to use it
instead of the ICP KVM class.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023080638.1011724.792095453419098948.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxics: Handle KVM ICP realize from the common code
Greg Kurz [Fri, 15 Feb 2019 11:40:00 +0000 (12:40 +0100)]
xics: Handle KVM ICP realize from the common code

The realization of KVM ICP currently follows the parent_realize logic,
which is a bit overkill here. Also we want to get rid of the KVM ICP
class. Explicitely call icp_kvm_realize() from the base ICP realize
function.

Note that ICPStateClass::parent_realize is retained because powernv
needs it.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023080049.1011724.15423463482790260696.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxics: Handle KVM ICP reset from the common code
Greg Kurz [Fri, 15 Feb 2019 11:39:54 +0000 (12:39 +0100)]
xics: Handle KVM ICP reset from the common code

The KVM ICP reset handler simply writes the ICP state to KVM. This
doesn't need the overkill parent_reset logic we have today. Call
icp_set_kvm_state() from the base ICP reset function instead.

Since there are no other users for ICPStateClass::parent_reset, and
it isn't currently expected to change, drop it as well.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023079461.1011724.12644984391500635645.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxics: Explicitely call KVM ICP methods from the common code
Greg Kurz [Fri, 15 Feb 2019 11:39:48 +0000 (12:39 +0100)]
xics: Explicitely call KVM ICP methods from the common code

The pre_save(), post_load() and synchronize_state() methods of the
ICPStateClass type are really KVM only things. Make that obvious
by dropping the indirections and directly calling the KVM functions
instead.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155023078871.1011724.3083923389814185598.stgit@bahia.lan>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agospapr/irq: remove the XICS offset adjustment
Cédric Le Goater [Wed, 13 Feb 2019 21:07:56 +0000 (22:07 +0100)]
spapr/irq: remove the XICS offset adjustment

Now that we have changed the XICS and the XIVE interrupt backend to
have different size for their IRQ number space, we do not need to
align their source numbers anymore. Remove the offset adjustment and
wire the dual 'qirq' handler to the 'qirq' handler of the current
interrupt mode in use.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20190213210756.27032-3-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agospapr/irq: add an 'nr_irq' parameter to initialize the backend.
Cédric Le Goater [Wed, 13 Feb 2019 21:07:55 +0000 (22:07 +0100)]
spapr/irq: add an 'nr_irq' parameter to initialize the backend.

When using the 'dual' interrupt mode, the source numbers of both sPAPR
IRQ backends are aligned to share a common IRQ number space and to use
a similar mapping of the machine qemu_irq array which is indexed by
the source number.

The XICS IRQ number range initially being [ 0x1000 - 0x2000 ], this
requires to change the XICS ICSState offset to 0 and to provision for
an extra 4K of source numbers and qemu_irqs which will never be used
by the machine when running under the XICS interrupt mode. This is not
an optimal solution.

Change the init() method to allocate an IRQ number space of the
expected size for the XICS sPAPR IRQ backend. It breaks the interrupt
signaling when under the 'dual' mode because source numbers have
unexpected values but next patch will fix that.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20190213210756.27032-2-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agospapr: fix out of bounds write in spapr_populate_drmem_v2
Fabiano Rosas [Wed, 13 Feb 2019 17:29:26 +0000 (15:29 -0200)]
spapr: fix out of bounds write in spapr_populate_drmem_v2

buf_len is uint8_t which is not large enough to hold the result of:

  nr_entries * sizeof(struct sPAPRDrconfCellV2) + sizeof(uint32_t);

for a nr_entries greater than 10.

This causes the allocated buffer 'int_buf' to be smaller than expected
and we eventually overwrite some of glibc's control structures (see
"chunk" in https://sourceware.org/glibc/wiki/MallocInternals)

The following error is seen while trying to free int_buf:

  "free(): invalid next size (fast)"

Fixes: a324d6f166 "spapr: Support ibm,dynamic-memory-v2 property"
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Message-Id: <20190213172926.21740-1-farosas@linux.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Disable ISA 2.06 PM instructions on POWER9
Benjamin Herrenschmidt [Mon, 28 Jan 2019 09:46:18 +0000 (10:46 +0100)]
target/ppc: Disable ISA 2.06 PM instructions on POWER9

The ISA 2.06/2.07 Power Management instructions (doze, nap & rvwinkle)
don't exist on POWER9, don't enable them.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20190128094625.4428-13-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoqdev: pass an Object * to qbus_set_hotplug_handler()
Michael Roth [Tue, 12 Feb 2019 18:24:59 +0000 (19:24 +0100)]
qdev: pass an Object * to qbus_set_hotplug_handler()

Certain devices types, like memory/CPU, are now being handled using a
hotplug interface provided by a top-level MachineClass. Hotpluggable
host bridges are another such device where it makes sense to use a
machine-level hotplug handler. However, unlike those devices,
host-bridges have a parent bus (the main system bus), and devices with
a parent bus use a different mechanism for registering their hotplug
handlers: qbus_set_hotplug_handler(). This interface currently expects
a handler to be a subclass of DeviceClass, but this is not the case
for MachineClass, which derives directly from ObjectClass.

Internally, the interface only requires an ObjectClass, so expose that
in qbus_set_hotplug_handler().

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <154999589921.690774.3640149277362188566.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoxive: Only set source type for LSIs
Greg Kurz [Tue, 12 Feb 2019 18:24:06 +0000 (19:24 +0100)]
xive: Only set source type for LSIs

MSI is the default and LSI specific code is guarded by the
xive_source_irq_is_lsi() helper. The xive_source_irq_set()
helper is a nop for MSIs.

Simplify the code by turning xive_source_irq_set() into
xive_source_irq_set_lsi() and only call it for LSIs. The
call to xive_source_irq_set(false) in spapr_xive_irq_free()
is also a nop. Just drop it.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <154999584656.690774.18352404495120358613.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoppc: fix crash during branch stepping
Roman Kapl [Tue, 12 Feb 2019 12:12:55 +0000 (13:12 +0100)]
ppc: fix crash during branch stepping

The PPC BRANCH exception could bubble up, but this is an QEMU internal exception
and QEMU then crased. Instead it should trigger TRACE exception, according to
PPC 2.07 book. It could happen only when using branch stepping, which is not
commonly used.

Change gen_prep_dbgex do do trigger TRACE. The excp, argument is now removed,
since the type of exception can be inferred from the singlestep_enabled flags.
removed the guards around gen_exception, since they are unnecessary.

Fixes: 0e3bf48909 ("ppc: add DBCR based debugging").
Signed-off-by: Roman Kapl <rka@sysgo.com>
Message-Id: <20190212121255.2279-1-rka@sysgo.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Remove some #if 0'ed code
Benjamin Herrenschmidt [Mon, 28 Jan 2019 09:46:12 +0000 (10:46 +0100)]
target/ppc: Remove some #if 0'ed code

Some debug stuff we don't need to keep there

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20190128094625.4428-7-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agomac_newworld: change default NIC to sungem for mac99 machine
Mark Cave-Ayland [Fri, 8 Feb 2019 17:22:01 +0000 (17:22 +0000)]
mac_newworld: change default NIC to sungem for mac99 machine

This model brings out-of-the-box networking for all of Linux, MacOS 9 and OS X
without requiring the installation of additional drivers.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20190208172201.29001-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agospapr: Disallow unsupported kernel-irqchip settings
Greg Kurz [Fri, 8 Feb 2019 18:17:47 +0000 (19:17 +0100)]
spapr: Disallow unsupported kernel-irqchip settings

Split mode doesn't make sense on pseries, neither with XICS nor XIVE. But
passing kernel-irqchip=split silently behaves like kernel-irqchip=on.
Other architectures that support kernel-irqchip do terminate QEMU when
split mode is requested but not available though. Do the same with pseries
for consistency.

Similarly, passing kernel-irqchip=on,accel=tcg starts the machine with the
emulated interrupt controller, ie, behaves like kernel-irqchip=off. However,
when passing  kernel-irqchip=on,accel=kvm, if we can't initialize the KVM
XICS for some reason, ie, xics_kvm_init() fails, then QEMU is terminated.
This is inconsistent. Terminate QEMU all the same when requesting the
in-kernel interrupt controller without KVM.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <154964986747.291716.2679312373018476920.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agocuda: decrease time delay before raising VIA SR interrupt and remove fast path
Mark Cave-Ayland [Sun, 10 Feb 2019 17:44:21 +0000 (17:44 +0000)]
cuda: decrease time delay before raising VIA SR interrupt and remove fast path

In order to handle a race condition in the MacOS 9 CUDA driver, a
delay was introduced when raising the VIA SR interrupt inspired by
similar code in MacOnLinux.

During original testing of the MacOS 9 patches it was found that the
30us delay used in MacOnLinux did not work reliably within QEMU, and a
value of 300us was required to function correctly.

Recent experiments have shown two things: firstly when booting Linux,
MacOS 9 and MacOS X the fast path which bypasses the delay is never
triggered once the OS kernel is loaded making it effectively
useless. Rather than leave this code in place where a guest could
potentially enable it by accident and break itself, we might as well
just remove it.

Secondly the previous reliability issues are no longer present, and
this value can be reduced down to 20us with no apparent ill
effects. This has the benefit of considerably improving the
responsiveness of the ADB keyboard and mouse within the guest.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agospapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path
Greg Kurz [Thu, 7 Feb 2019 17:28:37 +0000 (18:28 +0100)]
spapr_pci: Fix interrupt leak in rtas_ibm_change_msi() error path

Now that IRQ allocation has been split in two (first allocate IRQ numbers,
then claim them), if the claiming fails, we must release the IRQs.

Fixes: 4fe75a8ccd80 "spapr: split the IRQ allocation sequence"
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Fix msync to do what hardware does
BALATON Zoltan [Sat, 26 Jan 2019 14:50:28 +0000 (15:50 +0100)]
target/ppc: Fix msync to do what hardware does

According to BookE docs, invalid bits (while undefined behaviour) should
not raise exception but be ignored. This seems to be implementation
dependent though and QEMU currently does what e500 CPUs do and raise
exception for invalid bits. Unfortunately some versions of libstdc++
(and so all programs compiled with it) have lwsync on PPC440 which is
invalid but on real hardware it's just executed as msync ignoring the
invalid bits (maybe that's why it got undetected) but they fail on QEMU.
This patch changes invalid mask of msync to allow these programs to run
but keep generating exception on e500 cores to follow what hardware does.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agotarget/ppc: Enable reporting of SPRs to GDB
Fabiano Rosas [Wed, 6 Feb 2019 16:51:33 +0000 (14:51 -0200)]
target/ppc: Enable reporting of SPRs to GDB

This allows reading and writing of SPRs via GDB:

(gdb) p/x $srr1
$1 = 0x8000000002803033

(gdb) p/x $pvr
$2 = 0x4b0201
(gdb) set $pvr=0x4b0000
(gdb) p/x $pvr
$3 = 0x4b0000

The `info` command can also be used:
(gdb) info registers spr

For this purpose, GDB needs to be provided with an XML description of
the registers (see the gdb-xml directory for examples) and a set of
callbacks for reading and writing the registers must be defined.

The XML file in this case is created dynamically, based on the SPRs
already defined in the machine. This way we avoid the need for several
XML files to suit each possible ppc machine.

The gdb_{get,set}_spr_reg callbacks take an index based on the order
the registers appear in the XML file. This index does not match the
actual location of the registers in the env->spr array so the
gdb_find_spr_idx function does that conversion.

Note: GDB currently needs to know the guest endianness in order to
properly print the registers values. This is done automatically by GDB
when provided with the ELF file or explicitly with the `set endian
<big|little>` command.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agospapr: Rename xics to intc in interrupt controller agnostic code
Greg Kurz [Thu, 17 Jan 2019 17:14:39 +0000 (18:14 +0100)]
spapr: Rename xics to intc in interrupt controller agnostic code

All this code is used with both the XICS and XIVE interrupt controllers.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agohw/ppc/prep: Drop useless inclusion of "hw/i386/pc.h"
Philippe Mathieu-Daudé [Mon, 4 Feb 2019 21:04:33 +0000 (22:04 +0100)]
hw/ppc/prep: Drop useless inclusion of "hw/i386/pc.h"

In 47973a2dbf we split the last generic chipset out of the PC
board, but forgot to remove the include of "hw/i386/pc.h".
Since it is now unused, remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
5 years agoMerge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-20190215' into...
Peter Maydell [Fri, 15 Feb 2019 11:12:14 +0000 (11:12 +0000)]
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-20190215' into staging

qemu-openbios queue

# gpg: Signature made Fri 15 Feb 2019 10:31:11 GMT
# gpg:                using RSA key CC621AB98E82200D915CC9C45BC2C56FAE0F321F
# gpg:                issuer "mark.cave-ayland@ilande.co.uk"
# gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" [full]
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* remotes/mcayland/tags/qemu-openbios-20190215:
  Update OpenBIOS images to 3464681b built from submodule.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190215' into...
Peter Maydell [Fri, 15 Feb 2019 10:20:04 +0000 (10:20 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190215' into staging

target-arm queue:
 * gdbstub: Send a reply to the vKill packet
 * Improve codegen for neon min/max and saturating arithmetic
 * Fix a bug in clearing FPSCR exception status bits
 * hw/arm/armsse: Fix miswiring of expansion IRQs
 * hw/intc/armv7m_nvic: Allow byte accesses to SHPR1
 * MAINTAINERS: Remove Peter Crosthwaite from various entries
 * arm: Allow system registers for KVM guests to be changed by QEMU code
 * linux-user: support HWCAP_CPUID which exposes ID registers to user code
 * Fix bug in 128-bit cmpxchg for BE Arm guests
 * Implement (no-op) HACR_EL2
 * Fix CRn to be 14 for PMEVTYPER/PMEVCNTR

# gpg: Signature made Fri 15 Feb 2019 10:19:14 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20190215: (25 commits)
  gdbstub: Send a reply to the vKill packet.
  target/arm: Add missing clear_tail calls
  target/arm: Use vector operations for saturation
  target/arm: Split out FPSCR.QC to a vector field
  target/arm: Fix set of bits kept in xregs[ARM_VFP_FPSCR]
  target/arm: Split out flags setting from vfp compares
  target/arm: Fix arm_cpu_dump_state vs FPSCR
  target/arm: Fix vfp_gdb_get/set_reg vs FPSCR
  target/arm: Remove neon min/max helpers
  target/arm: Use tcg integer min/max primitives for neon
  target/arm: Use vector minmax expanders for aarch32
  target/arm: Use vector minmax expanders for aarch64
  target/arm: Rely on optimization within tcg_gen_gvec_or
  hw/arm/armsse: Fix miswiring of expansion IRQs
  hw/intc/armv7m_nvic: Allow byte accesses to SHPR1
  MAINTAINERS: Remove Peter Crosthwaite from various entries
  arm: Allow system registers for KVM guests to be changed by QEMU code
  linux-user/elfload: enable HWCAP_CPUID for AArch64
  target/arm: expose remaining CPUID registers as RAZ
  target/arm: expose MPIDR_EL1 to userspace
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agoUpdate OpenBIOS images to 3464681b built from submodule.
Mark Cave-Ayland [Fri, 15 Feb 2019 10:07:40 +0000 (10:07 +0000)]
Update OpenBIOS images to 3464681b built from submodule.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
5 years agogdbstub: Send a reply to the vKill packet.
Sandra Loosemore [Fri, 15 Feb 2019 09:56:41 +0000 (09:56 +0000)]
gdbstub: Send a reply to the vKill packet.

Per the GDB remote protocol documentation

https://sourceware.org/gdb/current/onlinedocs/gdb/Packets.html#index-vKill-packet

the debug stub is expected to send a reply to the 'vKill' packet.  At
least some versions of GDB crash if the gdb stub simply exits without
sending a reply.  This patch fixes QEMU's gdb stub to conform to the
expected behavior.

Note that QEMU's existing handling of the legacy 'k' packet is
correct: in that case GDB does not expect a reply, and QEMU does not
send one.

Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
Message-id: 1550008033-26540-1-git-send-email-sandra@codesourcery.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Add missing clear_tail calls
Richard Henderson [Fri, 15 Feb 2019 09:56:41 +0000 (09:56 +0000)]
target/arm: Add missing clear_tail calls

Fortunately, the functions affected are so far only called from SVE,
so there is no tail to be cleared.  But as we convert more of AdvSIMD
to gvec, this will matter.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-13-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Use vector operations for saturation
Richard Henderson [Fri, 15 Feb 2019 09:56:41 +0000 (09:56 +0000)]
target/arm: Use vector operations for saturation

For same-sign saturation, we have tcg vector operations.  We can
compute the QC bit by comparing the saturated value against the
unsaturated value.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-12-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Split out FPSCR.QC to a vector field
Richard Henderson [Fri, 15 Feb 2019 09:56:41 +0000 (09:56 +0000)]
target/arm: Split out FPSCR.QC to a vector field

Change the representation of this field such that it is easy
to set from vector code.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-11-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Fix set of bits kept in xregs[ARM_VFP_FPSCR]
Richard Henderson [Fri, 15 Feb 2019 09:56:41 +0000 (09:56 +0000)]
target/arm: Fix set of bits kept in xregs[ARM_VFP_FPSCR]

Given that we mask bits properly on set, there is no reason
to mask them again on get.  We failed to clear the exception
status bits, 0x9f, which means that the wrong value would be
returned on get.  Except in the (probably normal) case in which
the set clears all of the bits.

Simplify the code in set to also clear the RES0 bits.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-10-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Split out flags setting from vfp compares
Richard Henderson [Fri, 15 Feb 2019 09:56:40 +0000 (09:56 +0000)]
target/arm: Split out flags setting from vfp compares

Minimize the code within a macro by splitting out a helper function.
Use deposit32 instead of manual bit manipulation.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-9-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Fix arm_cpu_dump_state vs FPSCR
Richard Henderson [Fri, 15 Feb 2019 09:56:40 +0000 (09:56 +0000)]
target/arm: Fix arm_cpu_dump_state vs FPSCR

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-8-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Fix vfp_gdb_get/set_reg vs FPSCR
Richard Henderson [Fri, 15 Feb 2019 09:56:40 +0000 (09:56 +0000)]
target/arm: Fix vfp_gdb_get/set_reg vs FPSCR

The components of this register is stored in several
different locations.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-7-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Remove neon min/max helpers
Richard Henderson [Fri, 15 Feb 2019 09:56:40 +0000 (09:56 +0000)]
target/arm: Remove neon min/max helpers

These are now unused.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-6-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Use tcg integer min/max primitives for neon
Richard Henderson [Fri, 15 Feb 2019 09:56:40 +0000 (09:56 +0000)]
target/arm: Use tcg integer min/max primitives for neon

The 32-bit PMIN/PMAX has been decomposed to scalars,
and so can be trivially expanded inline.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-5-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Use vector minmax expanders for aarch32
Richard Henderson [Fri, 15 Feb 2019 09:56:40 +0000 (09:56 +0000)]
target/arm: Use vector minmax expanders for aarch32

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Use vector minmax expanders for aarch64
Richard Henderson [Fri, 15 Feb 2019 09:56:40 +0000 (09:56 +0000)]
target/arm: Use vector minmax expanders for aarch64

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agotarget/arm: Rely on optimization within tcg_gen_gvec_or
Richard Henderson [Fri, 15 Feb 2019 09:56:39 +0000 (09:56 +0000)]
target/arm: Rely on optimization within tcg_gen_gvec_or

Since we're now handling a == b generically, we no longer need
to do it by hand within target/arm/.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190209033847.9014-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 years agohw/arm/armsse: Fix miswiring of expansion IRQs
Peter Maydell [Fri, 15 Feb 2019 09:56:39 +0000 (09:56 +0000)]
hw/arm/armsse: Fix miswiring of expansion IRQs

In commit 91c1e9fcbd7548db368 where we added dual-CPU support to
the ARMSSE, we set up the wiring of the expansion IRQs via nested
loops: the outer loop on 'i' loops for each CPU, and the inner loop
on 'j' loops for each interrupt. Fix a typo which meant we were
wiring every expansion IRQ line to external IRQ 0 on CPU 0 and
to external IRQ 1 on CPU 1.

Fixes: 91c1e9fcbd7548db368 ("hw/arm/armsse: Support dual-CPU configuration")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agohw/intc/armv7m_nvic: Allow byte accesses to SHPR1
Peter Maydell [Fri, 15 Feb 2019 09:56:39 +0000 (09:56 +0000)]
hw/intc/armv7m_nvic: Allow byte accesses to SHPR1

The code for handling the NVIC SHPR1 register intends to permit
byte and halfword accesses (as the architecture requires). However
the 'case' line for it only lists the base address of the
register, so attempts to access bytes other than the first one
end up in the "bad write" default logic. This bug was added
accidentally when we split out the SHPR1 logic from SHPR2 and
SHPR3 to support v6M.

Fixes: 7c9140afd594 ("nvic: Handle ARMv6-M SCS reserved registers")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
The Zephyr RTOS happens to access SHPR1 byte at a time,
which is how I spotted this.

5 years agoMAINTAINERS: Remove Peter Crosthwaite from various entries
Peter Maydell [Fri, 15 Feb 2019 09:56:39 +0000 (09:56 +0000)]
MAINTAINERS: Remove Peter Crosthwaite from various entries

Peter Crosthwaite hasn't had the bandwidth to do code review or
other QEMU work for some time now -- remove his email address
from MAINTAINERS file entries so we don't bombard him with
patch emails.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20190207181422.4907-1-peter.maydell@linaro.org

5 years agoarm: Allow system registers for KVM guests to be changed by QEMU code
Peter Maydell [Fri, 15 Feb 2019 09:56:39 +0000 (09:56 +0000)]
arm: Allow system registers for KVM guests to be changed by QEMU code

At the moment the Arm implementations of kvm_arch_{get,put}_registers()
don't support having QEMU change the values of system registers
(aka coprocessor registers for AArch32). This is because although
kvm_arch_get_registers() calls write_list_to_cpustate() to
update the CPU state struct fields (so QEMU code can read the
values in the usual way), kvm_arch_put_registers() does not
call write_cpustate_to_list(), meaning that any changes to
the CPU state struct fields will not be passed back to KVM.

The rationale for this design is documented in a comment in the
AArch32 kvm_arch_put_registers() -- writing the values in the
cpregs list into the CPU state struct is "lossy" because the
write of a register might not succeed, and so if we blindly
copy the CPU state values back again we will incorrectly
change register values for the guest. The assumption was that
no QEMU code would need to write to the registers.

However, when we implemented debug support for KVM guests, we
broke that assumption: the code to handle "set the guest up
to take a breakpoint exception" does so by updating various
guest registers including ESR_EL1.

Support this by making kvm_arch_put_registers() synchronize
CPU state back into the list. We sync only those registers
where the initial write succeeds, which should be sufficient.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Dongjiu Geng <gengdongjiu@huawei.com>