OSDN Git Service

qmiga/qemu.git
2 years agosemihosting: Simplify softmmu_lock_user_string
Richard Henderson [Thu, 28 Apr 2022 04:06:58 +0000 (21:06 -0700)]
semihosting: Simplify softmmu_lock_user_string

We are not currently bounding the search to the 1024 bytes
that we allocated, possibly overrunning the buffer.
Use softmmu_strlen_user to find the length and allocate the
correct size from the beginning.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agosemihosting: Add target_strlen for softmmu-uaccess.h
Richard Henderson [Thu, 28 Apr 2022 04:03:12 +0000 (21:03 -0700)]
semihosting: Add target_strlen for softmmu-uaccess.h

Mirror the interface of the user-only function of the same name.
Use probe_access_flags for the common case of ram, and
cpu_memory_rw_debug for the uncommon case of mmio.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
v3: Use probe_access_flags (pmm)

2 years agoaccel/stubs: Add tcg stub for probe_access_flags
Richard Henderson [Sat, 21 May 2022 05:12:08 +0000 (22:12 -0700)]
accel/stubs: Add tcg stub for probe_access_flags

Reviewed-by: Luc Michel <lmichel@kalray.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agosemihosting: Move softmmu-uaccess.h functions out of line
Richard Henderson [Thu, 28 Apr 2022 03:44:17 +0000 (20:44 -0700)]
semihosting: Move softmmu-uaccess.h functions out of line

Rather that static (and not even inline) functions within a
header, move the functions to semihosting/uaccess.c.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agosemihosting: Improve condition for config.c and console.c
Richard Henderson [Sat, 30 Apr 2022 01:32:35 +0000 (18:32 -0700)]
semihosting: Improve condition for config.c and console.c

While CONFIG_SEMIHOSTING is currently only set for softmmu,
this will not continue to be true.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agosemihosting: Return failure from softmmu-uaccess.h functions
Richard Henderson [Thu, 28 Apr 2022 03:01:24 +0000 (20:01 -0700)]
semihosting: Return failure from softmmu-uaccess.h functions

We were reporting unconditional success for these functions;
pass on any failure from cpu_memory_rw_debug.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agosemihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.h
Richard Henderson [Thu, 28 Apr 2022 03:48:41 +0000 (20:48 -0700)]
semihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.h

We have a subdirectory for semihosting; move this file out of exec.
Rename to emphasize the contents are a replacement for the functions
in linux-user/bsd-user uaccess.c.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-target-arm-20220627' of https://git.linaro.org/people/pmaydell/qemu...
Richard Henderson [Mon, 27 Jun 2022 11:17:39 +0000 (16:47 +0530)]
Merge tag 'pull-target-arm-20220627' of https://git.linaro.org/people/pmaydell/qemu-arm into staging

target-arm queue:
 * sphinx: change default language to 'en'
 * Diagnose attempts to emulate EL3 in hvf as well as kvm
 * More SME groundwork patches
 * virt: Fix calculation of physical address space size
   for v7VE CPUs (eg cortex-a15)

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmK5hKEZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3lggEACtE2balVHrVCeSQkRW+FnS
# avm5i54MIGf3cgNhTKwD9ED3hl03Xm49yQkaq0gB6Qa4wQPEcYQLSyzP+UYIILO5
# 3xoWEw0nbtKWBuCzdiolynL1VFht6GV+Ga8lShoBiQsI/eARC6ZELvBv7gbApf4p
# DpDq1ty7fXMmMCNM5vgX9fu/LXahSONDXbYMpHpohnaLXCEF9MwqpO5TJf65Bgze
# z2+NO4R5u26mCcad7ltoiz3OKkq4Bq+b+QXrm6LmvSCIkvk6MUZuU1NwHSiqUoV/
# nOwhJriOVl8JG0sX0xzNZADYBt0YlcVuDZzyxP8eOiQ54CVK7rJOJSi+aiGkg2Mn
# YC4CkFZY9iM5YTA6y6T5mye7kLb/pJ746rLM1ia6Ng3rUwoE9bdvruqTMfPPJuoo
# XxMBQrjRjY6BzESG0NbjLgg80dPtqeOipjglYI7GCvh0i2yQVmKLQon5TK9DsScC
# 7Gu6IPVWZAb3axGEuqjJ4E+7PyyEW7zYgWNOpZoQW958WHDK0KSPrOwqxAC+QdEi
# vagKJGCQPuZiOARpXm6F/nscEDcy7P33z120O9/R6HuticGaM/oBaWy89CR4hbHB
# NWx5+0h5M/je8hJFJJVfHldR3nIpvnUtb4KEVoiNuxkrGZoejgTlBdKNL4Nph0U0
# E+CQyMuBBQ88LEbyCjJS5w==
# =GILG
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 27 Jun 2022 03:51:21 PM +0530
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [full]

* tag 'pull-target-arm-20220627' of https://git.linaro.org/people/pmaydell/qemu-arm: (25 commits)
  target/arm: Check V7VE as well as LPAE in arm_pamax
  target/arm: Extend arm_pamax to more than aarch64
  target/arm: Move pred_{full, gvec}_reg_{offset, size} to translate-a64.h
  target/arm: Add SVL to TB flags
  target/arm: Introduce sve_vqm1_for_el_sm
  target/arm: Add cpu properties for SME
  target/arm: Unexport aarch64_add_*_properties
  target/arm: Move arm_cpu_*_finalize to internals.h
  target/arm: Generalize cpu_arm_{get, set}_default_vec_len
  target/arm: Generalize cpu_arm_{get,set}_vq
  target/arm: Create ARMVQMap
  target/arm: Move error for sve%d property to arm_cpu_sve_finalize
  target/arm: Implement SMSTART, SMSTOP
  target/arm: Add the SME ZA storage to CPUARMState
  target/arm: Add PSTATE.{SM,ZA} to TB flags
  target/arm: Add SMIDR_EL1, SMPRI_EL1, SMPRIMAP_EL2
  target/arm: Add SMCR_ELx
  target/arm: Add SVCR
  target/arm: Add ARM_CP_SME
  target/arm: Add syn_smetrap
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotarget/arm: Check V7VE as well as LPAE in arm_pamax
Richard Henderson [Sun, 19 Jun 2022 00:15:41 +0000 (17:15 -0700)]
target/arm: Check V7VE as well as LPAE in arm_pamax

In machvirt_init we create a cpu but do not fully initialize it.
Thus the propagation of V7VE to LPAE has not been done, and we
compute the wrong value for some v7 cpus, e.g. cortex-a15.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1078
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reported-by: He Zhe <zhe.he@windriver.com>
Message-id: 20220619001541.131672-3-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Extend arm_pamax to more than aarch64
Richard Henderson [Sun, 19 Jun 2022 00:15:40 +0000 (17:15 -0700)]
target/arm: Extend arm_pamax to more than aarch64

Move the code from hw/arm/virt.c that is supposed
to handle v7 into the one function.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reported-by: He Zhe <zhe.he@windriver.com>
Message-id: 20220619001541.131672-2-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Move pred_{full, gvec}_reg_{offset, size} to translate-a64.h
Richard Henderson [Mon, 20 Jun 2022 17:52:04 +0000 (10:52 -0700)]
target/arm: Move pred_{full, gvec}_reg_{offset, size} to translate-a64.h

We will need these functions in translate-sme.c.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-21-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add SVL to TB flags
Richard Henderson [Mon, 20 Jun 2022 17:52:03 +0000 (10:52 -0700)]
target/arm: Add SVL to TB flags

We need SVL separate from VL for RDSVL et al, as well as
ZA storage loads and stores, which do not require PSTATE.SM.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-20-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Introduce sve_vqm1_for_el_sm
Richard Henderson [Mon, 20 Jun 2022 17:52:02 +0000 (10:52 -0700)]
target/arm: Introduce sve_vqm1_for_el_sm

When Streaming SVE mode is enabled, the size is taken from
SMCR_ELx instead of ZCR_ELx.  The format is shared, but the
set of vector lengths is not.  Further, Streaming SVE does
not require any particular length to be supported.

Adjust sve_vqm1_for_el to pass the current value of PSTATE.SM
to the new function.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-19-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add cpu properties for SME
Richard Henderson [Mon, 20 Jun 2022 17:52:01 +0000 (10:52 -0700)]
target/arm: Add cpu properties for SME

Mirror the properties for SVE.  The main difference is
that any arbitrary set of powers of 2 may be supported,
and not the stricter constraints that apply to SVE.

Include a property to control FEAT_SME_FA64, as failing
to restrict the runtime to the proper subset of insns
could be a major point for bugs.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20220620175235.60881-18-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Unexport aarch64_add_*_properties
Richard Henderson [Mon, 20 Jun 2022 17:52:00 +0000 (10:52 -0700)]
target/arm: Unexport aarch64_add_*_properties

These functions are not used outside cpu64.c,
so make them static.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-17-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Move arm_cpu_*_finalize to internals.h
Richard Henderson [Mon, 20 Jun 2022 17:51:59 +0000 (10:51 -0700)]
target/arm: Move arm_cpu_*_finalize to internals.h

Drop the aa32-only inline fallbacks,
and just use a couple of ifdefs.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-16-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Generalize cpu_arm_{get, set}_default_vec_len
Richard Henderson [Mon, 20 Jun 2022 17:51:58 +0000 (10:51 -0700)]
target/arm: Generalize cpu_arm_{get, set}_default_vec_len

Rename from cpu_arm_{get,set}_sve_default_vec_len,
and take the pointer to default_vq from opaque.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-15-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Generalize cpu_arm_{get,set}_vq
Richard Henderson [Mon, 20 Jun 2022 17:51:57 +0000 (10:51 -0700)]
target/arm: Generalize cpu_arm_{get,set}_vq

Rename from cpu_arm_{get,set}_sve_vq, and take the
ARMVQMap as the opaque parameter.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-14-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Create ARMVQMap
Richard Henderson [Mon, 20 Jun 2022 17:51:56 +0000 (10:51 -0700)]
target/arm: Create ARMVQMap

Pull the three sve_vq_* values into a structure.
This will be reused for SME.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-13-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Move error for sve%d property to arm_cpu_sve_finalize
Richard Henderson [Mon, 20 Jun 2022 17:51:55 +0000 (10:51 -0700)]
target/arm: Move error for sve%d property to arm_cpu_sve_finalize

Keep all of the error messages together.  This does mean that
when setting many sve length properties we'll only generate
one error, but we only really need one.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-12-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Implement SMSTART, SMSTOP
Richard Henderson [Mon, 20 Jun 2022 17:51:54 +0000 (10:51 -0700)]
target/arm: Implement SMSTART, SMSTOP

These two instructions are aliases of MSR (immediate).
Use the two helpers to properly implement svcr_write.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add the SME ZA storage to CPUARMState
Richard Henderson [Mon, 20 Jun 2022 17:51:53 +0000 (10:51 -0700)]
target/arm: Add the SME ZA storage to CPUARMState

Place this late in the resettable section of the structure,
to keep the most common element offsets from being > 64k.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-10-richard.henderson@linaro.org
[PMM: expanded comment on zarray[] format]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add PSTATE.{SM,ZA} to TB flags
Richard Henderson [Mon, 20 Jun 2022 17:51:52 +0000 (10:51 -0700)]
target/arm: Add PSTATE.{SM,ZA} to TB flags

These are required to determine if various insns
are allowed to issue.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-9-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add SMIDR_EL1, SMPRI_EL1, SMPRIMAP_EL2
Richard Henderson [Mon, 20 Jun 2022 17:51:51 +0000 (10:51 -0700)]
target/arm: Add SMIDR_EL1, SMPRI_EL1, SMPRIMAP_EL2

Implement the streaming mode identification register, and the
two streaming priority registers.  For QEMU, they are all RES0.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-8-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add SMCR_ELx
Richard Henderson [Mon, 20 Jun 2022 17:51:50 +0000 (10:51 -0700)]
target/arm: Add SMCR_ELx

These cpregs control the streaming vector length and whether the
full a64 instruction set is allowed while in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-7-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add SVCR
Richard Henderson [Mon, 20 Jun 2022 17:51:49 +0000 (10:51 -0700)]
target/arm: Add SVCR

This cpreg is used to access two new bits of PSTATE
that are not visible via any other mechanism.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add ARM_CP_SME
Richard Henderson [Mon, 20 Jun 2022 17:51:48 +0000 (10:51 -0700)]
target/arm: Add ARM_CP_SME

This will be used for controlling access to SME cpregs.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add syn_smetrap
Richard Henderson [Mon, 20 Jun 2022 17:51:47 +0000 (10:51 -0700)]
target/arm: Add syn_smetrap

This will be used for raising various traps for SME.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Add SMEEXC_EL to TB flags
Richard Henderson [Mon, 20 Jun 2022 17:51:46 +0000 (10:51 -0700)]
target/arm: Add SMEEXC_EL to TB flags

This is CheckSMEAccess, which is the basis for a set of
related tests for various SME cpregs and instructions.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Implement TPIDR2_EL0
Richard Henderson [Mon, 20 Jun 2022 17:51:45 +0000 (10:51 -0700)]
target/arm: Implement TPIDR2_EL0

This register is part of SME, but isn't closely related to the
rest of the extension.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620175235.60881-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agotarget/arm: Catch invalid kvm state also for hvf
Alexander Graf [Fri, 24 Jun 2022 14:42:56 +0000 (15:42 +0100)]
target/arm: Catch invalid kvm state also for hvf

Some features such as running in EL3 or running M profile code are
incompatible with virtualization as QEMU implements it today. To prevent
users from picking invalid configurations on other virt solutions like
Hvf, let's run the same checks there too.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1073
Signed-off-by: Alexander Graf <agraf@csgraf.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620192242.70573-2-agraf@csgraf.de
[PMM: Allow qtest accelerator too; tweak comment]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agoaccel: Introduce current_accel_name()
Alexander Graf [Fri, 24 Jun 2022 14:42:56 +0000 (15:42 +0100)]
accel: Introduce current_accel_name()

We need to fetch the name of the current accelerator in flexible error
messages more going forward. Let's create a helper that gives it to us
without casting in the target code.

Signed-off-by: Alexander Graf <agraf@csgraf.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220620192242.70573-1-agraf@csgraf.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agosphinx: change default language to 'en'
Martin Liška [Fri, 24 Jun 2022 14:42:55 +0000 (15:42 +0100)]
sphinx: change default language to 'en'

Fixes the following Sphinx warning (treated as error) starting
with 5.0 release:

Warning, treated as error:
Invalid configuration value found: 'language = None'. Update your configuration to a valid langauge code. Falling back to 'en' (English).

Signed-off-by: Martin Liska <mliska@suse.cz>
Message-id: e91e51ee-48ac-437e-6467-98b56ee40042@suse.cz
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agoMerge tag 'qemu-sparc-20220626' of https://github.com/mcayland/qemu into staging
Richard Henderson [Sun, 26 Jun 2022 23:51:05 +0000 (05:21 +0530)]
Merge tag 'qemu-sparc-20220626' of https://github.com/mcayland/qemu into staging

qemu-sparc queue

# -----BEGIN PGP SIGNATURE-----
#
# iQFSBAABCgA8FiEEzGIauY6CIA2RXMnEW8LFb64PMh8FAmK4moUeHG1hcmsuY2F2
# ZS1heWxhbmRAaWxhbmRlLmNvLnVrAAoJEFvCxW+uDzIfaXsH/0+FT9TbHXCplB8h
# gvOETq9r5UscYMqUIbRPv7eFIhhZUfq4mCzpthZHYfMA6Tag0jMqaP5ymATm6Jm/
# GgS/7Fx+14uO54Cu4NwIFylRuDt39cESrBHrVjmXmYzOXx7a040+TPxtHHwSRXiQ
# Vvx5Oo0P8qQfADQe/Y9iray3JBdFMg4yejO37yrdfP58Nh2dzr9dNKw6apY8dwcv
# eTVTqVbYY5AAKOjStpxb0x8dFq/WXttclbeaiSZsK1wnuqhJdUtiMY3UaAfYdMEW
# kputMhTZqV/oopUY0mHmBEUK843s8bSQs2aoCSXLamGTWcrm27XNOsX0f4AYwf/y
# jWBcSvg=
# =0MrK
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun 26 Jun 2022 11:12:29 PM +0530
# 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>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CC62 1AB9 8E82 200D 915C  C9C4 5BC2 C56F AE0F 321F

* tag 'qemu-sparc-20220626' of https://github.com/mcayland/qemu: (55 commits)
  artist: set memory region owners for buffers to the artist device
  ps2: remove update_irq() function and update_arg parameter
  pckbd: add QEMU interface comment for I8042 device
  pckbd: switch I8042 device from update_irq() function to PS2 device gpio
  pckbd: add i8042_reset() function to I8042 device
  pckbd: add QEMU interface comment for I8042_MMIO device
  pckbd: switch I8042_MMIO device from update_irq() function to PS2 device gpio
  lasips2: add QEMU interface comment
  lasips2: switch over from update_irq() function to PS2 device gpio
  lasips2: use sysbus IRQ for output IRQ
  lasips2: implement lasips2_realize()
  lasips2: add base property
  lasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init()
  lasips2: move mapping of LASIPS2 registers to HPPA machine
  lasips2: implement lasips2_init() function
  lasips2: rename lasips2_init() to lasips2_initfn() and update it to return the LASIPS2 device
  lasips2: move lasips2 QOM types from lasips2.c to lasips2.h
  lasips2: QOMify LASIPS2State
  pl050: add QEMU interface comment
  pl050: switch over from update_irq() function to PS2 device gpio
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoartist: set memory region owners for buffers to the artist device
Mark Cave-Ayland [Fri, 24 Jun 2022 16:08:39 +0000 (17:08 +0100)]
artist: set memory region owners for buffers to the artist device

This fixes the output of "info qom-tree" so that the buffers appear as children
of the artist device, rather than underneath the "unattached" container.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220624160839.886649-1-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Helge Deller <deller@gmx.de>
2 years agops2: remove update_irq() function and update_arg parameter
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:09 +0000 (14:41 +0100)]
ps2: remove update_irq() function and update_arg parameter

Now that all the PS2 devices have been converted to use GPIOs the update_irq()
callback function and the update_arg parameter can be removed.

This allows these arguments to be completely removed from ps2_kbd_init() and
ps2_mouse_init(), along with the transitional logic that was added to
ps2_raise_irq() and ps2_lower_irq().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-55-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: add QEMU interface comment for I8042 device
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:08 +0000 (14:41 +0100)]
pckbd: add QEMU interface comment for I8042 device

This describes the I8042 device interface implemented within QEMU.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220624134109.881989-54-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agopckbd: switch I8042 device from update_irq() function to PS2 device gpio
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:07 +0000 (14:41 +0100)]
pckbd: switch I8042 device from update_irq() function to PS2 device gpio

Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire up the
PS2 keyboard and mouse devices to use it. At the same time set update_irq() and
update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any
accidental attempt to use the legacy update_irq() function will cause a NULL
pointer dereference.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-53-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: add i8042_reset() function to I8042 device
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:06 +0000 (14:41 +0100)]
pckbd: add i8042_reset() function to I8042 device

This means that it is no longer necessary to call qemu_register_reset() manually
within i8042_realizefn().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-52-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: add QEMU interface comment for I8042_MMIO device
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:05 +0000 (14:41 +0100)]
pckbd: add QEMU interface comment for I8042_MMIO device

This describes the I8042_MMIO device interface implemented within QEMU.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220624134109.881989-51-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agopckbd: switch I8042_MMIO device from update_irq() function to PS2 device gpio
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:04 +0000 (14:41 +0100)]
pckbd: switch I8042_MMIO device from update_irq() function to PS2 device gpio

Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire up the
PS2 keyboard and mouse devices to use it. At the same time set update_irq() and
update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any
accidental attempt to use the legacy update_irq() function will cause a NULL
pointer dereference.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-50-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: add QEMU interface comment
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:03 +0000 (14:41 +0100)]
lasips2: add QEMU interface comment

This describes the LASI PS2 device interface implemented within QEMU.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220624134109.881989-49-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agolasips2: switch over from update_irq() function to PS2 device gpio
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:02 +0000 (14:41 +0100)]
lasips2: switch over from update_irq() function to PS2 device gpio

Add a qdev gpio input in lasips2_init() by taking the existing lasips2_port_set_irq()
function, updating it accordingly and then renaming to lasips2_set_irq(). Use these
new qdev gpio inputs to wire up the PS2 keyboard and mouse devices.

At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() and
ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq()
function will cause a NULL pointer dereference.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-48-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agolasips2: use sysbus IRQ for output IRQ
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:01 +0000 (14:41 +0100)]
lasips2: use sysbus IRQ for output IRQ

This enables the IRQ to be wired up using sysbus_connect_irq() in
lasips2_initfn().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-47-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agolasips2: implement lasips2_realize()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:41:00 +0000 (14:41 +0100)]
lasips2: implement lasips2_realize()

Move ps2_kbd_init() and ps2_mouse_init() from lasips2_initfn() to lasips2_realize.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-46-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: add base property
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:59 +0000 (14:40 +0100)]
lasips2: add base property

This is in preparation for handling vmstate_register() within the device.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-45-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agolasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:58 +0000 (14:40 +0100)]
lasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init()

This can be improved once the ps2_kbd_init() and ps2_mouse_init() functions have
been removed, but for now move the existing logic from lasi_initfn() to
lasi_init(). At the same time explicitly set keyboard port id to 0, even if it
isn't technically required.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-44-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: move mapping of LASIPS2 registers to HPPA machine
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:57 +0000 (14:40 +0100)]
lasips2: move mapping of LASIPS2 registers to HPPA machine

Now that the register memory regions are exposed as SysBus memory regions, move
the mapping of the LASIPS2 registers from lasips2_initfn() to the HPPA machine
(which is its only user).

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-43-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: implement lasips2_init() function
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:56 +0000 (14:40 +0100)]
lasips2: implement lasips2_init() function

Move the initialisation of the keyboard and mouse memory regions to lasips2_init()
and expose them as SysBus memory regions.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-42-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: rename lasips2_init() to lasips2_initfn() and update it to return the LASIPS...
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:55 +0000 (14:40 +0100)]
lasips2: rename lasips2_init() to lasips2_initfn() and update it to return the LASIPS2 device

When QOMifying a device it is typical to use _init() as the suffix for an
instance_init function, however this name is already in use by the legacy LASIPS2
wrapper function. Eventually the wrapper function will be removed, but for now
rename it to lasips2_initfn() to avoid a naming collision.

At the same time update lasips2_initfn() return the LASIPS2 device so that it
can later be accessed using qdev APIs by the HPPA machine.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-41-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: move lasips2 QOM types from lasips2.c to lasips2.h
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:54 +0000 (14:40 +0100)]
lasips2: move lasips2 QOM types from lasips2.c to lasips2.h

This allows the QOM types in lasips2.c to be used elsewhere by simply including
lasips2.h.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-40-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: QOMify LASIPS2State
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:53 +0000 (14:40 +0100)]
lasips2: QOMify LASIPS2State

Currently lasip2_init() creates a new LASIPS2State directly which is used by the HPPA
machine. Introduce a new LASIPS2 QOM type that will soon be used to allow the HPPA
machine to be wired up using standard qdev GPIOs.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-39-mark.cave-ayland@ilande.co.uk>

2 years agopl050: add QEMU interface comment
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:52 +0000 (14:40 +0100)]
pl050: add QEMU interface comment

This describes the PL050 device interface implemented within QEMU.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220624134109.881989-38-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agopl050: switch over from update_irq() function to PS2 device gpio
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:51 +0000 (14:40 +0100)]
pl050: switch over from update_irq() function to PS2 device gpio

Add a new pl050_init() function which initialises a qdev input gpio for handling
incoming PS2 IRQs, and then wire up the PS2 device to use it. At the same time
set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init()
to ensure that any accidental attempt to use the legacy update_irq() function will
cause a NULL pointer dereference.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-37-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agopckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:50 +0000 (14:40 +0100)]
pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState

This allows both IRQs to be declared as a single qdev gpio array.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-36-mark.cave-ayland@ilande.co.uk>

2 years agops2: add gpio for output IRQ and optionally use it in ps2_raise_irq() and ps2_lower_irq()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:49 +0000 (14:40 +0100)]
ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq() and ps2_lower_irq()

Define the gpio for the PS2 output IRQ in ps2_init() and add logic to optionally
use it in ps2_raise_irq() and ps2_lower_irq() if the gpio is connected. If the
gpio is not connected then call the legacy update_irq() function as before.

This allows the incremental conversion of devices from the legacy update_irq()
function to use gpios instead.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-35-mark.cave-ayland@ilande.co.uk>

2 years agops2: introduce ps2_lower_irq() instead of calling update_irq() directly
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:48 +0000 (14:40 +0100)]
ps2: introduce ps2_lower_irq() instead of calling update_irq() directly

This consolidates the logic of lowering the PS2 IRQ into one single function.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-34-mark.cave-ayland@ilande.co.uk>

2 years agops2: use ps2_raise_irq() instead of calling update_irq() directly
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:47 +0000 (14:40 +0100)]
ps2: use ps2_raise_irq() instead of calling update_irq() directly

This consolidates the logic of raising the PS2 IRQ into one single function.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-33-mark.cave-ayland@ilande.co.uk>

2 years agops2: make ps2_raise_irq() function static
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:46 +0000 (14:40 +0100)]
ps2: make ps2_raise_irq() function static

This function is no longer used outside of ps2.c and so can be declared static.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-32-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: move ps2_kbd_init() and ps2_mouse_init() to i8042_mmio_realize()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:45 +0000 (14:40 +0100)]
pckbd: move ps2_kbd_init() and ps2_mouse_init() to i8042_mmio_realize()

Move ps2_kbd_init() and ps2_mouse_init() from i8042_mm_init() to
i8042_mmio_realize() to further reduce the initialisation logic done in
i8042_mm_init().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-31-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: more vmstate_register() from i8042_mm_init() to i8042_mmio_realize()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:44 +0000 (14:40 +0100)]
pckbd: more vmstate_register() from i8042_mm_init() to i8042_mmio_realize()

Note in this case it is not possible to register a (new) VMStateDescription in
the DeviceClass without breaking migration compatibility for the MIPS magnum
machine.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-30-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agopckbd: move mapping of I8042_MMIO registers to MIPS magnum machine
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:43 +0000 (14:40 +0100)]
pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine

Now that the register memory region is exposed as a SysBus memory region, move
the mapping of the I8042_MMIO registers from i8042_mm_init() to the MIPS magnum
machine (which is its only user).

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-29-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: alter i8042_mm_init() to return a I8042_MMIO device
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:42 +0000 (14:40 +0100)]
pckbd: alter i8042_mm_init() to return a I8042_MMIO device

This exposes the I8042_MMIO device to the caller to allow the register memory
region to be mapped outside of i8042_mm_init().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-28-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: implement i8042_mmio_init() function
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:41 +0000 (14:40 +0100)]
pckbd: implement i8042_mmio_init() function

This enables use to set the required value of extended_state directly during
device init rather than in i8042_mm_init().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-27-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agopckbd: implement i8042_mmio_realize() function
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:40 +0000 (14:40 +0100)]
pckbd: implement i8042_mmio_realize() function

Move the initialisation of the register memory region to the I8042_MMIO device
realize function and expose it using sysbus_init_mmio().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-26-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: add size qdev property to I8042_MMIO device
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:39 +0000 (14:40 +0100)]
pckbd: add size qdev property to I8042_MMIO device

This will soon be used to set the size of the register memory region using a
qdev property.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-25-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: add mask qdev property to I8042_MMIO device
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:38 +0000 (14:40 +0100)]
pckbd: add mask qdev property to I8042_MMIO device

This allows the KBDState mask value to be set using a qdev property rather
than directly in i8042_mm_init().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-24-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: implement i8042_mmio_reset() for I8042_MMIO device
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:37 +0000 (14:40 +0100)]
pckbd: implement i8042_mmio_reset() for I8042_MMIO device

This allows the I8042_MMIO reset function to be registered directly within the
DeviceClass rather than using qemu_register_reset() directly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-23-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2 years agopckbd: introduce new I8042_MMIO QOM type
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:36 +0000 (14:40 +0100)]
pckbd: introduce new I8042_MMIO QOM type

Currently i8042_mm_init() creates a new KBDState directly which is used by the MIPS
magnum machine. Introduce a new I8042_MMIO QOM type that will soon be used to
allow the MIPS magnum machine to be wired up using standard qdev GPIOs.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-22-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: move ISAKBDState from pckbd.c to i8042.h
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:35 +0000 (14:40 +0100)]
pckbd: move ISAKBDState from pckbd.c to i8042.h

This allows the QOM types in pckbd.c to be used elsewhere by simply including
i8042.h.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-21-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: move KBDState from pckbd.c to i8042.h
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:34 +0000 (14:40 +0100)]
pckbd: move KBDState from pckbd.c to i8042.h

This allows the QOM types in pckbd.c to be used elsewhere by simply including
i8042.h.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-20-mark.cave-ayland@ilande.co.uk>

2 years agopckbd: checkpatch fixes
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:33 +0000 (14:40 +0100)]
pckbd: checkpatch fixes

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-19-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:32 +0000 (14:40 +0100)]
lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()

This better reflects that the IRQ input opaque is a LASIPS2Port structure
and not a PS2_DEVICE.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-18-mark.cave-ayland@ilande.co.uk>

2 years agolasips2: spacing fixes
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:31 +0000 (14:40 +0100)]
lasips2: spacing fixes

This helps improve the readability of lasips2.c.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-17-mark.cave-ayland@ilande.co.uk>

2 years agopl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq...
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:30 +0000 (14:40 +0100)]
pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions

This will soon allow pl050_set_irq() to be used as a GPIO input function.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-16-mark.cave-ayland@ilande.co.uk>

2 years agopl050: checkpatch fixes
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:29 +0000 (14:40 +0100)]
pl050: checkpatch fixes

This patch also includes a couple of minor spacing updates.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-15-mark.cave-ayland@ilande.co.uk>

2 years agops2: don't use vmstate_register() in ps2_mouse_init()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:28 +0000 (14:40 +0100)]
ps2: don't use vmstate_register() in ps2_mouse_init()

Since PS2_MOUSE_DEVICE is a qdev device then vmstate_ps2_mouse can be registered
using the DeviceClass vmsd field instead. There is no need to use
qdev_set_legacy_instance_id() to ensure migration compatibility since the first 2
parameters to vmstate_register() are NULL and 0 respectively.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-14-mark.cave-ayland@ilande.co.uk>

2 years agops2: don't use vmstate_register() in ps2_kbd_init()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:27 +0000 (14:40 +0100)]
ps2: don't use vmstate_register() in ps2_kbd_init()

Since PS2_KBD_DEVICE is a qdev device then vmstate_ps2_keyboard can be registered
using the DeviceClass vmsd field instead. There is no need to use
qdev_set_legacy_instance_id() to ensure migration compatibility since the first 2
parameters to vmstate_register() are NULL and 0 respectively.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-13-mark.cave-ayland@ilande.co.uk>

2 years agops2: implement ps2_mouse_realize() and use it to register ps2_mouse_handler
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:26 +0000 (14:40 +0100)]
ps2: implement ps2_mouse_realize() and use it to register ps2_mouse_handler

Move the registration of ps2_mouse_handler from ps2_mouse_init() to a new
ps2_mouse_realize() function. Since the abstract PS2_DEVICE parent class doesn't
have a realize() function then it is not necessary to store the reference to
it in PS2DeviceClass and use device_class_set_parent_realize().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-12-mark.cave-ayland@ilande.co.uk>

2 years agops2: implement ps2_kbd_realize() and use it to register ps2_keyboard_handler
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:25 +0000 (14:40 +0100)]
ps2: implement ps2_kbd_realize() and use it to register ps2_keyboard_handler

Move the registration of ps2_keyboard_handler from ps2_kbd_init() to a new
ps2_kbd_realize() function. Since the abstract PS2_DEVICE parent class doesn't
have a realize() function then it is not necessary to store the reference to
it in PS2DeviceClass and use device_class_set_parent_realize().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-11-mark.cave-ayland@ilande.co.uk>

2 years agops2: remove duplicate setting of scancode_set in ps2_kbd_init()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:24 +0000 (14:40 +0100)]
ps2: remove duplicate setting of scancode_set in ps2_kbd_init()

The default value for scancode_set is already set in ps2_kbd_reset() so there is no
need to duplicate this in ps2_kbd_init().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-10-mark.cave-ayland@ilande.co.uk>

2 years agops2: implement ps2_reset() for the PS2_DEVICE QOM type based upon ps2_common_reset()
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:23 +0000 (14:40 +0100)]
ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon ps2_common_reset()

The functionality of ps2_common_reset() can be moved into a new ps2_reset() function
for the PS2_DEVICE QOM type. Update PS2DeviceClass to hold a reference to the parent
reset function and update the PS2_KBD_DEVICE and PS2_MOUSE_DEVICE types to use
device_class_set_parent_reset() accordingly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-9-mark.cave-ayland@ilande.co.uk>

2 years agops2: introduce PS2DeviceClass
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:22 +0000 (14:40 +0100)]
ps2: introduce PS2DeviceClass

This is in preparation for allowing the new PS2_KBD_DEVICE and PS2_MOUSE_DEVICE
QOM types to reference the parent PS2_DEVICE device reset() function.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-8-mark.cave-ayland@ilande.co.uk>

2 years agops2: improve function prototypes in ps2.c and ps2.h
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:21 +0000 (14:40 +0100)]
ps2: improve function prototypes in ps2.c and ps2.h

With the latest changes it is now possible to improve some of the function
prototypes in ps2.c and ps.h to use the appropriate PS2KbdState or
PS2MouseState type instead of being a void opaque.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-7-mark.cave-ayland@ilande.co.uk>

2 years agops2: move QOM type definitions from ps2.c to ps2.h
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:20 +0000 (14:40 +0100)]
ps2: move QOM type definitions from ps2.c to ps2.h

Move the QOM type definitions into the ps2.h header file to allow the new QOM
types to be used by other devices.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-6-mark.cave-ayland@ilande.co.uk>

2 years agops2: QOMify PS2MouseState
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:19 +0000 (14:40 +0100)]
ps2: QOMify PS2MouseState

Make PS2MouseState into a new PS2_MOUSE_DEVICE QOM type which inherits from the
abstract PS2_DEVICE type.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-5-mark.cave-ayland@ilande.co.uk>

2 years agops2: QOMify PS2KbdState
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:18 +0000 (14:40 +0100)]
ps2: QOMify PS2KbdState

Make PS2KbdState into a new PS2_KBD_DEVICE QOM type which inherits from the
abstract PS2_DEVICE type.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-4-mark.cave-ayland@ilande.co.uk>

2 years agops2: QOMify PS2State
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:17 +0000 (14:40 +0100)]
ps2: QOMify PS2State

Make PS2State a new abstract PS2_DEVICE QOM type to represent the common
functionality shared between PS2 keyboard and mouse devices.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-3-mark.cave-ayland@ilande.co.uk>

2 years agops2: checkpatch fixes
Mark Cave-Ayland [Fri, 24 Jun 2022 13:40:16 +0000 (14:40 +0100)]
ps2: checkpatch fixes

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-2-mark.cave-ayland@ilande.co.uk>

2 years agoMerge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging
Richard Henderson [Fri, 24 Jun 2022 17:52:46 +0000 (10:52 -0700)]
Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging

Block layer patches

- Add vduse-blk export
- Dirty bitmaps: Fix and improve bitmap merge
- gluster: correctly set max_pdiscard
- rbd: report a better error when namespace does not exist
- aio_wait_kick: add missing memory barrier
- Code cleanups

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmK10yURHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9YnXg/+J9PKsGl7hbJUFVIb4RZ3pMQ0o4xC1TbS
# OjA63RRwdJWt1gGsgLNH6kdsgz04FXiXk7XNDTe8MYn21bvznCYGFsI2EFJiit+x
# HkOYXJwAGsrfKBViq8QznosBQbwf9fOrDUlOdbnixFH/dx6DXUZM2F9ud5shiuiC
# vrP76zjUgSlHhPwL+0xsJSNxxNISv845uN9SYNpiGbZDaYLBtNbEc8NA2GMOYW45
# sCbxJDxNSFNrTT5gaZyo4KGFH9393qJSmYHJ+q53elbhje5dpmcn2c/AkIG7/UM4
# HsEWd7Gj1YbLQV6kvkefJzF4BOuZmN/b8sG+LRDjrEMHLeOw5rh2ETmkQfIdy2H3
# 2U52mHqw9bMGWtds0ocOJFKw3vPZuOCJaA+ql/A0aWGO9Fjivx1cQcOVXn3jKgj5
# 7riSxigK9TCTd92Qhi3j4do86mJi9NpjgawbQ5oOvKqUiq29moOwcv1hit0WVzwB
# hJp2qsrM6w00wFseyp+10vHigW7ZMNEIh4TKYLfZ15Gvy6YIG/m/oyCYF4oVM5y5
# knbsnJBRpTjLnggag86Pk8Ji+Lxi0cbv7zrbn++/S9OLQ5VMV5OpxKXHmyX2HyXa
# RCV0rMaTC3s4hy8gElDSwSeor6NBaJ9TECcit67uJ/kw1eK+omoa4hKMCgKf6qYC
# GY+NRPELJGA=
# =OuiN
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 24 Jun 2022 08:07:17 AM PDT
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]

* tag 'for-upstream' of git://repo.or.cz/qemu/kevin:
  vduse-blk: Add name option
  vduse-blk: Add serial option
  nbd: Drop dead code spotted by Coverity
  aio_wait_kick: add missing memory barrier
  block/gluster: correctly set max_pdiscard
  block/rbd: report a better error when namespace does not exist
  qsd: document vduse-blk exports
  libvduse: Add support for reconnecting
  vduse-blk: Add vduse-blk resize support
  vduse-blk: Implement vduse-blk export
  libvduse: Add VDUSE (vDPA Device in Userspace) library
  linux-headers: Add vduse.h
  block/export: Abstract out the logic of virtio-blk I/O process
  block/export: Fix incorrect length passed to vu_queue_push()
  block: Support passing NULL ops to blk_set_dev_ops()
  block: simplify handling of try to merge different sized bitmaps
  block: improve block_dirty_bitmap_merge(): don't allocate extra bitmap
  block: block_dirty_bitmap_merge(): fix error path
  block: get rid of blk->guest_block_size
  block: drop unused bdrv_co_drain() API

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier...
Richard Henderson [Fri, 24 Jun 2022 15:58:33 +0000 (08:58 -0700)]
Merge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging

linux-user pull request 20220624

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEzS913cjjpNwuT1Fz8ww4vT8vvjwFAmK1iJISHGxhdXJlbnRA
# dml2aWVyLmV1AAoJEPMMOL0/L748NYIP/R11Ztk4XH8LNDszg/s0y+D3FJm3XAkj
# 5LHaJdRGu9KsCO1zVkZDbhm81LIzY8yEzoQKZhV0vy6A071A2QNp8Pu6JZ4fMt6H
# kIwKclwW7WOiI8Ox+cLW4YYPJvY0tbe9yGoHJnLQjjYOOPeoUQKJ/0wK6sBgnK4y
# R8u2x4AvE5hgFfQvI0HRF1Q1e4y5MQt1WmLIxsGl2yCKzKWA0LrPuLgLROLQPbFj
# R/7fNwQkFW0PGnyyd8MMzRTEV6mdNZ9rQDA8/n2Nqgf7uQQFsOpHfXnhoJPz/CGi
# njhixJXingozKb/mX8OA5/NO0Ps7n7/WgugB36QvaoG9M4+E+9vjOkKTFo0LtfeA
# r75++/gNcJhQrMRU6/jSRx25dlWjfuLmEbUVvvGYtgQJ1hsAs6UwXO9EF5n4ZOr8
# qzgbW0GssvFO8+Ow5HQvWOHENR6ylJSSGc0bvX61ZH+h7cJRbELCiO3wkpyGe8zN
# OjG4tHbAnqKhN52k2uannNnPPqXI4f7GMV91pPXqM5oppY0BNMKRC6+nIS6Ew1D3
# FnNDwYJcDBXRY+Abqdrxfx2BSC35cl7Bfl+OVkXal9tGZTmFB+NOaeFWs9fdHXFA
# QE0Ct3xMut6SfJCNLvHwvBHwYq5yDCV/dngGonqgacn+F/epkbdY9sdlsYeRbud2
# h1tremHRgq9e
# =6mTR
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 24 Jun 2022 02:49:06 AM PDT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [undefined]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [undefined]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu:
  linux-user: Adjust child_tidptr on set_tid_address() syscall
  linux-user: Add partial support for MADV_DONTNEED
  linux-user/x86_64: Fix ELF_PLATFORM

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agovduse-blk: Add name option
Xie Yongji [Tue, 14 Jun 2022 05:15:32 +0000 (13:15 +0800)]
vduse-blk: Add name option

Currently we use 'id' option as the name of VDUSE device.
It's a bit confusing since we use one value for two different
purposes: the ID to identfy the export within QEMU (must be
distinct from any other exports in the same QEMU process, but
can overlap with names used by other processes), and the VDUSE
name to uniquely identify it on the host (must be distinct from
other VDUSE devices on the same host, but can overlap with other
export types like NBD in the same process). To make it clear,
this patch adds a separate 'name' option to specify the VDUSE
name for the vduse-blk export instead.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Message-Id: <20220614051532.92-7-xieyongji@bytedance.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 years agovduse-blk: Add serial option
Xie Yongji [Tue, 14 Jun 2022 05:15:31 +0000 (13:15 +0800)]
vduse-blk: Add serial option

Add a 'serial' option to allow user to specify this value
explicitly. And the default value is changed to an empty
string as what we did in "hw/block/virtio-blk.c".

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Message-Id: <20220614051532.92-6-xieyongji@bytedance.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 years agonbd: Drop dead code spotted by Coverity
Eric Blake [Mon, 16 May 2022 21:05:19 +0000 (16:05 -0500)]
nbd: Drop dead code spotted by Coverity

CID 1488362 points out that the second 'rc >= 0' check is now dead
code.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Fixes: 172f5f1a40(nbd: remove peppering of nbd_client_connected)
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20220516210519.76135-1-eblake@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 years agoaio_wait_kick: add missing memory barrier
Emanuele Giuseppe Esposito [Tue, 24 May 2022 17:30:54 +0000 (13:30 -0400)]
aio_wait_kick: add missing memory barrier

It seems that aio_wait_kick always required a memory barrier
or atomic operation in the caller, but nobody actually
took care of doing it.

Let's put the barrier in the function instead, and pair it
with another one in AIO_WAIT_WHILE. Read aio_wait_kick()
comment for further explanation.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Message-Id: <20220524173054.12651-1-eesposit@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 years agoblock/gluster: correctly set max_pdiscard
Fabian Ebner [Fri, 20 May 2022 07:59:22 +0000 (09:59 +0200)]
block/gluster: correctly set max_pdiscard

On 64-bit platforms, assigning SIZE_MAX to the int64_t max_pdiscard
results in a negative value, and the following assertion would trigger
down the line (it's not the same max_pdiscard, but computed from the
other one):
qemu-system-x86_64: ../block/io.c:3166: bdrv_co_pdiscard: Assertion
`max_pdiscard >= bs->bl.request_alignment' failed.

On 32-bit platforms, it's fine to keep using SIZE_MAX.

The assertion in qemu_gluster_co_pdiscard() is checking that the value
of 'bytes' can safely be passed to glfs_discard_async(), which takes a
size_t for the argument in question, so it is kept as is. And since
max_pdiscard is still <= SIZE_MAX, relying on max_pdiscard is still
fine.

Fixes: 0c8022876f ("block: use int64_t instead of int in driver discard handlers")
Cc: qemu-stable@nongnu.org
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Message-Id: <20220520075922.43972-1-f.ebner@proxmox.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 years agoblock/rbd: report a better error when namespace does not exist
Stefano Garzarella [Tue, 17 May 2022 07:10:12 +0000 (09:10 +0200)]
block/rbd: report a better error when namespace does not exist

If the namespace does not exist, rbd_create() fails with -ENOENT and
QEMU reports a generic "error rbd create: No such file or directory":

    $ qemu-img create rbd:rbd/namespace/image 1M
    Formatting 'rbd:rbd/namespace/image', fmt=raw size=1048576
    qemu-img: rbd:rbd/namespace/image: error rbd create: No such file or directory

Unfortunately rados_ioctx_set_namespace() does not fail if the namespace
does not exist, so let's use rbd_namespace_exists() in qemu_rbd_connect()
to check if the namespace exists, reporting a more understandable error:

    $ qemu-img create rbd:rbd/namespace/image 1M
    Formatting 'rbd:rbd/namespace/image', fmt=raw size=1048576
    qemu-img: rbd:rbd/namespace/image: namespace 'namespace' does not exist

Reported-by: Tingting Mao <timao@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20220517071012.6120-1-sgarzare@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 years agoqsd: document vduse-blk exports
Stefan Hajnoczi [Wed, 25 May 2022 12:19:47 +0000 (13:19 +0100)]
qsd: document vduse-blk exports

Document vduse-blk exports in qemu-storage-daemon --help and the
qemu-storage-daemon(1) man page.

Based-on: <20220523084611.91-1-xieyongji@bytedance.com>
Cc: Xie Yongji <xieyongji@bytedance.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220525121947.859820-1-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 years agolibvduse: Add support for reconnecting
Xie Yongji [Mon, 23 May 2022 08:46:11 +0000 (16:46 +0800)]
libvduse: Add support for reconnecting

To support reconnecting after restart or crash, VDUSE backend
might need to resubmit inflight I/Os. This stores the metadata
such as the index of inflight I/O's descriptors to a shm file so
that VDUSE backend can restore them during reconnecting.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Message-Id: <20220523084611.91-9-xieyongji@bytedance.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 years agovduse-blk: Add vduse-blk resize support
Xie Yongji [Mon, 23 May 2022 08:46:10 +0000 (16:46 +0800)]
vduse-blk: Add vduse-blk resize support

To support block resize, this uses vduse_dev_update_config()
to update the capacity field in configuration space and inject
config interrupt on the block resize callback.

Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220523084611.91-8-xieyongji@bytedance.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>