[PATCH for-9.1 v5 0/3] kvm: add support for guest physical bits

2024-03-25 Thread Paolo Bonzini
The adjustments based on Gerd' v4 patches are small, the main change is the introduction of ABI-compatible machine types for 9.0 so that the new property is only available on 9.1. Gerd Hoffmann (2): target/i386: add guest-phys-bits cpu property kvm: add support for guest physical bits Paolo

[PATCH v2] pc_q35: remove unnecessary m->alias assignment

2024-03-25 Thread Paolo Bonzini
The assignment is already inherited from pc-q35-8.2. Signed-off-by: Paolo Bonzini --- hw/i386/pc_q35.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index b5922b44afa..c7bc8a2041f 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -393,7 +393,6

Re: [PATCH] pc_q35: remove unnecessary m->alias assignment

2024-03-25 Thread Paolo Bonzini
On Mon, Mar 25, 2024 at 3:02 PM Peter Maydell wrote: > > On Mon, 25 Mar 2024 at 13:59, Paolo Bonzini wrote: > > > > The assignment is already inherited from pc-q35-8.2. -s > > Missing signed-off-by and a stray "-s" in the commit message :-) You can proba

[PATCH] pc_q35: remove unnecessary m->alias assignment

2024-03-25 Thread Paolo Bonzini
The assignment is already inherited from pc-q35-8.2. -s --- hw/i386/pc_q35.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index b5922b44afa..c7bc8a2041f 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -393,7 +393,6 @@ static void

Re: [PATCH] qapi: document leftover members in qapi/run-state.json

2024-03-25 Thread Paolo Bonzini
Il lun 25 mar 2024, 12:36 Markus Armbruster ha scritto: > Paolo Bonzini writes: > > > Suggested-by: Markus Armbruster > > Signed-off-by: Paolo Bonzini > > --- > > qapi/run-state.json | 26 +- > > 1 file changed, 25 insertions(

Re: [PATCH 15/26] target/i386: Implement mc->kvm_type() to get VM type

2024-03-25 Thread Paolo Bonzini
On Mon, Mar 25, 2024 at 10:29 AM Philippe Mathieu-Daudé wrote: > > On 22/3/24 19:11, Paolo Bonzini wrote: > > KVM is introducing a new API to create confidential guests, which > > will be used by TDX and SEV-SNP but is also available for SEV and > > SEV-ES. The API u

Re: [PATCH 03/26] confidential guest support: Add kvm_init() and kvm_reset() in class

2024-03-25 Thread Paolo Bonzini
On Mon, Mar 25, 2024 at 9:33 AM Philippe Mathieu-Daudé wrote: > > Hi Xiaoyao, > > On 22/3/24 19:10, Paolo Bonzini wrote: > > From: Xiaoyao Li > > > > Different confidential VMs in different architectures all have the same > > needs to do their specific initial

[PATCH] qapi: document leftover members in qapi/run-state.json

2024-03-25 Thread Paolo Bonzini
Suggested-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- qapi/run-state.json | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/qapi/run-state.json b/qapi/run-state.json index 789fc34559a..cb4a2b43293 100644 --- a/qapi/run-state.json +++ b

[PATCH] qapi: document leftover members in qapi/stats.json

2024-03-25 Thread Paolo Bonzini
Suggested-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- qapi/stats.json | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/qapi/stats.json b/qapi/stats.json index ce9d8161ecb..578b52c7ef7 100644 --- a/qapi/stats.json +++ b/qapi/stats.json @@ -114,13

[PATCH] kvm: use configs/ definition to conditionalize debug support

2024-03-22 Thread Paolo Bonzini
If an architecture adds support for KVM_CAP_SET_GUEST_DEBUG but QEMU does not have the necessary code, QEMU will fail to build after updating kernel headers. Avoid this by using a #define in config-target.h instead of KVM_CAP_SET_GUEST_DEBUG. Signed-off-by: Paolo Bonzini --- configs/targets

[PATCH 10/26] [TO SQUASH] hw/i386: Remove redeclaration of struct setup_data

2024-03-22 Thread Paolo Bonzini
From: Michael Roth It is now provided by kernel headers. This needs to be squashed with the header update to avoid temporary build bisect breakage. Keeping it separate for reference. Signed-off-by: Michael Roth Message-ID: <20240320083945.991426-6-michael.r...@amd.com> Signed-off-by:

[PATCH 13/26] KVM: remove kvm_arch_cpu_check_are_resettable

2024-03-22 Thread Paolo Bonzini
Board reset requires writing a fresh CPU state. As far as KVM is concerned, the only thing that blocks reset is that CPU state is encrypted; therefore, kvm_cpus_are_resettable() can simply check if that is the case. Signed-off-by: Paolo Bonzini --- include/sysemu/kvm.h | 10

[PATCH 06/26] s390: Switch to use confidential_guest_kvm_init()

2024-03-22 Thread Paolo Bonzini
From: Xiaoyao Li Use unified confidential_guest_kvm_init() for consistency with other architectures. Signed-off-by: Xiaoyao Li Message-Id: <20240229060038.606591-1-xiaoyao...@intel.com> Signed-off-by: Paolo Bonzini --- target/s390x/kvm/pv.h | 14 -- hw/s390x/s390-

[PATCH 21/26] kvm/memory: Make memory type private by default if it has guest memfd backend

2024-03-22 Thread Paolo Bonzini
to private when memory region has valid guest memfd backend. Signed-off-by: Xiaoyao Li Signed-off-by: Michael Roth Message-ID: <20240320083945.991426-16-michael.r...@amd.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a

[PATCH 23/26] RAMBlock: make guest_memfd require uncoordinated discard

2024-03-22 Thread Paolo Bonzini
inated discard, i.e. use ram_block_coordinated_discard_require(). [Commit message mostly by Michael Roth ] Signed-off-by: Paolo Bonzini --- system/physmem.c | 8 1 file changed, 8 insertions(+) diff --git a/system/physmem.c b/system/physmem.c index f5dfa20e57e..5ebcf5be116 100644 --- a/

[PATCH 16/26] target/i386: SEV: use KVM_SEV_INIT2 if possible

2024-03-22 Thread Paolo Bonzini
type). Signed-off-by: Paolo Bonzini --- target/i386/kvm/kvm.c | 2 ++ target/i386/sev.c | 41 + 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index b599a7fae36..2577e345502 100644

[PATCH 15/26] target/i386: Implement mc->kvm_type() to get VM type

2024-03-22 Thread Paolo Bonzini
upport, but it will also enable support for VMSA features such as DebugSwap, which are only available via KVM_SEV_INIT2. Co-developed-by: Xiaoyao Li Signed-off-by: Xiaoyao Li Signed-off-by: Paolo Bonzini --- target/i386/confidential-guest.h | 19 ++ target/i386/kvm/kvm_i386.h | 2 ++ hw/i386

[PATCH 14/26] target/i386: introduce x86-confidential-guest

2024-03-22 Thread Paolo Bonzini
Introduce a common superclass for x86 confidential guest implementations. It will extend ConfidentialGuestSupportClass with a method that provides the VM type to be passed to KVM_CREATE_VM. Signed-off-by: Paolo Bonzini --- target/i386/confidential-guest.h | 40

[PATCH 09/26] [HACK] linux-headers: Update headers for 6.8 + kvm-coco-queue + SNP

2024-03-22 Thread Paolo Bonzini
From: Michael Roth Pull in 6.8 kvm-next + kvm-coco-queue + SNP headers. Signed-off-by: Michael Roth Signed-off-by: Paolo Bonzini --- include/standard-headers/asm-x86/bootparam.h | 17 +- include/standard-headers/asm-x86/kvm_para.h | 3 +- include/standard-headers/asm-x86/setup_data.h

[PATCH 22/26] HostMem: Add mechanism to opt in kvm guest memfd via MachineState

2024-03-22 Thread Paolo Bonzini
.r...@amd.com> Signed-off-by: Paolo Bonzini --- include/hw/boards.h | 2 ++ include/sysemu/hostmem.h | 1 + backends/hostmem-file.c | 1 + backends/hostmem-memfd.c | 1 + backends/hostmem-ram.c | 1 + backends/hostmem.c | 1 + hw/core/machine.c| 5 + 7 files changed, 12 ins

[PATCH 25/26] kvm: handle KVM_EXIT_MEMORY_FAULT

2024-03-22 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- include/sysemu/kvm.h | 2 + accel/kvm/kvm-all.c| 99 +- accel/kvm/trace-events | 2 + 3 files changed, 93 insertions(+), 10 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 2cb31

[PATCH 18/26] kvm: Introduce support for memory_attributes

2024-03-22 Thread Paolo Bonzini
or guest_memfd based private memory. Signed-off-by: Xiaoyao Li Message-ID: <20240320083945.991426-11-michael.r...@amd.com> Signed-off-by: Paolo Bonzini --- include/sysemu/kvm.h | 4 accel/kvm/kvm-all.c | 31 +++ 2 files changed, 35 insertions(+) diff --git a/i

[PATCH 24/26] physmem: Introduce ram_block_discard_guest_memfd_range()

2024-03-22 Thread Paolo Bonzini
Hildenbrand Signed-off-by: Michael Roth Message-ID: <20240320083945.991426-12-michael.r...@amd.com> Signed-off-by: Paolo Bonzini --- include/exec/cpu-common.h | 2 ++ system/physmem.c | 23 +++ 2 files changed, 25 insertions(+) diff --git a/include/ex

[PATCH 26/26] i386/kvm: Move architectural CPUID leaf generation to separate helper

2024-03-22 Thread Paolo Bonzini
. Signed-off-by: Sean Christopherson Signed-off-by: Xiaoyao Li Message-ID: <20240229063726.610065-23-xiaoyao...@intel.com> [Unify error reporting, rename function. - Paolo] Signed-off-by: Paolo Bonzini --- target/i386/kvm/kvm.c | 446 +- 1 file change

[PATCH 20/26] kvm: Enable KVM_SET_USER_MEMORY_REGION2 for memslot

2024-03-22 Thread Paolo Bonzini
-by: Xiaoyao Li Message-ID: <20240320083945.991426-10-michael.r...@amd.com> Signed-off-by: Paolo Bonzini --- include/sysemu/kvm_int.h | 2 ++ accel/kvm/kvm-all.c | 46 +--- accel/kvm/trace-events | 2 +- 3 files changed, 41 insertions(+), 9 del

[PATCH 19/26] RAMBlock: Add support of KVM private guest memfd

2024-03-22 Thread Paolo Bonzini
. Signed-off-by: Xiaoyao Li Reviewed-by: David Hildenbrand Message-ID: <20240320083945.991426-7-michael.r...@amd.com> Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 20 +--- include/exec/ram_addr.h | 2 +- include/exec/ramblock.h | 1 + include/sysemu/kvm.h

[PATCH 05/26] ppc/pef: switch to use confidential_guest_kvm_init/reset()

2024-03-22 Thread Paolo Bonzini
-by: Paolo Bonzini --- include/hw/ppc/pef.h | 17 - hw/ppc/pef.c | 9 ++--- hw/ppc/spapr.c | 10 +++--- 3 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 include/hw/ppc/pef.h diff --git a/include/hw/ppc/pef.h b/include/hw/ppc/pef.h deleted file

[PATCH 02/26] q35: Introduce smm_ranges property for q35-pci-host

2024-03-22 Thread Paolo Bonzini
Signed-off-by: Sean Christopherson Signed-off-by: Xiaoyao Li Signed-off-by: Michael Roth Message-ID: <20240320083945.991426-19-michael.r...@amd.com> Signed-off-by: Paolo Bonzini --- include/hw/i386/pc.h | 1 + include/hw/pci-host/q35.h | 1 + hw/i386/pc_q35.c | 2 ++

[PATCH for-9.1 00/26] x86, kvm: common confidential computing subset

2024-03-22 Thread Paolo Bonzini
rs: Update headers for 6.8 + kvm-coco-queue + SNP [TO SQUASH] hw/i386: Remove redeclaration of struct setup_data RAMBlock: Add support of KVM private guest memfd Paolo Bonzini (7): runstate: skip initial CPU reset if reset is not actually possible KVM: track whether guest state is encry

[PATCH 04/26] i386/sev: Switch to use confidential_guest_kvm_init()

2024-03-22 Thread Paolo Bonzini
/kvm/kvm.c to SEV code. Signed-off-by: Xiaoyao Li Message-Id: <20240229060038.606591-1-xiaoyao...@intel.com> Signed-off-by: Paolo Bonzini --- target/i386/sev.h | 2 - target/i386/kvm/kvm.c | 10 +-- target/i386/kvm/sev-stub.c | 21 -- target/i386/sev.c

[PATCH 08/26] scripts/update-linux-headers: Add bits.h to file imports

2024-03-22 Thread Paolo Bonzini
From: Michael Roth Signed-off-by: Michael Roth Signed-off-by: Paolo Bonzini --- scripts/update-linux-headers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh index d48856f9e24..5f20434d5c5 100755

[PATCH 11/26] runstate: skip initial CPU reset if reset is not actually possible

2024-03-22 Thread Paolo Bonzini
do not touch CPU state and that all such setup is done before, at the time of cpu_synchronize_all_post_init(). Signed-off-by: Paolo Bonzini --- system/runstate.c | 15 ++- roms/edk2 | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/system/runstate.c b

[PATCH 17/26] trace/kvm: Split address space and slot id in trace_kvm_set_user_memory()

2024-03-22 Thread Paolo Bonzini
From: Xiaoyao Li The upper 16 bits of kvm_userspace_memory_region::slot are address space id. Parse it separately in trace_kvm_set_user_memory(). Signed-off-by: Xiaoyao Li Message-ID: <20240229063726.610065-5-xiaoyao...@intel.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c

[PATCH 07/26] scripts/update-linux-headers: Add setup_data.h to import list

2024-03-22 Thread Paolo Bonzini
the list of allowed includes: it does not have a matching substitution, and therefore it would not be possible to use it on non-Linux systems where there is no /usr/include/asm-generic/ directory. Signed-off-by: Michael Roth Signed-off-by: Paolo Bonzini --- scripts/update-linux-headers.sh | 6

[PATCH 12/26] KVM: track whether guest state is encrypted

2024-03-22 Thread Paolo Bonzini
rom that point, skip reading registers so that cpu->vcpu_dirty is never true: if it ever becomes true, kvm_arch_put_registers() will fail miserably. Signed-off-by: Paolo Bonzini --- include/sysemu/kvm.h | 2 ++ include/sysemu/kvm_int.h | 1 + accel/kvm/kvm-all.c | 14 -- targe

[PATCH 03/26] confidential guest support: Add kvm_init() and kvm_reset() in class

2024-03-22 Thread Paolo Bonzini
yao...@intel.com> Signed-off-by: Paolo Bonzini --- include/exec/confidential-guest-support.h | 34 ++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/include/exec/confidential-guest-support.h b/include/exec/confidential-guest-support.h index ba2dd4b5dfc..e5b188cffbf

[PATCH 01/26] pci-host/q35: Move PAM initialization above SMRAM initialization

2024-03-22 Thread Paolo Bonzini
-18-michael.r...@amd.com> Signed-off-by: Paolo Bonzini --- hw/pci-host/q35.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 0d7d4e3f086..98d4a7c253a 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@

[PATCH] virtio: move logging definitions to hw/virtio/virtio.h

2024-03-22 Thread Paolo Bonzini
They are not included in upstream Linux, and therefore should not be in standard-headers. Otherwise, the next update to the headers would eliminate them. Cc: Michael S. Tsirkin Signed-off-by: Paolo Bonzini --- include/hw/virtio/virtio.h | 7 +++ include/standard-headers

Re: [PATCH v3 37/49] i386/sev: Add the SNP launch start context

2024-03-21 Thread Paolo Bonzini
Il mer 20 mar 2024, 23:33 Michael Roth ha scritto: > On Wed, Mar 20, 2024 at 10:58:30AM +0100, Paolo Bonzini wrote: > > On 3/20/24 09:39, Michael Roth wrote: > > > From: Brijesh Singh > > > > > > The SNP_LAUNCH_START is called first to create a crypt

Re: [PATCH RFC v3 00/49] Add AMD Secure Nested Paging (SEV-SNP) support

2024-03-20 Thread Paolo Bonzini
On Wed, Mar 20, 2024 at 10:59 AM Paolo Bonzini wrote: > I will now focus on reviewing patches 6-20. This way we can prepare a > common tree for SEV_INIT2/SNP/TDX, for both vendors to build upon. Ok, the attachment is the delta that I have. The only major change is requiring discard

Re: [PATCH v3 06/49] RAMBlock: Add support of KVM private guest memfd

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:39, Michael Roth wrote: @@ -1842,6 +1842,17 @@ static void ram_block_add(RAMBlock *new_block, Error **errp) } } +if (kvm_enabled() && (new_block->flags & RAM_GUEST_MEMFD)) { +assert(new_block->guest_memfd < 0); + +new_block->guest_memfd =

Re: [PATCH v3 19/49] kvm: Make kvm_convert_memory() obey ram_block_discard_is_enabled()

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:39, Michael Roth wrote: Some subsystems like VFIO might disable ram block discard for uncoordinated cases. Since kvm_convert_memory()/guest_memfd don't implement a RamDiscardManager handler to convey discard operations to various listeners like VFIO. > Because of this, sequences

Re: [PATCH v3 10/49] kvm: Introduce support for memory_attributes

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:39, Michael Roth wrote: From: Xiaoyao Li Introduce the helper functions to set the attributes of a range of memory to private or shared. This is necessary to notify KVM the private/shared attribute of each gpa range. KVM needs the information to decide the GPA needs to be mapped

Re: [PATCH v3 09/49] kvm: Enable KVM_SET_USER_MEMORY_REGION2 for memslot

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:39, Michael Roth wrote: +if (cap_user_memory2 == -1) { +cap_user_memory2 = kvm_check_extension(s, KVM_CAP_USER_MEMORY2); +} + +if (!cap_user_memory2 && slot->guest_memfd >= 0) { +error_report("%s, KVM doesn't support KVM_CAP_USER_MEMORY2," +

Re: [PATCH] target/i386: Export RFDS bit to guests

2024-03-20 Thread Paolo Bonzini
Queued, thanks. Paolo

Re: [PATCH v2] target/i386: Add new CPU model SierraForest

2024-03-20 Thread Paolo Bonzini
Queued, thanks. Paolo

Re: [PATCH v3 0/1] Introduce Icelake-Server-v7 to enable TSX

2024-03-20 Thread Paolo Bonzini
Queued, thanks. Paolo

[PULL 2/6] vl: convert qemu_machine_creation_done() to Error **

2024-03-20 Thread Paolo Bonzini
Allow using Error ** to pass an error string up to qmp_x_exit_preconfig() and possibly main(). Signed-off-by: Paolo Bonzini --- system/vl.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/vl.c b/system/vl.c index 70f4cece7f9..0c970cf0203 100644 --- a/system

[PULL 5/6] tests/plugins: fix use-after-free bug

2024-03-20 Thread Paolo Bonzini
rec->count.score is inside rec, which is freed before rec->count.score is. Reorder the instructions Reported by Coverity as CID 1539967. Cc: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- contrib/plugins/howvec.c | 2 +- 1 file changed, 1 insertion

[PULL 6/6] meson: remove dead dictionary access

2024-03-20 Thread Paolo Bonzini
uot;, 2023-02-16). So, remove it for a very small simplification of meson.build. Signed-off-by: Paolo Bonzini --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b375248a761..c9c3217ba4b 100644 --- a/meson.build +++ b/meson.build @@ -39

[PULL 3/6] vl: do not assert if sev-guest is used together with TCG

2024-03-20 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- system/vl.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/system/vl.c b/system/vl.c index 0c970cf0203..c6442229824 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2676,11 +2676,10 @@ static bool qemu_machine_creation_done(Error

[PULL 1/6] target/i386: fix direction of "32-bit MMU" test

2024-03-20 Thread Paolo Bonzini
Fixes: b1661801c18 ("target/i386: Fix physical address truncation", 2024-02-28) Cc: qemu-sta...@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2206 Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 2 +- target/i386/cpu.c | 2 +- 2 files changed, 2 insertions(+), 2

[PULL 0/6] QEMU bug fixes for 20240320

2024-03-20 Thread Paolo Bonzini
-support argument * fix NULL pointer dereference in x86 MCE injection Paolo Bonzini (5): target/i386: fix direction of "32-bit MMU" test vl: convert qemu_machine_creation_done() to Error ** vl: do not ass

[PULL 4/6] target/i386: Revert monitor_puts() in do_inject_x86_mce()

2024-03-20 Thread Paolo Bonzini
(monitor: expose monitor_puts to rest of code) Reviwed-by: Xiaoyao Li Reviewed-by: Markus Armbruster Signed-off-by: Tao Su Message-ID: <20240320083640.523287-1-tao1...@linux.intel.com> Signed-off-by: Paolo Bonzini --- target/i386/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 de

[PATCH] meson: remove dead dictionary access

2024-03-20 Thread Paolo Bonzini
uot;, 2023-02-16). So, remove it for a very small simplification of meson.build. Signed-off-by: Paolo Bonzini --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b375248a761..c9c3217ba4b 100644 --- a/meson.build +++ b/meson.build @@ -39

Re: [PATCH RFC v3 00/49] Add AMD Secure Nested Paging (SEV-SNP) support

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:38, Michael Roth wrote: These patches implement SEV-SNP base support along with CPUID enforcement support for QEMU, and are also available at: https://github.com/amdese/qemu/commits/snp-v3-rfc they are based on top of the following patchset from Paolo: "[PATCH 0/7]

Re: [PATCH v3 37/49] i386/sev: Add the SNP launch start context

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:39, Michael Roth wrote: From: Brijesh Singh The SNP_LAUNCH_START is called first to create a cryptographic launch context within the firmware. Signed-off-by: Brijesh Singh Signed-off-by: Michael Roth --- target/i386/sev.c| 42 +++-

Re: [PATCH v3 27/49] i386/sev: Set ms->require_guest_memfd for SNP

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:39, Michael Roth wrote: SNP requires guest_memfd for private guest memory, so enable it so that the appropriate guest_memfd backend will be available for normal RAM regions. Signed-off-by: Michael Roth --- target/i386/sev.c | 5 + 1 file changed, 5 insertions(+) diff

Re: [PATCH v3 25/49] i386/sev: Skip RAMBlock notifiers for SNP

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:39, Michael Roth wrote: SEV uses these notifiers to register/pin pages prior to guest use, since they could potentially be used for private memory where page migration is not supported. But SNP only uses guest_memfd-provided pages for private memory, which has its own

Re: [PATCH v3 24/49] target/i386: Add handling for KVM_X86_SNP_VM VM type

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:39, Michael Roth wrote: An SNP VM requires VM type KVM_X86_SNP_VM to be passed to kvm_ioctl(KVM_CREATE_VM). Add it to the list of supported VM types, and return it appropriately via X86ConfidentialGuestClass->kvm_type(). Signed-off-by: Michael Roth --- target/i386/kvm/kvm.c |

Re: [PATCH v3 02/49] scripts/update-linux-headers: Add setup_data.h to import list

2024-03-20 Thread Paolo Bonzini
On 3/20/24 09:38, Michael Roth wrote: Data structures like struct setup_data have been moved to a separate setup_data.h header which bootparam.h relies on. Add setup_data.h to the cp_portable() list and sync it along with the other header files. Note that currently struct setup_data is stripped

Re: [PULL 32/68] hw/virtio: Add support for VDPA network simulation devices

2024-03-20 Thread Paolo Bonzini
On 3/12/24 23:27, Michael S. Tsirkin wrote: diff --git a/include/standard-headers/linux/virtio_pci.h b/include/standard-headers/linux/virtio_pci.h index 3e2bc2c97e..86733278ba 100644 --- a/include/standard-headers/linux/virtio_pci.h +++ b/include/standard-headers/linux/virtio_pci.h @@ -221,6

Re: [PATCH v2] target/i386: Revert monitor_puts() in do_inject_x86_mce()

2024-03-20 Thread Paolo Bonzini
Queued, thanks. Paolo

[PATCH 4/7] KVM: remove kvm_arch_cpu_check_are_resettable

2024-03-19 Thread Paolo Bonzini
Board reset requires writing a fresh CPU state. As far as KVM is concerned, the only thing that blocks reset is that CPU state is encrypted; therefore, kvm_cpus_are_resettable() can simply check if that is the case. Signed-off-by: Paolo Bonzini --- include/sysemu/kvm.h | 10

Re: [PATCH 6/7] target/i386: Implement mc->kvm_type() to get VM type

2024-03-19 Thread Paolo Bonzini
On Tue, Mar 19, 2024 at 3:27 PM Daniel P. Berrangé wrote: > > On Tue, Mar 19, 2024 at 03:25:53PM +0100, Paolo Bonzini wrote: > > On Tue, Mar 19, 2024 at 3:15 PM Daniel P. Berrangé > > wrote: > > > > +int kvm_get_vm_type(MachineState *ms, const char *vm_type) >

Re: [PATCH 6/7] target/i386: Implement mc->kvm_type() to get VM type

2024-03-19 Thread Paolo Bonzini
On Tue, Mar 19, 2024 at 3:15 PM Daniel P. Berrangé wrote: > > +int kvm_get_vm_type(MachineState *ms, const char *vm_type) > > The 'vm_type' parameter is never used here. What value is it expected > to have, and should be diagnosing an error if some unexpected value > is provided. It's the value

[PATCH 2/7] runstate: skip initial CPU reset if reset is not actually possible

2024-03-19 Thread Paolo Bonzini
do not touch CPU state and that all such setup is done before, at the time of cpu_synchronize_all_post_init(). Signed-off-by: Paolo Bonzini --- system/runstate.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/system/runstate.c b/system/runstate.c index

[PATCH 3/7] KVM: track whether guest state is encrypted

2024-03-19 Thread Paolo Bonzini
rom that point, skip reading registers so that cpu->vcpu_dirty is never true: if it ever becomes true, kvm_arch_put_registers() will fail miserably. Signed-off-by: Paolo Bonzini --- include/sysemu/kvm.h | 2 ++ include/sysemu/kvm_int.h | 1 + accel/kvm/kvm-all.c | 14 -- targe

[PATCH 7/7] target/i386: SEV: use KVM_SEV_INIT2 if possible

2024-03-19 Thread Paolo Bonzini
type). Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 41 + 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index ebe36d4c10c..9dab4060b84 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c

[PATCH 0/7] target/i386: VM type infrastructure and KVM_SEV_INIT2 support

2024-03-19 Thread Paolo Bonzini
yao...@intel.com> Paolo Bonzini (6): linux-headers hack runstate: skip initial CPU reset if reset is not actually possible KVM: track whether guest state is encrypted KVM: remove kvm_arch_cpu_check_are_resettable target/i386: introduce x86-confidential-guest target/i386: SE

[PATCH 6/7] target/i386: Implement mc->kvm_type() to get VM type

2024-03-19 Thread Paolo Bonzini
EV-SNP support, but it will also enable support for VMSA features such as DebugSwap, which are only available via KVM_SEV_INIT2. Co-developed-by: Xiaoyao Li Signed-off-by: Xiaoyao Li Signed-off-by: Paolo Bonzini --- target/i386/confidential-guest.h | 19 ++ target/i386/kvm/kvm_

[PATCH 5/7] target/i386: introduce x86-confidential-guest

2024-03-19 Thread Paolo Bonzini
Introduce a common superclass for x86 confidential guest implementations. It will extend ConfidentialGuestSupportClass with a method that provides the VM type to be passed to KVM_CREATE_VM. Signed-off-by: Paolo Bonzini --- target/i386/confidential-guest.h | 40

[PATCH 1/7] linux-headers hack

2024-03-19 Thread Paolo Bonzini
To be replaced by update to kvm/next branch from Linux 6.9, once the new API is committed. --- linux-headers/asm-x86/kvm.h | 8 linux-headers/linux/kvm.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h index

[PATCH 2/2] vl: do not assert if sev-guest is used together with TCG

2024-03-18 Thread Paolo Bonzini
educed-phys-bits=1 -M confidential-guest-support=sev0 qemu-system-x86_64: ../softmmu/vl.c:2619: qemu_machine_creation_done: Assertion `machine->cgs->ready' failed. Signed-off-by: Paolo Bonzini --- system/vl.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a

[PATCH 0/2] avoid assertion failure when trying confidential guests without KVM

2024-03-18 Thread Paolo Bonzini
: qemu_machine_creation_done: Assertion `machine->cgs->ready' failed. Assume that the lack of initialization is due to missing code in the accelerator to look at current_machine->cgs, and report a nicer error error. Paolo Bonzini (2): vl: convert qemu_machine_creation_done() to Error ** vl: do not asse

[PATCH 1/2] vl: convert qemu_machine_creation_done() to Error **

2024-03-18 Thread Paolo Bonzini
Allow using Error ** to pass an error string up to qmp_x_exit_preconfig() and possibly main(). Signed-off-by: Paolo Bonzini --- system/vl.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/vl.c b/system/vl.c index 70f4cece7f9..0c970cf0203 100644 --- a/system

Re: [PATCH 2/4] i386/sev: Switch to use confidential_guest_kvm_init()

2024-03-18 Thread Paolo Bonzini
On Thu, Feb 29, 2024 at 7:01 AM Xiaoyao Li wrote: > > Use confidential_guest_kvm_init() instead of calling SEV specific > sev_kvm_init(). As a bouns, it fits to future TDX when TDX implements > its own confidential_guest_support and .kvm_init(). > > Move the "TypeInfo sev_guest_info" definition

Re: [PATCH v2 2/2] kvm: add support for guest physical bits

2024-03-11 Thread Paolo Bonzini
On Mon, Mar 11, 2024 at 12:59 PM Gerd Hoffmann wrote: > > Hi, > > > > diff --git a/target/i386/cpu.h b/target/i386/cpu.h > > > index 952174bb6f52..d427218827f6 100644 > > > --- a/target/i386/cpu.h > > > +++ b/target/i386/cpu.h > > > +guest_phys_bits = kvm_get_guest_phys_bits(cs->kvm_state);

Re: [PATCH v2 2/2] kvm: add support for guest physical bits

2024-03-11 Thread Paolo Bonzini
On Tue, Mar 5, 2024 at 11:52 AM Gerd Hoffmann wrote: > > Query kvm for supported guest physical address bits, in cpuid > function 8008, eax[23:16]. Usually this is identical to host > physical address bits. With NPT or EPT being used this might be > restricted to 48 (max 4-level paging

[PATCH] tcg/aarch64: fix assertion failure on TSTxx of UINT32_MAX

2024-03-11 Thread Paolo Bonzini
on Signed-off-by: Paolo Bonzini --- tcg/aarch64/tcg-target.c.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index dec8ecc1b65..6ed174bd172 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1465

[PATCH] tests/plugins: fix use-after-free bug

2024-03-11 Thread Paolo Bonzini
rec->count.score is inside rec, which is freed before rec->count.score is. Reorder the instructions Reported by Coverity as CID 1539967. Cc: Alex Bennée Signed-off-by: Paolo Bonzini --- contrib/plugins/howvec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c

[PATCH] target/i386: fix direction of "32-bit MMU" test

2024-03-11 Thread Paolo Bonzini
Fixes: b1661801c18 ("target/i386: Fix physical address truncation", 2024-02-28) Cc: qemu-sta...@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2206 Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 2 +- target/i386/cpu.c | 2 +- 2 files changed, 2 insertions(+), 2

[PULL 6/9] oslib-posix: fix memory leak in touch_all_pages

2024-03-08 Thread Paolo Bonzini
;, 2024-02-06) Reviewed-by: Mark Kanda Signed-off-by: Paolo Bonzini --- util/oslib-posix.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 3c379f96c26..e76441695bd 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c

[PULL v2 0/9] Misc fixes and coverity CI for 2024-03-08

2024-03-08 Thread Paolo Bonzini
(!dev) in qmp_device_add() Paolo Bonzini (5): hw/intc/apic: fix memory leak oslib-posix: fix memory leak in touch_all_pages mips: do not list individual devices from configs/ run-coverity-scan: add --check-upload-only option gitlab-ci: add manual job to run Coverity Sven Sc

[PULL 4/9] hw/scsi/lsi53c895a: stop script on phase mismatch

2024-03-08 Thread Paolo Bonzini
trigger a host interrupt. Signed-off-by: Sven Schnelle Tested-by: Helge Deller Message-ID: <20240302214453.2071388-1-sv...@stackframe.org> Signed-off-by: Paolo Bonzini --- hw/scsi/lsi53c895a.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/scsi/lsi53c

Re: [PULL 00/12] Misc fixes, i386 TSTEQ/TSTNE, coverity CI for 2024-03-08

2024-03-08 Thread Paolo Bonzini
On Fri, Mar 8, 2024 at 6:32 PM Peter Maydell wrote: > Looks like this hits a TCG assertion on aarch64 host: > https://gitlab.com/qemu-project/qemu/-/jobs/6353434430 Ok, I dropped the TSTEQ/TSTNE patches. Paolo

[PULL 5/9] hw/intc/apic: fix memory leak

2024-03-08 Thread Paolo Bonzini
. Fixes: b5ee0468e9d ("apic: add support for x2APIC mode", 2024-02-14) Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Bui Quang Minh Signed-off-by: Paolo Bonzini --- hw/intc/apic.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/intc/apic.c b/hw/intc/ap

[PULL 9/9] gitlab-ci: add manual job to run Coverity

2024-03-08 Thread Paolo Bonzini
as protected and masked variables. Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- .gitlab-ci.d/base.yml | 4 .gitlab-ci.d/buildtest.yml | 37 + .gitlab-ci.d/opensbi.yml | 4 3 files changed, 45 insertions(+) diff --git

[PULL 7/9] mips: do not list individual devices from configs/

2024-03-08 Thread Paolo Bonzini
use -nodefaults, so remove it from build-without-defaults Signed-off-by: Paolo Bonzini --- configs/devices/mips-softmmu/common.mak | 28 +++- configs/devices/mips64el-softmmu/default.mak | 3 --- .gitlab-ci.d/buildtest.yml | 2 +-

[PULL 8/9] run-coverity-scan: add --check-upload-only option

2024-03-08 Thread Paolo Bonzini
check changes the exit code from 1 to 99. 99 was chosen because it is what Autotools and Meson use to represent a problem in the setup (as opposed to a failure in the test). Reviewed-by: Peter Maydell Signed-off-by: Paolo Bonzini --- scripts/coverity-scan/run-coverity-scan | 59

[PULL 3/9] meson: Remove --warn-common ldflag

2024-03-08 Thread Paolo Bonzini
56 Signed-off-by: Akihiko Odaki Message-ID: <20240304-common-v1-1-1a2005d1f...@daynix.com> Signed-off-by: Paolo Bonzini --- meson.build | 5 - 1 file changed, 5 deletions(-) diff --git a/meson.build b/meson.build index c59ca496f2d..f9dbe7634e5 100644 --- a/meson.build +++ b/meson.build @

[PULL 1/9] hw/scsi/lsi53c895a: add timer to scripts processing

2024-03-08 Thread Paolo Bonzini
on the SCSI processor are usually very short. This keeps the time until the loop is exit short. Suggested-by: Peter Maydell Signed-off-by: Sven Schnelle Message-ID: <20240229204407.1699260-1-sv...@stackframe.org> Signed-off-by: Paolo Bonzini --- hw/scsi/lsi53c895a.

[PULL 2/9] system/qdev-monitor: move drain_call_rcu call under if (!dev) in qmp_device_add()

2024-03-08 Thread Paolo Bonzini
_device_add", 2020-10-12) Cc: qemu-sta...@nongnu.org Signed-off-by: Paolo Bonzini --- system/qdev-monitor.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index a13db763e5d..874d65191ce 100644 --- a/syste

[PULL 04/12] hw/scsi/lsi53c895a: stop script on phase mismatch

2024-03-08 Thread Paolo Bonzini
trigger a host interrupt. Signed-off-by: Sven Schnelle Tested-by: Helge Deller Message-ID: <20240302214453.2071388-1-sv...@stackframe.org> Signed-off-by: Paolo Bonzini --- hw/scsi/lsi53c895a.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/scsi/lsi53c

[PULL 03/12] meson: Remove --warn-common ldflag

2024-03-08 Thread Paolo Bonzini
56 Signed-off-by: Akihiko Odaki Message-ID: <20240304-common-v1-1-1a2005d1f...@daynix.com> Signed-off-by: Paolo Bonzini --- meson.build | 5 - 1 file changed, 5 deletions(-) diff --git a/meson.build b/meson.build index c59ca496f2d..f9dbe7634e5 100644 --- a/meson.build +++ b/meson.build @

[PULL 05/12] hw/intc/apic: fix memory leak

2024-03-08 Thread Paolo Bonzini
. Fixes: b5ee0468e9d ("apic: add support for x2APIC mode", 2024-02-14) Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Bui Quang Minh Signed-off-by: Paolo Bonzini --- hw/intc/apic.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/intc/apic.c b/hw/intc/ap

[PULL 06/12] oslib-posix: fix memory leak in touch_all_pages

2024-03-08 Thread Paolo Bonzini
;, 2024-02-06) Reviewed-by: Mark Kanda Signed-off-by: Paolo Bonzini --- util/oslib-posix.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 3c379f96c26..e76441695bd 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c

[PULL 11/12] run-coverity-scan: add --check-upload-only option

2024-03-08 Thread Paolo Bonzini
check changes the exit code from 1 to 99. 99 was chosen because it is what Autotools and Meson use to represent a problem in the setup (as opposed to a failure in the test). Reviewed-by: Peter Maydell Signed-off-by: Paolo Bonzini --- scripts/coverity-scan/run-coverity-scan | 59

[PULL 01/12] hw/scsi/lsi53c895a: add timer to scripts processing

2024-03-08 Thread Paolo Bonzini
on the SCSI processor are usually very short. This keeps the time until the loop is exit short. Suggested-by: Peter Maydell Signed-off-by: Sven Schnelle Message-ID: <20240229204407.1699260-1-sv...@stackframe.org> Signed-off-by: Paolo Bonzini --- hw/scsi/lsi53c895a.

[PULL 07/12] mips: do not list individual devices from configs/

2024-03-08 Thread Paolo Bonzini
use -nodefaults, so remove it from build-without-defaults Signed-off-by: Paolo Bonzini --- configs/devices/mips-softmmu/common.mak | 28 +++- configs/devices/mips64el-softmmu/default.mak | 3 --- .gitlab-ci.d/buildtest.yml | 2 +-

<    3   4   5   6   7   8   9   10   11   12   >