]> Git Repo - qemu.git/log
qemu.git
7 years agoMerge remote-tracking branch 'remotes/berrange/tags/pull-qio-201712151' into staging
Peter Maydell [Fri, 15 Dec 2017 17:05:26 +0000 (17:05 +0000)]
Merge remote-tracking branch 'remotes/berrange/tags/pull-qio-201712151' into staging

Merge qio 2017/12/15 v1

# gpg: Signature made Fri 15 Dec 2017 15:07:34 GMT
# gpg:                using RSA key 0xBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <[email protected]>"
# gpg:                 aka "Daniel P. Berrange <[email protected]>"
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/pull-qio-201712151:
  io: introduce a network socket listener API

Signed-off-by: Peter Maydell <[email protected]>
7 years agosparc: Make sure we mmap at SHMLBA alignment
Peter Maydell [Fri, 8 Dec 2017 16:57:28 +0000 (16:57 +0000)]
sparc: Make sure we mmap at SHMLBA alignment

SPARC Linux has an oddity that it insists that mmap()
of MAP_FIXED memory must be at an alignment defined by
SHMLBA, which is more aligned than the page size
(typically, SHMLBA alignment is to 16K, and pages are 8K).
This is a relic of ancient hardware that had cache
aliasing constraints, but even on modern hardware the
kernel still insists on the alignment.

To ensure that we get mmap() alignment sufficient to
make the kernel happy, change QEMU_VMALLOC_ALIGN,
qemu_fd_getpagesize() and qemu_mempath_getpagesize()
to use the maximum of getpagesize() and SHMLBA.

In particular, this allows 'make check' to pass on Sparc:
we were previously failing the ivshmem tests.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-id: 1512752248[email protected]

7 years agoio: introduce a network socket listener API
Daniel P. Berrange [Tue, 19 Jul 2016 12:37:51 +0000 (13:37 +0100)]
io: introduce a network socket listener API

The existing QIOChannelSocket class provides the ability to
listen on a single socket at a time. This patch introduces
a QIONetListener class that provides a higher level API
concept around listening for network services, allowing
for listening on multiple sockets.

Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Daniel P. Berrange <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20171215-v2' into staging
Peter Maydell [Fri, 15 Dec 2017 12:58:17 +0000 (12:58 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20171215-v2' into staging

s390x changes for 2.12:
- Lots of tcg improvements: ccw hotplug is now working and we can run
  a Linux kernel built for z12 under tcg
- zPCI improvements to get virtio-pci working
- get rid of the cssid restrictions for virtual and non-virtual channel
  devices
- we now support 8TB+ systems
- 2.12 compat machine
- fixes and cleanups

# gpg: Signature made Fri 15 Dec 2017 10:57:01 GMT
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# gpg:                 aka "Cornelia Huck <[email protected]>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20171215-v2: (46 commits)
  s390-ccw-virtio: allow for systems larger that 7.999TB
  s390x: change the QEMU cpu model to a stripped down z12
  s390x/tcg: we already implement the Set-Program-Parameter facility
  s390x/tcg: implement extract-CPU-time facility
  s390x/tcg: Implement SIGNAL ADAPTER instruction
  s390x/tcg: Implement STORE CHANNEL PATH STATUS
  s390x/tcg: wire up SET CHANNEL MONITOR
  s390x/tcg: wire up SET ADDRESS LIMIT
  s390x/tcg: implement Interlocked-Access Facility 2
  s390x/tcg: ASI/ASGI/ALSI/ALSGI are atomic with Interlocked-acccess facility 1
  s390x/tcg: wire up STORE CHANNEL REPORT WORD
  s390x/tcg: indicate value of TODPR in STCKE
  s390x/tcg: implement SET CLOCK PROGRAMMABLE FIELD
  s390x/tcg: fix and cleanup mcck injection
  s390x/kvm: factor out build_channel_report_mcic() into cpu.h
  s390x/css: attach css bridge
  s390x: deprecate s390-squash-mcss machine prop
  s390x/css: unrestrict cssids
  s390x/pci: search for subregion inside the BARs
  s390x/pci: move the memory region write from pcistg
  ...

# Conflicts:
# include/hw/compat.h

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.12-20171215' into staging
Peter Maydell [Fri, 15 Dec 2017 11:13:43 +0000 (11:13 +0000)]
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.12-20171215' into staging

ppc patch queue 2017-12-15

First pull request for qemu-2.12.  This has quite a bit of stuff
accumulated while 2.11 was finalizing.  Highlights are:

  * Some preliminary work towards implementing the "XIVE" POWER9
    interrupt controller
  * Some fixes for problems during reboot with MTTCG
  * A substantial TCG performance improvement via
    tcg_get_lookup_and_goto_ptr
  * Numerous assorted cleanups and bugfixes that weren't urgent enough
    for 2.11

# gpg: Signature made Fri 15 Dec 2017 03:14:12 GMT
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <[email protected]>"
# gpg:                 aka "David Gibson (Red Hat) <[email protected]>"
# gpg:                 aka "David Gibson (ozlabs.org) <[email protected]>"
# gpg:                 aka "David Gibson (kernel.org) <[email protected]>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.12-20171215: (24 commits)
  spapr: don't initialize PATB entry if max-cpu-compat < power9
  spapr: Assume msi_nonbroken
  spapr: Rename machine init functions for clarity
  target/ppc: introduce the PPC_BIT() macro
  spapr_events: drop bogus cell from "interrupt-ranges" property
  spapr: fix LSI interrupt specifiers in the device tree
  spapr: replace numa_get_node() with lookup in pc-dimm list
  spapr: introduce a spapr_qirq() helper
  spapr: introduce a spapr_irq_set_lsi() helper
  spapr: move the IRQ allocation routines under the machine
  ppc/xics: assign of the CPU 'intc' pointer under the core
  ppc/xics: introduce an icp_create() helper
  spapr/rtas: do not reset the MSR in stop-self command
  spapr/rtas: fix reboot of a a SMP TCG guest
  spapr/rtas: disable the decrementer interrupt when a CPU is unplugged
  e500: fix pci host bridge class/type
  openpic: debug w/ info_report()
  pcc: define the Power-saving mode Exit Cause Enable bits in PowerPCCPUClass
  nvram: add AT24Cx i2c eeprom
  e500: name openpic and pci host bridge
  ...

Signed-off-by: Peter Maydell <[email protected]>
7 years agos390-ccw-virtio: allow for systems larger that 7.999TB
Christian Borntraeger [Mon, 11 Dec 2017 12:21:46 +0000 (13:21 +0100)]
s390-ccw-virtio: allow for systems larger that 7.999TB

KVM does not allow memory regions > KVM_MEM_MAX_NR_PAGES, basically
limiting the memory per slot to 8TB-4k. As memory slots on s390/kvm must
be a multiple of 1MB we need start a new memory region if we cross
8TB-1M.

With that (and optimistic overcommitment in the kernel) I was able to
start a 24TB guest on a 1TB system.

Signed-off-by: Christian Borntraeger <[email protected]>
Message-Id: <20171211122146[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
[CH: 1UL -> 1ULL in KVM_MEM_MAX_NR_PAGES; build fix on 32 bit hosts]
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/sstabellini/tags/xen-20171214-tag' into staging
Peter Maydell [Fri, 15 Dec 2017 09:52:07 +0000 (09:52 +0000)]
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20171214-tag' into staging

Xen 2017/12/14

# gpg: Signature made Fri 15 Dec 2017 00:26:26 GMT
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <[email protected]>"
# gpg:                 aka "Stefano Stabellini <[email protected]>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20171214-tag:
  xen/pt: Set is_express to avoid out-of-bounds write
  xenfb: activate input handlers for raw pointer devices
  xenfb: Add [feature|request]-raw-pointer
  xenfb: Use Input Handlers directly
  ui: generate qcode to linux mappings
  xen-disk: use an IOThread per instance

Signed-off-by: Peter Maydell <[email protected]>
7 years agoxen/pt: Set is_express to avoid out-of-bounds write
Simon Gaiser [Sat, 28 Oct 2017 02:53:15 +0000 (04:53 +0200)]
xen/pt: Set is_express to avoid out-of-bounds write

The passed-through device might be an express device. In this case the
old code allocated a too small emulated config space in
pci_config_alloc() since pci_config_size() returned the size for a
non-express device. This leads to an out-of-bound write in
xen_pt_config_reg_init(), which sometimes results in crashes. So set
is_express as already done for KVM in vfio-pci.

Shortened ASan report:

==17512==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x611000041648 at pc 0x55e0fdac51ff bp 0x7ffe4af07410 sp 0x7ffe4af07408
WRITE of size 2 at 0x611000041648 thread T0
    #0 0x55e0fdac51fe in memcpy /usr/include/x86_64-linux-gnu/bits/string3.h:53
    #1 0x55e0fdac51fe in stw_he_p include/qemu/bswap.h:330
    #2 0x55e0fdac51fe in stw_le_p include/qemu/bswap.h:379
    #3 0x55e0fdac51fe in pci_set_word include/hw/pci/pci.h:490
    #4 0x55e0fdac51fe in xen_pt_config_reg_init hw/xen/xen_pt_config_init.c:1991
    #5 0x55e0fdac51fe in xen_pt_config_init hw/xen/xen_pt_config_init.c:2067
    #6 0x55e0fdabcf4d in xen_pt_realize hw/xen/xen_pt.c:830
    #7 0x55e0fdf59666 in pci_qdev_realize hw/pci/pci.c:2034
    #8 0x55e0fdda7d3d in device_set_realized hw/core/qdev.c:914
[...]

0x611000041648 is located 8 bytes to the right of 256-byte region [0x611000041540,0x611000041640)
allocated by thread T0 here:
    #0 0x7ff596a94bb8 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xd9bb8)
    #1 0x7ff57da66580 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x50580)
    #2 0x55e0fdda7d3d in device_set_realized hw/core/qdev.c:914
[...]

Signed-off-by: Simon Gaiser <[email protected]>
Acked-by: Stefano Stabellini <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
7 years agoxenfb: activate input handlers for raw pointer devices
Owen Smith [Fri, 3 Nov 2017 11:56:31 +0000 (11:56 +0000)]
xenfb: activate input handlers for raw pointer devices

If the frontend requests raw pointers, the input handlers must be
activated to have the input events delivered to the xenfb backend.
Without activation, the input events are delivered to handlers
registered earlier, which would be the emulated USB tablet or
emulated PS/2 mouse.
HVM xen_kbdfront can incorrectly scale absolute coordinates when
the display resolution is not 800x600.

Signed-off-by: Owen Smith <[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Stefano Stabellini <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
7 years agoxenfb: Add [feature|request]-raw-pointer
Owen Smith [Fri, 3 Nov 2017 11:56:30 +0000 (11:56 +0000)]
xenfb: Add [feature|request]-raw-pointer

Writes "feature-raw-pointer" during init to indicate the backend
can pass raw unscaled values for absolute axes to the frontend.
Frontends set "request-raw-pointer" to indicate the backend should
not attempt to scale absolute values to console size.
"request-raw-pointer" is only valid if "request-abs-pointer" is
also set. Raw unscaled pointer values are in the range [0, 0x7fff]

"feature-raw-pointer" and "request-raw-pointer" added to Xen
header in commit 7868654ff7fe5e4a2eeae2b277644fa884a5031e

Signed-off-by: Owen Smith <[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Stefano Stabellini <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
7 years agoxenfb: Use Input Handlers directly
Owen Smith [Fri, 3 Nov 2017 11:56:29 +0000 (11:56 +0000)]
xenfb: Use Input Handlers directly

Avoid the unneccessary calls through the input-legacy.c file by
using the qemu_input_handler_*() calls directly. This did require
reworking the event and sync handlers to use the reverse mapping
from qcode to linux using qemu_input_qcode_to_linux().
Removes the scancode2linux mapping, and supporting documention.

Signed-off-by: Owen Smith <[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
Reviewed-by: Stefano Stabellini <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
7 years agoui: generate qcode to linux mappings
Owen Smith [Fri, 3 Nov 2017 11:56:28 +0000 (11:56 +0000)]
ui: generate qcode to linux mappings

Use keycodedb to generate a qcode to linux mapping

Signed-off-by: Owen Smith <[email protected]>
Reviewed-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
7 years agoxen-disk: use an IOThread per instance
Paul Durrant [Tue, 7 Nov 2017 10:46:53 +0000 (05:46 -0500)]
xen-disk: use an IOThread per instance

This patch allocates an IOThread object for each xen_disk instance and
sets the AIO context appropriately on connect. This allows processing
of I/O to proceed in parallel.

The patch also adds tracepoints into xen_disk to make it possible to
follow the state transtions of an instance in the log.

Signed-off-by: Paul Durrant <[email protected]>
Acked-by: Stefano Stabellini <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
7 years agospapr: don't initialize PATB entry if max-cpu-compat < power9
Laurent Vivier [Thu, 14 Dec 2017 18:09:48 +0000 (19:09 +0100)]
spapr: don't initialize PATB entry if max-cpu-compat < power9

if KVM is enabled and KVM capabilities MMU radix is available,
the partition table entry (patb_entry) for the radix mode is
initialized by default in ppc_spapr_reset().

It's a problem if we want to migrate the guest to a POWER8 host
while the kernel is not started to set the value to the one
expected for a POWER8 CPU.

The "-machine max-cpu-compat=power8" should allow to migrate
a POWER9 KVM host to a POWER8 KVM host, but because patb_entry
is set, the destination QEMU tries to enable radix mode on the
POWER8 host. This fails and cancels the migration:

    Process table config unsupported by the host
    error while loading state for instance 0x0 of device 'spapr'
    load of migration failed: Invalid argument

This patch doesn't set the PATB entry if the user provides
a CPU compatibility mode that doesn't support radix mode.

Signed-off-by: Laurent Vivier <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: Assume msi_nonbroken
David Gibson [Fri, 8 Dec 2017 03:11:49 +0000 (14:11 +1100)]
spapr: Assume msi_nonbroken

We conditionally adjust part of the guest device tree based on the
global msi_nonbroken flag.  However, the main machine type code
initializes msi_nonbroken to true and there's nothing that would set
it to false again.

So replace the test with an assert().

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Alexey Kardashevskiy <[email protected]>
7 years agospapr: Rename machine init functions for clarity
David Gibson [Fri, 8 Dec 2017 01:47:34 +0000 (12:47 +1100)]
spapr: Rename machine init functions for clarity

Machine objects have two init functions - the generic QOM level
instance_init which should only do static object initialization, and
the Machine specific MachineClass::init which does the actual
construction of the machine.

In spapr the functions implementing these two have names -
ppc_machine_initfn() and ppc_spapr_init() - which don't correspond closely
to either of those.  To prevent people (read, me) from confusing which is
which, rename them spapr_instance_init() and spapr_machine_init() to
make it clearer which is which.

While we're there rename ppc_spapr_reset() to spapr_machine_reset() to
match.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Reviewed-by: Suraj Jitindar Singh <[email protected]>
7 years agotarget/ppc: introduce the PPC_BIT() macro
Cédric Le Goater [Wed, 6 Dec 2017 09:41:50 +0000 (10:41 +0100)]
target/ppc: introduce the PPC_BIT() macro

and use them in a couple of obvious places. Other macros will be used
in the model of the XIVE interrupt controller.

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_events: drop bogus cell from "interrupt-ranges" property
Greg Kurz [Wed, 6 Dec 2017 08:16:52 +0000 (09:16 +0100)]
spapr_events: drop bogus cell from "interrupt-ranges" property

According to LoPAPR 1.1 B.6.12, the "/event-sources" node has an "interrupt-
ranges" property, the format of which is described in B.6.9.1.2 as follows:

“interrupt-ranges”
 Standard property name that defines the interrupt number(s) and range(s)
 handled by this unit.

 prop-encoded-array: List of (int-number, range) specifications.

 Int-number is encoded as with encode-int.
 Range is encoded as with encode-int.

 The first entry in this list shall contain the int-number associated with
 the first “reg” property entry. The int-num-ber is the value representing
 the interrupt source as would appear in the PowerPC External Interrupt
 Architecture XISR. The range shall be the number of sequential interrupt
 numbers which this unit can generate.

There's no such thing as a cell count at the end of the array, like the
one introduced by commit ffbb1705a33d in QEMU 2.8. It doesn't seem it had
any impact on existing guests and I couldn't find any related workaround
in linux. So, let's just drop the bogus lines.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: fix LSI interrupt specifiers in the device tree
Greg Kurz [Wed, 6 Dec 2017 08:13:16 +0000 (09:13 +0100)]
spapr: fix LSI interrupt specifiers in the device tree

LoPAPR 1.1 B.6.9.1.2 describes the "#interrupt-cells" property of the
PowerPC External Interrupt Source Controller node as follows:

“#interrupt-cells”

  Standard property name to define the number of cells in an interrupt-
  specifier within an interrupt domain.

  prop-encoded-array: An integer, encoded as with encode-int, that denotes
  the number of cells required to represent an interrupt specifier in its
  child nodes.

  The value of this property for the PowerPC External Interrupt option shall
  be 2. Thus all interrupt specifiers (as used in the standard “interrupts”
  property) shall consist of two cells, each containing an integer encoded
  as with encode-int. The first integer represents the interrupt number the
  second integer is the trigger code: 0 for edge triggered, 1 for level
  triggered.

This patch fixes the interrupt specifiers in the "interrupt-map" property
of the PHB node, that were setting the second cell to 8 (confusion with
IRQ_TYPE_LEVEL_LOW ?) instead of 1.

VIO devices and RTAS event sources use the same format for interrupt
specifiers: while here, we introduce a common helper to handle the
encoding details.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Tested-by: Cédric Le Goater <[email protected]>
--
v3: - reference public LoPAPR instead of internal PAPR+ in changelog
    - change helper name to spapr_dt_xics_irq()

v2: - drop the erroneous changes to the "interrupts" prop in PCI device nodes
    - introduce a common helper to encode interrupt specifiers
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: replace numa_get_node() with lookup in pc-dimm list
Igor Mammedov [Tue, 5 Dec 2017 15:41:17 +0000 (16:41 +0100)]
spapr: replace numa_get_node() with lookup in pc-dimm list

SPAPR is the last user of numa_get_node() and a bunch of
supporting code to maintain numa_info[x].addr list.

Get LMB node id from pc-dimm list, which allows to
remove ~80LOC maintaining dynamic address range
lookup list.

It also removes pc-dimm dependency on numa_[un]set_mem_node_id()
and makes pc-dimms a sole source of information about which
node it belongs to and removes duplicate data from global
numa_info.

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: introduce a spapr_qirq() helper
Cédric Le Goater [Fri, 1 Dec 2017 16:06:04 +0000 (17:06 +0100)]
spapr: introduce a spapr_qirq() helper

xics_get_qirq() is only used by the sPAPR machine. Let's move it there
and change its name to reflect its scope. It will be useful for XIVE
support which will use its own set of qirqs.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: introduce a spapr_irq_set_lsi() helper
Cédric Le Goater [Fri, 1 Dec 2017 16:06:03 +0000 (17:06 +0100)]
spapr: introduce a spapr_irq_set_lsi() helper

It will make synchronisation easier with the XIVE interrupt mode when
available. The 'irq' parameter refers to the global IRQ number space.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: move the IRQ allocation routines under the machine
Cédric Le Goater [Fri, 1 Dec 2017 16:06:02 +0000 (17:06 +0100)]
spapr: move the IRQ allocation routines under the machine

Also change the prototype to use a sPAPRMachineState and prefix them
with spapr_irq_. It will let us synchronise the IRQ allocation with
the XIVE interrupt mode when available.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc/xics: assign of the CPU 'intc' pointer under the core
Cédric Le Goater [Fri, 1 Dec 2017 16:06:01 +0000 (17:06 +0100)]
ppc/xics: assign of the CPU 'intc' pointer under the core

The 'intc' pointer of the CPU references the interrupt presenter in
the XICS interrupt mode. When the XIVE interrupt mode is available and
activated, the machine will need to reassign this pointer to reflect
the change.

Moving this assignment under the realize routine of the CPU will ease
the process when the interrupt mode is toggled.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoppc/xics: introduce an icp_create() helper
Cédric Le Goater [Fri, 1 Dec 2017 16:06:00 +0000 (17:06 +0100)]
ppc/xics: introduce an icp_create() helper

The sPAPR and the PowerNV core objects create the interrupt presenter
object of the CPUs in a very similar way. Let's provide a common
routine in which we use the presenter 'type' as a child identifier.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr/rtas: do not reset the MSR in stop-self command
Cédric Le Goater [Fri, 24 Nov 2017 07:05:50 +0000 (08:05 +0100)]
spapr/rtas: do not reset the MSR in stop-self command

When a CPU is stopped with the 'stop-self' RTAS call, its state
'halted' is switched to 1 and, in this case, the MSR is not taken into
account anymore in the cpu_has_work() routine. Only the pending
hardware interrupts are checked with their LPCR:PECE* enablement bit.

The CPU is now also protected from the decrementer interrupt by the
LPCR:PECE* bits which are disabled in the 'stop-self' RTAS
call. Reseting the MSR is pointless.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr/rtas: fix reboot of a a SMP TCG guest
Cédric Le Goater [Fri, 24 Nov 2017 07:05:49 +0000 (08:05 +0100)]
spapr/rtas: fix reboot of a a SMP TCG guest

Just like for hot unplug CPUs, when a guest is rebooted, the secondary
CPUs can be awaken by the decrementer and start entering SLOF at the
same time the boot CPU is.

To be safe, let's disable on the secondaries all the exceptions which
can cause an exit while the CPU is in power-saving mode.

Based on previous work from Nikunj A Dadhania <[email protected]>

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr/rtas: disable the decrementer interrupt when a CPU is unplugged
Cédric Le Goater [Fri, 24 Nov 2017 07:05:48 +0000 (08:05 +0100)]
spapr/rtas: disable the decrementer interrupt when a CPU is unplugged

When a CPU is stopped with the 'stop-self' RTAS call, its state
'halted' is switched to 1 and, in this case, the MSR is not taken into
account anymore in the cpu_has_work() routine. Only the pending
hardware interrupts are checked with their LPCR:PECE* enablement bit.

If the DECR timer fires after 'stop-self' is called and before the CPU
'stop' state is reached, the nearly-dead CPU will have some work to do
and the guest will crash. This case happens very frequently with the
not yet upstream P9 XIVE exploitation mode. In XICS mode, the DECR is
occasionally fired but after 'stop' state, so no work is to be done
and the guest survives.

I suspect there is a race between the QEMU mainloop triggering the
timers and the TCG CPU thread but I could not quite identify the root
cause. To be safe, let's disable in the LPCR all the exceptions which
can cause an exit while the CPU is in power-saving mode and reenable
them when the CPU is started.

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoe500: fix pci host bridge class/type
Michael Davidsaver [Sun, 26 Nov 2017 21:59:05 +0000 (15:59 -0600)]
e500: fix pci host bridge class/type

Correct some confusion wrt. the PCI facing
side of the PCI host bridge (not PCIe root complex).
The ref. manual for the mpc8533 (as well as
mpc8540 and mpc8540) give the class code as
PCI_CLASS_PROCESSOR_POWERPC.
While the PCI_HEADER_TYPE field is oddly omitted,
the tables in the "PCI Configuration Header"
section shows a type 0 layout using all 6 BAR
registers (as 2x 32, and 2x 64 bit regions)

So 997505065dc92e533debf5cb23012ba4e673d387
seems to be in error.  Although there was
perhaps some confusion as the mpc8533
has a separate PCIe root complex.
With PCIe, a root complex has PCI_HEADER_TYPE=1.

Neither the PCI host bridge, nor the PCIe
root complex advertise class PCI_CLASS_BRIDGE_PCI.

This was confusing Linux guests, which try
to interpret the host bridge as a pci-pci
bridge, but get confused and re-enumerate
the bus when the primary/secondary/subordinate
bus registers don't have valid values.

Signed-off-by: Michael Davidsaver <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoopenpic: debug w/ info_report()
Michael Davidsaver [Sun, 26 Nov 2017 21:58:59 +0000 (15:58 -0600)]
openpic: debug w/ info_report()

Replace *printf() with *_report().
Remove trailing new lines.

Signed-off-by: Michael Davidsaver <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agopcc: define the Power-saving mode Exit Cause Enable bits in PowerPCCPUClass
Cédric Le Goater [Thu, 23 Nov 2017 17:05:24 +0000 (18:05 +0100)]
pcc: define the Power-saving mode Exit Cause Enable bits in PowerPCCPUClass

and use the value to define precisely the default value of the LPCR in
the helper routine cpu_ppc_set_papr()

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agonvram: add AT24Cx i2c eeprom
Michael Davidsaver [Mon, 20 Nov 2017 03:24:17 +0000 (21:24 -0600)]
nvram: add AT24Cx i2c eeprom

Signed-off-by: Michael Davidsaver <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agoe500: name openpic and pci host bridge
Michael Davidsaver [Mon, 20 Nov 2017 03:24:13 +0000 (21:24 -0600)]
e500: name openpic and pci host bridge

Signed-off-by: Michael Davidsaver <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr_cpu_core: instantiate CPUs separately
Greg Kurz [Mon, 20 Nov 2017 09:19:54 +0000 (10:19 +0100)]
spapr_cpu_core: instantiate CPUs separately

The current code assumes that only the CPU core object holds a
reference on each individual CPU object, and happily frees their
allocated memory when the core is unrealized. This is dangerous
as some other code can legitimely keep a pointer to a CPU if it
calls object_ref(), but it would end up with a dangling pointer.

Let's allocate all CPUs with object_new() and let QOM free them
when their reference count reaches zero. This greatly simplify the
code as we don't have to fiddle with the instance size anymore.

Signed-off-by: Greg Kurz <[email protected]>
Acked-by: Igor Mammedov <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agospapr: Add pseries-2.12 machine type
David Gibson [Mon, 13 Nov 2017 05:50:40 +0000 (16:50 +1100)]
spapr: Add pseries-2.12 machine type

While we're at it fix a couple of small errors in the 2.11 and 2.10 models
(they didn't have any real effect, but don't quite match the template).

Signed-off-by: David Gibson <[email protected]>
7 years agoppc/xics: remove useless if condition
Cédric Le Goater [Fri, 10 Nov 2017 15:20:08 +0000 (15:20 +0000)]
ppc/xics: remove useless if condition

The previous code section uses a 'first < 0' test and returns. Therefore,
there is no need to test the 'first' variable against '>= 0' afterwards.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agotarget/ppc: Use tcg_gen_lookup_and_goto_ptr
Richard Henderson [Fri, 27 Oct 2017 16:58:14 +0000 (18:58 +0200)]
target/ppc: Use tcg_gen_lookup_and_goto_ptr

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Daniel Henrique Barboza <[email protected]>
Signed-off-by: David Gibson <[email protected]>
7 years agos390x: change the QEMU cpu model to a stripped down z12
David Hildenbrand [Fri, 8 Dec 2017 16:55:29 +0000 (17:55 +0100)]
s390x: change the QEMU cpu model to a stripped down z12

We are good enough to boot upstream Linux kernels / Fedora 26/27. That
should be sufficient for now.

As the QEMU CPU model is migration safe, let's add compatibility code.
Generate the feature list to reduce the chance of messing things up in the
future.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208165529[email protected]>
[CH: squashed 's390x/cpumodel: make qemu cpu model play with "none" machine'
(20171213132407[email protected]) and 's390x/tcg: don't include z13
features in the qemu model' (20171213171512[email protected]) into
patch]
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: we already implement the Set-Program-Parameter facility
David Hildenbrand [Fri, 8 Dec 2017 16:02:06 +0000 (17:02 +0100)]
s390x/tcg: we already implement the Set-Program-Parameter facility

The Set-Program-Parameter facility (also known as Load-Program-Parameter
facility) provides the LPP instruction used to load the program
parameter. We already implement that instruction in TCG, so add it to our
list.

Note: Not documented in the PoP but in "The Load-Program-Parameter and
CPU-Measurement Facilities) - SA23-2260-05 document.

While at it, make the whole list ordered (according to cpu_features_def.h).

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: implement extract-CPU-time facility
David Hildenbrand [Fri, 8 Dec 2017 16:02:05 +0000 (17:02 +0100)]
s390x/tcg: implement extract-CPU-time facility

It only provides the EXTRACT CPU TIME instruction. We can reuse the stpt
helper, which calculates the CPU timer value.

As the instruction is not privileged, but we don't have a CPU timer
value in case of linux user, we simply reuse cpu_get_host_ticks() to
produce some descending value.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: Implement SIGNAL ADAPTER instruction
David Hildenbrand [Fri, 8 Dec 2017 16:02:04 +0000 (17:02 +0100)]
s390x/tcg: Implement SIGNAL ADAPTER instruction

KVM suppresses SIGA, setting cc=3. Let's do the same for TCG, so we're at
least equal.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: Implement STORE CHANNEL PATH STATUS
David Hildenbrand [Fri, 8 Dec 2017 16:02:03 +0000 (17:02 +0100)]
s390x/tcg: Implement STORE CHANNEL PATH STATUS

Just like KVM does, we should suppress this instruction:
    When this instruction is not provided, it is
    checked for privileged operation exception and the
    instruction is suppressed by the machine

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: wire up SET CHANNEL MONITOR
David Hildenbrand [Fri, 8 Dec 2017 16:02:02 +0000 (17:02 +0100)]
s390x/tcg: wire up SET CHANNEL MONITOR

Let's just wire it up like KVM.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: wire up SET ADDRESS LIMIT
David Hildenbrand [Fri, 8 Dec 2017 16:02:01 +0000 (17:02 +0100)]
s390x/tcg: wire up SET ADDRESS LIMIT

Let's handle it just like KVM:
    Depending on the model, this instruction may not be
    provided. When this instruction is not provided, it is
    checked for operand exception and privileged-opera-
    tion exception, and then is suppressed.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: implement Interlocked-Access Facility 2
David Hildenbrand [Fri, 8 Dec 2017 16:02:00 +0000 (17:02 +0100)]
s390x/tcg: implement Interlocked-Access Facility 2

With this facility, OI/OIY, NI/NIY and XI/XIY are atomic. All operate on
one byte (MO_UB). Emulate old behavior.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: ASI/ASGI/ALSI/ALSGI are atomic with Interlocked-acccess facility 1
David Hildenbrand [Fri, 8 Dec 2017 16:01:59 +0000 (17:01 +0100)]
s390x/tcg: ASI/ASGI/ALSI/ALSGI are atomic with Interlocked-acccess facility 1

The semantics of ASI/ASGI/ALSI/ALSGI changed. Let's implement them just
like LOAD AND ADD, so they are atomic. Emulate old behavior.

This fixes random crashes when booting a Linux kernel compiled for
z196+ with SMP + MTTCG.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: wire up STORE CHANNEL REPORT WORD
David Hildenbrand [Fri, 8 Dec 2017 16:01:58 +0000 (17:01 +0100)]
s390x/tcg: wire up STORE CHANNEL REPORT WORD

CRW machine check handling requires STCRW. So let's wire it up.

Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: indicate value of TODPR in STCKE
David Hildenbrand [Fri, 8 Dec 2017 16:01:57 +0000 (17:01 +0100)]
s390x/tcg: indicate value of TODPR in STCKE

We were not yet using the value of the TOD Programmable Register.

Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: implement SET CLOCK PROGRAMMABLE FIELD
David Hildenbrand [Fri, 8 Dec 2017 16:01:56 +0000 (17:01 +0100)]
s390x/tcg: implement SET CLOCK PROGRAMMABLE FIELD

Needed for machine check handling inside Linux (when restoring registers).

Except for SIGP and machine checks, we don't make use of the register
yet. Sufficient for now.

Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: fix and cleanup mcck injection
David Hildenbrand [Fri, 8 Dec 2017 16:01:55 +0000 (17:01 +0100)]
s390x/tcg: fix and cleanup mcck injection

The architecture mode indication wasn't stored. The split of certain
64bit fields was unnecessary. Also, the complete clock comparator, not
just bit 0-55 (starting at byte 1) was stored.

We now generate a proper MCIC via the same helper we use for KVM.

There is more to clean up, but we will change the other parts later on
either way.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/kvm: factor out build_channel_report_mcic() into cpu.h
David Hildenbrand [Fri, 8 Dec 2017 16:01:54 +0000 (17:01 +0100)]
s390x/kvm: factor out build_channel_report_mcic() into cpu.h

We'll need it later on in two places. Refactor it to just indicate the
validity bits. While at it, introduce a define for the used CR14 bit (we'll
also need later on).

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171208160207[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/css: attach css bridge
Cornelia Huck [Tue, 28 Nov 2017 13:08:14 +0000 (14:08 +0100)]
s390x/css: attach css bridge

Logically, the css bridge should be attached to the machine.

Reviewed-by: Christian Borntraeger <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Tested-by: Bjoern Walk <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x: deprecate s390-squash-mcss machine prop
Halil Pasic [Wed, 6 Dec 2017 14:44:38 +0000 (15:44 +0100)]
s390x: deprecate s390-squash-mcss machine prop

With the cssids unrestricted (commit "s390x/css: unrestrict cssids") the
s390-squash-mcss machine property should not be used.  Actually Libvirt
never supported this, so the expectation is that removing it should be
pretty painless.  But let's play nice and deprecate it first.

Signed-off-by: Halil Pasic <[email protected]>
Message-Id: <20171206144438[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/css: unrestrict cssids
Halil Pasic [Wed, 6 Dec 2017 14:44:37 +0000 (15:44 +0100)]
s390x/css: unrestrict cssids

The default css 0xfe is currently restricted to virtual subchannel
devices. The hope when the decision was made was, that non-virtual
subchannel devices will come around when guest can exploit multiple
channel subsystems. Since the guests generally don't do, the pain
of the partitioned (cssid) namespace outweighs the gain.

Let us remove the corresponding restrictions (virtual devices
can be put only in 0xfe and non-virtual devices in any css except
the 0xfe -- while s390-squash-mcss then remaps everything to cssid 0).

At the same time, change our schema for generating css bus ids to put
both virtual and non-virtual devices into the default css (spilling over
into other css images, if needed). The intention is to deprecate
s390-squash-mcss. With this change devices without a specified devno
won't end up hidden to guests not supporting multiple channel subsystems,
unless this can not be avoided (default css full).

Let us also advertise the changes to the management software (so it can
tell are cssids unrestricted or restricted).

The adverse effect of getting rid of the restriction on migration should
not be too severe.  Vfio-ccw devices are not live-migratable yet, and for
virtual devices using the extra freedom would only make sense with the
aforementioned guest support in place.

The auto-generated bus ids are affected by both changes. We hope to not
encounter any auto-generated bus ids in production as Libvirt is always
explicit about the bus id.  Since 8ed179c937 ("s390x/css: catch section
mismatch on load", 2017-05-18) the worst that can happen because the same
device ended up having a different bus id is a cleanly failed migration.
I find it hard to reason about the impact of changed auto-generated bus
ids on migration for command line users as I don't know which rules is
such an user supposed to follow.

Another pain-point is down- or upgrade of QEMU for command line users.
The old way and the new way of doing vfio-ccw are mutually incompatible.
Libvirt is only going to support the new way, so for libvirt users, the
possible problems at QEMU downgrade are the following. If a domain
contains virtual devices placed into a css different than 0xfe the domain
will refuse to start with a QEMU not having this patch. Putting devices
into a css different that 0xfe however won't make much sense in the near
future (guest support). Libvirt will refuse to do vfio-ccw with a QEMU
not having this patch. This is business as usual.

Signed-off-by: Halil Pasic <[email protected]>
Acked-by: Christian Borntraeger <[email protected]>
Reviewed-by: Dong Jia Shi <[email protected]>
Message-Id: <20171206144438[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: search for subregion inside the BARs
Pierre Morel [Thu, 30 Nov 2017 12:55:30 +0000 (13:55 +0100)]
s390x/pci: search for subregion inside the BARs

When dispatching memory access to PCI BAR region, we must
look for possible subregions, used by the PCI device to map
different memory areas inside the same PCI BAR.

Since the data offset we received is calculated starting at the
region start address we need to adjust the offset for the subregion.

The data offset inside the subregion is calculated by substracting
the subregion's starting address from the data offset in the region.

The access to the MSIX region is now handled in a generic way,
we do not need the specific trap_msix() function anymore.

Signed-off-by: Pierre Morel <[email protected]>
Reviewed-by: Yi Min Zhao <[email protected]>
Message-Id: <1512046530[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: move the memory region write from pcistg
Pierre Morel [Thu, 30 Nov 2017 12:55:29 +0000 (13:55 +0100)]
s390x/pci: move the memory region write from pcistg

Let's move the memory region write from pcistg into a dedicated
function.
This allows us to prepare a later patch searching for subregions
inside of the memory region.

Signed-off-by: Pierre Morel <[email protected]>
Reviewed-by: Yi Min Zhao <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <1512046530[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: move the memory region read from pcilg
Pierre Morel [Thu, 30 Nov 2017 12:55:28 +0000 (13:55 +0100)]
s390x/pci: move the memory region read from pcilg

Let's move the memory region read from pcilg into a dedicated function.
This allows us to prepare a later patch.

Signed-off-by: Pierre Morel <[email protected]>
Reviewed-by: Yi Min Zhao <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-Id: <1512046530[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: rework PCI STORE BLOCK
Pierre Morel [Thu, 30 Nov 2017 12:55:27 +0000 (13:55 +0100)]
s390x/pci: rework PCI STORE BLOCK

Enhance the fault detection.

Fixup the precedence to check the destination path existance
before checking for the source accessibility.

Add the maxstbl entry to both the Query PCI Function Group
response and the PCIBusDevice structure.

Initialize the maxstbl to 128 per default until we get
the actual data from the hardware.

Signed-off-by: Pierre Morel <[email protected]>
Reviewed-by: Yi Min Zhao <[email protected]>
Message-Id: <1512046530[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: rework PCI LOAD
Pierre Morel [Thu, 30 Nov 2017 12:55:26 +0000 (13:55 +0100)]
s390x/pci: rework PCI LOAD

Enhance the fault detection, correction of the fault reporting.

Signed-off-by: Pierre Morel <[email protected]>
Reviewed-by: Yi Min Zhao <[email protected]>
Message-Id: <1512046530[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: rework PCI STORE
Pierre Morel [Thu, 30 Nov 2017 12:55:25 +0000 (13:55 +0100)]
s390x/pci: rework PCI STORE

Enhance the fault detection, correction of the fault reporting.

Signed-off-by: Pierre Morel <[email protected]>
Reviewed-by: Yi Min Zhao <[email protected]>
Message-Id: <1512046530[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: factor out endianess conversion
Pierre Morel [Thu, 30 Nov 2017 12:55:24 +0000 (13:55 +0100)]
s390x/pci: factor out endianess conversion

There are two places where the same endianness conversion
is done.
Let's factor this out into a static function.

Note that the conversion must always be done for data in a register:

The S390 BE guest converted date to le before issuing the instruction.

After interception in a BE host:
ZPCI VFIO using pwrite must make the conversion back for the BE kernel.
Kernel will do BE to le translation when loading the register for the
real instruction.

After interception in a le host:
TCG stores a BE register in le, swapping bytes.
But since the data in the register was already le it is now BE
ZPCI VFIO must convert it to le before writing to the PCI memory.

In both cases ZPCI VFIO must swap the bytes from the register.

Signed-off-by: Pierre Morel <[email protected]>
Reviewed-by: Yi Min Zhao <[email protected]>
Message-Id: <1512046530[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: drop potential_page_fault()
David Hildenbrand [Thu, 30 Nov 2017 16:27:44 +0000 (17:27 +0100)]
s390x/tcg: drop potential_page_fault()

Only one user left, get rid of it so we don't get any new users.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: drop program_interrupt()
David Hildenbrand [Thu, 30 Nov 2017 16:27:43 +0000 (17:27 +0100)]
s390x/tcg: drop program_interrupt()

All users are gone, we can finally drop it and make sure that all new
program interrupt injections are reminded of the retaddr - as they have to
use s390_program_interrupt() now.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: use s390_program_interrupt() in STSI
David Hildenbrand [Thu, 30 Nov 2017 16:27:42 +0000 (17:27 +0100)]
s390x/tcg: use s390_program_interrupt() in STSI

STSI needs some more love, but let's do one step at a time.
We can now drop potential_page_fault().

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: use s390_program_interrupt() in SACF
David Hildenbrand [Thu, 30 Nov 2017 16:27:41 +0000 (17:27 +0100)]
s390x/tcg: use s390_program_interrupt() in SACF

Convert this user, too.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: use s390_program_interrupt() in per_check_exception()
David Hildenbrand [Thu, 30 Nov 2017 16:27:40 +0000 (17:27 +0100)]
s390x/tcg: use s390_program_interrupt() in per_check_exception()

We can now drop updating the cc.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: use s390_program_interrupt() in DIAG
David Hildenbrand [Thu, 30 Nov 2017 16:27:39 +0000 (17:27 +0100)]
s390x/tcg: use s390_program_interrupt() in DIAG

Now we can drop the two save statements in the translate function.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: use s390_program_interrupt() in SCLP Service Call
David Hildenbrand [Thu, 30 Nov 2017 16:27:38 +0000 (17:27 +0100)]
s390x/tcg: use s390_program_interrupt() in SCLP Service Call

Now we can drop potential_page_fault(). While at it, move the
unlock further up, looks cleaner.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: io instructions don't need potential_page_fault()
David Hildenbrand [Thu, 30 Nov 2017 16:27:37 +0000 (17:27 +0100)]
s390x/tcg: io instructions don't need potential_page_fault()

As we handle the retaddr in all cases properly now, we can drop it.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: don't exit the cpu loop in s390_cpu_virt_mem_rw()
David Hildenbrand [Thu, 30 Nov 2017 16:27:36 +0000 (17:27 +0100)]
s390x/tcg: don't exit the cpu loop in s390_cpu_virt_mem_rw()

s390_cpu_virt_mem_rw() must always return, so callers can react on
an exception (e.g. see ioinst_handle_stcrw()).

Therefore, using program_interrupt() is wrong. Fix that up.

Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x: handle exceptions during s390_cpu_virt_mem_rw() correctly (TCG)
David Hildenbrand [Thu, 30 Nov 2017 16:27:35 +0000 (17:27 +0100)]
s390x: handle exceptions during s390_cpu_virt_mem_rw() correctly (TCG)

s390_cpu_virt_mem_rw() must always return, so callers can react on
an exception (e.g. see ioinst_handle_stcrw()).

However, for TCG we always have to exit the cpu loop (and restore the
cpu state before that) if we injected a program interrupt. So let's
introduce and use s390_cpu_virt_mem_handle_exc() in code that is not
purely KVM.

Directly pass the retaddr we already have available in these functions.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/diag: pass the retaddr into handle_diag_308()
David Hildenbrand [Thu, 30 Nov 2017 16:27:34 +0000 (17:27 +0100)]
s390x/diag: pass the retaddr into handle_diag_308()

Needed to later drop potential_page_fault() from the diag TCG translate
function.

Convert program_interrupt() to s390_program_interrupt() directly, making
use of the passed address.

Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/pci: pass the retaddr to all PCI instructions
David Hildenbrand [Thu, 30 Nov 2017 16:27:33 +0000 (17:27 +0100)]
s390x/pci: pass the retaddr to all PCI instructions

Once we wire up TCG, we will need the retaddr to correctly inject
program interrupts. As we want to get rid of the function
program_interrupt(), convert PCI code too.

For KVM, we can simply use RA_IGNORED.

Convert program_interrupt() to s390_program_interrupt() directly, making
use of the passed address.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/ioinst: pass the retaddr to all IO instructions
David Hildenbrand [Thu, 30 Nov 2017 16:27:32 +0000 (17:27 +0100)]
s390x/ioinst: pass the retaddr to all IO instructions

TCG needs the retaddr when injecting an interrupt. Let's just pass it
along and use RA_IGNORED for KVM. The value will be completely ignored for
KVM.

Convert program_interrupt() to s390_program_interrupt() directly, making
use of the passed address.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: rip out dead tpi code
David Hildenbrand [Thu, 30 Nov 2017 16:27:31 +0000 (17:27 +0100)]
s390x/tcg: rip out dead tpi code

It is broken and not even wired up. We'll add a new handler soon, but
that will live somewhere else.

Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: get rid of runtime_exception()
David Hildenbrand [Thu, 30 Nov 2017 16:27:30 +0000 (17:27 +0100)]
s390x/tcg: get rid of runtime_exception()

Let's use s390_program_interrupt() instead.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/tcg: introduce and use s390_program_interrupt()
David Hildenbrand [Thu, 30 Nov 2017 16:27:29 +0000 (17:27 +0100)]
s390x/tcg: introduce and use s390_program_interrupt()

Allows to easily convert more callers of program_interrupt() and to
easily introduce new exceptions without forgetting about the cpu state
reset.

Use s390_program_interrupt() in places where we already had the same
pattern. We will later get rid of program_interrupt().

RA != 0 checks are already done behind the scenes.

Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Message-Id: <20171130162744[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agotarget/s390x: nuke DPRINTF in helper.c
Cornelia Huck [Thu, 30 Nov 2017 13:57:36 +0000 (14:57 +0100)]
target/s390x: nuke DPRINTF in helper.c

It is not used anywhere.

Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x: introduce 2.12 compat machine
Cornelia Huck [Fri, 24 Nov 2017 15:26:51 +0000 (16:26 +0100)]
s390x: introduce 2.12 compat machine

Acked-by: Christian Borntraeger <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw.img: update image
Cornelia Huck [Wed, 22 Nov 2017 15:39:45 +0000 (16:39 +0100)]
pc-bios/s390-ccw.img: update image

Contains the following commit:
- pc-bios/s390-ccw: zero out bss section

Signed-off-by: Cornelia Huck <[email protected]>
7 years agopc-bios/s390-ccw: zero out bss section
Christian Borntraeger [Wed, 22 Nov 2017 14:26:27 +0000 (15:26 +0100)]
pc-bios/s390-ccw: zero out bss section

The QEMU ELF loader does not zero the bss segment.
This resulted in several bugs, e.g. see

commit 5d739a4787a5 (s390-ccw.img: Fix sporadic errors with ccw boot image - initialize css)
commit 6a40fa2669d3 (s390-ccw.img: Initialize next_idx)
commit 8775d91a0f42 (pc-bios/s390-ccw: Fix problem with invalid virtio-scsi LUN when rebooting)

Let's fix this once and forever by letting the BIOS zero the bss itself.

Suggested-by: Alexander Graf <[email protected]>
Signed-off-by: Christian Borntraeger <[email protected]>
Message-Id: <20171122142627[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agos390x/migration: use zero flag parameter
Christian Borntraeger [Wed, 22 Nov 2017 14:26:26 +0000 (15:26 +0100)]
s390x/migration: use zero flag parameter

valgrind pointed out that we call KVM_S390_GET_IRQ_STATE with an
undefined value for flags. Kernels prior to 4.15 did not use that
field, and later kernels ignore it for compatibility reasons, but we
better play safe.

The same is true for SET_IRQ_STATE. We should make sure to not use the
flag field, either.

Signed-off-by: Christian Borntraeger <[email protected]>
Message-Id: <20171122142627[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Signed-off-by: Cornelia Huck <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20171214' into staging
Peter Maydell [Thu, 14 Dec 2017 15:32:32 +0000 (15:32 +0000)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20171214' into staging

HMP pull 2017-12-14

# gpg: Signature made Thu 14 Dec 2017 12:46:41 GMT
# gpg:                using RSA key 0x0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <[email protected]>"
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-hmp-20171214:
  tests: test-hmp: print command execution result
  hmp-commands: Remove the deprecated usb_add and usb_del

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171213' into...
Peter Maydell [Thu, 14 Dec 2017 14:22:17 +0000 (14:22 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171213' into staging

target-arm queue:
 * xilinx_spips: set reset values correctly
 * MAINTAINERS: fix an email address
 * hw/display/tc6393xb: limit irq handler index to TC6393XB_GPIOS
 * nvic: Make systick banked for v8M
 * refactor get_phys_addr() so we can return the right format PAR
   for ATS operations
 * implement v8M TT instruction
 * fix some minor v8M bugs
 * Implement reset for GICv3 ITS
 * xlnx-zcu102: Add support for the ZynqMP QSPI

# gpg: Signature made Wed 13 Dec 2017 18:01:31 GMT
# gpg:                using RSA key 0x3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <[email protected]>"
# gpg:                 aka "Peter Maydell <[email protected]>"
# gpg:                 aka "Peter Maydell <[email protected]>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20171213: (43 commits)
  xilinx_spips: Use memset instead of a for loop to zero registers
  xilinx_spips: Set all of the reset values
  xilinx_spips: Update the QSPI Mod ID reset value
  MAINTAINERS: replace the unavailable email address
  hw/display/tc6393xb: limit irq handler index to TC6393XB_GPIOS
  nvic: Make systick banked
  nvic: Make nvic_sysreg_ns_ops work with any MemoryRegion
  target/arm: Extend PAR format determination
  target/arm: Remove fsr argument from get_phys_addr() and arm_tlb_fill()
  target/arm: Ignore fsr from get_phys_addr() in do_ats_write()
  target/arm: Use ARMMMUFaultInfo in deliver_fault()
  target/arm: Convert get_phys_addr_pmsav8() to not return FSC values
  target/arm: Convert get_phys_addr_pmsav7() to not return FSC values
  target/arm: Convert get_phys_addr_pmsav5() to not return FSC values
  target/arm: Convert get_phys_addr_lpae() to not return FSC values
  target/arm: Convert get_phys_addr_v6() to not return FSC values
  target/arm: Convert get_phys_addr_v5() to not return FSC values
  target/arm: Remove fsr argument from arm_ld*_ptw()
  target/arm: Provide fault type enum and FSR conversion functions
  target/arm: Implement TT instruction
  ...

Signed-off-by: Peter Maydell <[email protected]>
7 years agoMerge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20171213.0' into...
Peter Maydell [Thu, 14 Dec 2017 13:28:06 +0000 (13:28 +0000)]
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20171213.0' into staging

VFIO updates for v2.12

 - Fix bug failing to register all but the first group attached to
   a container with kvm-vfio device (Alex Williamson)

 - Explicit QLIST init (Yi Lui)

 - SPAPR IOMMU v1 fallback (Alexey Kardashevskiy)

 - Remove unused structure fields (Alexey Kardashevskiy)

# gpg: Signature made Wed 13 Dec 2017 18:03:48 GMT
# gpg:                using RSA key 0x239B9B6E3BB08B22
# gpg: Good signature from "Alex Williamson <[email protected]>"
# gpg:                 aka "Alex Williamson <[email protected]>"
# gpg:                 aka "Alex Williamson <[email protected]>"
# gpg:                 aka "Alex Williamson <[email protected]>"
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* remotes/awilliam/tags/vfio-update-20171213.0:
  vfio-pci: Remove unused fields from VFIOMSIXInfo
  vfio/spapr: Allow fallback to SPAPR TCE IOMMU v1
  vfio/common: init giommu_list and hostwin_list of vfio container
  vfio: Fix vfio-kvm group registration

Signed-off-by: Peter Maydell <[email protected]>
7 years agotests: test-hmp: print command execution result
Vadim Galitsyn [Mon, 23 Oct 2017 15:13:10 +0000 (17:13 +0200)]
tests: test-hmp: print command execution result

Provide HMP monitor command execution result as it would be seen
by user who established an HMP monitor session.

Currently many commands may silently fail without any sign of that.
This patch let this info to be printed once test is running in
verbose mode.

For the future it might be useful to fail the test if command has
failed, however it would require a bit of rework inside test
engine itself.

A simple example of silent failure without reporting it would to
add some non-existent HMP command into 'hmp_cmds' list. In this case
test will report it successfully passed without error.

Signed-off-by: Vadim Galitsyn <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: [email protected]
Message-Id: <20171023151310[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agohmp-commands: Remove the deprecated usb_add and usb_del
Thomas Huth [Thu, 30 Nov 2017 20:19:00 +0000 (21:19 +0100)]
hmp-commands: Remove the deprecated usb_add and usb_del

It's easy to use device_add and device_del as replacement instead.
The usb_add and usb_del commands are deprecated since QEMU 2.10,
and nobody complained that they are still needed, so let's get rid
of them now to make the HMP interface a little bit less overloaded.

Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
Message-Id: <1512073140[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
7 years agoxilinx_spips: Use memset instead of a for loop to zero registers
Alistair Francis [Wed, 13 Dec 2017 17:59:26 +0000 (17:59 +0000)]
xilinx_spips: Use memset instead of a for loop to zero registers

Use memset() instead of a for loop to zero all of the registers.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Reviewed-by: Francisco Iglesias <[email protected]>
Message-id: c076e907f355923864cb1afde31b938ffb677778.1513104804[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agoxilinx_spips: Set all of the reset values
Alistair Francis [Wed, 13 Dec 2017 17:59:26 +0000 (17:59 +0000)]
xilinx_spips: Set all of the reset values

Following the ZynqMP register spec let's ensure that all reset values
are set.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Francisco Iglesias <[email protected]>
Message-id: 19836f3e0a298b13343c5a59c87425355e7fd8bd.1513104804[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agoxilinx_spips: Update the QSPI Mod ID reset value
Alistair Francis [Wed, 13 Dec 2017 17:59:26 +0000 (17:59 +0000)]
xilinx_spips: Update the QSPI Mod ID reset value

Update the reset value to match the latest ZynqMP register spec.

Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Reviewed-by: Francisco Iglesias <[email protected]>
Message-id: c03e51d041db7f055596084891aeb1e856e32b9f.1513104804[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agoMAINTAINERS: replace the unavailable email address
Zhaoshenglong [Wed, 13 Dec 2017 17:59:26 +0000 (17:59 +0000)]
MAINTAINERS: replace the unavailable email address

Since I'm not working as an assignee in Linaro, replace the Linaro email
address with my personal one.

Signed-off-by: Zhaoshenglong <[email protected]>
Message-id: 1513058845[email protected]
Signed-off-by: Peter Maydell <[email protected]>
7 years agohw/display/tc6393xb: limit irq handler index to TC6393XB_GPIOS
Prasad J Pandit [Wed, 13 Dec 2017 17:59:26 +0000 (17:59 +0000)]
hw/display/tc6393xb: limit irq handler index to TC6393XB_GPIOS

The ctz32() routine could return a value greater than
TC6393XB_GPIOS=16, because the device has 24 GPIO level
bits but we only implement 16 outgoing lines. This could
lead to an OOB array access. Mask 'level' to avoid it.

Reported-by: Moguofang <[email protected]>
Signed-off-by: Prasad J Pandit <[email protected]>
Message-id: 20171212041539[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
7 years agonvic: Make systick banked
Peter Maydell [Wed, 13 Dec 2017 17:59:26 +0000 (17:59 +0000)]
nvic: Make systick banked

For the v8M security extension, there should be two systick
devices, which use separate banked systick exceptions. The
register interface is banked in the same way as for other
banked registers, including the existence of an NS alias
region for secure code to access the nonsecure timer.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 1512154296[email protected]

7 years agonvic: Make nvic_sysreg_ns_ops work with any MemoryRegion
Peter Maydell [Wed, 13 Dec 2017 17:59:26 +0000 (17:59 +0000)]
nvic: Make nvic_sysreg_ns_ops work with any MemoryRegion

Generalize nvic_sysreg_ns_ops so that we can pass it an
arbitrary MemoryRegion which it will use as the underlying
register implementation to apply the NS-alias behaviour
to. We'll want this so we can do the same with systick.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 1512154296[email protected]

7 years agotarget/arm: Extend PAR format determination
Edgar E. Iglesias [Wed, 13 Dec 2017 17:59:25 +0000 (17:59 +0000)]
target/arm: Extend PAR format determination

Now that do_ats_write() is entirely in control of whether to
generate a 32-bit PAR or a 64-bit PAR, we can make it use the
correct (complicated) condition for doing so.

Signed-off-by: Edgar E. Iglesias <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Tested-by: Stefano Stabellini <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
Message-id: 1512503192[email protected]
[PMM: Rebased Edgar's patch on top of get_phys_addr() refactoring;
 use arm_s1_regime_using_lpae_format() rather than
 regime_using_lpae_format() because the latter will assert
 if passed ARMMMUIdx_S12NSE0 or ARMMMUIdx_S12NSE1;
 updated commit message appropriately]
Signed-off-by: Peter Maydell <[email protected]>
7 years agotarget/arm: Remove fsr argument from get_phys_addr() and arm_tlb_fill()
Peter Maydell [Wed, 13 Dec 2017 17:59:25 +0000 (17:59 +0000)]
target/arm: Remove fsr argument from get_phys_addr() and arm_tlb_fill()

All of the callers of get_phys_addr() and arm_tlb_fill() now ignore
the FSR values they return, so we can just remove the argument
entirely.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Tested-by: Stefano Stabellini <[email protected]>
Message-id: 1512503192[email protected]

7 years agotarget/arm: Ignore fsr from get_phys_addr() in do_ats_write()
Peter Maydell [Wed, 13 Dec 2017 17:59:25 +0000 (17:59 +0000)]
target/arm: Ignore fsr from get_phys_addr() in do_ats_write()

In do_ats_write(), rather than using the FSR value from get_phys_addr(),
construct the PAR values using the information in the ARMMMUFaultInfo
struct. This allows us to create a PAR of the correct format regardless
of what the translation table format is.

For the moment we leave the condition for "when should this be a
64 bit PAR" as it was previously; this will need to be fixed to
properly support AArch32 Hyp mode.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Tested-by: Stefano Stabellini <[email protected]>
Message-id: 1512503192[email protected]

7 years agotarget/arm: Use ARMMMUFaultInfo in deliver_fault()
Peter Maydell [Wed, 13 Dec 2017 17:59:25 +0000 (17:59 +0000)]
target/arm: Use ARMMMUFaultInfo in deliver_fault()

Now that ARMMMUFaultInfo is guaranteed to have enough information
to construct a fault status code, we can pass it in to the
deliver_fault() function and let it generate the correct type
of FSR for the destination, rather than relying on the value
provided by get_phys_addr().

I don't think there are any cases the old code was getting
wrong, but this is more obviously correct.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Tested-by: Stefano Stabellini <[email protected]>
Message-id: 1512503192[email protected]

7 years agotarget/arm: Convert get_phys_addr_pmsav8() to not return FSC values
Peter Maydell [Wed, 13 Dec 2017 17:59:25 +0000 (17:59 +0000)]
target/arm: Convert get_phys_addr_pmsav8() to not return FSC values

Make get_phys_addr_pmsav8() return a fault type in the ARMMMUFaultInfo
structure, which we convert to the FSC at the callsite.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Tested-by: Stefano Stabellini <[email protected]>
Message-id: 1512503192[email protected]

7 years agotarget/arm: Convert get_phys_addr_pmsav7() to not return FSC values
Peter Maydell [Wed, 13 Dec 2017 17:59:25 +0000 (17:59 +0000)]
target/arm: Convert get_phys_addr_pmsav7() to not return FSC values

Make get_phys_addr_pmsav7() return a fault type in the ARMMMUFaultInfo
structure, which we convert to the FSC at the callsite.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Edgar E. Iglesias <[email protected]>
Tested-by: Stefano Stabellini <[email protected]>
Message-id: 1512503192[email protected]

This page took 0.0982769999999999 seconds and 4 git commands to generate.