557 Commits

Author SHA1 Message Date
Chen Qun
a8d152c93d target/arm: Add more CPU features
Add i8mm, bf16, and dgh CPU features for AArch64.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
b209941fd1 target/arm: Add CPU features to query-cpu-model-expansion
Add CPU features to the result of query-cpu-model-expansion so that
other applications (such as libvirt) can know the supported CPU
features.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
7e8ced22a8 target/arm: introduce KVM_CAP_ARM_CPU_FEATURE
Introduce KVM_CAP_ARM_CPU_FEATURE to check whether KVM supports to set
CPU features in ARM.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
eb4515d392 target/arm: introduce CPU feature dependency mechanism
Some CPU features are dependent on other CPU features.  For example,
ID_AA64PFR0_EL1.FP field and ID_AA64PFR0_EL1.AdvSIMD must have the same
value, which means FP and ADVSIMD are dependent on each other, FPHP and
ADVSIMDHP are dependent on each other.

This commit introduces a mechanism for CPU feature dependency in
AArch64.  We build a directed graph from the CPU feature dependency
relationship, each edge from->to means the `to` CPU feature is dependent
on the `from` CPU feature.  And we will automatically enable/disable CPU
feature according to the directed graph.

For example, a, b, and c CPU features are in relationship a->b->c, which
means c is dependent on b and b is dependent on a.  If c is enabled by
user, then a and b is enabled automatically.  And if a is disabled by
user, then b and c is disabled automatically.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
91f65debbe target/arm: Allow ID registers to synchronize to KVM
There are 2 steps to synchronize the values of system registers from
CPU state to KVM:
1. write to the values of system registers from CPU state to
   (index,value) list by write_cpustate_to_list;
2. write the values in (index,value) list to KVM by
   write_list_to_kvmstate;

In step 1, the values of constant system registers are not allowed to
write to (index,value) list.  However, a constant system register is
CONSTANT for guest but not for QEMU, which means, QEMU can set/modify
the value of constant system registers that is different from phsical
registers when startup.  But if KVM is enabled, guest can not read the
values of the system registers which QEMU set unless they can be written
to (index,value) list.  And why not try to write to KVM if kvm_sync is
true?

At the moment we call write_cpustate_to_list, all ID registers are
contant, including ID_PFR1_EL1 and ID_AA64PFR0_EL1 because GIC has been
initialized.  Hence, let's give all ID registers a chance to write to
KVM.  If the write is successful, then write to (index,value) list.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
ba927d042e target/arm: register CPU features for property
The Arm architecture specifies a number of ID registers that are
characterized as comprising a set of 4-bit ID fields. Each ID field
identifies the presence, and possibly the level of support for, a
particular feature in an implementation of the architecture. [1]

For most of the ID fields, there is a minimum presence value, equal to
or higher than which means the corresponding CPU feature is implemented.
Hence, we can use the minimum presence value to determine whether a CPU
feature is enabled and enable a CPU feature.

To disable a CPU feature, setting the corresponding ID field to 0x0/0xf
(for unsigned/signed field) seems as a good idea.  However, it maybe
lead to some problems.  For example,  ID_AA64PFR0_EL1.FP is a signed ID
field. ID_AA64PFR0_EL1.FP == 0x0 represents the implementation of FP
(floating-point) and ID_AA64PFR0_EL1.FP == 0x1 represents the
implementation of FPHP (half-precision floating-point).  If
ID_AA64PFR0_EL1.FP is set to 0xf when FPHP is disabled (which is also
disable FP), guest kernel maybe stuck.  Hence, we add a ni_value (means
not-implemented value) to disable a CPU feature safely.

[1] D13.1.3 Principles of the ID scheme for fields in ID registers in
    DDI.0487

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
2b32a865ed target/arm: parse cpu feature related options
The implementation of CPUClass::parse_features only supports CPU
features in "feature=value" format.  However, libvirt maybe send us a
CPU feature string in "+feature/-feature" format.  Hence, we need to
override CPUClass::parse_features to support CPU feature string in both
"feature=value" and "+feature/-feature" format.

The logic of AArch64CPUClass::parse_features is similar to that of
X86CPUClass::parse_features.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
9604fd9462 target/arm: convert isar regs to array
The isar in ARMCPU is a struct, each field of which represents an ID
register.  It's not convenient for us to support CPU feature in AArch64.
So let's change it to an array first and add an enum as the index of the
array for convenience.  Since we will never access high 32-bits of ID
registers in AArch32, it's harmless to change the ID registers in
AArch32 to 64-bits.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
02d6bdafd7 spec: Update patch and changelog with !241 x86 cache透传优化补丁回合 !241
i386: cache passthrough: Update Intel CPUID4.EAX[25:14] based on vCPU topo
i386: cache passthrough: Update AMD 8000_001D.EAX[25:14] based on vCPU topo

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
4cb2eaa9a9 i386: cache passthrough: Update AMD 8000_001D.EAX[25:14] based on vCPU topo
On AMD target, when host cache passthrough is disabled we will
emulate the guest caches with default values and initialize the
shared cpu list of the caches based on vCPU topology. However
when host cache passthrough is enabled, the shared cpu list is
consistent with host regardless what the vCPU topology is.

For example, when cache passthrough is enabled, running a guest
with vThreads=1 on a host with pThreads=2, we will get that there
are every *two* logical vCPUs sharing a L1/L2 cache, which is not
consistent with the vCPU topology (vThreads=1).

So let's reinitialize BITs[25:14] of AMD CPUID 8000_001D.EAX
based on the actual vCPU topology instead of host pCPU topology.

Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
0532b39a49 i386: cache passthrough: Update Intel CPUID4.EAX[25:14] based on vCPU topo
On Intel target, when host cache passthrough is disabled we will
emulate the guest caches with default values and initialize the
shared cpu list of the caches based on vCPU topology. However when
host cache passthrough is enabled, the shared cpu list is consistent
with host regardless what the vCPU topology is.

For example, when cache passthrough is enabled, running a guest
with vThreads=1 on a host with pThreads=2, we will get that there
are every *two* logical vCPUs sharing a L1/L2 cache, which is not
consistent with the vCPU topology (vThreads=1).

So let's reinitialize BITs[25:14] of Intel CPUID 4 based on the
actual vCPU topology instead of host pCPU topology.

Signed-off-by: Jian Wang <wangjian161@huawei.com>
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
9d233e7b1d spec: Update patch and changelog with !233 【6.2.0】IO补丁回合 !233
nbd/server.c: fix invalid read after client was already free
qemu-nbd: make native as the default aio mode
qemu-nbd: set timeout to qemu-nbd socket
qemu-pr: fixed ioctl failed for multipath disk
block: enable cache mode of empty cdrom
block: disallow block jobs when there is a BDRV_O_INACTIVE flag
scsi: cdrom: Fix crash after remote cdrom detached
block: bugfix: disable process AIO when attach scsi disk
block: bugfix: Don't pause vm when NOSPACE EIO happened
scsi: bugfix: fix division by zero

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
f4bc48e577 scsi: bugfix: fix division by zero
Error of PRDM disk may cause divide by zero in
scsi_read_complete(), so add LOG and assert().

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
f9ee5bf0c7 block: bugfix: Don't pause vm when NOSPACE EIO happened
When backend disk is FULL and disk IO type is 'dataplane',
QEMU will pause the vm, and this may cause endless-loop in
QEMU main thread if we do the snapshot merge now.

When backend disk is FULL, only reporting an error rather
than pausing the virtual machine.

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
9285ceab91 block: bugfix: disable process AIO when attach scsi disk
When initializing the virtio-scsi disk, hd_geometry_guess() will
be called to process AIO.  At this time, the scsi disk has not
been fully initialized, and some fields in struct SCSIDiskState,
such as vendor and version, are NULL.  If processing AIO at this
time, qemu may crash down.

Add aio_disable_external() before hd_geometry_guess() to disable
processing AIO at that time.

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
b92432f462 scsi: cdrom: Fix crash after remote cdrom detached
There is a small window between the twice blk_is_available in
scsi_disk_emulate_command which would cause crash due to the later
assertion if the remote cdrom is detached in this window.

So this patch replaces assertions with return to avoid qemu crash.

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
e6eb2724a2 block: disallow block jobs when there is a BDRV_O_INACTIVE flag
Currently, migration will put a BDRV_O_INACTIVE flag
on bs's open_flags until another resume being called. In that case,
any IO from vm or block jobs will cause a qemu crash with an assert
'assert(!(bs->open_flags & BDRV_O_INACTIVE))' failure in bdrv_co_pwritev
function. we hereby disallow block jobs by faking a blocker.

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
05acb1318d block: enable cache mode of empty cdrom
enable cache mode even if cdrom is empty

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
95206472cc qemu-pr: fixed ioctl failed for multipath disk
We use ioctl to detect multipath devices.  However, we only set flags in
struct dm_ioctl (the argument to ioctl) and left other fields in random,
which may cause the failure of calling ioctl.  Hence, we set other
fields to 0 to avoid the failure.

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
5f9b6047bd qemu-nbd: set timeout to qemu-nbd socket
In case of insufficient memory and kill-9,
the NBD socket cannot be processed and stuck all the time.

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
ec87f83a2e qemu-nbd: make native as the default aio mode
When the file system is dealing with multithreading concurrent writing to a file,
the performance will be degraded because of the lock.
At present, the default AIO mode of QEMU NBD is threads. In the case of large blocks,
because IO is divided into small pieces and multiple queues, it will become multithreading
concurrent writing the same file. Due to the file system, the performance will be greatly reduced.
If you change to native mode, this problem will not exist.

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
3f9841ed96 nbd/server.c: fix invalid read after client was already free
In the process of NBD equipment pressurization, executing QEMU NBD will
lead to the failure of IO distribution and go to NBD_ Out process of trip().
If two or more IO go to the out process, client NBD will release in nbd_request_put().
The user after free problem that is read again in close().
Through the NBD_ Save the value of client > closing before the out process in trip
to solve the use after free problem.

Signed-off-by: wangjian161 <wangjian161@huawei.com>
2022-03-19 14:42:31 +08:00
imxcc
42a3ff7919 Update Release with openeuler !226 !231 !227 !228
Signed-off-by: imxcc <xingchaochao@huawei.com>
2022-03-19 14:42:31 +08:00
imxcc
92f8ca0f24 Update patch and changelog with openeuler !228
Signed-off-by: imxcc <xingchaochao@huawei.com>
2022-03-19 14:42:31 +08:00
imxcc
54733e3d90 Update patch and changelog with openeuler !227
Signed-off-by: imxcc <xingchaochao@huawei.com>
2022-03-19 14:42:31 +08:00
imxcc
baab1dcfbb Update patch and changelog with openeuler !231
Signed-off-by: imxcc <xingchaochao@huawei.com>
2022-03-19 14:42:31 +08:00
imxcc
f0de605f36 Update patch and changelog with openeuler !226
Signed-off-by: imxcc <xingchaochao@huawei.com>
2022-03-19 14:42:31 +08:00
Yan Wang
1dfcba926c log: disable qemu_log function for "make check V=1"
Lots of patches will use qemu_log, it will cause "make check V=1"
failure. So disable qemu_log when calling "make check V=1".

Signed-off-by: Yan Wang <wangyan122@huawei.com>
2022-03-19 14:42:31 +08:00
Yan Wang
cb1e6efc6e chardev/baum: disable unused brlapi
disable unused brlapi.

Signed-off-by: Yan Wang <wangyan122@huawei.com>
2022-03-19 14:42:31 +08:00
imxcc
aca5683fc4 Update with openEuler !230
Signed-off-by: imxcc <xingchaochao@huawei.com>
2022-03-19 14:42:31 +08:00
imxcc
6b0777d910 sync from openeuler/pulls/221 and 222
Signed-off-by: imxcc <xingchaochao@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
8dba2ce743 spec: Update release version with !225
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
d52f975c7d spec: Update patch and changelog with !225 回合openEuler CPU model 自研patch Merge pull request !225 from limingwang/qemu-6.2.0 !225
cpu: parse +/- feature to avoid failure
cpu: add Kunpeng-920 cpu support
cpu: add Cortex-A72 processor kvm target support
add Phytium's CPU models: FT-2000+ and Tengyun-S2500.

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
ac48c0f1e8 add Phytium's CPU models: FT-2000+ and Tengyun-S2500.
Signed-off-by: Jiadong Zeng <zengjiadong@phytium.com.cn>
Signed-off-by: Mingwang Li <limingwang@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
a06c9a7f18 cpu: add Cortex-A72 processor kvm target support
The ARM Cortex-A72 is ARMv8-A micro-architecture,
add kvm target to ARM Cortex-A72 processor definition.

Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
Signed-off-by: Mingwang Li <limingwang@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
324e05ef61 cpu: add Kunpeng-920 cpu support
Add the Kunpeng-920 CPU model

Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
Signed-off-by: Mingwang Li <limingwang@huawei.com>
2022-03-19 14:42:31 +08:00
Chen Qun
5f141f43f0 cpu: parse +/- feature to avoid failure
To avoid cpu feature parse failure, +/- feature is added.

Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
Signed-off-by: Mingwang Li <limingwang@huawei.com>
2022-03-19 14:42:31 +08:00
liuxiangdong
db2c567699 qemu-6.2.0 compilation init
add net-dump.c-Suppress-spurious-compiler-warning.patch
2022-03-19 14:34:46 +08:00
liuxiangdong
787ea25064 Package init
Signed-off-by: yezengruan <yezengruan@huawei.com>
2022-03-19 14:31:23 +08:00
openeuler-ci-bot
cff59dc576
!411 Automatically generate code patches with openeuler !208 !213 !211
Merge pull request !411 from KuhnChen/master
2022-01-18 08:41:57 +00:00
Chen Qun
ff7588196f spec: Update release version with !208 !213 !211
increase release verison by one

Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
2021-12-21 21:28:08 +08:00
Chen Qun
e61a706223 spec: Update patch and changelog with !211 add Phytium's CPU models: FT-2000+ and Tengyun-S2500. Merge pull request !211 from 曾佳栋/qemu-4.1.0 !211
add Phytium's CPU models: FT-2000+ and Tengyun-S2500.

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-12-21 21:28:05 +08:00
Chen Qun
8a4ebc892a add Phytium's CPU models: FT-2000+ and Tengyun-S2500.
Signed-off-by: Jiadong Zeng <zengjiadong@phytium.com.cn>
2021-12-21 21:28:05 +08:00
Chen Qun
005d9d40c2 spec: Update patch and changelog with !213 virtio-balloon: apply upstream patch. !213
virtio-balloon: apply upstream patch.

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-12-21 21:28:03 +08:00
Chen Qun
7941e858a5 virtio-balloon: apply upstream patch.
Signed-off-by: Ming Yang <yangming73@huawei.com>
2021-12-21 21:28:03 +08:00
Chen Qun
14a75ddc3c spec: Update patch and changelog with !208 sync from SP1 !208
fix cve-2020-35504
fix cve-2020-35505

Signed-off-by: Chen Qun<kuhn.chenqun@huawei.com>
2021-12-21 21:28:00 +08:00
Chen Qun
da2b6f4f92 fix cve-2020-35505
esp: ensure cmdfifo is not empty and current_dev is non-NULL

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: imxcc <xingchaochao@huawei.com>
2021-12-21 21:28:00 +08:00
Chen Qun
a327e9e928 fix cve-2020-35504
esp: always check current_req is not NULL before use in DMA callbacks

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: imxcc <xingchaochao@huawei.com>
2021-12-21 21:28:00 +08:00
openeuler-ci-bot
774b9773fa !393 修复qemu的3个cve:cve-2021-3592 cve-2021-3593 cve-2021-3595
From: @bobychen
Reviewed-by: @imxcc
Signed-off-by: @imxcc
2021-10-27 02:38:56 +00:00
bobychen
5a2a43fcb1 fix cve-2021-3592 cve-2021-3593 cve-2021-3595
fix submodule slirp cve-2021-3592 cve-2021-3593 and cve-2021-3595

Signed-off-by: imxcc <xingchaochao@huawei.com>
Signed-off-by: bobychen <boby.chen@huawei.com>
2021-10-27 09:23:26 +08:00