From patchwork Tue Oct 3 08:30:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842495 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fpPJUiQK; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S09yP6YVdz1yng for ; Tue, 3 Oct 2023 19:31:09 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnant-0001oZ-9X; Tue, 03 Oct 2023 04:30:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnans-0001nb-Ar for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:30:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnanq-0000Ft-Qb for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:30:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oM/kNXmOf7pF5c5aEMrfjCntn3rClcCDEzkX2duHLEA=; b=fpPJUiQKB9bc3J/z2xn/i7gvqIHcQ43WzH+falPUPg9oDAdD2NqfSTiWoLQ+3mlOz/xy28 YuyiH0qdM/SXFn4JyGuNJDc5kZxyAfNFe94FDXquLesJYm2h/DuVL0JEWSSRhwvI4s1Yc1 YgrFl7G/QfJ0DHcydoNHPHz/uVnAMao= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-10-fwiANM_qNM68dGsq_RdSTQ-1; Tue, 03 Oct 2023 04:30:48 -0400 X-MC-Unique: fwiANM_qNM68dGsq_RdSTQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9b2e030e4caso400426966b.1 for ; Tue, 03 Oct 2023 01:30:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321846; x=1696926646; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oM/kNXmOf7pF5c5aEMrfjCntn3rClcCDEzkX2duHLEA=; b=RDZIdHGoY4xa++JUjMRK8Xk9wNVwjppUaMZ/XerHPNskRimrA3YkptrKYkUQUhRyKL Wli44putUYhNVoYvn6HzjZxWY7KwSIfWwzucdRrXjnWawl4bmpHdKQXzm874OKiCacnZ 3WS+8czfhBjfJrl6T3z3B3VyLT+aEzzwcxtb/D3PtVvZD0ZqkO4d/ri2B7cM93+e4mWJ UELR/wEw+mEUNTG0UWjXY6XZJOxKOXwpbNWUK9J4UGKa2e7nD9Gi7ZFZOP2/9KQFolS1 zt1ldPfPtYc+pLi2x8Czm6N9IehrYlLXXSAhHBwCkZnpZDhQIZxSB3KlBjk2AP3PW6Pc dPOw== X-Gm-Message-State: AOJu0YyfQdFRiljwnavcS3nCPOEnuSIDSDFeJVoYYRdvIgiasbS5oHcb omQIBGx8+qx2CX3Lq8LhJTOku7ksz+r34sKbZU52GJF2Oq80j2jZgDT6U+wMbqOIXdpU+bbvUvy GnlP5TaecfA5Ozb0rEawhmVpvlj3QlCsc0VgTEKz5t/3HO3GAy4GMP978SIYlLquyCD5DK0chQ4 8= X-Received: by 2002:a05:6402:51d2:b0:533:5d3d:7efe with SMTP id r18-20020a05640251d200b005335d3d7efemr1813909edd.6.1696321846468; Tue, 03 Oct 2023 01:30:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3HBkf/spAPCWg2buADvp8XJgSosJn5mNjPkpxijnTnpr+wawUqquGx+CMLe/IM6grUfrflw== X-Received: by 2002:a05:6402:51d2:b0:533:5d3d:7efe with SMTP id r18-20020a05640251d200b005335d3d7efemr1813891edd.6.1696321846102; Tue, 03 Oct 2023 01:30:46 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id v18-20020aa7dbd2000000b00535204ffdb4sm486394edt.72.2023.10.03.01.30.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:30:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Vasiliy Ulyanov , Thomas Huth , stable@vger.kernel.org Subject: [PULL 01/24] optionrom: Remove build-id section Date: Tue, 3 Oct 2023 10:30:18 +0200 Message-ID: <20231003083042.110065-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Fabiano Rosas Our linker script for optionroms specifies only the placement of the .text section, leaving the linker free to place the remaining sections at arbitrary places in the file. Since at least binutils 2.39, the .note.gnu.build-id section is now being placed at the start of the file, which causes label addresses to be shifted. For linuxboot_dma.bin that means that the PnP header (among others) will not be found when determining the type of ROM at optionrom_setup(): (0x1c is the label _pnph, where the magic "PnP" is) $ xxd /usr/share/qemu/linuxboot_dma.bin | grep "PnP" 00000010: 0000 0000 0000 0000 0000 1c00 2450 6e50 ............$PnP $ xxd pc-bios/optionrom/linuxboot_dma.bin | grep "PnP" 00000010: 0000 0000 0000 0000 0000 4c00 2450 6e50 ............$PnP ^bad Using a freshly built linuxboot_dma.bin ROM results in a broken boot: SeaBIOS (version rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org) Booting from Hard Disk... Boot failed: could not read the boot disk Booting from Floppy... Boot failed: could not read the boot disk No bootable device. We're not using the build-id section, so pass the --build-id=none option to the linker to remove it entirely. Note: In theory, this same issue could happen with any other section. The ideal solution would be to have all unused sections discarded in the linker script. However that would be a larger change, specially for the pvh rom which uses the .bss and COMMON sections so I'm addressing only the immediate issue here. Reported-by: Vasiliy Ulyanov Signed-off-by: Fabiano Rosas Reviewed-by: Thomas Huth Message-ID: <20230926192502.15986-1-farosas@suse.de> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini --- pc-bios/optionrom/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index b1fff0ba6c8..30d07026c79 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -36,7 +36,7 @@ config-cc.mak: Makefile $(call cc-option,-Wno-array-bounds)) 3> config-cc.mak -include config-cc.mak -override LDFLAGS = -nostdlib -Wl,-T,$(SRC_DIR)/flat.lds +override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds pvh.img: pvh.o pvh_main.o From patchwork Tue Oct 3 08:30:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842519 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RdjfudTA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B5H099dz1yph for ; Tue, 3 Oct 2023 19:37:07 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnao7-0001uz-4e; Tue, 03 Oct 2023 04:31:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao3-0001rH-W9 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao2-0000Hb-9a for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q0LC5OOAa8z5GyVDABXpLQOMcj65G8oVaFMpm1S2hNU=; b=RdjfudTAX3HGmWNgTfZYI+kT7kvUZgcjso0KF5v8RaXzLuEIy+FtikvP25v0UrYkGfIOtQ 640pnngYL0ol9AVf5ryKsee/s7Yd/jjT0GPvgbSdwKfv+UVop2zhr+yTN7uUHnKe5c0nVY VbHqCLdp0mcm2aqjJ1KIlh2iyA2HFqc= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-228-2n568OysNA-gvD1AJMISWw-1; Tue, 03 Oct 2023 04:30:50 -0400 X-MC-Unique: 2n568OysNA-gvD1AJMISWw-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-533f8bc82a8so512968a12.0 for ; Tue, 03 Oct 2023 01:30:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321848; x=1696926648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q0LC5OOAa8z5GyVDABXpLQOMcj65G8oVaFMpm1S2hNU=; b=QY/pEVE8ZvLFa17C6D+D9K2NK07/RHABQHQYvJiDBVmjJtI25owR9XkYxYCiA8/Yg0 XDA5R4q5aTKsbZicAV/UUMyKD8htqF82kELGJVFaDxJAG9sjUAhh3Nq+YFzbHNFVNvza wZVyNdLOQUoSrz2PDrdRBysKE1OiaMm4MegW3Onj8jG8v7Fe/CJ0hM54jp8parmlNmB7 7JQ53dwMwJx+K4+xsh/0RVIq4/tqWXd3iSwLnaviZDLpaO4KDUhzFhPiv/gw7s2PY77Y EeMAff3BiPDxfOxjHr67/Z0U2dcG6HevA30yS7ShiaicsDVAIFqmMwNtobQ6eBOHk0kq mrxw== X-Gm-Message-State: AOJu0YwfWXIV45JQVW4NBIE+qEE27FriouX09tc47jao/kiJUm5HEeti XQzd3H8WsMYspMDwTf9O8WOArF0aMfM8ykDqXy1nuTgpxKXVhOZ75iiDOpUxzi7/MWjNV1ird7Z EY4YOTAhbO23Hngh+JD76xdXC/a8ql78OaeqE941sfiU5/t+VgvawMFFDWvQOt+hpktrcPPfoJL I= X-Received: by 2002:aa7:c6d3:0:b0:531:f4:57a8 with SMTP id b19-20020aa7c6d3000000b0053100f457a8mr11972728eds.26.1696321848250; Tue, 03 Oct 2023 01:30:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3UeMGLLw8V/A9wj4DU1d+Wb+fA9JYIuSZPph7QBzDNHtkEtnCe9yiuFbWjxE324f+tWnDFA== X-Received: by 2002:aa7:c6d3:0:b0:531:f4:57a8 with SMTP id b19-20020aa7c6d3000000b0053100f457a8mr11972713eds.26.1696321847887; Tue, 03 Oct 2023 01:30:47 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id d26-20020aa7d5da000000b0053635409213sm484993eds.34.2023.10.03.01.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:30:47 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Akihiko Odaki Subject: [PULL 02/24] accel/kvm/kvm-all: Handle register access errors Date: Tue, 3 Oct 2023 10:30:19 +0200 Message-ID: <20231003083042.110065-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Akihiko Odaki A register access error typically means something seriously wrong happened so that anything bad can happen after that and recovery is impossible. Even failing one register access is catastorophic as architecture-specific code are not written so that it torelates such failures. Make sure the VM stop and nothing worse happens if such an error occurs. Signed-off-by: Akihiko Odaki Message-ID: <20221201102728.69751-1-akihiko.odaki@daynix.com> Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index ff1578bb32b..72e1d1141c4 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2851,7 +2851,13 @@ bool kvm_cpu_check_are_resettable(void) static void do_kvm_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg) { if (!cpu->vcpu_dirty) { - kvm_arch_get_registers(cpu); + int ret = kvm_arch_get_registers(cpu); + if (ret) { + error_report("Failed to get registers: %s", strerror(-ret)); + cpu_dump_state(cpu, stderr, CPU_DUMP_CODE); + vm_stop(RUN_STATE_INTERNAL_ERROR); + } + cpu->vcpu_dirty = true; } } @@ -2865,7 +2871,13 @@ void kvm_cpu_synchronize_state(CPUState *cpu) static void do_kvm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg) { - kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE); + int ret = kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE); + if (ret) { + error_report("Failed to put registers after reset: %s", strerror(-ret)); + cpu_dump_state(cpu, stderr, CPU_DUMP_CODE); + vm_stop(RUN_STATE_INTERNAL_ERROR); + } + cpu->vcpu_dirty = false; } @@ -2876,7 +2888,12 @@ void kvm_cpu_synchronize_post_reset(CPUState *cpu) static void do_kvm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg) { - kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE); + int ret = kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE); + if (ret) { + error_report("Failed to put registers after init: %s", strerror(-ret)); + exit(1); + } + cpu->vcpu_dirty = false; } @@ -2969,7 +2986,14 @@ int kvm_cpu_exec(CPUState *cpu) MemTxAttrs attrs; if (cpu->vcpu_dirty) { - kvm_arch_put_registers(cpu, KVM_PUT_RUNTIME_STATE); + ret = kvm_arch_put_registers(cpu, KVM_PUT_RUNTIME_STATE); + if (ret) { + error_report("Failed to put registers after init: %s", + strerror(-ret)); + ret = -1; + break; + } + cpu->vcpu_dirty = false; } From patchwork Tue Oct 3 08:30:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842520 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OCwBq4nx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B5K40lWz1yph for ; Tue, 3 Oct 2023 19:37:09 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnao7-00020V-R7; Tue, 03 Oct 2023 04:31:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao6-0001uy-1g for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao4-0000I1-8p for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x4t8E12TymlIMhdbdE+oLswhb61Lq4W9BqxeOsmnEps=; b=OCwBq4nxqsBNtgB21lS518CzBSUNBfaOhDOFgcjuOoZOzcLqT1I5p9EmGFhjUqh7QKYD15 tDYRgrLWC943wgPxdG4oAKeVH5cZFkinqQRIMJ4T5Uc3dL32L3EWYAwMq5g08Ani92UKBv DczgQv9eZjZPqBNS47QYHqDmvCXSGkA= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-649-ss0a7uF_PgqVI37oOLD2fQ-1; Tue, 03 Oct 2023 04:30:52 -0400 X-MC-Unique: ss0a7uF_PgqVI37oOLD2fQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9a1cf3e6c04so49235166b.3 for ; Tue, 03 Oct 2023 01:30:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321850; x=1696926650; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x4t8E12TymlIMhdbdE+oLswhb61Lq4W9BqxeOsmnEps=; b=vXDR6691OCTEzbLIskQWAPR7TTT3YZAzt3UdZJP1RA0/JFq8WlIaXn5DtTuEr+inZZ un7Qsxlo0Le6JYI2Br5mPG4Jqs/oG/SGDkAm9V2ORh409L+cPU8p68V/lf8nvE8mgWGX XA65dFP2puQdl+g/TekeGFRr6gCKP71f44RBpFOdE2sG/WXWpqdvS+SNPdZCJ9eK79Nt jzAHgBi9SNc/3ifacDzZjBZN/cgebwSnBGCADB9yj2sxAL8m8CkLZnD/rN+xrWotK8mZ xpAgBGt5AhDBUQLjZSCfa9zKvu+FYxA35O0FVT2Huxx6m05US9ajkI5pNaFEaN4AVZDj +OBQ== X-Gm-Message-State: AOJu0YxJ13JSPHQs9FQLgnxMDA5WQ+YYqHtYITcGxEj220cuPgoiKcBP nQIO81HhXn7xhIdcHmXJziYlUpSMiQzXiCItV+uJyF5NyodwBcJ4vRr+g5xN7gGxbyZm6HMfLnd DzrN9ClRymzoptsKpRsHrAxFilA5A0kePX1pdbcPAt3nhgDyRD7sxEzzV6NE5VPNbIQnc/t6dO5 8= X-Received: by 2002:a17:906:53d6:b0:9ae:7611:99be with SMTP id p22-20020a17090653d600b009ae761199bemr13244768ejo.66.1696321850423; Tue, 03 Oct 2023 01:30:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJQaFcALZZWdj2BsO68rUpm5me8NaoSG7ShISYbsjJS6ErnqS/qCP5eSPIC/rErzAXdRjwoQ== X-Received: by 2002:a17:906:53d6:b0:9ae:7611:99be with SMTP id p22-20020a17090653d600b009ae761199bemr13244740ejo.66.1696321849983; Tue, 03 Oct 2023 01:30:49 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id kb15-20020a1709070f8f00b00997c1d125fasm655612ejc.170.2023.10.03.01.30.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:30:48 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/24] e1000: remove old compatibility code Date: Tue, 3 Oct 2023 10:30:20 +0200 Message-ID: <20231003083042.110065-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This code is not needed anymore in the supported machine types. Signed-off-by: Paolo Bonzini --- hw/net/e1000.c | 79 +++++++++++++++++--------------------------------- 1 file changed, 27 insertions(+), 52 deletions(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 093c2d45315..548bcabcbba 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -127,13 +127,9 @@ struct E1000State_st { QEMUTimer *flush_queue_timer; /* Compatibility flags for migration to/from qemu 1.3.0 and older */ -#define E1000_FLAG_AUTONEG_BIT 0 -#define E1000_FLAG_MIT_BIT 1 #define E1000_FLAG_MAC_BIT 2 #define E1000_FLAG_TSO_BIT 3 #define E1000_FLAG_VET_BIT 4 -#define E1000_FLAG_AUTONEG (1 << E1000_FLAG_AUTONEG_BIT) -#define E1000_FLAG_MIT (1 << E1000_FLAG_MIT_BIT) #define E1000_FLAG_MAC (1 << E1000_FLAG_MAC_BIT) #define E1000_FLAG_TSO (1 << E1000_FLAG_TSO_BIT) #define E1000_FLAG_VET (1 << E1000_FLAG_VET_BIT) @@ -180,7 +176,7 @@ e1000_autoneg_done(E1000State *s) static bool have_autoneg(E1000State *s) { - return chkflag(AUTONEG) && (s->phy_reg[MII_BMCR] & MII_BMCR_AUTOEN); + return (s->phy_reg[MII_BMCR] & MII_BMCR_AUTOEN); } static void @@ -308,35 +304,34 @@ set_interrupt_cause(E1000State *s, int index, uint32_t val) if (s->mit_timer_on) { return; } - if (chkflag(MIT)) { - /* Compute the next mitigation delay according to pending - * interrupts and the current values of RADV (provided - * RDTR!=0), TADV and ITR. - * Then rearm the timer. - */ - mit_delay = 0; - if (s->mit_ide && - (pending_ints & (E1000_ICR_TXQE | E1000_ICR_TXDW))) { - mit_update_delay(&mit_delay, s->mac_reg[TADV] * 4); - } - if (s->mac_reg[RDTR] && (pending_ints & E1000_ICS_RXT0)) { - mit_update_delay(&mit_delay, s->mac_reg[RADV] * 4); - } - mit_update_delay(&mit_delay, s->mac_reg[ITR]); - /* - * According to e1000 SPEC, the Ethernet controller guarantees - * a maximum observable interrupt rate of 7813 interrupts/sec. - * Thus if mit_delay < 500 then the delay should be set to the - * minimum delay possible which is 500. - */ - mit_delay = (mit_delay < 500) ? 500 : mit_delay; - - s->mit_timer_on = 1; - timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + - mit_delay * 256); - s->mit_ide = 0; + /* Compute the next mitigation delay according to pending + * interrupts and the current values of RADV (provided + * RDTR!=0), TADV and ITR. + * Then rearm the timer. + */ + mit_delay = 0; + if (s->mit_ide && + (pending_ints & (E1000_ICR_TXQE | E1000_ICR_TXDW))) { + mit_update_delay(&mit_delay, s->mac_reg[TADV] * 4); } + if (s->mac_reg[RDTR] && (pending_ints & E1000_ICS_RXT0)) { + mit_update_delay(&mit_delay, s->mac_reg[RADV] * 4); + } + mit_update_delay(&mit_delay, s->mac_reg[ITR]); + + /* + * According to e1000 SPEC, the Ethernet controller guarantees + * a maximum observable interrupt rate of 7813 interrupts/sec. + * Thus if mit_delay < 500 then the delay should be set to the + * minimum delay possible which is 500. + */ + mit_delay = (mit_delay < 500) ? 500 : mit_delay; + + s->mit_timer_on = 1; + timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + mit_delay * 256); + s->mit_ide = 0; } s->mit_irq_level = (pending_ints != 0); @@ -1223,9 +1218,6 @@ enum { MAC_ACCESS_PARTIAL = 1, MAC_ACCESS_FLAG_NEEDED = 2 }; * n - flag needed * p - partially implenented */ static const uint8_t mac_reg_access[0x8000] = { - [RDTR] = markflag(MIT), [TADV] = markflag(MIT), - [RADV] = markflag(MIT), [ITR] = markflag(MIT), - [IPAV] = markflag(MAC), [WUC] = markflag(MAC), [IP6AT] = markflag(MAC), [IP4AT] = markflag(MAC), [FFVT] = markflag(MAC), [WUPM] = markflag(MAC), @@ -1394,11 +1386,6 @@ static int e1000_post_load(void *opaque, int version_id) E1000State *s = opaque; NetClientState *nc = qemu_get_queue(s->nic); - if (!chkflag(MIT)) { - s->mac_reg[ITR] = s->mac_reg[RDTR] = s->mac_reg[RADV] = - s->mac_reg[TADV] = 0; - s->mit_irq_level = false; - } s->mit_ide = 0; s->mit_timer_on = true; timer_mod(s->mit_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 1); @@ -1432,13 +1419,6 @@ static int e1000_tx_tso_post_load(void *opaque, int version_id) return 0; } -static bool e1000_mit_state_needed(void *opaque) -{ - E1000State *s = opaque; - - return chkflag(MIT); -} - static bool e1000_full_mac_needed(void *opaque) { E1000State *s = opaque; @@ -1457,7 +1437,6 @@ static const VMStateDescription vmstate_e1000_mit_state = { .name = "e1000/mit_state", .version_id = 1, .minimum_version_id = 1, - .needed = e1000_mit_state_needed, .fields = (VMStateField[]) { VMSTATE_UINT32(mac_reg[RDTR], E1000State), VMSTATE_UINT32(mac_reg[RADV], E1000State), @@ -1699,10 +1678,6 @@ static void pci_e1000_realize(PCIDevice *pci_dev, Error **errp) static Property e1000_properties[] = { DEFINE_NIC_PROPERTIES(E1000State, conf), - DEFINE_PROP_BIT("autonegotiation", E1000State, - compat_flags, E1000_FLAG_AUTONEG_BIT, true), - DEFINE_PROP_BIT("mitigation", E1000State, - compat_flags, E1000_FLAG_MIT_BIT, true), DEFINE_PROP_BIT("extra_mac_registers", E1000State, compat_flags, E1000_FLAG_MAC_BIT, true), DEFINE_PROP_BIT("migrate_tso_props", E1000State, From patchwork Tue Oct 3 08:30:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842504 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PaawNOM1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B0T3Vz0z1yng for ; Tue, 3 Oct 2023 19:32:57 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaod-0003K8-Tq; Tue, 03 Oct 2023 04:31:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoL-0002Mv-Kk for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoH-0000Ja-GV for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JEdULn8yExrQeLoHMh7eLE9pzVlfh7yoO+hxU9Gh7z4=; b=PaawNOM197D4uPqJ0hoEswE60Qw08E8o1zRhbMQu9biPQlkk5Md5llsHjUNrK3FgIYuPsk kCaySQWgnliW908cbl0MQHNRg6ZN8KtMhA5gKJM+6eLcMxs6D/rB1BwPJHZ+qa/hAY/Bha OafnN2naMyO5jLvj6qcxz6swraeelWk= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-626-GnxxHiyfPLunmaAsLQyDsw-1; Tue, 03 Oct 2023 04:30:53 -0400 X-MC-Unique: GnxxHiyfPLunmaAsLQyDsw-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-52f274df255so4774654a12.1 for ; Tue, 03 Oct 2023 01:30:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321852; x=1696926652; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JEdULn8yExrQeLoHMh7eLE9pzVlfh7yoO+hxU9Gh7z4=; b=rA1BmfhBdtN3EcggHdVacKA60hP8cB6ciDCRd/Wx28nGD1iBBAP51gNzPYwLDe1Fo8 pnBtjcLLD7tl7FPR3ZO1Wm+Sad1svrr583lBjN0RKx3CUzgUHw7+IsoO4WwMztmklcNA NeOETw9udtlJh4PCCdoKy0FIJeYjWyqYFN/icEF+sBfPhy/GT01n9Wdfhgsfd/oBZYuj QefF1TnEqdDf/EkelDgG6R75tYsRtngkagTop/PP7ikdDtkr+lyEC4Vs8w8uxj9RHuMS Cx0LmzDswpcOxHtvvOQFi5AVkpCZCHYVG7ele6DV++Ofq5EUWZcKlakJrzRgqUZkw2Om 7Eug== X-Gm-Message-State: AOJu0YxTi9C3f4Or8u3YE70OCmh+Zc+B5KjTG8PznOs06T7wL6JrlZsv 1s7hBu8gqyE6Krkl9qsV88TojoaBhd9ZoWNpcLMzGOe0f7Cgys/9cUzu34ov46/Ho/ggeuvWH4U jH6+cMPCI/JxsSeih2g1xwxm7M1u1McLsZZ5lovfLvTm0O75ddYwKwwDT5lj26t3dKLL05gMy4N g= X-Received: by 2002:a17:906:cd2:b0:9a1:ca55:d0cb with SMTP id l18-20020a1709060cd200b009a1ca55d0cbmr1613725ejh.23.1696321851942; Tue, 03 Oct 2023 01:30:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxGt0k+Ie97A7cXhiSulCvr4iyIOAlQOuKOzbvFhfILX75th3p/BL0RkTCaJ6G0V/446Z5Qw== X-Received: by 2002:a17:906:cd2:b0:9a1:ca55:d0cb with SMTP id l18-20020a1709060cd200b009a1ca55d0cbmr1613710ejh.23.1696321851633; Tue, 03 Oct 2023 01:30:51 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id kf1-20020a17090776c100b00992f2befcbcsm649242ejc.180.2023.10.03.01.30.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:30:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/24] pc: remove short_root_bus property Date: Tue, 3 Oct 2023 10:30:21 +0200 Message-ID: <20231003083042.110065-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The property was only used on QEMU 1.6 machine types. Signed-off-by: Paolo Bonzini --- hw/pci-host/i440fx.c | 8 -------- hw/pci-host/q35.c | 7 ------- include/hw/pci-host/q35.h | 1 - 3 files changed, 16 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 62d62876818..653cc3f1495 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -56,7 +56,6 @@ struct I440FXState { uint64_t above_4g_mem_size; uint64_t pci_hole64_size; bool pci_hole64_fix; - uint32_t short_root_bus; char *pci_type; }; @@ -351,19 +350,12 @@ static const TypeInfo i440fx_info = { static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge, PCIBus *rootbus) { - I440FXState *s = I440FX_PCI_HOST_BRIDGE(host_bridge); - - /* For backwards compat with old device paths */ - if (s->short_root_bus) { - return "0000"; - } return "0000:00"; } static Property i440fx_props[] = { DEFINE_PROP_SIZE(PCI_HOST_PROP_PCI_HOLE64_SIZE, I440FXState, pci_hole64_size, I440FX_PCI_HOST_HOLE64_SIZE_DEFAULT), - DEFINE_PROP_UINT32("short_root_bus", I440FXState, short_root_bus, 0), DEFINE_PROP_SIZE(PCI_HOST_BELOW_4G_MEM_SIZE, I440FXState, below_4g_mem_size, 0), DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MEM_SIZE, I440FXState, diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 91c46df9ae3..08534bc7cc0 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -73,12 +73,6 @@ static void q35_host_realize(DeviceState *dev, Error **errp) static const char *q35_host_root_bus_path(PCIHostState *host_bridge, PCIBus *rootbus) { - Q35PCIHost *s = Q35_HOST_DEVICE(host_bridge); - - /* For backwards compat with old device paths */ - if (s->mch.short_root_bus) { - return "0000"; - } return "0000:00"; } @@ -181,7 +175,6 @@ static Property q35_host_props[] = { MCH_HOST_BRIDGE_PCIEXBAR_DEFAULT), DEFINE_PROP_SIZE(PCI_HOST_PROP_PCI_HOLE64_SIZE, Q35PCIHost, mch.pci_hole64_size, Q35_PCI_HOST_HOLE64_SIZE_DEFAULT), - DEFINE_PROP_UINT32("short_root_bus", Q35PCIHost, mch.short_root_bus, 0), DEFINE_PROP_SIZE(PCI_HOST_BELOW_4G_MEM_SIZE, Q35PCIHost, mch.below_4g_mem_size, 0), DEFINE_PROP_SIZE(PCI_HOST_ABOVE_4G_MEM_SIZE, Q35PCIHost, diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h index 1d98bbfe0dd..bafcbe67521 100644 --- a/include/hw/pci-host/q35.h +++ b/include/hw/pci-host/q35.h @@ -54,7 +54,6 @@ struct MCHPCIState { uint64_t below_4g_mem_size; uint64_t above_4g_mem_size; uint64_t pci_hole64_size; - uint32_t short_root_bus; uint16_t ext_tseg_mbytes; }; From patchwork Tue Oct 3 08:30:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842502 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CPkHKNOl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S09zj31J2z1yng for ; Tue, 3 Oct 2023 19:32:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoX-0002qT-Lt; Tue, 03 Oct 2023 04:31:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoJ-0002LW-OR for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao3-0000Hi-On for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t7eXq7UgzPmULRL3TIyMtMS9O4FF89KJBAS2EjoKyTg=; b=CPkHKNOlZJ1jZ7VuDhj6VsUNjOkj2wetjnFs4H0G/gDqKnGkWBC4KKUpUgtZ7GDZekfOWy LsgbC5RN3I3rCuv47/FLddRSWJrEmZzyXUAtik0K2mkB+2pW0Ewc59QrVccgY87G+DyAp/ D+kZY1BiazqTmP2vjI14NzzO8Bbv4/U= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-l-dsXyaQOGOQynEI87ovtQ-1; Tue, 03 Oct 2023 04:30:55 -0400 X-MC-Unique: l-dsXyaQOGOQynEI87ovtQ-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9b2c1159b0aso47461566b.3 for ; Tue, 03 Oct 2023 01:30:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321853; x=1696926653; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t7eXq7UgzPmULRL3TIyMtMS9O4FF89KJBAS2EjoKyTg=; b=XDUtItqdFdgKHwKL8tazZDifwuMF4UTrCQWYk6YJbMWx2aU9EEkfyIJI2yCVixgFsA wC1QYawcHKOfUFalJbatvtVMVGqIPcyYNnKvn+Hnl2Quww2IEOpRpeqJgOdmlwbfrcp/ LlW8IqLDgQvm+NkSj4kh2BR+xmar63tVipg4rKkvbOshz93hGEUd0Vdppq6VDUm5FSVf MVWD23HrvGmK5bw14/IVWRIjBe5ffVn/rfKBDjQgOvzb8XCMGz2hYSfxT0rJT5bSaJMr 5VotIjgz9I1kUT1QkUfkrdEoT45DMGWAERh2nkuJc7UF5BzG2NATYTHGxONqTckwXkIt 1Kjw== X-Gm-Message-State: AOJu0Yxr2GDjAL8VEhHZoYIB7+0E4CRZUf44cQcYwgMq3rnjiQleC5XO ZlY/onv4eJGvYCrlHTDvangxbs2fGeI8GeRLekjnDuNj/I3iih7ZB2+mttHQncaw9vSSq+Cy7sr /azSTaPYPfajRZun69yPo1GOXKk3jPjJBq+v6yui/f22hwOepH9+Zt+CaCP72SxnpLWpODR/6v6 8= X-Received: by 2002:a17:906:3ca1:b0:9a6:5696:3887 with SMTP id b1-20020a1709063ca100b009a656963887mr11613850ejh.59.1696321853623; Tue, 03 Oct 2023 01:30:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8vTZy9JHPJ/BNBj5UeMMHG4fFEprhjxEWWMGRgji7RGQVZyXBUbJI3jGoB2I5mEQ+UAU+6w== X-Received: by 2002:a17:906:3ca1:b0:9a6:5696:3887 with SMTP id b1-20020a1709063ca100b009a656963887mr11613823ejh.59.1696321853182; Tue, 03 Oct 2023 01:30:53 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id y22-20020a170906449600b0098e2969ed44sm653204ejo.45.2023.10.03.01.30.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:30:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/24] make-release: do not ship dtc sources Date: Tue, 3 Oct 2023 10:30:22 +0200 Message-ID: <20231003083042.110065-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org A new enough libfdt is included in all of Debian 11, Ubuntu 20.04 and MSYS2. It has also been included for several minor releases in Fedora and openSUSE Leap, as well as in CentOS. Therefore there is no need anymore to ship the sources together with the QEMU tarballs. Keep the wrap file so that it can be used with --enable-download, but do not ship the sources anymore with either archive-source.sh or make-release. Signed-off-by: Paolo Bonzini --- meson.build | 3 +++ scripts/archive-source.sh | 2 +- scripts/make-release | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 5139db2ff7c..81430ce2348 100644 --- a/meson.build +++ b/meson.build @@ -3070,6 +3070,9 @@ if fdt_required.length() > 0 or fdt_opt == 'enabled' endif if fdt_opt in ['enabled', 'auto', 'system'] + if get_option('wrap_mode') == 'nodownload' + fdt_opt = 'system' + endif fdt = cc.find_library('fdt', required: fdt_opt == 'system') if fdt.found() and cc.links(''' #include diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh index 48996304910..65af8063e4b 100755 --- a/scripts/archive-source.sh +++ b/scripts/archive-source.sh @@ -26,7 +26,7 @@ sub_file="${sub_tdir}/submodule.tar" # independent of what the developer currently has initialized # in their checkout, because the build environment is completely # different to the host OS. -subprojects="dtc keycodemapdb libvfio-user berkeley-softfloat-3 berkeley-testfloat-3" +subprojects="keycodemapdb libvfio-user berkeley-softfloat-3 berkeley-testfloat-3" sub_deinit="" function cleanup() { diff --git a/scripts/make-release b/scripts/make-release index c5db87b3f91..9c570b87f4a 100755 --- a/scripts/make-release +++ b/scripts/make-release @@ -17,7 +17,7 @@ if [ $# -ne 2 ]; then fi # Only include wraps that are invoked with subproject() -SUBPROJECTS="dtc libvfio-user keycodemapdb berkeley-softfloat-3 berkeley-testfloat-3" +SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3 berkeley-testfloat-3" src="$1" version="$2" From patchwork Tue Oct 3 08:30:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842497 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RcWFA2oA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S09yr3ZNNz1yng for ; Tue, 3 Oct 2023 19:31:32 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnao5-0001re-9i; Tue, 03 Oct 2023 04:31:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao1-0001qy-8w for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnanz-0000HN-E9 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321858; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EJuRDnczFGkrZrQtbctZD5wLjABq9HjGRfbPbj3RDdI=; b=RcWFA2oAz8+Uub+3iNoqOTuYfbZF1cZtr5xJT/xH8SRJZ/fzMlxosUfvooWtNVcD04PsFf Ic4zo2oVUrKloJ0sr+BqH0MRRNZntwCrue9+6XGXMkKAxVCKxz9wCwp2F/VC3OZ1kvc6qg WfIYsikH8WK4GIddEUF5n0GpA8OJbw8= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-klEGVl2WMsynvksOMxSM1Q-1; Tue, 03 Oct 2023 04:30:57 -0400 X-MC-Unique: klEGVl2WMsynvksOMxSM1Q-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-99bcb13d8ddso53289766b.0 for ; Tue, 03 Oct 2023 01:30:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321855; x=1696926655; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EJuRDnczFGkrZrQtbctZD5wLjABq9HjGRfbPbj3RDdI=; b=vmKtStv1nE9DZgpn8c+bmCz0Zo1bUP3VUt6VhNmlGYpIcmYDV5boHtk5xnIREiurYg KaMt9Xz85143kfo2BcBpkkyxdkmFxVMyznjW5CVO5Acaf2T7lGJwGUmueO+PHISwPbly woAi60DhKp/LZz9llUIzwQZFJZeISALanwQrD04YJe7rwRBpQKH54oKEQ71JcXjsxadX VrEkwGz5eg5k1xmXdO5vAob90DH0Ebe+bMuBi8mNx/wnGMV6YRrRXX1VtRtrPaqVSejC 7YzswgDq379GCW8aevmhbI6D4uNG0JyvisekYhFsIx3tnN2aHJPzbPUlT8+sGRkbXjB6 /agw== X-Gm-Message-State: AOJu0YyLBYMHUCwtz+iF8nAzMZqAcPpnlgaALD9+V5XnbLuHyX4VmS8Y 4XSxRhOKoVk8rj9PXFwk3OSn7xaKCJ/uqyihKF30WWse4LW/r2vnZci0InLip32otwe6/rupoWt YMdkfKHBhsCuNTuCE5GGSRmotJV1uP4eOWg5LWGm7FLPVdzdXtf1oPqPpd6583ESKm1lj3YG/4i c= X-Received: by 2002:a17:906:538f:b0:9ae:699d:8a2a with SMTP id g15-20020a170906538f00b009ae699d8a2amr13026449ejo.5.1696321855373; Tue, 03 Oct 2023 01:30:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2gxPr7jd+dut5hTeypIv9rVljl/ZlrN+TTjajaTLt7lNFW9v9r3RItOf24bCHu/yNUIapRg== X-Received: by 2002:a17:906:538f:b0:9ae:699d:8a2a with SMTP id g15-20020a170906538f00b009ae699d8a2amr13026425ejo.5.1696321854992; Tue, 03 Oct 2023 01:30:54 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id ch22-20020a170906c2d600b00993664a9987sm655577ejb.103.2023.10.03.01.30.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:30:53 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/24] meson: clean up static_library keyword arguments Date: Tue, 3 Oct 2023 10:30:23 +0200 Message-ID: <20231003083042.110065-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org These are either built because they are dependencies of other targets, or not needed at all because they are used via extract_objects(). Mark them as "build_by_default: false"; if applicable, mark them as "fa" so that -Wl,--whole-archive does not interact with the linker script used for fuzzing. (The "fa" hack is brittle; updating to Meson 1.1 would allow using declare_dependency(objects: ...) instead). Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1044 Signed-off-by: Paolo Bonzini --- gdbstub/meson.build | 4 ++-- meson.build | 11 +++++++---- tcg/meson.build | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gdbstub/meson.build b/gdbstub/meson.build index 9500b9dc4e6..a5a1f4e433f 100644 --- a/gdbstub/meson.build +++ b/gdbstub/meson.build @@ -21,12 +21,12 @@ libgdb_user = static_library('gdb_user', gdb_user_ss.sources() + genh, name_suffix: 'fa', c_args: '-DCONFIG_USER_ONLY', - build_by_default: have_user) + build_by_default: false) libgdb_softmmu = static_library('gdb_softmmu', gdb_system_ss.sources() + genh, name_suffix: 'fa', - build_by_default: have_system) + build_by_default: false) gdb_user = declare_dependency(link_whole: libgdb_user) user_ss.add(gdb_user) diff --git a/meson.build b/meson.build index 81430ce2348..21a1bc03f87 100644 --- a/meson.build +++ b/meson.build @@ -3180,7 +3180,6 @@ foreach d : hx_headers input: files(d[0]), output: d[1], capture: true, - build_by_default: true, # to be removed when added to a target command: [hxtool, '-h', '@INPUT0@']) endforeach genh += hxdep @@ -3366,12 +3365,15 @@ endif qom_ss = qom_ss.apply(config_targetos, strict: false) libqom = static_library('qom', qom_ss.sources() + genh, dependencies: [qom_ss.dependencies()], - name_suffix: 'fa') + name_suffix: 'fa', + build_by_default: false) qom = declare_dependency(link_whole: libqom) event_loop_base = files('event-loop-base.c') -event_loop_base = static_library('event-loop-base', sources: event_loop_base + genh, - build_by_default: true) +event_loop_base = static_library('event-loop-base', + sources: event_loop_base + genh, + name_suffix: 'fa', + build_by_default: false) event_loop_base = declare_dependency(link_whole: event_loop_base, dependencies: [qom]) @@ -3380,6 +3382,7 @@ stub_ss = stub_ss.apply(config_all, strict: false) util_ss.add_all(trace_ss) util_ss = util_ss.apply(config_all, strict: false) libqemuutil = static_library('qemuutil', + build_by_default: false, sources: util_ss.sources() + stub_ss.sources() + genh, dependencies: [util_ss.dependencies(), libm, threads, glib, socket, malloc, pixman]) qemuutil = declare_dependency(link_with: libqemuutil, diff --git a/tcg/meson.build b/tcg/meson.build index 0014dca7d4f..4be4a616caa 100644 --- a/tcg/meson.build +++ b/tcg/meson.build @@ -28,7 +28,7 @@ libtcg_user = static_library('tcg_user', tcg_ss.sources() + genh, name_suffix: 'fa', c_args: '-DCONFIG_USER_ONLY', - build_by_default: have_user) + build_by_default: false) tcg_user = declare_dependency(link_with: libtcg_user, dependencies: tcg_ss.dependencies()) @@ -38,7 +38,7 @@ libtcg_softmmu = static_library('tcg_softmmu', tcg_ss.sources() + genh, name_suffix: 'fa', c_args: '-DCONFIG_SOFTMMU', - build_by_default: have_system) + build_by_default: false) tcg_softmmu = declare_dependency(link_with: libtcg_softmmu, dependencies: tcg_ss.dependencies()) From patchwork Tue Oct 3 08:30:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842501 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=h7YVZSpY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S09zc55zfz1yng for ; Tue, 3 Oct 2023 19:32:12 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoJ-0002Gd-0L; Tue, 03 Oct 2023 04:31:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao9-00029G-B7 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao7-0000IV-KP for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qJUl/ROgEOzlEPXIQ/RmbL6Jx87XvYZOKpE+KtRjM2c=; b=h7YVZSpYtX+lFGFxewfXIEEi1Ciha+29uJKCCImleUteym6nByvNE7bGeojLH0PpnTKxTE JKgFFOzcUxsbZT1gcld+s2r0BUTpzVLr1UtV2E/n2lOVoCSpIS8nYb6QzhYOvNLng/Dmxs Rg6AFoSOR5wiZlnCwn+fXGZSelZIvGs= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-271-QZArtXkVPhu0InBXI27wVg-1; Tue, 03 Oct 2023 04:30:59 -0400 X-MC-Unique: QZArtXkVPhu0InBXI27wVg-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9ae0bf9c0a9so50293866b.3 for ; Tue, 03 Oct 2023 01:30:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321857; x=1696926657; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qJUl/ROgEOzlEPXIQ/RmbL6Jx87XvYZOKpE+KtRjM2c=; b=NJDymyCiYXfuGlOfwV9SbfvOuu79dci77xfBzxG3CWdhzdkCBBeWPu/lKy5U173ZLk eR2ZBq8skPrmFFZQbfCxXtO5szCNi5jihvF4wDL+y/F5+uuhdtv6oHDV0FsoUfCvI8Bl UE9kAuzOhgU9toitw+JlK/ZcjnonJ/79CW4JWcJQOswsrX4dQhIaMzcwEt/vBLtfmjuO ticUzxR0hpfjJgo01chIkDi91Zlz9J207S8KvHbvSTZHubdf9BN2aKCrJIkswrVU4izt rPPWUsc8wDwy6Q8oXJEV3lZyccq/cmR2wjlkWNdEZhIrK9mRJGsJJIQ6SIkN8aDU5L2n yCCA== X-Gm-Message-State: AOJu0Yx9eztjCO/jYIl/iJQxplOZ63EmPDuNlBP0RJ0QtioOGYZRVV+y 0YsprUPI2LUOsW65BIDL8gjaQg/0QlcFcNdvO7CRtDNa7r1Zn/oJ+LIxsd7SE3KmAHPtEa8ylrl caqfb4bPsPXbYt6pLsebPOvHs87WpKz0hdWBYWQur/UNk7D+DJFmGR4urrA74X0U5C1m7LEB0m6 Q= X-Received: by 2002:a17:906:8a74:b0:9ae:3e72:7c72 with SMTP id hy20-20020a1709068a7400b009ae3e727c72mr10462839ejc.58.1696321857506; Tue, 03 Oct 2023 01:30:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1snEbVNPTaVJRoT54hhE5o9EOKMKXfV1vuE+pwIKg9GlKSzSjYkrGaugPBAn+x2008zfCrg== X-Received: by 2002:a17:906:8a74:b0:9ae:3e72:7c72 with SMTP id hy20-20020a1709068a7400b009ae3e727c72mr10462822ejc.58.1696321857187; Tue, 03 Oct 2023 01:30:57 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id gg24-20020a170906e29800b0099bd7b26639sm663471ejb.6.2023.10.03.01.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:30:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PULL 07/24] Makefile: build plugins before running TCG tests Date: Tue, 3 Oct 2023 10:30:24 +0200 Message-ID: <20231003083042.110065-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add back test-plugins and, after making sure it is always defined, do so unconditionally. Reported-by: Alex Bennée Fixes: 2c13c574418 ("configure, meson: move --enable-plugins to meson", 2023-09-07) Reviewed-by: Alex Bennée Tested-by: Alex Bennée Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 2 +- tests/meson.build | 5 +---- tests/plugin/meson.build | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 38987426594..dab1989a071 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -73,7 +73,7 @@ $(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%): distclean-tcg-tests-%: build-tcg: $(BUILD_TCG_TARGET_RULES) .PHONY: check-tcg -.ninja-goals.check-tcg = all +.ninja-goals.check-tcg = all test-plugins check-tcg: $(RUN_TCG_TARGET_RULES) .PHONY: clean-tcg diff --git a/tests/meson.build b/tests/meson.build index debaa4505eb..9996a293fbb 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -80,10 +80,7 @@ if 'CONFIG_TCG' in config_all subdir('fp') endif -if get_option('plugins') - subdir('plugin') -endif - +subdir('plugin') subdir('unit') subdir('qapi-schema') subdir('qtest') diff --git a/tests/plugin/meson.build b/tests/plugin/meson.build index 2bbfc4b19e1..322cafcdf6b 100644 --- a/tests/plugin/meson.build +++ b/tests/plugin/meson.build @@ -1,7 +1,13 @@ t = [] -foreach i : ['bb', 'empty', 'insn', 'mem', 'syscall'] - t += shared_module(i, files(i + '.c'), - include_directories: '../../include/qemu', - dependencies: glib) -endforeach -alias_target('test-plugins', t) +if get_option('plugins') + foreach i : ['bb', 'empty', 'insn', 'mem', 'syscall'] + t += shared_module(i, files(i + '.c'), + include_directories: '../../include/qemu', + dependencies: glib) + endforeach +endif +if t.length() > 0 + alias_target('test-plugins', t) +else + run_target('test-plugins', command: find_program('true')) +endif From patchwork Tue Oct 3 08:30:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=e4YTegu0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B270nKCz1yng for ; Tue, 3 Oct 2023 19:34:23 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoU-0002Wj-C2; Tue, 03 Oct 2023 04:31:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoK-0002Ll-Oa for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao3-0000Hk-45 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xYyqjxmMIyCWgEK6pYjK962SrBGTEF8AIbddXhlTQ/o=; b=e4YTegu0ljgxaezcZnp+QKv0nybvEiHMrATFaB9EzktCqhwSbb+YhG0Pfes8sTJvnJzAnR dGaj9dyqUoFB3uK/naoeMq+17B+r7fl+bMQ11kPo8W0nTLtJvsg80AMkgXDGFt85ln03Tp PQm6M14T6HVOto+qwFYLBt3fOQ7j19g= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-Glpapzv_MCynKLiRb42HUw-1; Tue, 03 Oct 2023 04:31:01 -0400 X-MC-Unique: Glpapzv_MCynKLiRb42HUw-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9a9f282713fso53926766b.3 for ; Tue, 03 Oct 2023 01:31:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321859; x=1696926659; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xYyqjxmMIyCWgEK6pYjK962SrBGTEF8AIbddXhlTQ/o=; b=u1rz4EmW7txkSIfXFvlxPWfisvRhviFBco7lcmxXLcWqiezSz5ZONiOq6oryDY55s8 /p8PpWVFGfi9R5ABdURhegdKDrA0qM2oAdK0ciUdCwOVQ0HTbtXaRtSFC9Sl7/AzAaRV rCdstyy4hO09kB02yJLqo+XC7/45PDfCFaYyw/4tXKgEME4t3MVbialHyw9d2PlGr3oh O0JH6qvSbJgX+1Fm3JcpyIFjZiWFdQbB5b9z/CXoxnxf1vKiiDxvTXssAPySQhnVcvsm 7CIjF1llpQ0KF5xbeOYz3uB9d3z531GlPmEiIcr5vdvE97jWhVDJvAqAdF5FyJ2vQ7Nx USVw== X-Gm-Message-State: AOJu0YxCOMMAasuO27McY9oXMUnzaB78V37fCGCE6WH6AcpbKuWiVUpd mkOozpLhNjQdNYOUyOXrtsyekTFvKjCgaHWYZ5mER44HfjSfGYGDsfSFun7sH/GvVQr2IYqWHVe 3cBnTXUTiQFlCvG2REGka3diYroUWcgCMpqViFEsora5jZJ6ml4Asr64VjcLE/6tjA8BfOED4dA g= X-Received: by 2002:a17:906:74c4:b0:9a9:e5bb:eddc with SMTP id z4-20020a17090674c400b009a9e5bbeddcmr11290582ejl.16.1696321859361; Tue, 03 Oct 2023 01:30:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvh2QzZm/LAv14NsYoYu98BBvQSKj9f5dTV/WnyaD4U1dVS02hmj51gOcxTofzNg24hfHH/w== X-Received: by 2002:a17:906:74c4:b0:9a9:e5bb:eddc with SMTP id z4-20020a17090674c400b009a9e5bbeddcmr11290565ejl.16.1696321859029; Tue, 03 Oct 2023 01:30:59 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id ss26-20020a170907039a00b009a5f1d15644sm635190ejb.119.2023.10.03.01.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:30:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , Thomas Huth Subject: [PULL 08/24] esp: use correct type for esp_dma_enable() in sysbus_esp_gpio_demux() Date: Tue, 3 Oct 2023 10:30:25 +0200 Message-ID: <20231003083042.110065-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Mark Cave-Ayland The call to esp_dma_enable() was being made with the SYSBUS_ESP type instead of the ESP type. This meant that when GPIO 1 was being used to trigger a DMA request from an external DMA controller, the setting of ESPState's dma_enabled field would clobber unknown memory whilst the dma_cb callback pointer would typically return NULL so the DMA request would never start. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-ID: <20230913204410.65650-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/esp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index e52188d0228..4218a6a9605 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -1395,7 +1395,7 @@ static void sysbus_esp_gpio_demux(void *opaque, int irq, int level) parent_esp_reset(s, irq, level); break; case 1: - esp_dma_enable(opaque, irq, level); + esp_dma_enable(s, irq, level); break; } } From patchwork Tue Oct 3 08:30:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842511 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iOnxlFgU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B2m6j2Jz1yng for ; Tue, 3 Oct 2023 19:34:56 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnapL-0004u0-H2; Tue, 03 Oct 2023 04:32:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoK-0002Lk-Dd for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoF-0000JS-GO for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CORtctayitClxawrdYJ5GiASnRAV4m5SygYmlM2tjSY=; b=iOnxlFgUfy6C7qngHuvDMWe3EqHHey+/Fzyv1+YOTxY1w9jDT328RE1FFHgRWEkfO8sGwC HjNKmlMI1SZ2gUE4///inpqTaVQczM/NKiMVsaatAYUi9zbgxizNB3/OVHmDzNma84a5Un Wb3SsonCmyqvcopJ1k24VtvsfDxbn3U= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-282-p3AMWHaSPuinCsSjy2dsJA-1; Tue, 03 Oct 2023 04:31:02 -0400 X-MC-Unique: p3AMWHaSPuinCsSjy2dsJA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-99bca0b9234so52522566b.2 for ; Tue, 03 Oct 2023 01:31:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321861; x=1696926661; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CORtctayitClxawrdYJ5GiASnRAV4m5SygYmlM2tjSY=; b=P/gQLjPc+QDQT0LSbDtUHSHfPgC/mY06GQvrrmzn+gF0a+GDPi/QNSqGWdL3z4FyQj p4vsnyxpW1mmyTf8/8RY5x4FpscNnfwoDnelRm+Q0s3IdS4lIHeejxjRYG5rbSHuMJMO +7vTRWj5SdHF/YGvpnoPfOxrwWO5d5995Ydef8bu8eVSYbzLQwitHqqkpsM2zxng4oC1 L3dFe+ncivWAs4a9UjhG+Ig2K5wVJNjMhbA5pV0DnpEL7R27tqT8IDmp2KhBdZhpl7hQ eN+CaAIlya5Q66cWEhrB1NtYicD22+h7RX6WG9eyNOwMIK8Nd1NoY8W2OCFP5Ro1je0D zf5w== X-Gm-Message-State: AOJu0YwWcRyjSlzI5x3Eyg/JA0z7AZo112RHivfaHw1oITo7CiA7hJsI dAyVBMuFM3kqq3aLwCH9kRMh7B3DyarJC+PftMjKTORQfjXrMaHQy+4QVVQMxjvMbZAxoV9Xy1U lGE3pSI8rHFFtuiShJj12bTuhD8x81y9H7/w82ljjFGyVNl3HhV7epYEJwVPhgRqDyQou3LW1QJ 4= X-Received: by 2002:a17:906:8b:b0:9a5:846d:d823 with SMTP id 11-20020a170906008b00b009a5846dd823mr14512996ejc.45.1696321861191; Tue, 03 Oct 2023 01:31:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhrgSdRpmOcxmV7M01tAK0arkf022edU22M9sfuYEAZ318glorHMbnQoNVLrTHPYm9YugdkA== X-Received: by 2002:a17:906:8b:b0:9a5:846d:d823 with SMTP id 11-20020a170906008b00b009a5846dd823mr14512978ejc.45.1696321860880; Tue, 03 Oct 2023 01:31:00 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id v27-20020a170906339b00b0099cb1a2cab0sm657858eja.28.2023.10.03.01.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:00 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth Subject: [PULL 09/24] esp: restrict non-DMA transfer length to that of available data Date: Tue, 3 Oct 2023 10:30:26 +0200 Message-ID: <20231003083042.110065-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Mark Cave-Ayland In the case where a SCSI layer transfer is incorrectly terminated, it is possible for a TI command to cause a SCSI buffer overflow due to the expected transfer data length being less than the available data in the FIFO. When this occurs the unsigned async_len variable underflows and becomes a large offset which writes past the end of the allocated SCSI buffer. Restrict the non-DMA transfer length to be the smallest of the expected transfer length and the available FIFO data to ensure that it is no longer possible for the SCSI buffer overflow to occur. Signed-off-by: Mark Cave-Ayland Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1810 Reviewed-by: Thomas Huth Message-ID: <20230913204410.65650-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/esp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 4218a6a9605..9b11d8c5738 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -759,7 +759,8 @@ static void esp_do_nodma(ESPState *s) } if (to_device) { - len = MIN(fifo8_num_used(&s->fifo), ESP_FIFO_SZ); + len = MIN(s->async_len, ESP_FIFO_SZ); + len = MIN(len, fifo8_num_used(&s->fifo)); esp_fifo_pop_buf(&s->fifo, s->async_buf, len); s->async_buf += len; s->async_len -= len; From patchwork Tue Oct 3 08:30:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842498 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Uy3ayEbp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S09z457bkz20Zh for ; Tue, 3 Oct 2023 19:31:44 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaob-00039A-No; Tue, 03 Oct 2023 04:31:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoL-0002N4-Mi for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao6-0000IZ-MM for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321866; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7A7XLyUbLXuEVp9hnv5SZ1RtggfAbndCdpUl9H3FpLM=; b=Uy3ayEbpGTMCcuL55no3S7S5+7AgKs1S8eHRvnMbm8FAdxUCMpjzqEdoU5tMfZ1vzm+Xu7 E7K5H/Jge9kcD59ihxlJSEk6YVzZFUyM/wymR0BJDzMoinrzI6R7rrqhWcP0E6XNWTbI4A MB0MFcZKUjW4yEjEZl4d3BlPqMBLG34= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-380-73b4WRdnOnukJYkHbvwDbA-1; Tue, 03 Oct 2023 04:31:04 -0400 X-MC-Unique: 73b4WRdnOnukJYkHbvwDbA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-99c8bbc902eso49803666b.1 for ; Tue, 03 Oct 2023 01:31:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321863; x=1696926663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7A7XLyUbLXuEVp9hnv5SZ1RtggfAbndCdpUl9H3FpLM=; b=WXjEfQPlXzHf7e5h9QDJPLqwR6TY+F/0nmhD9oCbHgk64bmBuNQXibqp66dxVjR5W4 +Af8lqd09HhOj583jEPORK332RXiCHtqst0YKMCF0QwKTTatFEVdo4s/+Il7APF3u95q QSwRaXACVfcUTMdnoMzcq2XG1bd+jgYC62Sj28XQGn6Dd4SXSBxGCGoOdg0EDLWliI2k MTgPMwy3aBwlRBmMwke6H6tCMWH0kVvFhWfvo67g1s90GTjN0wvACrxBXgrjBQL6HOoG tvrM7ipL23lMvxY1oFTiqFQs9DiRUSgDG9asX/lANesPX7cc9najGpYCtwFWn0odazQr vUPQ== X-Gm-Message-State: AOJu0Yx4RYwqn/EQTzaC8h444Lw1+zlAeRVFvs6b4OhNai1WvD+UxTZ1 hrYNCnsNBGmGNlNR1QnQf6D6AuUDNKmgp6CpYZkeCtPwricKIlMrkih6B6Z2DQc7nekmnK/ykaZ KMgW7OUJhGL0f87NNUe0VtTnVr7yD1MubNQQs2geoW/X29e4aECq8aif8KGIH7BHmSdvVlzt6Yk E= X-Received: by 2002:a17:907:7851:b0:9ae:594d:d3fc with SMTP id lb17-20020a170907785100b009ae594dd3fcmr10360331ejc.17.1696321863132; Tue, 03 Oct 2023 01:31:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfmtkUmKpjTAgdFoBdR2hzXEUzDh5lLK2tDm3hIRuE8iHdNY1vY5iti9fTrGCPli7NUH0efQ== X-Received: by 2002:a17:907:7851:b0:9ae:594d:d3fc with SMTP id lb17-20020a170907785100b009ae594dd3fcmr10360318ejc.17.1696321862798; Tue, 03 Oct 2023 01:31:02 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id c2-20020a170906340200b009adcb6c0f0esm650772ejb.193.2023.10.03.01.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , Thomas Huth Subject: [PULL 10/24] scsi-disk: ensure that FORMAT UNIT commands are terminated Date: Tue, 3 Oct 2023 10:30:27 +0200 Message-ID: <20231003083042.110065-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Mark Cave-Ayland Otherwise when a FORMAT UNIT command is issued, the SCSI layer can become confused because it can find itself in the situation where it thinks there is still data to be transferred which can cause the next emulated SCSI command to fail. Signed-off-by: Mark Cave-Ayland Fixes: 6ab71761 ("scsi-disk: add FORMAT UNIT command") Tested-by: Thomas Huth Message-ID: <20230913204410.65650-4-mark.cave-ayland@ilande.co.uk> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 477ee2bcd47..6691f5edb84 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1959,6 +1959,10 @@ static void scsi_disk_emulate_write_data(SCSIRequest *req) scsi_disk_emulate_write_same(r, r->iov.iov_base); break; + case FORMAT_UNIT: + scsi_req_complete(&r->req, GOOD); + break; + default: abort(); } From patchwork Tue Oct 3 08:30:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gwpBYqWC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B2F16VJz1yng for ; Tue, 3 Oct 2023 19:34:29 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoO-0002N6-29; Tue, 03 Oct 2023 04:31:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoE-0002JJ-0W for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnao9-0000Iy-Ux for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321869; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JBVBdM+9uj89cR+ThOaqChPLTmRyffYAAxAEvfalfqQ=; b=gwpBYqWCRNDkmmq3i5atvzsrRR/v2S2sEe9MjXw+iNHDeGPpqegUF4Td8DqbcWLPdliLjI c91bvb0chCBJ72iV5zcfNqH2rtN2uG7eMaRndAramHFKX73am5YV6V9o3WBdFDlmPbiQDo LBZ0L2pr+skzV1ujJ5a0F7XVROjXLfI= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-emw-HyOhOfe7naZPNLmYRw-1; Tue, 03 Oct 2023 04:31:07 -0400 X-MC-Unique: emw-HyOhOfe7naZPNLmYRw-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9ae0601d689so51899966b.0 for ; Tue, 03 Oct 2023 01:31:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321866; x=1696926666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JBVBdM+9uj89cR+ThOaqChPLTmRyffYAAxAEvfalfqQ=; b=VlQvazTnuP4wSNgXTLJy1YVUwD3rFNI2W0QpP1M2YUCQRs2EfTguf343z+SflGiGJz y0kgcEALtVk8BdS0odiZF86bzcNRxeSevjhHJYtOdpUfCErV8SX89FeI1teGASTz9lRU DD03j6o4lZHB9QNKhxia/hXjWO2GSCw5GDHfZmK2QZE5CTUTA8PP2hSnlXHFj7iFAzi9 Jtb9tsPFoc7molY7EYt6HS++FFeXWw7wqjYNkVrNC2fz6hUSMq1zLsZTLPpAp4lYO29G HgqD28swdKL9Xq2u32Y1c55D8ZsSClORU7PC2Nr4LtGEGDqWL7txuKaEtfOe8rwB9LOc Qs9A== X-Gm-Message-State: AOJu0YzS2yZ4g4s9gNrFtCyRfsNqBsGJZN6gzRswBv4RLo9UA33X4QlJ C//PEs2ivLlyIgYoHH6QyryHln6xGpsuia0GrBa5ZWJrvd/0MtR8oso6mpEJjsuGjWxko0dK2rd QnPUGlj/NTsVnbs+EvWfZ6d11442m8pbIYpuI2O7mPW19uwxoUXz+Cq8f6Zyj5TSgdlF50aoxWS M= X-Received: by 2002:a17:906:ce:b0:9a4:88af:b7b with SMTP id 14-20020a17090600ce00b009a488af0b7bmr10559411eji.62.1696321865871; Tue, 03 Oct 2023 01:31:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzZUo7agvcs+JIhFIFaKCceuPuYpTGy42p/6AjRborbAfNfq5e6bceCqJMCEoob4Aa1pwMRg== X-Received: by 2002:a17:906:ce:b0:9a4:88af:b7b with SMTP id 14-20020a17090600ce00b009a488af0b7bmr10559391eji.62.1696321865524; Tue, 03 Oct 2023 01:31:05 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id v5-20020a1709064e8500b009b29553b648sm640260eju.206.2023.10.03.01.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PULL 11/24] crypto: only include tls-cipher-suites in emulators Date: Tue, 3 Oct 2023 10:30:28 +0200 Message-ID: <20231003083042.110065-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org tls-cipher-suites is an object that is used to inject TLS configuration into the guest (via fw_cfg). It is never used for host-side TLS operation, and therefore it need not be available in the tools. Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- crypto/meson.build | 3 ++- hw/nvram/meson.build | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/crypto/meson.build b/crypto/meson.build index 9ac1a898027..c46f9c22a7f 100644 --- a/crypto/meson.build +++ b/crypto/meson.build @@ -46,7 +46,8 @@ endif if have_afalg crypto_ss.add(if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c')) endif -crypto_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c')) + +system_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c')) util_ss.add(files( 'aes.c', diff --git a/hw/nvram/meson.build b/hw/nvram/meson.build index 988dff6f8e5..75e415b1a01 100644 --- a/hw/nvram/meson.build +++ b/hw/nvram/meson.build @@ -1,8 +1,4 @@ -if have_system or have_tools - # QOM interfaces must be available anytime QOM is used. - qom_ss.add(files('fw_cfg-interface.c')) -endif - +system_ss.add(files('fw_cfg-interface.c')) system_ss.add(files('fw_cfg.c')) system_ss.add(when: 'CONFIG_CHRP_NVRAM', if_true: files('chrp_nvram.c')) system_ss.add(when: 'CONFIG_DS1225Y', if_true: files('ds1225y.c')) From patchwork Tue Oct 3 08:30:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842512 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NW8l4ARj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B2p4g0Pz1yng for ; Tue, 3 Oct 2023 19:34:58 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoU-0002aU-L0; Tue, 03 Oct 2023 04:31:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoJ-0002LV-Nh for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoD-0000JB-1a for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=062lQOPC+PhYZGAGOhww6XlMuZlq/6DlQrwBd4uWz6k=; b=NW8l4ARjGnIOqXHeUb3iMLqoKvdq+eTfnqBr7+LpupuqXCiNtKkQMaVpvznIEVVD4mpdJi nr1qORhRieIBzwF2ZB59MCbdvIuDRsEIODsxB8PDXwsXJLzH30ZzOztSyGjMQW77UeFJ0A 4HnPwgbF+iTPChgVN4X6nb/856g4iuI= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-scm5HJHLMAiGmvJOnvCuoA-1; Tue, 03 Oct 2023 04:31:10 -0400 X-MC-Unique: scm5HJHLMAiGmvJOnvCuoA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-99c8bbc902eso49810466b.1 for ; Tue, 03 Oct 2023 01:31:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321868; x=1696926668; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=062lQOPC+PhYZGAGOhww6XlMuZlq/6DlQrwBd4uWz6k=; b=Ep6n+5114Uj6VXC8GC09hYtjf9vLbBs5aSeIy1TVtF8TdL2wAs8d9hdIvpK+j6+1lG y3Ti9CqE//3OLXm7WXZ3pnu4TLxxwbSsj3hnTrLGKWDwjg7QiQPXYkezMI27v7A01NZM xSqYdnbbAA8xZiiQTZZxOIELl2TRxVHN/yGi60B5SJ9W3Mq5l5NIBAzhkKiMNTzbB4hu BygZ+c0Mb/bTJxWAuyc+O0hSabQ4yr96oO4hmNveJA08yumshTJcZU4FsYK95GFCLt9h DJB8oBF9PaiOppfATsOBuWvdSfvrMiPwhgQ+f0wnxAXxbtzCQ9vlWWNkDtNHgTp5NcN0 AcWw== X-Gm-Message-State: AOJu0YwSBR8UxpuJi3Bw2h8SYqB9qhlhSmsN2EYPJMY0hGFM4VOwom5i 6747cCwTz/m/pbUYLm7aG1HxunD5xyxM3Uqc+HwjQPFAOqb2ooPQFtJYWs1BDfHwDfxRhg5ZsHL qYC8CyLtg57WT/S3JTCOXEPdn8/77lpcWYtZzQOeFBPKiLT+dIiWMNlmyoNBCV6Y06aC9wTxOrG U= X-Received: by 2002:a17:906:749b:b0:992:c8d7:b66f with SMTP id e27-20020a170906749b00b00992c8d7b66fmr11749899ejl.75.1696321868326; Tue, 03 Oct 2023 01:31:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+03vM2Bn88nAlceA/zx7mvqOsVLZXwBO4PQ8ZpGKTbNzlRiplYww0ShjYW77Z3Pe21ueoJg== X-Received: by 2002:a17:906:749b:b0:992:c8d7:b66f with SMTP id e27-20020a170906749b00b00992c8d7b66fmr11749883ejl.75.1696321867965; Tue, 03 Oct 2023 01:31:07 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id n23-20020a170906089700b009adc77fe165sm653134eje.118.2023.10.03.01.31.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PULL 12/24] ui/vnc: Require audiodev= to enable audio Date: Tue, 3 Oct 2023 10:30:29 +0200 Message-ID: <20231003083042.110065-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If there is no audiodev do not send the audio ack in response to VNC_ENCODING_AUDIO, so that clients aren't told audio exists, and immediately drop the client if they try to send any audio control messages when audio is not advertised. Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- docs/about/deprecated.rst | 8 +++----- docs/about/removed-features.rst | 6 ++++++ ui/vnc.c | 11 ++++++++++- ui/vnc.h | 2 ++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 8f3fef97bd4..c07bf58dde1 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -45,13 +45,11 @@ backend settings instead of environment variables. To ease migration to the new format, the ``-audiodev-help`` option can be used to convert the current values of the environment variables to ``-audiodev`` options. -Creating sound card devices and vnc without ``audiodev=`` property (since 4.2) -'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' +Creating sound card devices without ``audiodev=`` property (since 4.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' When not using the deprecated legacy audio config, each sound card -should specify an ``audiodev=`` property. Additionally, when using -vnc, you should specify an ``audiodev=`` property if you plan to -transmit audio through the VNC protocol. +should specify an ``audiodev=`` property. Short-form boolean options (since 6.0) '''''''''''''''''''''''''''''''''''''' diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst index 97ec47f1d25..276060b320c 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -436,6 +436,12 @@ the process listing. This was replaced by the new ``password-secret`` option which lets the password be securely provided on the command line using a ``secret`` object instance. +Creating vnc without ``audiodev=`` property (removed in 8.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +When using vnc, you should specify an ``audiodev=`` property if +you plan to transmit audio through the VNC protocol. + QEMU Machine Protocol (QMP) commands ------------------------------------ diff --git a/ui/vnc.c b/ui/vnc.c index c302bb07a5b..acb56461b2d 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2195,7 +2195,10 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) send_ext_key_event_ack(vs); break; case VNC_ENCODING_AUDIO: - send_ext_audio_ack(vs); + if (vs->vd->audio_state) { + vs->features |= VNC_FEATURE_AUDIO_MASK; + send_ext_audio_ack(vs); + } break; case VNC_ENCODING_WMVi: vs->features |= VNC_FEATURE_WMVI_MASK; @@ -2502,6 +2505,12 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len) read_u32(data, 4), read_u32(data, 8)); break; case VNC_MSG_CLIENT_QEMU_AUDIO: + if (!vnc_has_feature(vs, VNC_FEATURE_AUDIO)) { + error_report("Audio message %d with audio disabled", read_u8(data, 2)); + vnc_client_error(vs); + break; + } + if (len == 2) return 4; diff --git a/ui/vnc.h b/ui/vnc.h index 757fa83044e..96d19dce199 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -464,6 +464,7 @@ enum VncFeatures { VNC_FEATURE_LED_STATE, VNC_FEATURE_XVP, VNC_FEATURE_CLIPBOARD_EXT, + VNC_FEATURE_AUDIO, }; #define VNC_FEATURE_RESIZE_MASK (1 << VNC_FEATURE_RESIZE) @@ -481,6 +482,7 @@ enum VncFeatures { #define VNC_FEATURE_LED_STATE_MASK (1 << VNC_FEATURE_LED_STATE) #define VNC_FEATURE_XVP_MASK (1 << VNC_FEATURE_XVP) #define VNC_FEATURE_CLIPBOARD_EXT_MASK (1 << VNC_FEATURE_CLIPBOARD_EXT) +#define VNC_FEATURE_AUDIO_MASK (1 << VNC_FEATURE_AUDIO) /* Client -> Server message IDs */ From patchwork Tue Oct 3 08:30:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YMONj6r6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S09zC5nSCz1yng for ; Tue, 3 Oct 2023 19:31:51 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaof-0003LX-Kd; Tue, 03 Oct 2023 04:31:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoM-0002ND-RQ for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoL-0000KG-9s for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2zaDS58SaB+9o6+flazBQrj9kRQw5pA/KRCUziy84sQ=; b=YMONj6r6VFwiIV1CVrWafvxvdQa3dCPMdDZDLmJxW9kYjziRFV6H/zFwfIwgolzoqECVJf GXnjvYfwMLD84I8d4taNj0ViNoH3SS+n/aUMO/NIubetbEeYuXS/9X6SNBvYFfr9wuYG1y w0mn7iAznlcORMBEgJudWbU1MoT3ojI= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-130-FhNX1VbDN76gUAQJa_SfZA-1; Tue, 03 Oct 2023 04:31:12 -0400 X-MC-Unique: FhNX1VbDN76gUAQJa_SfZA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9a9d7a801a3so55232766b.2 for ; Tue, 03 Oct 2023 01:31:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321870; x=1696926670; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2zaDS58SaB+9o6+flazBQrj9kRQw5pA/KRCUziy84sQ=; b=VHkKqC7ly80H4P7jvPBnq/rUEb+6CfDsdf0UykWm8RR1Pc43kYxfvD3IFyLk4ILmAC S0JKWJww3c3z8sQkBB/R2E7FI1Wofbsp4o+XoX65vNr9cFkNi1ZG0ayFONjcdjJHBzU2 Ps1mPwcGJIKWCAodoQwLIRDoZhRzyoBcn2jxrQxBP4ZvhhSgYyzl5yHcvUmnV8rf6UHs TWqCaF7oZSJfGT5pmHpWkWMrA5yxE6cNKrx9qh3pG+T5fqBUtVa/XUl6WUpLYnEQXLKf j5vAJQCNWPf/Crk8OQb6CPW5sZxm4KK0knz93iowQupD8YmJIy3pINjIClTjm4JOi1K8 0Eqg== X-Gm-Message-State: AOJu0YzZJBdFR1Oqb7xiLXyzMA2uMmswY3Gecz8vWkoD20Omqqp+dpT/ /dfiz6aXQwVwsbnCaX8FxqSbsLn/dKNfJEU+Y3SLgFKuW89BQDRSpfvxI09vf3E+9bl3W5kQGSH 6EvMF7RVq2SQn5hT1dNFIV6B7vtyurEllKj5BckHkZZTnEYpckGF1SexpezQa92J42na8m17T06 w= X-Received: by 2002:a17:906:74ca:b0:9b2:94a8:df5 with SMTP id z10-20020a17090674ca00b009b294a80df5mr12232611ejl.35.1696321870319; Tue, 03 Oct 2023 01:31:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEK5ocTogznjUcIcfCewj+5asU7+eNkif6eojK06Ls3wBc/c3PyBsADazKtHHdtMEl4MXTOVw== X-Received: by 2002:a17:906:74ca:b0:9b2:94a8:df5 with SMTP id z10-20020a17090674ca00b009b294a80df5mr12232599ejl.35.1696321870084; Tue, 03 Oct 2023 01:31:10 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id a11-20020a170906468b00b00997cce73cc7sm659455ejr.29.2023.10.03.01.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Martin Kletzander Subject: [PULL 13/24] audio: Require AudioState in AUD_add_capture Date: Tue, 3 Oct 2023 10:30:30 +0200 Message-ID: <20231003083042.110065-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Martin Kletzander Since all callers require a valid audiodev this function can now safely abort in case of missing AudioState. Signed-off-by: Martin Kletzander Message-ID: Signed-off-by: Paolo Bonzini --- audio/audio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 2f479657117..d4387cb3e21 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1876,10 +1876,8 @@ CaptureVoiceOut *AUD_add_capture( struct capture_callback *cb; if (!s) { - if (!legacy_config) { - dolog("Capturing without setting an audiodev is deprecated\n"); - } - s = audio_init(NULL, NULL); + error_report("Capturing without setting an audiodev is not supported"); + abort(); } if (!audio_get_pdo_out(s->dev)->mixing_engine) { From patchwork Tue Oct 3 08:30:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OMPY8fMJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B4q5pkfz1yph for ; Tue, 3 Oct 2023 19:36:43 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaof-0003MF-RV; Tue, 03 Oct 2023 04:31:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoL-0002N3-Mb for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoJ-0000Jl-B1 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V5eiff4FcfKrQOYI6I9AbyytH3v867cRXYjZGJRwl2U=; b=OMPY8fMJeYG6w0LSNr4uQz97cwhp6hUKOGfq++qj1pcTxnD5TGHyw6AF66deuSXYR2ooYs cstm2LZNsesc4uELOuChRWf5626/+b/yfnGBdRSO4PK02j1y1ihtP6Kd4ls8hG8Q+nYhxH KcD7+BRVHPNg4rq85c1gCP8cvsg/fNs= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-jh2XtUeeMhS1_6IBzzeM6w-1; Tue, 03 Oct 2023 04:31:14 -0400 X-MC-Unique: jh2XtUeeMhS1_6IBzzeM6w-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5342c8a70a8so503555a12.1 for ; Tue, 03 Oct 2023 01:31:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321872; x=1696926672; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V5eiff4FcfKrQOYI6I9AbyytH3v867cRXYjZGJRwl2U=; b=wVqFI760gBMrFvzRdJuGEqrHiKePKbsqewMp7WZcLZCg+9ch8wb9HaAw0kaomzr0LY KyFnZ/BESp0c3Av1fuA1LgVui+fscPiSw76t8888Quq3H5qwVaQ4gQeo35OX5QDxDvtC gC5tgFgT+d8Fh88xKcfyAtEeSz+DWjc3Ywen5sQHCOgGjrtlAEBwuK/jGBikoGi5Ce1G BJ2lZ0LERlJTayfogUzXFGRRUuQFCuEr5rw3nt4o5ZZulE/4U4ZCds0fl/rmzHUF+fdR sAT2QCO5VvtsFbK2sx8mhMgKJbkYmRfyOEFpsiHVjkB2cwmthgHuFzOlW5AHdCo/dLNe Up/g== X-Gm-Message-State: AOJu0Yx4HJqnsHtJ6AHFEy7vYpk/m6hmivNnGs34DnE7R2a9VOmN9Qlq u7BMdphb1QIXbFta6FGM9OPchFoti1Jlgp2g6ugPNKoZj2Lkej33iruRv2CFMykZ6cNs1ib9Sbk 0/2jzC8yCcY0BJ7qOsQCA4ZStVtnQJPB/viX6oOS1C8VsU32maOILWK8I8Y0B9M2r2j3BWZV3im s= X-Received: by 2002:a05:6402:6d4:b0:52c:92e3:1d12 with SMTP id n20-20020a05640206d400b0052c92e31d12mr13397240edy.11.1696321872269; Tue, 03 Oct 2023 01:31:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8l2K/G7Bf8myBbKfjmhwTWNKCKO1LESMDevjBPMgKyfdd3I7av6d3sNOmtJaT0E9IU+WeHw== X-Received: by 2002:a05:6402:6d4:b0:52c:92e3:1d12 with SMTP id n20-20020a05640206d400b0052c92e31d12mr13397213edy.11.1696321871893; Tue, 03 Oct 2023 01:31:11 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id g22-20020aa7c596000000b00536246d1eadsm486350edq.41.2023.10.03.01.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= Subject: [PULL 14/24] audio: allow returning an error from the driver init Date: Tue, 3 Oct 2023 10:30:31 +0200 Message-ID: <20231003083042.110065-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org An error is already printed by audio_driver_init, but we can make it more precise if the driver can return an Error *. Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- audio/alsaaudio.c | 2 +- audio/audio.c | 13 ++++++++++--- audio/audio_int.h | 2 +- audio/coreaudio.m | 2 +- audio/dbusaudio.c | 2 +- audio/dsoundaudio.c | 2 +- audio/jackaudio.c | 2 +- audio/noaudio.c | 2 +- audio/ossaudio.c | 11 ++++++++--- audio/paaudio.c | 7 +++++-- audio/pwaudio.c | 16 +++++++++------- audio/sdlaudio.c | 5 +++-- audio/sndioaudio.c | 2 +- audio/spiceaudio.c | 5 ++++- audio/wavaudio.c | 2 +- 15 files changed, 48 insertions(+), 27 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 057571dd1e0..6fb78e5b972 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -904,7 +904,7 @@ static void alsa_init_per_direction(AudiodevAlsaPerDirectionOptions *apdo) } } -static void *alsa_audio_init(Audiodev *dev) +static void *alsa_audio_init(Audiodev *dev, Error **errp) { AudiodevAlsaOptions *aopts; assert(dev->driver == AUDIODEV_DRIVER_ALSA); diff --git a/audio/audio.c b/audio/audio.c index d4387cb3e21..fdc34a77520 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -33,6 +33,7 @@ #include "qapi/qapi-visit-audio.h" #include "qapi/qapi-commands-audio.h" #include "qemu/cutils.h" +#include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/module.h" #include "qemu/help_option.h" @@ -1555,7 +1556,9 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size) static int audio_driver_init(AudioState *s, struct audio_driver *drv, bool msg, Audiodev *dev) { - s->drv_opaque = drv->init(dev); + Error *local_err = NULL; + + s->drv_opaque = drv->init(dev, &local_err); if (s->drv_opaque) { if (!drv->pcm_ops->get_buffer_in) { @@ -1572,8 +1575,12 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv, s->drv = drv; return 0; } else { - if (msg) { - dolog("Could not init `%s' audio driver\n", drv->name); + if (!msg) { + error_free(local_err); + } else if (local_err) { + error_report_err(local_err); + } else { + error_report("Could not init `%s' audio driver", drv->name); } return -1; } diff --git a/audio/audio_int.h b/audio/audio_int.h index e57ff50155a..06e815de9f6 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -140,7 +140,7 @@ typedef struct audio_driver audio_driver; struct audio_driver { const char *name; const char *descr; - void *(*init) (Audiodev *); + void *(*init) (Audiodev *, Error **); void (*fini) (void *); #ifdef CONFIG_GIO void (*set_dbus_server) (AudioState *s, GDBusObjectManagerServer *manager, bool p2p); diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 4695291621a..7cfb38fb6ae 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -644,7 +644,7 @@ static void coreaudio_enable_out(HWVoiceOut *hw, bool enable) update_device_playback_state(core); } -static void *coreaudio_audio_init(Audiodev *dev) +static void *coreaudio_audio_init(Audiodev *dev, Error **errp) { return dev; } diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 7a11fbfb420..310ca997ff4 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -395,7 +395,7 @@ dbus_enable_in(HWVoiceIn *hw, bool enable) } static void * -dbus_audio_init(Audiodev *dev) +dbus_audio_init(Audiodev *dev, Error **errp) { DBusAudio *da = g_new0(DBusAudio, 1); diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index 3fb67ec3eed..eefde88edcb 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -619,7 +619,7 @@ static void dsound_audio_fini (void *opaque) g_free(s); } -static void *dsound_audio_init(Audiodev *dev) +static void *dsound_audio_init(Audiodev *dev, Error **errp) { int err; HRESULT hr; diff --git a/audio/jackaudio.c b/audio/jackaudio.c index e1eaa3477dc..823e7d96bae 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -645,7 +645,7 @@ static int qjack_thread_creator(jack_native_thread_t *thread, } #endif -static void *qjack_init(Audiodev *dev) +static void *qjack_init(Audiodev *dev, Error **errp) { assert(dev->driver == AUDIODEV_DRIVER_JACK); return dev; diff --git a/audio/noaudio.c b/audio/noaudio.c index 4fdee5adecf..a36bfeffd14 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -104,7 +104,7 @@ static void no_enable_in(HWVoiceIn *hw, bool enable) } } -static void *no_audio_init(Audiodev *dev) +static void *no_audio_init(Audiodev *dev, Error **errp) { return &no_audio_init; } diff --git a/audio/ossaudio.c b/audio/ossaudio.c index e8d732b612c..ec4448d573d 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -28,6 +28,7 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/host-utils.h" +#include "qapi/error.h" #include "audio.h" #include "trace.h" @@ -736,7 +737,7 @@ static void oss_init_per_direction(AudiodevOssPerDirectionOptions *opdo) } } -static void *oss_audio_init(Audiodev *dev) +static void *oss_audio_init(Audiodev *dev, Error **errp) { AudiodevOssOptions *oopts; assert(dev->driver == AUDIODEV_DRIVER_OSS); @@ -745,8 +746,12 @@ static void *oss_audio_init(Audiodev *dev) oss_init_per_direction(oopts->in); oss_init_per_direction(oopts->out); - if (access(oopts->in->dev ?: "/dev/dsp", R_OK | W_OK) < 0 || - access(oopts->out->dev ?: "/dev/dsp", R_OK | W_OK) < 0) { + if (access(oopts->in->dev ?: "/dev/dsp", R_OK | W_OK) < 0) { + error_setg_errno(errp, errno, "%s not accessible", oopts->in->dev ?: "/dev/dsp"); + return NULL; + } + if (access(oopts->out->dev ?: "/dev/dsp", R_OK | W_OK) < 0) { + error_setg_errno(errp, errno, "%s not accessible", oopts->out->dev ?: "/dev/dsp"); return NULL; } return dev; diff --git a/audio/paaudio.c b/audio/paaudio.c index 529b39daacc..39bd6cfa38a 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -3,7 +3,7 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "audio.h" -#include "qapi/opts-visitor.h" +#include "qapi/error.h" #include @@ -818,7 +818,7 @@ fail: return NULL; } -static void *qpa_audio_init(Audiodev *dev) +static void *qpa_audio_init(Audiodev *dev, Error **errp) { paaudio *g; AudiodevPaOptions *popts = &dev->u.pa; @@ -834,10 +834,12 @@ static void *qpa_audio_init(Audiodev *dev) runtime = getenv("XDG_RUNTIME_DIR"); if (!runtime) { + error_setg(errp, "XDG_RUNTIME_DIR not set"); return NULL; } snprintf(pidfile, sizeof(pidfile), "%s/pulse/pid", runtime); if (stat(pidfile, &st) != 0) { + error_setg_errno(errp, errno, "could not stat pidfile %s", pidfile); return NULL; } } @@ -867,6 +869,7 @@ static void *qpa_audio_init(Audiodev *dev) } if (!g->conn) { g_free(g); + error_setg(errp, "could not connect to PulseAudio server"); return NULL; } diff --git a/audio/pwaudio.c b/audio/pwaudio.c index b6a38738ee9..1020cb11df1 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -13,6 +13,7 @@ #include "audio.h" #include #include "qemu/error-report.h" +#include "qapi/error.h" #include #include #include @@ -736,7 +737,7 @@ static const struct pw_core_events core_events = { }; static void * -qpw_audio_init(Audiodev *dev) +qpw_audio_init(Audiodev *dev, Error **errp) { g_autofree pwaudio *pw = g_new0(pwaudio, 1); @@ -748,19 +749,19 @@ qpw_audio_init(Audiodev *dev) pw->dev = dev; pw->thread_loop = pw_thread_loop_new("PipeWire thread loop", NULL); if (pw->thread_loop == NULL) { - error_report("Could not create PipeWire loop: %s", g_strerror(errno)); + error_setg_errno(errp, errno, "Could not create PipeWire loop"); goto fail; } pw->context = pw_context_new(pw_thread_loop_get_loop(pw->thread_loop), NULL, 0); if (pw->context == NULL) { - error_report("Could not create PipeWire context: %s", g_strerror(errno)); + error_setg_errno(errp, errno, "Could not create PipeWire context"); goto fail; } if (pw_thread_loop_start(pw->thread_loop) < 0) { - error_report("Could not start PipeWire loop: %s", g_strerror(errno)); + error_setg_errno(errp, errno, "Could not start PipeWire loop"); goto fail; } @@ -769,13 +770,13 @@ qpw_audio_init(Audiodev *dev) pw->core = pw_context_connect(pw->context, NULL, 0); if (pw->core == NULL) { pw_thread_loop_unlock(pw->thread_loop); - goto fail; + goto fail_error; } if (pw_core_add_listener(pw->core, &pw->core_listener, &core_events, pw) < 0) { pw_thread_loop_unlock(pw->thread_loop); - goto fail; + goto fail_error; } if (wait_resync(pw) < 0) { pw_thread_loop_unlock(pw->thread_loop); @@ -785,8 +786,9 @@ qpw_audio_init(Audiodev *dev) return g_steal_pointer(&pw); +fail_error: + error_setg(errp, "Failed to initialize PW context"); fail: - AUD_log(AUDIO_CAP, "Failed to initialize PW context"); if (pw->thread_loop) { pw_thread_loop_stop(pw->thread_loop); } diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 68a237b76b4..4d8473d9ece 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -26,6 +26,7 @@ #include #include #include "qemu/module.h" +#include "qapi/error.h" #include "audio.h" #ifndef _WIN32 @@ -449,10 +450,10 @@ static void sdl_enable_in(HWVoiceIn *hw, bool enable) SDL_PauseAudioDevice(sdl->devid, !enable); } -static void *sdl_audio_init(Audiodev *dev) +static void *sdl_audio_init(Audiodev *dev, Error **errp) { if (SDL_InitSubSystem (SDL_INIT_AUDIO)) { - sdl_logerr ("SDL failed to initialize audio subsystem\n"); + error_setg(errp, "SDL failed to initialize audio subsystem"); return NULL; } diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 3fde01fdbd5..1e35925a497 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -518,7 +518,7 @@ static void sndio_fini_in(HWVoiceIn *hw) sndio_fini(self); } -static void *sndio_audio_init(Audiodev *dev) +static void *sndio_audio_init(Audiodev *dev, Error **errp) { assert(dev->driver == AUDIODEV_DRIVER_SNDIO); return dev; diff --git a/audio/spiceaudio.c b/audio/spiceaudio.c index d17ef1a25ef..7f02f7285cf 100644 --- a/audio/spiceaudio.c +++ b/audio/spiceaudio.c @@ -22,6 +22,7 @@ #include "qemu/module.h" #include "qemu/error-report.h" #include "qemu/timer.h" +#include "qapi/error.h" #include "ui/qemu-spice.h" #define AUDIO_CAP "spice" @@ -71,11 +72,13 @@ static const SpiceRecordInterface record_sif = { .base.minor_version = SPICE_INTERFACE_RECORD_MINOR, }; -static void *spice_audio_init(Audiodev *dev) +static void *spice_audio_init(Audiodev *dev, Error **errp) { if (!using_spice) { + error_setg(errp, "Cannot use spice audio without -spice"); return NULL; } + return &spice_audio_init; } diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 6445a2cb90c..26b03906d59 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -182,7 +182,7 @@ static void wav_enable_out(HWVoiceOut *hw, bool enable) } } -static void *wav_audio_init(Audiodev *dev) +static void *wav_audio_init(Audiodev *dev, Error **errp) { assert(dev->driver == AUDIODEV_DRIVER_WAV); return dev; From patchwork Tue Oct 3 08:30:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842499 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Gw9ZMdsc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S09z92rDpz1yng for ; Tue, 3 Oct 2023 19:31:49 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoZ-0002zT-37; Tue, 03 Oct 2023 04:31:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoL-0002N5-S5 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoJ-0000Jv-CR for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w6ECQLPbNpe6+9u+YwbeHCePsExVXlSR1Ai6vZUxTVc=; b=Gw9ZMdscsaxsxqc1jfTGCSfB5jIld6wJAVn5W73MmIhFE6VCNIcSZcC2/Ip17yvxWms9pz nF2SLmwg6F3lmnCnnSyr80luxsQdzTlqXTTQIAB2xqmtE9XU9EcQkSDAEaYZXrsKk79RLp XiTbiK8g2aPgrKHMWhh6sY+KqKSK8vY= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-mpvE70A9MXCraVynKKsdyQ-1; Tue, 03 Oct 2023 04:31:16 -0400 X-MC-Unique: mpvE70A9MXCraVynKKsdyQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9a681c3470fso54399566b.1 for ; Tue, 03 Oct 2023 01:31:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321875; x=1696926675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w6ECQLPbNpe6+9u+YwbeHCePsExVXlSR1Ai6vZUxTVc=; b=sqdFIFPb/PIXbYwnwTVLijZzokPBDAADph4n8rKjVRD6uKG3eGZF1LFrWoW0XUDEFb Z5RHMVPBXiXdbEWy/OS1LAzyTm20tuxlV6OHhSuty4GNWvmlOkZ3FRlNNe+SmKaq6IBd 8ZcldGP/BpYGhxUzbXj3h/F6pgjR7FpqP9ZQqtZah2fumSKBOIvonZKFK5cDFAYyBVIK GxhGAgv2Xm/mKjiTFIjQ+Thzd37pMXCq676sMEG6yhLMUx7mS0HaHa9+oa9buWk58t6E +yTwuc+fK60OoQq0YRj8vQ/suco+OOS+i9hEt+clxo5LG8KoM/tqMswcDUur/h8rA5e5 uj0A== X-Gm-Message-State: AOJu0YzzMsWRnnBHZuANVJbh1PR9jNEi0wf3JhivaOnBBHc20sukXdue WHTnzy/tiYtcyM95A+1CCFeMIdjgC8hrFNs7dIfO55h3Q/OCUp7WXSUWs6hPvboPig8lFnc3u5u HStEBj8USfYaTBioy6KdOmjuIACB4WMnSR6LDOVVeFwKhjxj8vYKHt/U6jpQiB4vi0UDs1uCIAY Q= X-Received: by 2002:a17:906:cc15:b0:9b7:1e26:e2de with SMTP id ml21-20020a170906cc1500b009b71e26e2demr255554ejb.21.1696321874853; Tue, 03 Oct 2023 01:31:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFD6tc8Df9dT1RqVaUjjEKk1V35ONoWfp4nJuQjMU37Kz1NZSUa/gVFwBZF5ycQ2xKh4JpkEg== X-Received: by 2002:a17:906:cc15:b0:9b7:1e26:e2de with SMTP id ml21-20020a170906cc1500b009b71e26e2demr255542ejb.21.1696321874521; Tue, 03 Oct 2023 01:31:14 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id h22-20020a17090619d600b009ad8796a6aesm652007ejd.56.2023.10.03.01.31.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 15/24] audio: return Error ** from audio_state_by_name Date: Tue, 3 Oct 2023 10:30:32 +0200 Message-ID: <20231003083042.110065-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Remove duplicate error formatting code. Signed-off-by: Paolo Bonzini --- audio/audio-hmp-cmds.c | 6 ++++-- audio/audio.c | 3 ++- audio/audio.h | 2 +- hw/core/qdev-properties-system.c | 16 ++++------------ ui/dbus.c | 3 +-- ui/vnc.c | 3 +-- 6 files changed, 13 insertions(+), 20 deletions(-) diff --git a/audio/audio-hmp-cmds.c b/audio/audio-hmp-cmds.c index 1237ce9e750..c9608b715b8 100644 --- a/audio/audio-hmp-cmds.c +++ b/audio/audio-hmp-cmds.c @@ -26,6 +26,7 @@ #include "audio/audio.h" #include "monitor/hmp.h" #include "monitor/monitor.h" +#include "qapi/error.h" #include "qapi/qmp/qdict.h" static QLIST_HEAD (capture_list_head, CaptureState) capture_head; @@ -65,10 +66,11 @@ void hmp_wavcapture(Monitor *mon, const QDict *qdict) int nchannels = qdict_get_try_int(qdict, "nchannels", 2); const char *audiodev = qdict_get_str(qdict, "audiodev"); CaptureState *s; - AudioState *as = audio_state_by_name(audiodev); + Error *local_err = NULL; + AudioState *as = audio_state_by_name(audiodev, &local_err); if (!as) { - monitor_printf(mon, "Audiodev '%s' not found\n", audiodev); + error_report_err(local_err); return; } diff --git a/audio/audio.c b/audio/audio.c index fdc34a77520..874a4c3c412 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -2260,7 +2260,7 @@ int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo, audioformat_bytes_per_sample(as->fmt); } -AudioState *audio_state_by_name(const char *name) +AudioState *audio_state_by_name(const char *name, Error **errp) { AudioState *s; QTAILQ_FOREACH(s, &audio_states, list) { @@ -2269,6 +2269,7 @@ AudioState *audio_state_by_name(const char *name) return s; } } + error_setg(errp, "audiodev '%s' not found", name); return NULL; } diff --git a/audio/audio.h b/audio/audio.h index 01bdc567fb1..e0c13b5dcdf 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -174,7 +174,7 @@ bool audio_init_audiodevs(void); void audio_help(void); void audio_legacy_help(void); -AudioState *audio_state_by_name(const char *name); +AudioState *audio_state_by_name(const char *name, Error **errp); const char *audio_get_id(QEMUSoundCard *card); #define DEFINE_AUDIO_PROPERTIES(_s, _f) \ diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index 41b7e682c78..688340610ec 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -480,24 +480,16 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name, Property *prop = opaque; QEMUSoundCard *card = object_field_prop_ptr(obj, prop); AudioState *state; - int err = 0; - char *str; + g_autofree char *str = NULL; if (!visit_type_str(v, name, &str, errp)) { return; } - state = audio_state_by_name(str); - - if (!state) { - err = -ENOENT; - goto out; + state = audio_state_by_name(str, errp); + if (state) { + card->state = state; } - card->state = state; - -out: - error_set_from_qdev_prop_error(errp, err, obj, name, str); - g_free(str); } const PropertyInfo qdev_prop_audiodev = { diff --git a/ui/dbus.c b/ui/dbus.c index 32f1bbe81ae..866467ad2e3 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -220,9 +220,8 @@ dbus_display_complete(UserCreatable *uc, Error **errp) } if (dd->audiodev && *dd->audiodev) { - AudioState *audio_state = audio_state_by_name(dd->audiodev); + AudioState *audio_state = audio_state_by_name(dd->audiodev, errp); if (!audio_state) { - error_setg(errp, "Audiodev '%s' not found", dd->audiodev); return; } if (!g_str_equal(audio_state->drv->name, "dbus")) { diff --git a/ui/vnc.c b/ui/vnc.c index acb56461b2d..82929469130 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -4181,9 +4181,8 @@ void vnc_display_open(const char *id, Error **errp) audiodev = qemu_opt_get(opts, "audiodev"); if (audiodev) { - vd->audio_state = audio_state_by_name(audiodev); + vd->audio_state = audio_state_by_name(audiodev, errp); if (!vd->audio_state) { - error_setg(errp, "Audiodev '%s' not found", audiodev); goto fail; } } From patchwork Tue Oct 3 08:30:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842510 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=WzfvrQ2B; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B2K5Hv4z1yng for ; Tue, 3 Oct 2023 19:34:33 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoY-0002ys-Un; Tue, 03 Oct 2023 04:31:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoM-0002NB-5S for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoK-0000KI-6m for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321879; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rj1HXspE/zOGUd94i7jDR1pjjXabvJvCmfMOVXSmfDY=; b=WzfvrQ2Blt+as8NcMPTTrKG8X6yw37OCzZrMP5CLLbrdPZH2NAke96zzNxhOtwmnY66wF7 quFjDh67o6dic0oDEMyDWSYQJ+D/Beh9R4ytp9xnuAALPeoD0AYlnyo1Ji2a2FnwnPPPWU 2Zz65rTpMF32qiuyCQ3bLlYpghYI+Cs= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-371UMGJgN8Wv9ycDjsrYHA-1; Tue, 03 Oct 2023 04:31:18 -0400 X-MC-Unique: 371UMGJgN8Wv9ycDjsrYHA-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9ae42088b4bso49466066b.3 for ; Tue, 03 Oct 2023 01:31:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321877; x=1696926677; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rj1HXspE/zOGUd94i7jDR1pjjXabvJvCmfMOVXSmfDY=; b=a8sGtTIaHt+TWXwUAbDY7lJTpxVZqfUL5pXuAM+rq3ao1geTUG8UqaTebJJbcpzzC4 pDHHkaiT1voU765XlvPvlU67u/eg4jyZonUuEgQZL42O59oohasxw2wIAPgswmkSt9t4 2KFrrMF0xySj4mSPR8bxpupwDvZQRe4qK2P7idRz5CSgemoKzZR/yv1wBQW0TIItBD6U lMzdehSG2Tt+HDWeIRK5bPnonyBt8/NW0CxuUEg5H/mroRZZCx3Fbm1hh/NvUDGtbTNP 4mfbUx4ZwLxC0qWXYhMAQenDfp0NhOQ2ppgVcpyrSQDGE7rF3/aahBFJ1DBlLnBkwPXu JGgw== X-Gm-Message-State: AOJu0Yy6nsgweIvWBcf3DgDGmiwwjP7uJbHMwt4UQNNv/AsFFIJO4kBy y94l+aYQ7pYsquUn8gWfQ+G+8i0WQg4pgCiFz2bIXo9+FgKK64f2QSthMfRsR6iXBzqriiAA1Ff 0cWKzcNqEGuUCrX07xPnko8hj8eEMHKQJlsQhNL+bzWtxVR4Dx7zxgtzf4PKNwchhldI0FxTme8 k= X-Received: by 2002:a17:906:150:b0:9ae:7081:4018 with SMTP id 16-20020a170906015000b009ae70814018mr12632209ejh.33.1696321876774; Tue, 03 Oct 2023 01:31:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnI937F4aLi8AVxX7YM5OYZFQsIGMFDJDV07qIgt55PVm/PN5n7SyMChT46SAHlwuy3RS/hQ== X-Received: by 2002:a17:906:150:b0:9ae:7081:4018 with SMTP id 16-20020a170906015000b009ae70814018mr12632194ejh.33.1696321876405; Tue, 03 Oct 2023 01:31:16 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id b25-20020a170906195900b0099cc3c7ace2sm670105eje.140.2023.10.03.01.31.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 16/24] audio: commonize voice initialization Date: Tue, 3 Oct 2023 10:30:33 +0200 Message-ID: <20231003083042.110065-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Move some mostly irrelevant code out of audio_init. Signed-off-by: Paolo Bonzini --- audio/audio.c | 19 ++----------------- audio/audio_template.h | 9 ++++++++- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 874a4c3c412..bb1734a95d3 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1570,8 +1570,8 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv, drv->pcm_ops->put_buffer_out = audio_generic_put_buffer_out; } - audio_init_nb_voices_out(s, drv); - audio_init_nb_voices_in(s, drv); + audio_init_nb_voices_out(s, drv, 1); + audio_init_nb_voices_in(s, drv, 0); s->drv = drv; return 0; } else { @@ -1774,21 +1774,6 @@ static AudioState *audio_init(Audiodev *dev, const char *name) s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); - s->nb_hw_voices_out = audio_get_pdo_out(dev)->voices; - s->nb_hw_voices_in = audio_get_pdo_in(dev)->voices; - - if (s->nb_hw_voices_out < 1) { - dolog ("Bogus number of playback voices %d, setting to 1\n", - s->nb_hw_voices_out); - s->nb_hw_voices_out = 1; - } - - if (s->nb_hw_voices_in < 0) { - dolog ("Bogus number of capture voices %d, setting to 0\n", - s->nb_hw_voices_in); - s->nb_hw_voices_in = 0; - } - if (drvname) { driver = audio_driver_lookup(drvname); if (driver) { diff --git a/audio/audio_template.h b/audio/audio_template.h index dc0c74aa746..7ccfec01168 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -37,11 +37,12 @@ #endif static void glue(audio_init_nb_voices_, TYPE)(AudioState *s, - struct audio_driver *drv) + struct audio_driver *drv, int min_voices) { int max_voices = glue (drv->max_voices_, TYPE); size_t voice_size = glue(drv->voice_size_, TYPE); + glue (s->nb_hw_voices_, TYPE) = glue(audio_get_pdo_, TYPE)(s->dev)->voices; if (glue (s->nb_hw_voices_, TYPE) > max_voices) { if (!max_voices) { #ifdef DAC @@ -56,6 +57,12 @@ static void glue(audio_init_nb_voices_, TYPE)(AudioState *s, glue (s->nb_hw_voices_, TYPE) = max_voices; } + if (glue (s->nb_hw_voices_, TYPE) < min_voices) { + dolog ("Bogus number of " NAME " voices %d, setting to %d\n", + glue (s->nb_hw_voices_, TYPE), + min_voices); + } + if (audio_bug(__func__, !voice_size && max_voices)) { dolog ("drv=`%s' voice_size=0 max_voices=%d\n", drv->name, max_voices); From patchwork Tue Oct 3 08:30:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZdC5ffjf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B4K45vCz1yph for ; Tue, 3 Oct 2023 19:36:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoY-0002x0-Nt; Tue, 03 Oct 2023 04:31:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoR-0002PN-8m for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoN-0000L0-Iq for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R35GuaxbPqLX8vLeX4uWYvTxQwHT9t6PuBxHCoBtF3I=; b=ZdC5ffjfmynxMGVpkRuYjdWmp9BNVcu56Eq/ZcZVa/mlKVaJ6IS0flU9hc+ktbiaJZaum/ psQ9dpumIVwCHsDnqWCkL83cBxP9rVfkIKwITORdwnpqGyrFe2OSwuLgGuEPlHXPixGALm c1GbjUti64KaZB+jfoYocvu9Ttq2HUU= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-169-3Kc9CkoSOgmtfwTzZFdz5w-1; Tue, 03 Oct 2023 04:31:20 -0400 X-MC-Unique: 3Kc9CkoSOgmtfwTzZFdz5w-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9a9e12a3093so73767866b.0 for ; Tue, 03 Oct 2023 01:31:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321878; x=1696926678; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R35GuaxbPqLX8vLeX4uWYvTxQwHT9t6PuBxHCoBtF3I=; b=UyPnpz0ndzhpXLxGUAa6LY+Zk0RcKB+9XI0+mizYrCSLIzYSCVpbJijDfS/pxBWY7v TZsj0esnf1DZ03MG9NFevjf/kZACjigzJfhzrQ0ynwinb/zHSmqzCUko9GoaXFMispiP mR6gxSIhFKo9/YiIxcFprJdEC30ggJEuiyM3AeObQqKB0/tr/86NmkjnTOfmRe5ggpHc iXlot50neYvD4P1ehHPFSVYUZz3vUE1TvXB0KbfHQjMsYNN7riVD/n4Ix6bZ5Qf/Dmq5 UWDF2eHXDigFqezMVucGh91/T/TuGU0btXvqVtrl+32w9UQ/eYY/o01j5XlFAG0VzjkB dRQQ== X-Gm-Message-State: AOJu0Yzgvq3wwzvJkezWEAJk1lI3E3P6/Z5ZMoHz4bSodeiklYYj4msB NXwalrzuzdPj5N4qR31EzwJL0WHbXTvBz26nhyKytCKjytaLPo2676qvBUWKy8JIxMTCRWkHPjJ 9ItDvWXzE6nnIOX5cM/A/iFfrHafIKWKosH2hoy6w6eM8fUQpVeUOzWj9yy/nrkhRg28olOwYPj M= X-Received: by 2002:a17:906:794a:b0:9ae:50ec:bd81 with SMTP id l10-20020a170906794a00b009ae50ecbd81mr1781977ejo.21.1696321878563; Tue, 03 Oct 2023 01:31:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbGQ+l0Lx37QHRXHC5guISB8gItnYnnryXWdXnuV6tXhOvL8ffxI7f1V/nrIIqIgbY3Bu5wQ== X-Received: by 2002:a17:906:794a:b0:9ae:50ec:bd81 with SMTP id l10-20020a170906794a00b009ae50ecbd81mr1781960ejo.21.1696321878103; Tue, 03 Oct 2023 01:31:18 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id j12-20020a170906474c00b00993a37aebc5sm643226ejs.50.2023.10.03.01.31.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 17/24] audio: simplify flow in audio_init Date: Tue, 3 Oct 2023 10:30:34 +0200 Message-ID: <20231003083042.110065-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Merge two ifs into one. Signed-off-by: Paolo Bonzini --- audio/audio.c | 76 +++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index bb1734a95d3..2e22664daf9 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1707,12 +1707,12 @@ static AudiodevListEntry *audiodev_find( * if dev == NULL => legacy implicit initialization, return the already created * state or create a new one */ -static AudioState *audio_init(Audiodev *dev, const char *name) +static AudioState *audio_init(Audiodev *dev) { static bool atexit_registered; size_t i; int done = 0; - const char *drvname = NULL; + const char *drvname; VMChangeStateEntry *vmse; AudioState *s; struct audio_driver *driver; @@ -1736,17 +1736,32 @@ static AudioState *audio_init(Audiodev *dev, const char *name) } } + s = g_new0(AudioState, 1); + + QLIST_INIT (&s->hw_head_out); + QLIST_INIT (&s->hw_head_in); + QLIST_INIT (&s->cap_head); + if (!atexit_registered) { + atexit(audio_cleanup); + atexit_registered = true; + } + + s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); + if (dev) { /* -audiodev option */ - legacy_config = false; + s->dev = dev; drvname = AudiodevDriver_str(dev->driver); - } else if (!QTAILQ_EMPTY(&audio_states)) { - if (!legacy_config) { - dolog("Device %s: audiodev default parameter is deprecated, please " - "specify audiodev=%s\n", name, - QTAILQ_FIRST(&audio_states)->dev->id); + driver = audio_driver_lookup(drvname); + if (driver) { + done = !audio_driver_init(s, driver, true, dev); + } else { + dolog ("Unknown audio driver `%s'\n", drvname); + } + if (!done) { + free_audio_state(s); + return NULL; } - return QTAILQ_FIRST(&audio_states); } else { /* legacy implicit initialization */ head = audio_handle_legacy_opts(); @@ -1759,33 +1774,7 @@ static AudioState *audio_init(Audiodev *dev, const char *name) */ dev = QSIMPLEQ_FIRST(&head)->dev; audio_validate_opts(dev, &error_abort); - } - s = g_new0(AudioState, 1); - s->dev = dev; - - QLIST_INIT (&s->hw_head_out); - QLIST_INIT (&s->hw_head_in); - QLIST_INIT (&s->cap_head); - if (!atexit_registered) { - atexit(audio_cleanup); - atexit_registered = true; - } - - s->ts = timer_new_ns(QEMU_CLOCK_VIRTUAL, audio_timer, s); - - if (drvname) { - driver = audio_driver_lookup(drvname); - if (driver) { - done = !audio_driver_init(s, driver, true, dev); - } else { - dolog ("Unknown audio driver `%s'\n", drvname); - } - if (!done) { - free_audio_state(s); - return NULL; - } - } else { for (i = 0; audio_prio_list[i]; i++) { AudiodevListEntry *e = audiodev_find(&head, audio_prio_list[i]); driver = audio_driver_lookup(audio_prio_list[i]); @@ -1800,8 +1789,9 @@ static AudioState *audio_init(Audiodev *dev, const char *name) } } } + + audio_free_audiodev_list(&head); } - audio_free_audiodev_list(&head); if (!done) { driver = audio_driver_lookup("none"); @@ -1841,7 +1831,16 @@ void audio_free_audiodev_list(AudiodevListHead *head) void AUD_register_card (const char *name, QEMUSoundCard *card) { if (!card->state) { - card->state = audio_init(NULL, name); + if (!QTAILQ_EMPTY(&audio_states)) { + if (!legacy_config) { + dolog("Device %s: audiodev default parameter is deprecated, please " + "specify audiodev=%s\n", name, + QTAILQ_FIRST(&audio_states)->dev->id); + } + card->state = QTAILQ_FIRST(&audio_states); + } else { + card->state = audio_init(NULL); + } } card->name = g_strdup (name); @@ -2171,6 +2170,7 @@ void audio_define(Audiodev *dev) e = g_new0(AudiodevListEntry, 1); e->dev = dev; QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next); + legacy_config = false; } bool audio_init_audiodevs(void) @@ -2178,7 +2178,7 @@ bool audio_init_audiodevs(void) AudiodevListEntry *e; QSIMPLEQ_FOREACH(e, &audiodevs, next) { - if (!audio_init(e->dev, NULL)) { + if (!audio_init(e->dev)) { return false; } } From patchwork Tue Oct 3 08:30:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ioVGdQPu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B4l6lvwz1yph for ; Tue, 3 Oct 2023 19:36:39 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoy-0003zf-EP; Tue, 03 Oct 2023 04:32:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoZ-00030y-8f for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoU-0000Lu-Pa for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qMkjlTeoksq95wIWU8vWRoYbxGK7J91qieFaZeahS1I=; b=ioVGdQPuzP0iKZ1tsgJepF7zNY8NMsZWbovA4dBMJHWqAucUYasXY6opspPIkj9sxpQmfQ rWVLKRT4/cCAp+fkOxH1rlMN68NIqm4MI/Wmq0i0DbJIlPuQQL11T0qGK6JUoeXT5Jgc2+ 8Iu3MBiXe9glp0MNhJHRENoyL03QqRo= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-351-5PaZF6TWPBeOPoEpTTXPug-1; Tue, 03 Oct 2023 04:31:23 -0400 X-MC-Unique: 5PaZF6TWPBeOPoEpTTXPug-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-537efd62f36so452297a12.2 for ; Tue, 03 Oct 2023 01:31:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321881; x=1696926681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qMkjlTeoksq95wIWU8vWRoYbxGK7J91qieFaZeahS1I=; b=I2F7fdm9QEUKb1kwG1yZZnaNCmDI7MNtghRI5Rn+QtNl8vHtvZudlUDZgjRTqhW/DG BHbSN1UHuNeDoZc6OXKcqZfXiJSfe+Ir4tHQ3vcsuCHBg/pLL3t+MzwyHMMRrhq0F3Vr jzX8oCLTcfcNtJnYtgzQysQy2nUTNcYNEMNeOxC2MMmCDzYTHMv4Da1uoeTEVqu+WDbC 96YpW5FRefYhrxxohcaGg9e+FrUKl6jmVNZ63k+nhK5urJBqX/uOWy4cewvS4XJJC6VU mMqejFlMUnlgjYxAwCV4UH1kZN7L23S+vw1ISHObVqPmBj+WvdYBTSD1xt7xlFezUh2S /J8w== X-Gm-Message-State: AOJu0YxmF+Te1q9xjCZ8IX2UGDZ8kSDRPO8pFQyzUtzV69cRHH9TKp0e MfNSk4exRiXcy0a6AlwGysRdxcrNEXnu43ymf/j0jX+7R6zJU2Eo8DacnPyHYjZA7IYhJmzTYSG 0RIQCmmOF6A+AWAyT/kswxBYZbNsrXDe6145VRJJg3wGTasp4lznEPRhPP3bUliraOysEom68tT g= X-Received: by 2002:a05:6402:12c1:b0:531:1875:bbc8 with SMTP id k1-20020a05640212c100b005311875bbc8mr14129841edx.19.1696321880985; Tue, 03 Oct 2023 01:31:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFt+1wu4Vzo31xrjWlHWlBTPWIHqeLB8nEJuZtR+Jvy6O9rrDjHrSZDLUY/cipCdQhmarlNJw== X-Received: by 2002:a05:6402:12c1:b0:531:1875:bbc8 with SMTP id k1-20020a05640212c100b005311875bbc8mr14129798edx.19.1696321880199; Tue, 03 Oct 2023 01:31:20 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id p3-20020a056402074300b00537666d307csm489472edy.32.2023.10.03.01.31.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 18/24] audio: remove QEMU_AUDIO_* and -audio-help support Date: Tue, 3 Oct 2023 10:30:35 +0200 Message-ID: <20231003083042.110065-19-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org These have been deprecated for a long time, and the introduction of -audio in 7.1.0 has cemented the new way of specifying an audio backend's parameters. However, there is still a need for simple configuration of the audio backend in the desktop case; therefore, if no audiodev is passed to audio_init(), go through a bunch of simple Audiodev* structures and pick the first that can be initialized successfully. The only QEMU_AUDIO_* option that is left in, waiting for a better idea, is QEMU_AUDIO_DRV=none which is used by qtest. Remove all the parsing code, including the concept of "can_be_default" audio drivers: now that audio_prio_list[] is only used in a single place, wav can be excluded directly in that function. Signed-off-by: Paolo Bonzini --- audio/alsaaudio.c | 1 - audio/audio.c | 138 ++++---- audio/audio.h | 1 - audio/audio_int.h | 5 - audio/audio_legacy.c | 591 -------------------------------- audio/coreaudio.m | 1 - audio/dbusaudio.c | 1 - audio/dsoundaudio.c | 1 - audio/jackaudio.c | 1 - audio/meson.build | 1 - audio/noaudio.c | 1 - audio/ossaudio.c | 1 - audio/paaudio.c | 1 - audio/pwaudio.c | 1 - audio/sdlaudio.c | 1 - audio/sndioaudio.c | 1 - audio/wavaudio.c | 1 - docs/about/deprecated.rst | 8 - docs/about/removed-features.rst | 6 + qemu-options.hx | 10 - softmmu/vl.c | 4 - 21 files changed, 65 insertions(+), 711 deletions(-) delete mode 100644 audio/audio_legacy.c diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 6fb78e5b972..cacae1ea59c 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -960,7 +960,6 @@ static struct audio_driver alsa_audio_driver = { .init = alsa_audio_init, .fini = alsa_audio_fini, .pcm_ops = &alsa_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof (ALSAVoiceOut), diff --git a/audio/audio.c b/audio/audio.c index 2e22664daf9..818d79e50f0 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -32,6 +32,7 @@ #include "qapi/qobject-input-visitor.h" #include "qapi/qapi-visit-audio.h" #include "qapi/qapi-commands-audio.h" +#include "qapi/qmp/qdict.h" #include "qemu/cutils.h" #include "qemu/error-report.h" #include "qemu/log.h" @@ -62,19 +63,22 @@ const char *audio_prio_list[] = { "spice", CONFIG_AUDIO_DRIVERS "none", - "wav", NULL }; static QLIST_HEAD(, audio_driver) audio_drivers; -static AudiodevListHead audiodevs = QSIMPLEQ_HEAD_INITIALIZER(audiodevs); +static AudiodevListHead audiodevs = + QSIMPLEQ_HEAD_INITIALIZER(audiodevs); +static AudiodevListHead default_audiodevs = + QSIMPLEQ_HEAD_INITIALIZER(default_audiodevs); + void audio_driver_register(audio_driver *drv) { QLIST_INSERT_HEAD(&audio_drivers, drv, next); } -audio_driver *audio_driver_lookup(const char *name) +static audio_driver *audio_driver_lookup(const char *name) { struct audio_driver *d; Error *local_err = NULL; @@ -112,8 +116,6 @@ const struct mixeng_volume nominal_volume = { #endif }; -static bool legacy_config = true; - int audio_bug (const char *funcname, int cond) { if (cond) { @@ -1688,17 +1690,41 @@ static const VMStateDescription vmstate_audio = { static void audio_validate_opts(Audiodev *dev, Error **errp); -static AudiodevListEntry *audiodev_find( - AudiodevListHead *head, const char *drvname) +static void audio_create_default_audiodevs(void) { - AudiodevListEntry *e; - QSIMPLEQ_FOREACH(e, head, next) { - if (strcmp(AudiodevDriver_str(e->dev->driver), drvname) == 0) { - return e; - } + const char *drvname = getenv("QEMU_AUDIO_DRV"); + + /* QEMU_AUDIO_DRV=none is used by libqtest. */ + if (drvname && !g_str_equal(drvname, "none")) { + error_report("Please use -audiodev instead of QEMU_AUDIO_*"); + exit(1); } - return NULL; + for (int i = 0; audio_prio_list[i]; i++) { + if (drvname && !g_str_equal(drvname, audio_prio_list[i])) { + continue; + } + + if (audio_driver_lookup(audio_prio_list[i])) { + QDict *dict = qdict_new(); + Audiodev *dev = NULL; + AudiodevListEntry *e; + Visitor *v; + + qdict_put_str(dict, "driver", audio_prio_list[i]); + qdict_put_str(dict, "id", "#default"); + + v = qobject_input_visitor_new_keyval(QOBJECT(dict)); + qobject_unref(dict); + visit_type_Audiodev(v, NULL, &dev, &error_fatal); + visit_free(v); + + audio_validate_opts(dev, &error_abort); + e = g_new0(AudiodevListEntry, 1); + e->dev = dev; + QSIMPLEQ_INSERT_TAIL(&default_audiodevs, e, next); + } + } } /* @@ -1710,31 +1736,11 @@ static AudiodevListEntry *audiodev_find( static AudioState *audio_init(Audiodev *dev) { static bool atexit_registered; - size_t i; int done = 0; const char *drvname; VMChangeStateEntry *vmse; AudioState *s; struct audio_driver *driver; - /* silence gcc warning about uninitialized variable */ - AudiodevListHead head = QSIMPLEQ_HEAD_INITIALIZER(head); - - if (using_spice) { - /* - * When using spice allow the spice audio driver being picked - * as default. - * - * Temporary hack. Using audio devices without explicit - * audiodev= property is already deprecated. Same goes for - * the -soundhw switch. Once this support gets finally - * removed we can also drop the concept of a default audio - * backend and this can go away. - */ - driver = audio_driver_lookup("spice"); - if (driver) { - driver->can_be_default = 1; - } - } s = g_new0(AudioState, 1); @@ -1759,45 +1765,23 @@ static AudioState *audio_init(Audiodev *dev) dolog ("Unknown audio driver `%s'\n", drvname); } if (!done) { - free_audio_state(s); - return NULL; + goto out; } } else { - /* legacy implicit initialization */ - head = audio_handle_legacy_opts(); - /* - * In case of legacy initialization, all Audiodevs in the list will have - * the same configuration (except the driver), so it doesn't matter which - * one we chose. We need an Audiodev to set up AudioState before we can - * init a driver. Also note that dev at this point is still in the - * list. - */ - dev = QSIMPLEQ_FIRST(&head)->dev; - audio_validate_opts(dev, &error_abort); - - for (i = 0; audio_prio_list[i]; i++) { - AudiodevListEntry *e = audiodev_find(&head, audio_prio_list[i]); - driver = audio_driver_lookup(audio_prio_list[i]); - - if (e && driver) { - s->dev = dev = e->dev; - audio_validate_opts(dev, &error_abort); - done = !audio_driver_init(s, driver, false, dev); - if (done) { - e->dev = NULL; - break; - } + for (;;) { + AudiodevListEntry *e = QSIMPLEQ_FIRST(&default_audiodevs); + if (!e) { + dolog("no default audio driver available\n"); + goto out; } + s->dev = dev = e->dev; + drvname = AudiodevDriver_str(dev->driver); + driver = audio_driver_lookup(drvname); + if (!audio_driver_init(s, driver, false, dev)) { + break; + } + QSIMPLEQ_REMOVE_HEAD(&default_audiodevs, next); } - - audio_free_audiodev_list(&head); - } - - if (!done) { - driver = audio_driver_lookup("none"); - done = !audio_driver_init(s, driver, false, dev); - assert(done); - dolog("warning: Using timer based audio emulation\n"); } if (dev->timer_period <= 0) { @@ -1816,29 +1800,26 @@ static AudioState *audio_init(Audiodev *dev) QLIST_INIT (&s->card_head); vmstate_register (NULL, 0, &vmstate_audio, s); return s; -} -void audio_free_audiodev_list(AudiodevListHead *head) -{ - AudiodevListEntry *e; - while ((e = QSIMPLEQ_FIRST(head))) { - QSIMPLEQ_REMOVE_HEAD(head, next); - qapi_free_Audiodev(e->dev); - g_free(e); - } +out: + free_audio_state(s); + return NULL; } void AUD_register_card (const char *name, QEMUSoundCard *card) { if (!card->state) { if (!QTAILQ_EMPTY(&audio_states)) { - if (!legacy_config) { + if (QSIMPLEQ_EMPTY(&default_audiodevs)) { dolog("Device %s: audiodev default parameter is deprecated, please " "specify audiodev=%s\n", name, QTAILQ_FIRST(&audio_states)->dev->id); } card->state = QTAILQ_FIRST(&audio_states); } else { + if (QSIMPLEQ_EMPTY(&default_audiodevs)) { + audio_create_default_audiodevs(); + } card->state = audio_init(NULL); } } @@ -2170,7 +2151,6 @@ void audio_define(Audiodev *dev) e = g_new0(AudiodevListEntry, 1); e->dev = dev; QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next); - legacy_config = false; } bool audio_init_audiodevs(void) diff --git a/audio/audio.h b/audio/audio.h index e0c13b5dcdf..34df8962a66 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -172,7 +172,6 @@ void audio_define(Audiodev *audio); void audio_parse_option(const char *opt); bool audio_init_audiodevs(void); void audio_help(void); -void audio_legacy_help(void); AudioState *audio_state_by_name(const char *name, Error **errp); const char *audio_get_id(QEMUSoundCard *card); diff --git a/audio/audio_int.h b/audio/audio_int.h index 06e815de9f6..2d079d00a25 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -146,7 +146,6 @@ struct audio_driver { void (*set_dbus_server) (AudioState *s, GDBusObjectManagerServer *manager, bool p2p); #endif struct audio_pcm_ops *pcm_ops; - int can_be_default; int max_voices_out; int max_voices_in; size_t voice_size_out; @@ -243,7 +242,6 @@ extern const struct mixeng_volume nominal_volume; extern const char *audio_prio_list[]; void audio_driver_register(audio_driver *drv); -audio_driver *audio_driver_lookup(const char *name); void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as); void audio_pcm_info_clear_buf (struct audio_pcm_info *info, void *buf, int len); @@ -297,9 +295,6 @@ typedef struct AudiodevListEntry { } AudiodevListEntry; typedef QSIMPLEQ_HEAD(, AudiodevListEntry) AudiodevListHead; -AudiodevListHead audio_handle_legacy_opts(void); - -void audio_free_audiodev_list(AudiodevListHead *head); void audio_create_pdos(Audiodev *dev); AudiodevPerDirectionOptions *audio_get_pdo_in(Audiodev *dev); diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c deleted file mode 100644 index dc72ba55e9a..00000000000 --- a/audio/audio_legacy.c +++ /dev/null @@ -1,591 +0,0 @@ -/* - * QEMU Audio subsystem: legacy configuration handling - * - * Copyright (c) 2015-2019 Zoltán Kővágó - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -#include "qemu/osdep.h" -#include "audio.h" -#include "audio_int.h" -#include "qemu/cutils.h" -#include "qemu/timer.h" -#include "qapi/error.h" -#include "qapi/qapi-visit-audio.h" -#include "qapi/visitor-impl.h" - -#define AUDIO_CAP "audio-legacy" -#include "audio_int.h" - -static uint32_t toui32(const char *str) -{ - uint64_t ret; - if (parse_uint_full(str, 10, &ret) || ret > UINT32_MAX) { - dolog("Invalid integer value `%s'\n", str); - exit(1); - } - return ret; -} - -/* helper functions to convert env variables */ -static void get_bool(const char *env, bool *dst, bool *has_dst) -{ - const char *val = getenv(env); - if (val) { - *dst = toui32(val) != 0; - *has_dst = true; - } -} - -static void get_int(const char *env, uint32_t *dst, bool *has_dst) -{ - const char *val = getenv(env); - if (val) { - *dst = toui32(val); - *has_dst = true; - } -} - -static void get_str(const char *env, char **dst) -{ - const char *val = getenv(env); - if (val) { - g_free(*dst); - *dst = g_strdup(val); - } -} - -static void get_fmt(const char *env, AudioFormat *dst, bool *has_dst) -{ - const char *val = getenv(env); - if (val) { - size_t i; - for (i = 0; AudioFormat_lookup.size; ++i) { - if (strcasecmp(val, AudioFormat_lookup.array[i]) == 0) { - *dst = i; - *has_dst = true; - return; - } - } - - dolog("Invalid audio format `%s'\n", val); - exit(1); - } -} - - -#if defined(CONFIG_AUDIO_ALSA) || defined(CONFIG_AUDIO_DSOUND) -static void get_millis_to_usecs(const char *env, uint32_t *dst, bool *has_dst) -{ - const char *val = getenv(env); - if (val) { - *dst = toui32(val) * 1000; - *has_dst = true; - } -} -#endif - -#if defined(CONFIG_AUDIO_ALSA) || defined(CONFIG_AUDIO_COREAUDIO) || \ - defined(CONFIG_AUDIO_PA) || defined(CONFIG_AUDIO_SDL) || \ - defined(CONFIG_AUDIO_DSOUND) || defined(CONFIG_AUDIO_OSS) -static uint32_t frames_to_usecs(uint32_t frames, - AudiodevPerDirectionOptions *pdo) -{ - uint32_t freq = pdo->has_frequency ? pdo->frequency : 44100; - return (frames * 1000000 + freq / 2) / freq; -} -#endif - -#ifdef CONFIG_AUDIO_COREAUDIO -static void get_frames_to_usecs(const char *env, uint32_t *dst, bool *has_dst, - AudiodevPerDirectionOptions *pdo) -{ - const char *val = getenv(env); - if (val) { - *dst = frames_to_usecs(toui32(val), pdo); - *has_dst = true; - } -} -#endif - -#if defined(CONFIG_AUDIO_PA) || defined(CONFIG_AUDIO_SDL) || \ - defined(CONFIG_AUDIO_DSOUND) || defined(CONFIG_AUDIO_OSS) -static uint32_t samples_to_usecs(uint32_t samples, - AudiodevPerDirectionOptions *pdo) -{ - uint32_t channels = pdo->has_channels ? pdo->channels : 2; - return frames_to_usecs(samples / channels, pdo); -} -#endif - -#if defined(CONFIG_AUDIO_PA) || defined(CONFIG_AUDIO_SDL) -static void get_samples_to_usecs(const char *env, uint32_t *dst, bool *has_dst, - AudiodevPerDirectionOptions *pdo) -{ - const char *val = getenv(env); - if (val) { - *dst = samples_to_usecs(toui32(val), pdo); - *has_dst = true; - } -} -#endif - -#if defined(CONFIG_AUDIO_DSOUND) || defined(CONFIG_AUDIO_OSS) -static uint32_t bytes_to_usecs(uint32_t bytes, AudiodevPerDirectionOptions *pdo) -{ - AudioFormat fmt = pdo->has_format ? pdo->format : AUDIO_FORMAT_S16; - uint32_t bytes_per_sample = audioformat_bytes_per_sample(fmt); - return samples_to_usecs(bytes / bytes_per_sample, pdo); -} - -static void get_bytes_to_usecs(const char *env, uint32_t *dst, bool *has_dst, - AudiodevPerDirectionOptions *pdo) -{ - const char *val = getenv(env); - if (val) { - *dst = bytes_to_usecs(toui32(val), pdo); - *has_dst = true; - } -} -#endif - -/* backend specific functions */ - -#ifdef CONFIG_AUDIO_ALSA -/* ALSA */ -static void handle_alsa_per_direction( - AudiodevAlsaPerDirectionOptions *apdo, const char *prefix) -{ - char buf[64]; - size_t len = strlen(prefix); - bool size_in_usecs = false; - bool dummy; - - memcpy(buf, prefix, len); - strcpy(buf + len, "TRY_POLL"); - get_bool(buf, &apdo->try_poll, &apdo->has_try_poll); - - strcpy(buf + len, "DEV"); - get_str(buf, &apdo->dev); - - strcpy(buf + len, "SIZE_IN_USEC"); - get_bool(buf, &size_in_usecs, &dummy); - - strcpy(buf + len, "PERIOD_SIZE"); - get_int(buf, &apdo->period_length, &apdo->has_period_length); - if (apdo->has_period_length && !size_in_usecs) { - apdo->period_length = frames_to_usecs( - apdo->period_length, - qapi_AudiodevAlsaPerDirectionOptions_base(apdo)); - } - - strcpy(buf + len, "BUFFER_SIZE"); - get_int(buf, &apdo->buffer_length, &apdo->has_buffer_length); - if (apdo->has_buffer_length && !size_in_usecs) { - apdo->buffer_length = frames_to_usecs( - apdo->buffer_length, - qapi_AudiodevAlsaPerDirectionOptions_base(apdo)); - } -} - -static void handle_alsa(Audiodev *dev) -{ - AudiodevAlsaOptions *aopt = &dev->u.alsa; - handle_alsa_per_direction(aopt->in, "QEMU_ALSA_ADC_"); - handle_alsa_per_direction(aopt->out, "QEMU_ALSA_DAC_"); - - get_millis_to_usecs("QEMU_ALSA_THRESHOLD", - &aopt->threshold, &aopt->has_threshold); -} -#endif - -#ifdef CONFIG_AUDIO_COREAUDIO -/* coreaudio */ -static void handle_coreaudio(Audiodev *dev) -{ - get_frames_to_usecs( - "QEMU_COREAUDIO_BUFFER_SIZE", - &dev->u.coreaudio.out->buffer_length, - &dev->u.coreaudio.out->has_buffer_length, - qapi_AudiodevCoreaudioPerDirectionOptions_base(dev->u.coreaudio.out)); - get_int("QEMU_COREAUDIO_BUFFER_COUNT", - &dev->u.coreaudio.out->buffer_count, - &dev->u.coreaudio.out->has_buffer_count); -} -#endif - -#ifdef CONFIG_AUDIO_DSOUND -/* dsound */ -static void handle_dsound(Audiodev *dev) -{ - get_millis_to_usecs("QEMU_DSOUND_LATENCY_MILLIS", - &dev->u.dsound.latency, &dev->u.dsound.has_latency); - get_bytes_to_usecs("QEMU_DSOUND_BUFSIZE_OUT", - &dev->u.dsound.out->buffer_length, - &dev->u.dsound.out->has_buffer_length, - dev->u.dsound.out); - get_bytes_to_usecs("QEMU_DSOUND_BUFSIZE_IN", - &dev->u.dsound.in->buffer_length, - &dev->u.dsound.in->has_buffer_length, - dev->u.dsound.in); -} -#endif - -#ifdef CONFIG_AUDIO_OSS -/* OSS */ -static void handle_oss_per_direction( - AudiodevOssPerDirectionOptions *opdo, const char *try_poll_env, - const char *dev_env) -{ - get_bool(try_poll_env, &opdo->try_poll, &opdo->has_try_poll); - get_str(dev_env, &opdo->dev); - - get_bytes_to_usecs("QEMU_OSS_FRAGSIZE", - &opdo->buffer_length, &opdo->has_buffer_length, - qapi_AudiodevOssPerDirectionOptions_base(opdo)); - get_int("QEMU_OSS_NFRAGS", &opdo->buffer_count, - &opdo->has_buffer_count); -} - -static void handle_oss(Audiodev *dev) -{ - AudiodevOssOptions *oopt = &dev->u.oss; - handle_oss_per_direction(oopt->in, "QEMU_AUDIO_ADC_TRY_POLL", - "QEMU_OSS_ADC_DEV"); - handle_oss_per_direction(oopt->out, "QEMU_AUDIO_DAC_TRY_POLL", - "QEMU_OSS_DAC_DEV"); - - get_bool("QEMU_OSS_MMAP", &oopt->try_mmap, &oopt->has_try_mmap); - get_bool("QEMU_OSS_EXCLUSIVE", &oopt->exclusive, &oopt->has_exclusive); - get_int("QEMU_OSS_POLICY", &oopt->dsp_policy, &oopt->has_dsp_policy); -} -#endif - -#ifdef CONFIG_AUDIO_PA -/* pulseaudio */ -static void handle_pa_per_direction( - AudiodevPaPerDirectionOptions *ppdo, const char *env) -{ - get_str(env, &ppdo->name); -} - -static void handle_pa(Audiodev *dev) -{ - handle_pa_per_direction(dev->u.pa.in, "QEMU_PA_SOURCE"); - handle_pa_per_direction(dev->u.pa.out, "QEMU_PA_SINK"); - - get_samples_to_usecs( - "QEMU_PA_SAMPLES", &dev->u.pa.in->buffer_length, - &dev->u.pa.in->has_buffer_length, - qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.in)); - get_samples_to_usecs( - "QEMU_PA_SAMPLES", &dev->u.pa.out->buffer_length, - &dev->u.pa.out->has_buffer_length, - qapi_AudiodevPaPerDirectionOptions_base(dev->u.pa.out)); - - get_str("QEMU_PA_SERVER", &dev->u.pa.server); -} -#endif - -#ifdef CONFIG_AUDIO_SDL -/* SDL */ -static void handle_sdl(Audiodev *dev) -{ - /* SDL is output only */ - get_samples_to_usecs("QEMU_SDL_SAMPLES", &dev->u.sdl.out->buffer_length, - &dev->u.sdl.out->has_buffer_length, - qapi_AudiodevSdlPerDirectionOptions_base(dev->u.sdl.out)); -} -#endif - -/* wav */ -static void handle_wav(Audiodev *dev) -{ - get_int("QEMU_WAV_FREQUENCY", - &dev->u.wav.out->frequency, &dev->u.wav.out->has_frequency); - get_fmt("QEMU_WAV_FORMAT", &dev->u.wav.out->format, - &dev->u.wav.out->has_format); - get_int("QEMU_WAV_DAC_FIXED_CHANNELS", - &dev->u.wav.out->channels, &dev->u.wav.out->has_channels); - get_str("QEMU_WAV_PATH", &dev->u.wav.path); -} - -/* general */ -static void handle_per_direction( - AudiodevPerDirectionOptions *pdo, const char *prefix) -{ - char buf[64]; - size_t len = strlen(prefix); - - memcpy(buf, prefix, len); - strcpy(buf + len, "FIXED_SETTINGS"); - get_bool(buf, &pdo->fixed_settings, &pdo->has_fixed_settings); - - strcpy(buf + len, "FIXED_FREQ"); - get_int(buf, &pdo->frequency, &pdo->has_frequency); - - strcpy(buf + len, "FIXED_FMT"); - get_fmt(buf, &pdo->format, &pdo->has_format); - - strcpy(buf + len, "FIXED_CHANNELS"); - get_int(buf, &pdo->channels, &pdo->has_channels); - - strcpy(buf + len, "VOICES"); - get_int(buf, &pdo->voices, &pdo->has_voices); -} - -static AudiodevListEntry *legacy_opt(const char *drvname) -{ - AudiodevListEntry *e = g_new0(AudiodevListEntry, 1); - e->dev = g_new0(Audiodev, 1); - e->dev->id = g_strdup(drvname); - e->dev->driver = qapi_enum_parse( - &AudiodevDriver_lookup, drvname, -1, &error_abort); - - audio_create_pdos(e->dev); - - handle_per_direction(audio_get_pdo_in(e->dev), "QEMU_AUDIO_ADC_"); - handle_per_direction(audio_get_pdo_out(e->dev), "QEMU_AUDIO_DAC_"); - - /* Original description: Timer period in HZ (0 - use lowest possible) */ - get_int("QEMU_AUDIO_TIMER_PERIOD", - &e->dev->timer_period, &e->dev->has_timer_period); - if (e->dev->has_timer_period && e->dev->timer_period) { - e->dev->timer_period = NANOSECONDS_PER_SECOND / 1000 / - e->dev->timer_period; - } - - switch (e->dev->driver) { -#ifdef CONFIG_AUDIO_ALSA - case AUDIODEV_DRIVER_ALSA: - handle_alsa(e->dev); - break; -#endif - -#ifdef CONFIG_AUDIO_COREAUDIO - case AUDIODEV_DRIVER_COREAUDIO: - handle_coreaudio(e->dev); - break; -#endif - -#ifdef CONFIG_AUDIO_DSOUND - case AUDIODEV_DRIVER_DSOUND: - handle_dsound(e->dev); - break; -#endif - -#ifdef CONFIG_AUDIO_OSS - case AUDIODEV_DRIVER_OSS: - handle_oss(e->dev); - break; -#endif - -#ifdef CONFIG_AUDIO_PA - case AUDIODEV_DRIVER_PA: - handle_pa(e->dev); - break; -#endif - -#ifdef CONFIG_AUDIO_SDL - case AUDIODEV_DRIVER_SDL: - handle_sdl(e->dev); - break; -#endif - - case AUDIODEV_DRIVER_WAV: - handle_wav(e->dev); - break; - - default: - break; - } - - return e; -} - -AudiodevListHead audio_handle_legacy_opts(void) -{ - const char *drvname = getenv("QEMU_AUDIO_DRV"); - AudiodevListHead head = QSIMPLEQ_HEAD_INITIALIZER(head); - - if (drvname) { - AudiodevListEntry *e; - audio_driver *driver = audio_driver_lookup(drvname); - if (!driver) { - dolog("Unknown audio driver `%s'\n", drvname); - exit(1); - } - e = legacy_opt(drvname); - QSIMPLEQ_INSERT_TAIL(&head, e, next); - } else { - for (int i = 0; audio_prio_list[i]; i++) { - audio_driver *driver = audio_driver_lookup(audio_prio_list[i]); - if (driver && driver->can_be_default) { - AudiodevListEntry *e = legacy_opt(driver->name); - QSIMPLEQ_INSERT_TAIL(&head, e, next); - } - } - if (QSIMPLEQ_EMPTY(&head)) { - dolog("Internal error: no default audio driver available\n"); - exit(1); - } - } - - return head; -} - -/* visitor to print -audiodev option */ -typedef struct { - Visitor visitor; - - bool comma; - GList *path; -} LegacyPrintVisitor; - -static bool lv_start_struct(Visitor *v, const char *name, void **obj, - size_t size, Error **errp) -{ - LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v; - lv->path = g_list_append(lv->path, g_strdup(name)); - return true; -} - -static void lv_end_struct(Visitor *v, void **obj) -{ - LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v; - lv->path = g_list_delete_link(lv->path, g_list_last(lv->path)); -} - -static void lv_print_key(Visitor *v, const char *name) -{ - GList *e; - LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v; - if (lv->comma) { - putchar(','); - } else { - lv->comma = true; - } - - for (e = lv->path; e; e = e->next) { - if (e->data) { - printf("%s.", (const char *) e->data); - } - } - - printf("%s=", name); -} - -static bool lv_type_int64(Visitor *v, const char *name, int64_t *obj, - Error **errp) -{ - lv_print_key(v, name); - printf("%" PRIi64, *obj); - return true; -} - -static bool lv_type_uint64(Visitor *v, const char *name, uint64_t *obj, - Error **errp) -{ - lv_print_key(v, name); - printf("%" PRIu64, *obj); - return true; -} - -static bool lv_type_bool(Visitor *v, const char *name, bool *obj, Error **errp) -{ - lv_print_key(v, name); - printf("%s", *obj ? "on" : "off"); - return true; -} - -static bool lv_type_str(Visitor *v, const char *name, char **obj, Error **errp) -{ - const char *str = *obj; - lv_print_key(v, name); - - while (*str) { - if (*str == ',') { - putchar(','); - } - putchar(*str++); - } - return true; -} - -static void lv_complete(Visitor *v, void *opaque) -{ - LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v; - assert(lv->path == NULL); -} - -static void lv_free(Visitor *v) -{ - LegacyPrintVisitor *lv = (LegacyPrintVisitor *) v; - - g_list_free_full(lv->path, g_free); - g_free(lv); -} - -static Visitor *legacy_visitor_new(void) -{ - LegacyPrintVisitor *lv = g_new0(LegacyPrintVisitor, 1); - - lv->visitor.start_struct = lv_start_struct; - lv->visitor.end_struct = lv_end_struct; - /* lists not supported */ - lv->visitor.type_int64 = lv_type_int64; - lv->visitor.type_uint64 = lv_type_uint64; - lv->visitor.type_bool = lv_type_bool; - lv->visitor.type_str = lv_type_str; - - lv->visitor.type = VISITOR_OUTPUT; - lv->visitor.complete = lv_complete; - lv->visitor.free = lv_free; - - return &lv->visitor; -} - -void audio_legacy_help(void) -{ - AudiodevListHead head; - AudiodevListEntry *e; - - printf("Environment variable based configuration deprecated.\n"); - printf("Please use the new -audiodev option.\n"); - - head = audio_handle_legacy_opts(); - printf("\nEquivalent -audiodev to your current environment variables:\n"); - if (!getenv("QEMU_AUDIO_DRV")) { - printf("(Since you didn't specify QEMU_AUDIO_DRV, I'll list all " - "possibilities)\n"); - } - - QSIMPLEQ_FOREACH(e, &head, next) { - Visitor *v; - Audiodev *dev = e->dev; - printf("-audiodev "); - - v = legacy_visitor_new(); - visit_type_Audiodev(v, NULL, &dev, &error_abort); - visit_free(v); - - printf("\n"); - } - audio_free_audiodev_list(&head); -} diff --git a/audio/coreaudio.m b/audio/coreaudio.m index 7cfb38fb6ae..8cd129a27d0 100644 --- a/audio/coreaudio.m +++ b/audio/coreaudio.m @@ -673,7 +673,6 @@ static void coreaudio_audio_fini (void *opaque) .init = coreaudio_audio_init, .fini = coreaudio_audio_fini, .pcm_ops = &coreaudio_pcm_ops, - .can_be_default = 1, .max_voices_out = 1, .max_voices_in = 0, .voice_size_out = sizeof (coreaudioVoiceOut), diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c index 310ca997ff4..60fcf643ecf 100644 --- a/audio/dbusaudio.c +++ b/audio/dbusaudio.c @@ -676,7 +676,6 @@ static struct audio_driver dbus_audio_driver = { .fini = dbus_audio_fini, .set_dbus_server = dbus_audio_set_server, .pcm_ops = &dbus_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof(DBusVoiceOut), diff --git a/audio/dsoundaudio.c b/audio/dsoundaudio.c index eefde88edcb..f3bb48d0073 100644 --- a/audio/dsoundaudio.c +++ b/audio/dsoundaudio.c @@ -721,7 +721,6 @@ static struct audio_driver dsound_audio_driver = { .init = dsound_audio_init, .fini = dsound_audio_fini, .pcm_ops = &dsound_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = 1, .voice_size_out = sizeof (DSoundVoiceOut), diff --git a/audio/jackaudio.c b/audio/jackaudio.c index 823e7d96bae..974a3caad34 100644 --- a/audio/jackaudio.c +++ b/audio/jackaudio.c @@ -676,7 +676,6 @@ static struct audio_driver jack_driver = { .init = qjack_init, .fini = qjack_fini, .pcm_ops = &jack_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof(QJackOut), diff --git a/audio/meson.build b/audio/meson.build index df4d968c0fe..c8f658611f4 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -1,7 +1,6 @@ system_ss.add([spice_headers, files('audio.c')]) system_ss.add(files( 'audio-hmp-cmds.c', - 'audio_legacy.c', 'mixeng.c', 'noaudio.c', 'wavaudio.c', diff --git a/audio/noaudio.c b/audio/noaudio.c index a36bfeffd14..1b60d8518a4 100644 --- a/audio/noaudio.c +++ b/audio/noaudio.c @@ -135,7 +135,6 @@ static struct audio_driver no_audio_driver = { .init = no_audio_init, .fini = no_audio_fini, .pcm_ops = &no_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof (NoVoiceOut), diff --git a/audio/ossaudio.c b/audio/ossaudio.c index ec4448d573d..3f31852371d 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -784,7 +784,6 @@ static struct audio_driver oss_audio_driver = { .init = oss_audio_init, .fini = oss_audio_fini, .pcm_ops = &oss_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof (OSSVoiceOut), diff --git a/audio/paaudio.c b/audio/paaudio.c index 39bd6cfa38a..f3193b08c32 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -931,7 +931,6 @@ static struct audio_driver pa_audio_driver = { .init = qpa_audio_init, .fini = qpa_audio_fini, .pcm_ops = &qpa_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof (PAVoiceOut), diff --git a/audio/pwaudio.c b/audio/pwaudio.c index 1020cb11df1..3ce5f6507b4 100644 --- a/audio/pwaudio.c +++ b/audio/pwaudio.c @@ -843,7 +843,6 @@ static struct audio_driver pw_audio_driver = { .init = qpw_audio_init, .fini = qpw_audio_fini, .pcm_ops = &qpw_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof(PWVoiceOut), diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 4d8473d9ece..641357e5ee3 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -494,7 +494,6 @@ static struct audio_driver sdl_audio_driver = { .init = sdl_audio_init, .fini = sdl_audio_fini, .pcm_ops = &sdl_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof(SDLVoiceOut), diff --git a/audio/sndioaudio.c b/audio/sndioaudio.c index 1e35925a497..8eb35e1e538 100644 --- a/audio/sndioaudio.c +++ b/audio/sndioaudio.c @@ -550,7 +550,6 @@ static struct audio_driver sndio_audio_driver = { .init = sndio_audio_init, .fini = sndio_audio_fini, .pcm_ops = &sndio_pcm_ops, - .can_be_default = 1, .max_voices_out = INT_MAX, .max_voices_in = INT_MAX, .voice_size_out = sizeof(SndioVoice), diff --git a/audio/wavaudio.c b/audio/wavaudio.c index 26b03906d59..ea20fed0ccb 100644 --- a/audio/wavaudio.c +++ b/audio/wavaudio.c @@ -208,7 +208,6 @@ static struct audio_driver wav_audio_driver = { .init = wav_audio_init, .fini = wav_audio_fini, .pcm_ops = &wav_pcm_ops, - .can_be_default = 0, .max_voices_out = 1, .max_voices_in = 0, .voice_size_out = sizeof (WAVVoiceOut), diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index c07bf58dde1..2f51cf770ae 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -37,14 +37,6 @@ coverage. System emulator command line arguments -------------------------------------- -``QEMU_AUDIO_`` environment variables and ``-audio-help`` (since 4.0) -''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -The ``-audiodev`` argument is now the preferred way to specify audio -backend settings instead of environment variables. To ease migration to -the new format, the ``-audiodev-help`` option can be used to convert -the current values of the environment variables to ``-audiodev`` options. - Creating sound card devices without ``audiodev=`` property (since 4.2) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst index 276060b320c..e83ed087f6b 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -436,6 +436,12 @@ the process listing. This was replaced by the new ``password-secret`` option which lets the password be securely provided on the command line using a ``secret`` object instance. +``QEMU_AUDIO_`` environment variables and ``-audio-help`` (removed in 8.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The ``-audiodev`` and ``-audio`` command line options are now the only +way to specify audio backend settings. + Creating vnc without ``audiodev=`` property (removed in 8.2) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' diff --git a/qemu-options.hx b/qemu-options.hx index bcd77255cbd..9ce8a5b9578 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -727,16 +727,6 @@ SRST ERST -HXCOMM Deprecated by -audiodev -DEF("audio-help", 0, QEMU_OPTION_audio_help, - "-audio-help show -audiodev equivalent of the currently specified audio settings\n", - QEMU_ARCH_ALL) -SRST -``-audio-help`` - Will show the -audiodev equivalent of the currently specified - (deprecated) environment variables. -ERST - DEF("audio", HAS_ARG, QEMU_OPTION_audio, "-audio [driver=]driver,model=value[,prop[=value][,...]]\n" " specifies the audio backend and device to use;\n" diff --git a/softmmu/vl.c b/softmmu/vl.c index 59a472a0b10..cafb1a98427 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2926,10 +2926,6 @@ void qemu_init(int argc, char **argv) } break; #endif - case QEMU_OPTION_audio_help: - audio_legacy_help(); - exit (0); - break; case QEMU_OPTION_audiodev: audio_parse_option(optarg); break; From patchwork Tue Oct 3 08:30:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ArOJD125; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B1b0dthz1yng for ; Tue, 3 Oct 2023 19:33:55 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoc-0003Cu-7h; Tue, 03 Oct 2023 04:31:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoY-0002xX-Ls for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoW-0000NT-IV for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NGlxuLyun+dUBX7xD0BT13EOzRTwugSo2SXeCOO3kog=; b=ArOJD125gjIuk3c515okWU9tQ7Xthn9mX816T5+yzS/rCcxnyfc5zeNZLW8w65npmsS6+g MwX2bM92mwY7KWAW94E5kN94qCqnmIrk1hMMZsQ2H9I+jB8rO3NnMd0JxQaTH1Ca24Y9S3 c/VTv2tYcC6ALrjd2RQSwg2+TcfU9A4= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-381-bUycKeyINFaHvJncVm6KpA-1; Tue, 03 Oct 2023 04:31:24 -0400 X-MC-Unique: bUycKeyINFaHvJncVm6KpA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-9adad8f306fso51003966b.0 for ; Tue, 03 Oct 2023 01:31:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321882; x=1696926682; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NGlxuLyun+dUBX7xD0BT13EOzRTwugSo2SXeCOO3kog=; b=uq2ccscU/9+0N8w14XktMivnpXpt/7fEjVPJ8JnMo1xE0ul2Y91KVoq9nI4Us4W+mm +Swha7tSQRn/q6QrmAAWoEhFpoBopYvdyQEkqSEUUz4vRJxMZpudqqv9nvCODsBo2WnV ChmcPYSbq7K5oTI73Unjzyxuanukb+qq0JpaLicf5ItBUZZHR1slcvDZuxvE7He0KQ3Q U5kZIA7IdapTbAysVXLkEXpWbTXrJPKCjXHHX7Ddvpjw+qMwWQp1BXky/0H/dl3x0VF7 +I+9nl+wYY76qlDaJ6LWd1Hw/q5KVEnh21yuD8Ioz5qZ+AdQrdQziHYa0jqXqsTZiGK2 Y5MQ== X-Gm-Message-State: AOJu0YwHG4KOEJfgA+QAY1PfrSvYbKQ65dTKQ81m8DsB0RF73PGMVAfu GoWMp4D+HMg+Q3nhXRBu+pjeKGoa96T2zRYmGzKgY3y5zBbZEyKd4H4Aoealu1jfeyGJRmBkMUw syvvu9drUxZOOy5rWIkyiSyLqwYIzTdMwyxK8cmgzf680Pod/+atDtSvlCuAt9sctRf6n1wEqW3 w= X-Received: by 2002:a17:907:75f9:b0:9b6:582e:be5e with SMTP id jz25-20020a17090775f900b009b6582ebe5emr2227362ejc.60.1696321882156; Tue, 03 Oct 2023 01:31:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEBWwQbVtQBHhO28yYbWB8ucN1FkLlEbUdYyBkZR3s6tMNEga1UzrUHSk+mIXCBWE7jINQEwQ== X-Received: by 2002:a17:907:75f9:b0:9b6:582e:be5e with SMTP id jz25-20020a17090775f900b009b6582ebe5emr2227347ejc.60.1696321881871; Tue, 03 Oct 2023 01:31:21 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id gr11-20020a170906e2cb00b0099bc80d5575sm635517ejb.200.2023.10.03.01.31.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Martin Kletzander Subject: [PULL 19/24] Introduce machine property "audiodev" Date: Tue, 3 Oct 2023 10:30:36 +0200 Message-ID: <20231003083042.110065-20-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Martin Kletzander Many machine types have default audio devices with no way to set the underlying audiodev. Instead of adding an option for each and every one of them, this new property can be used as a default during machine initialisation when creating such devices. Signed-off-by: Martin Kletzander [Make the property optional, instead of including it in all machines. - Paolo] Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 33 +++++++++++++++++++++++++++++++++ include/hw/boards.h | 9 +++++++++ 2 files changed, 42 insertions(+) diff --git a/hw/core/machine.c b/hw/core/machine.c index cb38b8cf4cb..6aa49c8d4f1 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -39,6 +39,7 @@ #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-pci.h" #include "hw/virtio/virtio-net.h" +#include "audio/audio.h" GlobalProperty hw_compat_8_1[] = {}; const size_t hw_compat_8_1_len = G_N_ELEMENTS(hw_compat_8_1); @@ -686,6 +687,26 @@ bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type) return allowed; } +static char *machine_get_audiodev(Object *obj, Error **errp) +{ + MachineState *ms = MACHINE(obj); + + return g_strdup(ms->audiodev); +} + +static void machine_set_audiodev(Object *obj, const char *value, + Error **errp) +{ + MachineState *ms = MACHINE(obj); + + if (!audio_state_by_name(value, errp)) { + return; + } + + g_free(ms->audiodev); + ms->audiodev = g_strdup(value); +} + HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine) { int i; @@ -931,6 +952,17 @@ out_free: qapi_free_BootConfiguration(config); } +void machine_add_audiodev_property(MachineClass *mc) +{ + ObjectClass *oc = OBJECT_CLASS(mc); + + object_class_property_add_str(oc, "audiodev", + machine_get_audiodev, + machine_set_audiodev); + object_class_property_set_description(oc, "audiodev", + "Audiodev to use for default machine devices"); +} + static void machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -1136,6 +1168,7 @@ static void machine_finalize(Object *obj) g_free(ms->device_memory); g_free(ms->nvdimms_state); g_free(ms->numa_state); + g_free(ms->audiodev); } bool machine_usb(MachineState *machine) diff --git a/include/hw/boards.h b/include/hw/boards.h index 6c67af196a3..55a64a13fdf 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -24,6 +24,7 @@ OBJECT_DECLARE_TYPE(MachineState, MachineClass, MACHINE) extern MachineState *current_machine; +void machine_add_audiodev_property(MachineClass *mc); void machine_run_board_init(MachineState *machine, const char *mem_path, Error **errp); bool machine_usb(MachineState *machine); int machine_phandle_start(MachineState *machine); @@ -358,6 +359,14 @@ struct MachineState { MemoryRegion *ram; DeviceMemoryState *device_memory; + /* + * Included in MachineState for simplicity, but not supported + * unless machine_add_audiodev_property is called. Boards + * that have embedded audio devices can call it from the + * machine init function and forward the property to the device. + */ + char *audiodev; + ram_addr_t ram_size; ram_addr_t maxram_size; uint64_t ram_slots; From patchwork Tue Oct 3 08:30:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SNPl4jyR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S09zk1Yvqz20Zh for ; Tue, 3 Oct 2023 19:32:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoh-0003No-O4; Tue, 03 Oct 2023 04:31:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaod-0003JU-C5 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoa-0000Ov-BU for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eYUtdTr60CLv5P1H2OfOWHbBZ7FzVeIg9uSPjv5Hm2s=; b=SNPl4jyRGJnO6oz1Zwqvf0AQUqs8WOy3IRBvTamp1EVTarCme4Z577e77tW20GTxuA2l18 IHhtke7iMPeP69VEBFtFMWpqN1TCmzcMTl6WUcsiE6h48hmfL3hQVrJbQytbh2y8DgSoxX BLGJDunqAs2hQP+EGqT0cEipK9QW5AQ= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-308-plxKCNYGNlGQeocCzG6Lpg-1; Tue, 03 Oct 2023 04:31:26 -0400 X-MC-Unique: plxKCNYGNlGQeocCzG6Lpg-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-993d7ca4607so48300666b.1 for ; Tue, 03 Oct 2023 01:31:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321884; x=1696926684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eYUtdTr60CLv5P1H2OfOWHbBZ7FzVeIg9uSPjv5Hm2s=; b=libW0wPyqSgfTXnCJkWdk1EHsWfguWLgMtH2vL8ouJ718PMfbpL7xpHs/6viHu/4Zh TsWRq/nuDr/35DV2u2w0jtOm4yYwk/XPN1Ulw0Z6x8qYPmP36ZC7iT2NvidOC9rswp12 wBFJbK0Cz5hB/FPljGd6y+UK9ssyf+i8qH2bVX7gm/Ch815YmQTxutHYmIkPwmjuv4Xh UH8V2fab86AwsRh6y7nBfbmIapPMZYVvae/HVGD+nJ7ZDnL3NYTS4RicwbFy4yasAjN/ 0c6n1vmbr4BIAIUVQOFX9D5vP8ZowWCP7AANo/HHDTtRwIhFC9X3u1JcijdbUiWtfmH7 3khA== X-Gm-Message-State: AOJu0YwIn+5MJIof9wRQoyXC1Ip9IBvTvAEnE7BmY0o34vWbX+gvBZ0Z DTIKCz++RW6V9HrMScTcvV98V3N3P5qAi6dVkTGWYOkhHLAEpSSlbSx3P89lkTufayTJ6fIxfau Xu8dwqspVGMt7YLnOzgOsn5EsnVq1X2bSRglIkJukVCO4ep547lTii2dkyCWe2WwIEyES+Vm780 0= X-Received: by 2002:a17:906:844d:b0:9b7:2a13:160c with SMTP id e13-20020a170906844d00b009b72a13160cmr221793ejy.69.1696321884494; Tue, 03 Oct 2023 01:31:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH4JCwg4uUMzNrD1lOiN57VwV2Ntba92dz/v6UjzoSFna0UjPBAqG0MhB3dWiD5SMgZD9L5OA== X-Received: by 2002:a17:906:844d:b0:9b7:2a13:160c with SMTP id e13-20020a170906844d00b009b72a13160cmr221777ejy.69.1696321884060; Tue, 03 Oct 2023 01:31:24 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id e10-20020a170906c00a00b009b2b9af0784sm651856ejz.110.2023.10.03.01.31.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Martin Kletzander Subject: [PULL 20/24] hw/arm: Support machine-default audiodev with fallback Date: Tue, 3 Oct 2023 10:30:37 +0200 Message-ID: <20231003083042.110065-21-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Martin Kletzander Signed-off-by: Martin Kletzander Signed-off-by: Paolo Bonzini --- hw/arm/integratorcp.c | 11 ++++++++++- hw/arm/musicpal.c | 11 +++++++++-- hw/arm/nseries.c | 4 ++++ hw/arm/omap2.c | 5 +++++ hw/arm/palm.c | 2 ++ hw/arm/realview.c | 12 ++++++++++++ hw/arm/spitz.c | 17 ++++++++++++----- hw/arm/versatilepb.c | 8 ++++++++ hw/arm/vexpress.c | 5 +++++ hw/arm/xlnx-zcu102.c | 6 ++++++ hw/arm/z2.c | 15 ++++++++++++++- hw/input/tsc210x.c | 5 +++++ 12 files changed, 92 insertions(+), 9 deletions(-) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index b109ece3ae0..d176e9af7ee 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -27,6 +27,7 @@ #include "hw/irq.h" #include "hw/sd/sd.h" #include "qom/object.h" +#include "audio/audio.h" #define TYPE_INTEGRATOR_CM "integrator_core" OBJECT_DECLARE_SIMPLE_TYPE(IntegratorCMState, INTEGRATOR_CM) @@ -660,7 +661,13 @@ static void integratorcp_init(MachineState *machine) &error_fatal); } - sysbus_create_varargs("pl041", 0x1d000000, pic[25], NULL); + dev = qdev_new("pl041"); + if (machine->audiodev) { + qdev_prop_set_string(dev, "audiodev", machine->audiodev); + } + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x1d000000); + sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[25]); if (nd_table[0].used) smc91c111_init(&nd_table[0], 0xc8000000, pic[27]); @@ -678,6 +685,8 @@ static void integratorcp_machine_init(MachineClass *mc) mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); mc->default_ram_id = "integrator.ram"; + + machine_add_audiodev_property(mc); } DEFINE_MACHINE("integratorcp", integratorcp_machine_init) diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index dc4e43e0ee2..9703bfb97fb 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -37,9 +37,9 @@ #include "qemu/cutils.h" #include "qom/object.h" #include "hw/net/mv88w8618_eth.h" +#include "audio/audio.h" #include "qemu/error-report.h" - #define MP_MISC_BASE 0x80002000 #define MP_MISC_SIZE 0x00001000 @@ -1326,7 +1326,12 @@ static void musicpal_init(MachineState *machine) qdev_connect_gpio_out(key_dev, i, qdev_get_gpio_in(dev, i + 15)); } - wm8750_dev = i2c_slave_create_simple(i2c, TYPE_WM8750, MP_WM_ADDR); + wm8750_dev = i2c_slave_new(TYPE_WM8750, MP_WM_ADDR); + if (machine->audiodev) { + qdev_prop_set_string(DEVICE(wm8750_dev), "audiodev", machine->audiodev); + } + i2c_slave_realize_and_unref(wm8750_dev, i2c, &error_abort); + dev = qdev_new(TYPE_MV88W8618_AUDIO); s = SYS_BUS_DEVICE(dev); object_property_set_link(OBJECT(dev), "wm8750", OBJECT(wm8750_dev), @@ -1347,6 +1352,8 @@ static void musicpal_machine_init(MachineClass *mc) mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); mc->default_ram_size = MP_RAM_DEFAULT_SIZE; mc->default_ram_id = "musicpal.ram"; + + machine_add_audiodev_property(mc); } DEFINE_MACHINE("musicpal", musicpal_machine_init) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 9e49e9e1776..35aff46b4b4 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -1432,6 +1432,8 @@ static void n800_class_init(ObjectClass *oc, void *data) /* Actually two chips of 0x4000000 bytes each */ mc->default_ram_size = 0x08000000; mc->default_ram_id = "omap2.dram"; + + machine_add_audiodev_property(mc); } static const TypeInfo n800_type = { @@ -1452,6 +1454,8 @@ static void n810_class_init(ObjectClass *oc, void *data) /* Actually two chips of 0x4000000 bytes each */ mc->default_ram_size = 0x08000000; mc->default_ram_id = "omap2.dram"; + + machine_add_audiodev_property(mc); } static const TypeInfo n810_type = { diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index d5a2ae7af6e..41b1f596dca 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -37,6 +37,7 @@ #include "hw/block/flash.h" #include "hw/arm/soc_dma.h" #include "hw/sysbus.h" +#include "hw/boards.h" #include "audio/audio.h" /* Enhanced Audio Controller (CODEC only) */ @@ -609,6 +610,10 @@ static struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta, s->codec.txdrq = *drq; omap_eac_reset(s); + if (current_machine->audiodev) { + s->codec.card.name = g_strdup(current_machine->audiodev); + s->codec.card.state = audio_state_by_name(s->codec.card.name, &error_fatal); + } AUD_register_card("OMAP EAC", &s->codec.card); memory_region_init_io(&s->iomem, NULL, &omap_eac_ops, s, "omap.eac", diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 17c11ac4cec..b86f2c331bb 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -310,6 +310,8 @@ static void palmte_machine_init(MachineClass *mc) mc->default_cpu_type = ARM_CPU_TYPE_NAME("ti925t"); mc->default_ram_size = 0x02000000; mc->default_ram_id = "omap1.dram"; + + machine_add_audiodev_property(mc); } DEFINE_MACHINE("cheetah", palmte_machine_init) diff --git a/hw/arm/realview.c b/hw/arm/realview.c index a5aa2f046ae..8f89526596c 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -29,6 +29,7 @@ #include "hw/irq.h" #include "hw/i2c/arm_sbcon_i2c.h" #include "hw/sd/sd.h" +#include "audio/audio.h" #define SMP_BOOT_ADDR 0xe0000000 #define SMP_BOOTREG_ADDR 0x10000030 @@ -207,6 +208,9 @@ static void realview_init(MachineState *machine, pl041 = qdev_new("pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); + if (machine->audiodev) { + qdev_prop_set_string(pl041, "audiodev", machine->audiodev); + } sysbus_realize_and_unref(SYS_BUS_DEVICE(pl041), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, 0x10004000); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[19]); @@ -412,6 +416,8 @@ static void realview_eb_class_init(ObjectClass *oc, void *data) mc->block_default_type = IF_SCSI; mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); + + machine_add_audiodev_property(mc); } static const TypeInfo realview_eb_type = { @@ -430,6 +436,8 @@ static void realview_eb_mpcore_class_init(ObjectClass *oc, void *data) mc->max_cpus = 4; mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm11mpcore"); + + machine_add_audiodev_property(mc); } static const TypeInfo realview_eb_mpcore_type = { @@ -446,6 +454,8 @@ static void realview_pb_a8_class_init(ObjectClass *oc, void *data) mc->init = realview_pb_a8_init; mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); + + machine_add_audiodev_property(mc); } static const TypeInfo realview_pb_a8_type = { @@ -463,6 +473,8 @@ static void realview_pbx_a9_class_init(ObjectClass *oc, void *data) mc->max_cpus = 4; mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); + + machine_add_audiodev_property(mc); } static const TypeInfo realview_pbx_a9_type = { diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index f732fe0acf9..cc268c6ac0b 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -35,6 +35,7 @@ #include "exec/address-spaces.h" #include "cpu.h" #include "qom/object.h" +#include "audio/audio.h" enum spitz_model_e { spitz, akita, borzoi, terrier }; @@ -774,15 +775,19 @@ static void spitz_wm8750_addr(void *opaque, int line, int level) i2c_slave_set_address(wm, SPITZ_WM_ADDRL); } -static void spitz_i2c_setup(PXA2xxState *cpu) +static void spitz_i2c_setup(MachineState *machine, PXA2xxState *cpu) { /* Attach the CPU on one end of our I2C bus. */ I2CBus *bus = pxa2xx_i2c_bus(cpu->i2c[0]); - DeviceState *wm; - /* Attach a WM8750 to the bus */ - wm = DEVICE(i2c_slave_create_simple(bus, TYPE_WM8750, 0)); + I2CSlave *i2c_dev = i2c_slave_new(TYPE_WM8750, 0); + DeviceState *wm = DEVICE(i2c_dev); + + if (machine->audiodev) { + qdev_prop_set_string(wm, "audiodev", machine->audiodev); + } + i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort); spitz_wm8750_addr(wm, 0, 0); qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_WM, @@ -1013,7 +1018,7 @@ static void spitz_common_init(MachineState *machine) spitz_gpio_setup(mpu, (model == akita) ? 1 : 2); - spitz_i2c_setup(mpu); + spitz_i2c_setup(machine, mpu); if (model == akita) spitz_akita_i2c_setup(mpu); @@ -1037,6 +1042,8 @@ static void spitz_common_class_init(ObjectClass *oc, void *data) mc->block_default_type = IF_IDE; mc->ignore_memory_transaction_failures = true; mc->init = spitz_common_init; + + machine_add_audiodev_property(mc); } static const TypeInfo spitz_common_info = { diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 05b9462a5b7..2f22dc890f4 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -26,6 +26,7 @@ #include "hw/char/pl011.h" #include "hw/sd/sd.h" #include "qom/object.h" +#include "audio/audio.h" #define VERSATILE_FLASH_ADDR 0x34000000 #define VERSATILE_FLASH_SIZE (64 * 1024 * 1024) @@ -343,6 +344,9 @@ static void versatile_init(MachineState *machine, int board_id) /* Add PL041 AACI Interface to the LM4549 codec */ pl041 = qdev_new("pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); + if (machine->audiodev) { + qdev_prop_set_string(pl041, "audiodev", machine->audiodev); + } sysbus_realize_and_unref(SYS_BUS_DEVICE(pl041), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, 0x10004000); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, sic[24]); @@ -416,6 +420,8 @@ static void versatilepb_class_init(ObjectClass *oc, void *data) mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); mc->default_ram_id = "versatile.ram"; + + machine_add_audiodev_property(mc); } static const TypeInfo versatilepb_type = { @@ -434,6 +440,8 @@ static void versatileab_class_init(ObjectClass *oc, void *data) mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("arm926"); mc->default_ram_id = "versatile.ram"; + + machine_add_audiodev_property(mc); } static const TypeInfo versatileab_type = { diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 56abadd9b8b..8ff37f52ca1 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -44,6 +44,7 @@ #include "hw/i2c/arm_sbcon_i2c.h" #include "hw/sd/sd.h" #include "qom/object.h" +#include "audio/audio.h" #define VEXPRESS_BOARD_ID 0x8e0 #define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024) @@ -613,6 +614,9 @@ static void vexpress_common_init(MachineState *machine) pl041 = qdev_new("pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); + if (machine->audiodev) { + qdev_prop_set_string(pl041, "audiodev", machine->audiodev); + } sysbus_realize_and_unref(SYS_BUS_DEVICE(pl041), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, map[VE_PL041]); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, pic[11]); @@ -776,6 +780,7 @@ static void vexpress_class_init(ObjectClass *oc, void *data) mc->ignore_memory_transaction_failures = true; mc->default_ram_id = "vexpress.highmem"; + machine_add_audiodev_property(mc); object_class_property_add_bool(oc, "secure", vexpress_get_secure, vexpress_set_secure); object_class_property_set_description(oc, "secure", diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index 21483f75fd9..c5a07cfe195 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -24,6 +24,7 @@ #include "sysemu/device_tree.h" #include "qom/object.h" #include "net/can_emu.h" +#include "audio/audio.h" struct XlnxZCU102 { MachineState parent_obj; @@ -143,6 +144,10 @@ static void xlnx_zcu102_init(MachineState *machine) object_initialize_child(OBJECT(machine), "soc", &s->soc, TYPE_XLNX_ZYNQMP); + if (machine->audiodev) { + qdev_prop_set_string(DEVICE(&s->soc.dp), "audiodev", machine->audiodev); + } + object_property_set_link(OBJECT(&s->soc), "ddr-ram", OBJECT(machine->ram), &error_abort); object_property_set_bool(OBJECT(&s->soc), "secure", s->secure, @@ -275,6 +280,7 @@ static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data) mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS; mc->default_ram_id = "ddr-ram"; + machine_add_audiodev_property(mc); object_class_property_add_bool(oc, "secure", zcu102_get_secure, zcu102_set_secure); object_class_property_set_description(oc, "secure", diff --git a/hw/arm/z2.c b/hw/arm/z2.c index dc25304290a..d9a08fa67b2 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -27,6 +27,7 @@ #include "exec/address-spaces.h" #include "cpu.h" #include "qom/object.h" +#include "qapi/error.h" #ifdef DEBUG_Z2 #define DPRINTF(fmt, ...) \ @@ -307,6 +308,7 @@ static void z2_init(MachineState *machine) void *z2_lcd; I2CBus *bus; DeviceState *wm; + I2CSlave *i2c_dev; /* Setup CPU & memory */ mpu = pxa270_init(z2_binfo.ram_size, machine->cpu_type); @@ -328,8 +330,17 @@ static void z2_init(MachineState *machine) type_register_static(&aer915_info); z2_lcd = ssi_create_peripheral(mpu->ssp[1], TYPE_ZIPIT_LCD); bus = pxa2xx_i2c_bus(mpu->i2c[0]); + i2c_slave_create_simple(bus, TYPE_AER915, 0x55); - wm = DEVICE(i2c_slave_create_simple(bus, TYPE_WM8750, 0x1b)); + + i2c_dev = i2c_slave_new(TYPE_WM8750, 0x1b); + wm = DEVICE(i2c_dev); + + if (machine->audiodev) { + qdev_prop_set_string(wm, "audiodev", machine->audiodev); + } + i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort); + mpu->i2s->opaque = wm; mpu->i2s->codec_out = wm8750_dac_dat; mpu->i2s->codec_in = wm8750_adc_dat; @@ -348,6 +359,8 @@ static void z2_machine_init(MachineClass *mc) mc->init = z2_init; mc->ignore_memory_transaction_failures = true; mc->default_cpu_type = ARM_CPU_TYPE_NAME("pxa270-c5"); + + machine_add_audiodev_property(mc); } DEFINE_MACHINE("z2", z2_machine_init) diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index f568759e05a..e7960a50696 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -27,6 +27,7 @@ #include "sysemu/reset.h" #include "ui/console.h" #include "hw/arm/omap.h" /* For I2SCodec */ +#include "hw/boards.h" /* for current_machine */ #include "hw/input/tsc2xxx.h" #include "hw/irq.h" #include "migration/vmstate.h" @@ -1097,6 +1098,10 @@ static void tsc210x_init(TSC210xState *s, qemu_add_mouse_event_handler(tsc210x_touchscreen_event, s, 1, name); + if (current_machine->audiodev) { + s->card.name = g_strdup(current_machine->audiodev); + s->card.state = audio_state_by_name(s->card.name, &error_fatal); + } AUD_register_card(s->name, &s->card); qemu_register_reset((void *) tsc210x_reset, s); From patchwork Tue Oct 3 08:30:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fVabOoRt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B0j3Cdfz1yng for ; Tue, 3 Oct 2023 19:33:09 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaob-000349-An; Tue, 03 Oct 2023 04:31:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoV-0002lA-N7 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoU-0000Lo-7H for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5QcmQw2PVuW7Kd2iuNxUNyWZSEU9TNIASS3C9a1HLJI=; b=fVabOoRt2rpkUU7ANpzpRBfhoav7h7aSyh4N/7VqKKQHEXCxxMYufioJirpxjxoKz4F+C1 32Q4C9aCkMY7Bnl247xEfGIQEtbvm/AsNkINBIv3ZLvB4JP0mB1b8ExSaTFLunoR0E5Jco CRgAtyJUQtjJXvCx1EGKRY9SteG2FI8= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-HzC8gvuuOaa4CZ8-fjLVlw-1; Tue, 03 Oct 2023 04:31:28 -0400 X-MC-Unique: HzC8gvuuOaa4CZ8-fjLVlw-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-533f8bc82a8so513673a12.0 for ; Tue, 03 Oct 2023 01:31:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321887; x=1696926687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5QcmQw2PVuW7Kd2iuNxUNyWZSEU9TNIASS3C9a1HLJI=; b=S+ZGLUJ/meSQ4YRFinyLoV0iD3jVbyHcFk9/K6ZWvRk4N5r7Euq5JgmRJUYPICE4g5 l1u4CSnLLpCtZcdYk/2d7gIxiMcGBKb4G3NRS1zvE8aBjcQLuef8BN9dZ+26fNUHXO5W PUuxFha4fehRxoZvRCUKUqzlA05/ZDwhY/z7z3Gus8vjznT7HoPaObUwZUQLwd7rof/a VWasnCXAtvRl2VJQ1/6Z18P+VgskevhS5/2VDOwcrkI9eFgnibJf8iryZpLchiBmryv9 370TDFsgRXefu39ElrLaejYm1MuQWNyR/6WSJ5ctvBBHAMPmZnoRdldS3vDglArvvHDQ ZF3g== X-Gm-Message-State: AOJu0Yyv9Doupr7k3/UyqPWurXwAmIm5KaS+Yf0qbNuaRb/7DylNUye0 glYIxLU23S6ErqA8zfR0qIDb97Uf1t5v79xHDw6EZpjXwcpg1vd7N8tad0GjW/17dAxauv1nEVL PQg8GqtAxO7wbNhx/LP1TUxoH2OgHtz+reHIeP1f6QmYkruMw7cYzWnjKiDw7ACx6j8bYTnevv6 8= X-Received: by 2002:aa7:df07:0:b0:530:8897:f0e9 with SMTP id c7-20020aa7df07000000b005308897f0e9mr12064502edy.21.1696321886821; Tue, 03 Oct 2023 01:31:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnm7J/8v1HPrvbaO1MZHgS0def4es6X79LnW230e1dSnVOBS8dhR+kHPIRNWz89MosYOox2g== X-Received: by 2002:aa7:df07:0:b0:530:8897:f0e9 with SMTP id c7-20020aa7df07000000b005308897f0e9mr12064482edy.21.1696321886481; Tue, 03 Oct 2023 01:31:26 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id k25-20020aa7c399000000b005342fa19070sm489389edq.89.2023.10.03.01.31.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Martin Kletzander Subject: [PULL 21/24] hw/ppc: Support machine-default audiodev with fallback Date: Tue, 3 Oct 2023 10:30:38 +0200 Message-ID: <20231003083042.110065-22-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Martin Kletzander Signed-off-by: Martin Kletzander Signed-off-by: Paolo Bonzini --- hw/ppc/prep.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index f6fd35fcb9e..137276bcb92 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -45,6 +45,7 @@ #include "trace.h" #include "elf.h" #include "qemu/units.h" +#include "audio/audio.h" /* SMP is not enabled, for now */ #define MAX_CPUS 1 @@ -310,6 +311,10 @@ static void ibm_40p_init(MachineState *machine) dev = DEVICE(isa_dev); qdev_prop_set_uint32(dev, "iobase", 0x830); qdev_prop_set_uint32(dev, "irq", 10); + + if (machine->audiodev) { + qdev_prop_set_string(dev, "audiodev", machine->audiodev); + } isa_realize_and_unref(isa_dev, isa_bus, &error_fatal); isa_dev = isa_new("pc87312"); @@ -426,6 +431,8 @@ static void ibm_40p_machine_init(MachineClass *mc) mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("604"); mc->default_display = "std"; mc->default_nic = "pcnet"; + + machine_add_audiodev_property(mc); } DEFINE_MACHINE("40p", ibm_40p_machine_init) From patchwork Tue Oct 3 08:30:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XWxqW32y; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B5559pwz1yph for ; Tue, 3 Oct 2023 19:36:57 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoy-0003yC-8d; Tue, 03 Oct 2023 04:32:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoZ-000314-Bj for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoW-0000Nc-JA for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z5jMXh0AgvMSbbzSsPF24dLhbhVyf2VnDuH5Ua++icY=; b=XWxqW32ydpaaohk8CQBDDNlELFFmu222tH6lYm2CmjsrxJIs3iOgSdmHpfLyBXfrK7raC7 ZHXBWsbVuprHICqPcnem0WtL/r+D0Re7Y0cp7Nmw/K2ingm2HdrzBaUiAdv7+9zE8OEpvz HAC5yJ0FxEYLTFYPml6Egoq5LJVD4DQ= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-73-AhUAXkYDPne3x3RBV6QYWA-1; Tue, 03 Oct 2023 04:31:30 -0400 X-MC-Unique: AhUAXkYDPne3x3RBV6QYWA-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-99bebfada8cso50596466b.1 for ; Tue, 03 Oct 2023 01:31:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321888; x=1696926688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z5jMXh0AgvMSbbzSsPF24dLhbhVyf2VnDuH5Ua++icY=; b=hg0LNUmJ8gJqC9JG4Eb5xbDuVUQeE7+q9cYgq5QBpO3iuNWgoCHq82z+HksNashZRg tlERw8sdhBep8Sx9iKZutg+JbC6Lyzo6sd0V/pAJ1Zgu0xsWYOqkCOY2ZPSLhsKqbw7O VnnZKC6ySKFd6jqhvw1HyU94fcYR2dvp1qRtMZjg1rIqZU6xVEpXaB9XNELQTnavuBtS zzPaFP2WieH//VgdCCmDuwx7hfdZpqC3ONvMBiqKt2oVzmwrmgw9CtW6/9UrbA3cwX4Q dFPQN3vhWZW+aAiiAMF2zSlktFEg3P3KbGA1vFaF96RsZ3UYzEfRyTGrR6LTk1Lhpe9D s97A== X-Gm-Message-State: AOJu0Yy/EdFifyJqUY+oQ2tpZV+67I1YkSLBNW8n/pmm3zd5icsXp3d9 y/VUVyb4CvP9ZUYLFc8eZp7CJ0/39D4zYY97TLIk9haVYLkkbfaX0rQDaKKSwbOxmWvLlJoa/3x tI8/RFBvlC47BrnfkL4D73DxK7ZVavsFzBsEGJJ952++w61i1GwtWqac48WUDsH43PmvUjJFJRC M= X-Received: by 2002:a17:906:7695:b0:9ae:3d7b:6f46 with SMTP id o21-20020a170906769500b009ae3d7b6f46mr11298965ejm.46.1696321888657; Tue, 03 Oct 2023 01:31:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgHQznhIS9GgZfwcFvhwJJDni0dFO2xh502EAOKDWQ19ugQg2AshyDiHpbTyvW32Ii5K7hnw== X-Received: by 2002:a17:906:7695:b0:9ae:3d7b:6f46 with SMTP id o21-20020a170906769500b009ae3d7b6f46mr11298951ejm.46.1696321888310; Tue, 03 Oct 2023 01:31:28 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id r19-20020a170906365300b009a2235ed496sm662717ejb.141.2023.10.03.01.31.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 22/24] vt82c686 machines: Support machine-default audiodev with fallback Date: Tue, 3 Oct 2023 10:30:39 +0200 Message-ID: <20231003083042.110065-23-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Paolo Bonzini --- hw/mips/fuloong2e.c | 15 ++++++++++++--- hw/ppc/pegasos2.c | 12 ++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index c827f615f3b..c6109633fee 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -295,9 +295,17 @@ static void mips_fuloong2e_init(MachineState *machine) pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); /* South bridge -> IP5 */ - pci_dev = pci_create_simple_multifunction(pci_bus, - PCI_DEVFN(FULOONG2E_VIA_SLOT, 0), - TYPE_VT82C686B_ISA); + pci_dev = pci_new_multifunction(PCI_DEVFN(FULOONG2E_VIA_SLOT, 0), + TYPE_VT82C686B_ISA); + + /* Set properties on individual devices before realizing the south bridge */ + if (machine->audiodev) { + dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ac97")); + qdev_prop_set_string(dev, "audiodev", machine->audiodev); + } + + pci_realize_and_unref(pci_dev, pci_bus, &error_abort); + object_property_add_alias(OBJECT(machine), "rtc-time", object_resolve_path_component(OBJECT(pci_dev), "rtc"), @@ -337,6 +345,7 @@ static void mips_fuloong2e_machine_init(MachineClass *mc) mc->default_ram_size = 256 * MiB; mc->default_ram_id = "fuloong2e.ram"; mc->minimum_page_bits = 14; + machine_add_audiodev_property(mc); } DEFINE_MACHINE("fuloong2e", mips_fuloong2e_machine_init) diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index bd397cf2b5c..3203a4a7289 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -180,8 +180,15 @@ static void pegasos2_init(MachineState *machine) pci_bus_irqs(pci_bus, pegasos2_pci_irq, pm, PCI_NUM_PINS); /* VIA VT8231 South Bridge (multifunction PCI device) */ - via = OBJECT(pci_create_simple_multifunction(pci_bus, PCI_DEVFN(12, 0), - TYPE_VT8231_ISA)); + via = OBJECT(pci_new_multifunction(PCI_DEVFN(12, 0), TYPE_VT8231_ISA)); + + /* Set properties on individual devices before realizing the south bridge */ + if (machine->audiodev) { + dev = PCI_DEVICE(object_resolve_path_component(via, "ac97")); + qdev_prop_set_string(DEVICE(dev), "audiodev", machine->audiodev); + } + + pci_realize_and_unref(PCI_DEVICE(via), pci_bus, &error_abort); for (i = 0; i < PCI_NUM_PINS; i++) { pm->via_pirq[i] = qdev_get_gpio_in_named(DEVICE(via), "pirq", i); } @@ -556,6 +563,7 @@ static void pegasos2_machine_class_init(ObjectClass *oc, void *data) mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("7457_v1.2"); mc->default_ram_id = "pegasos2.ram"; mc->default_ram_size = 512 * MiB; + machine_add_audiodev_property(mc); vhc->cpu_in_nested = pegasos2_cpu_in_nested; vhc->hypercall = pegasos2_hypercall; From patchwork Tue Oct 3 08:30:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842513 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eEAh2H2S; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B342gNjz1yph for ; Tue, 3 Oct 2023 19:35:12 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnapL-0004sG-C2; Tue, 03 Oct 2023 04:32:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaob-00038A-HR for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaoY-0000ON-VY for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U5tBSULoyUh3MOQSGkOSKpnFNoNW+PF5NawtxjfSwPU=; b=eEAh2H2SVQhigannzt3zZqzo89/upNA1NIUt4LC8QVYEGLFRXRGPK8m6ujbb3r4qdNnEMQ ZbMj5UyBPgQ4813KAFVmkZVjbrSQ89FT9XqIIDY7Tmr5NTdufsoHVMBvEDy99I/Sau5up6 7wv/WewthxHmNp8E+iQjgmxkMDI53Xo= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-231-rhSwy28lMiyikR2IdQmsqQ-1; Tue, 03 Oct 2023 04:31:32 -0400 X-MC-Unique: rhSwy28lMiyikR2IdQmsqQ-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-94f7a2b21fdso49397466b.2 for ; Tue, 03 Oct 2023 01:31:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321890; x=1696926690; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U5tBSULoyUh3MOQSGkOSKpnFNoNW+PF5NawtxjfSwPU=; b=JIScMv54oBZmbukwp8HbfjuoCjWppi39H76uxo00E9EP0InFWUhm9QUBJgx7FXzbLY 0slOcZP2KL8LKl9U6Abwe4RYFFBdSKqh+0hOsjyXlYWhSx7ayn1uLt8DnjP+4P+ksXbN Nf/q03oDuJNkGEvB+7OFbqhtJnspGqF1K63cpVRHay6C5c6iaWiNmzDx7K9qnI2V/RDE OHldYFI3gBWDx41EnurGvAf2XkymVtG7yc4BOBHQG/rIBATSFjd7QOLK02iTlDn876JN pWIOUYFr9J3AIMBs7Ox9uDXMOjaWg0bIrc2jvIig0qPjmuJmWWxo78kuAtVxGF6SEZnF N3iw== X-Gm-Message-State: AOJu0YyKgSbZ6ghIaCTxV4x4tmdvUBE8jeIuxzxoomUjBbGcp1hdPYLt JT9qUs6oDbUMmyAXYLs9tBEabRAWraR47VF8tPn6a+BkjXJQgjrj7EQmPR4hFUHxg5fJiRzX6Sn tugUVKTCbD5RFKfZ6sCvQifUPfphINj1m6UQoEvjj3Q2Q4q74yCs5iKK0gIUJt/4gzeV/YLVdgq M= X-Received: by 2002:a17:906:53d9:b0:9ae:7611:99bb with SMTP id p25-20020a17090653d900b009ae761199bbmr13338867ejo.59.1696321890618; Tue, 03 Oct 2023 01:31:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFq2EflKZlDI9rNf45LwXcZUUWMbPxG2im2GhxebTXkGKggicLJQ7OmygWvvuq6kf0uJv4hCA== X-Received: by 2002:a17:906:53d9:b0:9ae:7611:99bb with SMTP id p25-20020a17090653d900b009ae761199bbmr13338850ejo.59.1696321890221; Tue, 03 Oct 2023 01:31:30 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id j6-20020a170906410600b009ad8acac02asm663791ejk.172.2023.10.03.01.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Martin Kletzander Subject: [PULL 23/24] audio: propagate Error * out of audio_init Date: Tue, 3 Oct 2023 10:30:40 +0200 Message-ID: <20231003083042.110065-24-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Martin Kletzander Starting from audio_driver_init, propagate errors via Error ** so that audio_init_audiodevs can simply pass &error_fatal, and AUD_register_card can signal faiure. Signed-off-by: Martin Kletzander [Reworked the audio/audio.c parts, while keeping Martin's hw/ changes. - Paolo] Signed-off-by: Paolo Bonzini --- audio/audio.c | 37 ++++++++++++++++++------------------- audio/audio.h | 4 ++-- hw/arm/omap2.c | 2 +- hw/audio/ac97.c | 6 +++++- hw/audio/adlib.c | 6 ++++-- hw/audio/cs4231a.c | 6 ++++-- hw/audio/es1370.c | 5 ++++- hw/audio/gus.c | 6 ++++-- hw/audio/hda-codec.c | 5 ++++- hw/audio/lm4549.c | 8 +++++--- hw/audio/pcspk.c | 4 +--- hw/audio/sb16.c | 6 ++++-- hw/audio/via-ac97.c | 6 ++++-- hw/audio/wm8750.c | 5 ++++- hw/display/xlnx_dp.c | 6 ++++-- hw/input/tsc210x.c | 2 +- hw/usb/dev-audio.c | 5 ++++- softmmu/vl.c | 4 +--- 18 files changed, 74 insertions(+), 49 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 818d79e50f0..4289b7bf028 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1556,7 +1556,7 @@ size_t audio_generic_read(HWVoiceIn *hw, void *buf, size_t size) } static int audio_driver_init(AudioState *s, struct audio_driver *drv, - bool msg, Audiodev *dev) + Audiodev *dev, Error **errp) { Error *local_err = NULL; @@ -1577,12 +1577,10 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv, s->drv = drv; return 0; } else { - if (!msg) { - error_free(local_err); - } else if (local_err) { - error_report_err(local_err); + if (local_err) { + error_propagate(errp, local_err); } else { - error_report("Could not init `%s' audio driver", drv->name); + error_setg(errp, "Could not init `%s' audio driver", drv->name); } return -1; } @@ -1733,7 +1731,7 @@ static void audio_create_default_audiodevs(void) * if dev == NULL => legacy implicit initialization, return the already created * state or create a new one */ -static AudioState *audio_init(Audiodev *dev) +static AudioState *audio_init(Audiodev *dev, Error **errp) { static bool atexit_registered; int done = 0; @@ -1760,9 +1758,9 @@ static AudioState *audio_init(Audiodev *dev) drvname = AudiodevDriver_str(dev->driver); driver = audio_driver_lookup(drvname); if (driver) { - done = !audio_driver_init(s, driver, true, dev); + done = !audio_driver_init(s, driver, dev, errp); } else { - dolog ("Unknown audio driver `%s'\n", drvname); + error_setg(errp, "Unknown audio driver `%s'\n", drvname); } if (!done) { goto out; @@ -1771,13 +1769,13 @@ static AudioState *audio_init(Audiodev *dev) for (;;) { AudiodevListEntry *e = QSIMPLEQ_FIRST(&default_audiodevs); if (!e) { - dolog("no default audio driver available\n"); + error_setg(errp, "no default audio driver available"); goto out; } s->dev = dev = e->dev; drvname = AudiodevDriver_str(dev->driver); driver = audio_driver_lookup(drvname); - if (!audio_driver_init(s, driver, false, dev)) { + if (!audio_driver_init(s, driver, dev, NULL)) { break; } QSIMPLEQ_REMOVE_HEAD(&default_audiodevs, next); @@ -1806,7 +1804,7 @@ out: return NULL; } -void AUD_register_card (const char *name, QEMUSoundCard *card) +bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp) { if (!card->state) { if (!QTAILQ_EMPTY(&audio_states)) { @@ -1820,13 +1818,18 @@ void AUD_register_card (const char *name, QEMUSoundCard *card) if (QSIMPLEQ_EMPTY(&default_audiodevs)) { audio_create_default_audiodevs(); } - card->state = audio_init(NULL); + card->state = audio_init(NULL, errp); + if (!card->state) { + return false; + } } } card->name = g_strdup (name); memset (&card->entries, 0, sizeof (card->entries)); QLIST_INSERT_HEAD(&card->state->card_head, card, entries); + + return true; } void AUD_remove_card (QEMUSoundCard *card) @@ -2153,17 +2156,13 @@ void audio_define(Audiodev *dev) QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next); } -bool audio_init_audiodevs(void) +void audio_init_audiodevs(void) { AudiodevListEntry *e; QSIMPLEQ_FOREACH(e, &audiodevs, next) { - if (!audio_init(e->dev)) { - return false; - } + audio_init(e->dev, &error_fatal); } - - return true; } audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo) diff --git a/audio/audio.h b/audio/audio.h index 34df8962a66..80f3f92124d 100644 --- a/audio/audio.h +++ b/audio/audio.h @@ -94,7 +94,7 @@ typedef struct QEMUAudioTimeStamp { void AUD_vlog (const char *cap, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); void AUD_log (const char *cap, const char *fmt, ...) G_GNUC_PRINTF(2, 3); -void AUD_register_card (const char *name, QEMUSoundCard *card); +bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp); void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture( AudioState *s, @@ -170,7 +170,7 @@ void audio_sample_from_uint64(void *samples, int pos, void audio_define(Audiodev *audio); void audio_parse_option(const char *opt); -bool audio_init_audiodevs(void); +void audio_init_audiodevs(void); void audio_help(void); AudioState *audio_state_by_name(const char *name, Error **errp); diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c index 41b1f596dca..f170728e7ec 100644 --- a/hw/arm/omap2.c +++ b/hw/arm/omap2.c @@ -614,7 +614,7 @@ static struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta, s->codec.card.name = g_strdup(current_machine->audiodev); s->codec.card.state = audio_state_by_name(s->codec.card.name, &error_fatal); } - AUD_register_card("OMAP EAC", &s->codec.card); + AUD_register_card("OMAP EAC", &s->codec.card, &error_fatal); memory_region_init_io(&s->iomem, NULL, &omap_eac_ops, s, "omap.eac", omap_l4_region_size(ta, 0)); diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index c2a5ce062a1..6a7a2dc80c4 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -1273,6 +1273,10 @@ static void ac97_realize(PCIDevice *dev, Error **errp) AC97LinkState *s = AC97(dev); uint8_t *c = s->dev.config; + if (!AUD_register_card ("ac97", &s->card, errp)) { + return; + } + /* TODO: no need to override */ c[PCI_COMMAND] = 0x00; /* pcicmd pci command rw, ro */ c[PCI_COMMAND + 1] = 0x00; @@ -1306,7 +1310,7 @@ static void ac97_realize(PCIDevice *dev, Error **errp) "ac97-nabm", 256); pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nam); pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->io_nabm); - AUD_register_card("ac97", &s->card); + ac97_on_reset(DEVICE(s)); } diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c index 5f979b1487d..bd73806d83a 100644 --- a/hw/audio/adlib.c +++ b/hw/audio/adlib.c @@ -255,6 +255,10 @@ static void adlib_realizefn (DeviceState *dev, Error **errp) AdlibState *s = ADLIB(dev); struct audsettings as; + if (!AUD_register_card ("adlib", &s->card, errp)) { + return; + } + s->opl = OPLCreate (3579545, s->freq); if (!s->opl) { error_setg (errp, "OPLCreate %d failed", s->freq); @@ -270,8 +274,6 @@ static void adlib_realizefn (DeviceState *dev, Error **errp) as.fmt = AUDIO_FORMAT_S16; as.endianness = AUDIO_HOST_ENDIANNESS; - AUD_register_card ("adlib", &s->card); - s->voice = AUD_open_out ( &s->card, s->voice, diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c index 5c6d6437320..3aa105748d3 100644 --- a/hw/audio/cs4231a.c +++ b/hw/audio/cs4231a.c @@ -678,13 +678,15 @@ static void cs4231a_realizefn (DeviceState *dev, Error **errp) return; } + if (!AUD_register_card ("cs4231a", &s->card, errp)) { + return; + } + s->pic = isa_bus_get_irq(bus, s->irq); k = ISADMA_GET_CLASS(s->isa_dma); k->register_channel(s->isa_dma, s->dma, cs_dma_read, s); isa_register_ioport (d, &s->ioports, s->port); - - AUD_register_card ("cs4231a", &s->card); } static Property cs4231a_properties[] = { diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c index 4f738a0ad88..90f73d4c23d 100644 --- a/hw/audio/es1370.c +++ b/hw/audio/es1370.c @@ -853,6 +853,10 @@ static void es1370_realize(PCIDevice *dev, Error **errp) ES1370State *s = ES1370(dev); uint8_t *c = s->dev.config; + if (!AUD_register_card ("es1370", &s->card, errp)) { + return; + } + c[PCI_STATUS + 1] = PCI_STATUS_DEVSEL_SLOW >> 8; #if 0 @@ -868,7 +872,6 @@ static void es1370_realize(PCIDevice *dev, Error **errp) memory_region_init_io (&s->io, OBJECT(s), &es1370_io_ops, s, "es1370", 256); pci_register_bar (&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io); - AUD_register_card ("es1370", &s->card); es1370_reset (s); } diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 787345ce543..6c2b586ca71 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -241,14 +241,16 @@ static void gus_realizefn (DeviceState *dev, Error **errp) IsaDmaClass *k; struct audsettings as; + if (!AUD_register_card ("gus", &s->card, errp)) { + return; + } + s->isa_dma = isa_bus_get_dma(bus, s->emu.gusdma); if (!s->isa_dma) { error_setg(errp, "ISA controller does not support DMA"); return; } - AUD_register_card ("gus", &s->card); - as.freq = s->freq; as.nchannels = 2; as.fmt = AUDIO_FORMAT_S16; diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index a26048cf15e..b9ad1f4c39e 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -685,11 +685,14 @@ static void hda_audio_init(HDACodecDevice *hda, const desc_param *param; uint32_t i, type; + if (!AUD_register_card("hda", &a->card, errp)) { + return; + } + a->desc = desc; a->name = object_get_typename(OBJECT(a)); dprint(a, 1, "%s: cad %d\n", __func__, a->hda.cad); - AUD_register_card("hda", &a->card); for (i = 0; i < a->desc->nnodes; i++) { node = a->desc->nodes + i; param = hda_codec_find_param(node, AC_PAR_AUDIO_WIDGET_CAP); diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c index 418041bc9c6..e7bfcc4b9fe 100644 --- a/hw/audio/lm4549.c +++ b/hw/audio/lm4549.c @@ -281,6 +281,11 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_req_cb, void* opaque, { struct audsettings as; + /* Register an audio card */ + if (!AUD_register_card("lm4549", &s->card, errp)) { + return; + } + /* Store the callback and opaque pointer */ s->data_req_cb = data_req_cb; s->opaque = opaque; @@ -288,9 +293,6 @@ void lm4549_init(lm4549_state *s, lm4549_callback data_req_cb, void* opaque, /* Init the registers */ lm4549_reset(s); - /* Register an audio card */ - AUD_register_card("lm4549", &s->card); - /* Open a default voice */ as.freq = 48000; as.nchannels = 2; diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index daf92a4ce11..fe7f07ced21 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -123,8 +123,6 @@ static int pcspk_audio_init(PCSpkState *s) return 0; } - AUD_register_card(s_spk, &s->card); - s->voice = AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback, &as); if (!s->voice) { AUD_log(s_spk, "Could not open voice\n"); @@ -191,7 +189,7 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp) isa_register_ioport(isadev, &s->ioport, s->iobase); - if (s->card.state) { + if (s->card.state && AUD_register_card(s_spk, &s->card, errp)) { pcspk_audio_init(s); } diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index 535ccccdc98..18f6d252db3 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -1402,6 +1402,10 @@ static void sb16_realizefn (DeviceState *dev, Error **errp) SB16State *s = SB16 (dev); IsaDmaClass *k; + if (!AUD_register_card ("sb16", &s->card, errp)) { + return; + } + s->isa_hdma = isa_bus_get_dma(bus, s->hdma); s->isa_dma = isa_bus_get_dma(bus, s->dma); if (!s->isa_dma || !s->isa_hdma) { @@ -1434,8 +1438,6 @@ static void sb16_realizefn (DeviceState *dev, Error **errp) k->register_channel(s->isa_dma, s->dma, SB_read_DMA, s); s->can_write = 1; - - AUD_register_card ("sb16", &s->card); } static Property sb16_properties[] = { diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c index 676254b7a40..30095a4c7aa 100644 --- a/hw/audio/via-ac97.c +++ b/hw/audio/via-ac97.c @@ -426,6 +426,10 @@ static void via_ac97_realize(PCIDevice *pci_dev, Error **errp) ViaAC97State *s = VIA_AC97(pci_dev); Object *o = OBJECT(s); + if (!AUD_register_card ("via-ac97", &s->card, errp)) { + return; + } + /* * Command register Bus Master bit is documented to be fixed at 0 but it's * needed for PCI DMA to work in QEMU. The pegasos2 firmware writes 0 here @@ -445,8 +449,6 @@ static void via_ac97_realize(PCIDevice *pci_dev, Error **errp) pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_IO, &s->fm); memory_region_init_io(&s->midi, o, &midi_ops, s, "via-ac97.midi", 4); pci_register_bar(pci_dev, 2, PCI_BASE_ADDRESS_SPACE_IO, &s->midi); - - AUD_register_card ("via-ac97", &s->card); } static void via_ac97_exit(PCIDevice *dev) diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c index b5722b37c36..57954a63144 100644 --- a/hw/audio/wm8750.c +++ b/hw/audio/wm8750.c @@ -624,7 +624,10 @@ static void wm8750_realize(DeviceState *dev, Error **errp) { WM8750State *s = WM8750(dev); - AUD_register_card(CODEC, &s->card); + if (!AUD_register_card(CODEC, &s->card, errp)) { + return; + } + wm8750_reset(I2C_SLAVE(s)); } diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index 341e91e886f..eee8f33a584 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -1302,6 +1302,10 @@ static void xlnx_dp_realize(DeviceState *dev, Error **errp) DisplaySurface *surface; struct audsettings as; + if (!AUD_register_card("xlnx_dp.audio", &s->aud_card, errp)) { + return; + } + aux_bus_realize(s->aux_bus); qdev_realize(DEVICE(s->dpcd), BUS(s->aux_bus), &error_fatal); @@ -1320,8 +1324,6 @@ static void xlnx_dp_realize(DeviceState *dev, Error **errp) as.fmt = AUDIO_FORMAT_S16; as.endianness = 0; - AUD_register_card("xlnx_dp.audio", &s->aud_card); - s->amixer_output_stream = AUD_open_out(&s->aud_card, s->amixer_output_stream, "xlnx_dp.audio.out", diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index e7960a50696..950506fb382 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -1102,7 +1102,7 @@ static void tsc210x_init(TSC210xState *s, s->card.name = g_strdup(current_machine->audiodev); s->card.state = audio_state_by_name(s->card.name, &error_fatal); } - AUD_register_card(s->name, &s->card); + AUD_register_card(s->name, &s->card, &error_fatal); qemu_register_reset((void *) tsc210x_reset, s); vmstate_register(NULL, 0, vmsd, s); diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 8748c1ba040..d5ac1f8962e 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -944,12 +944,15 @@ static void usb_audio_realize(USBDevice *dev, Error **errp) USBAudioState *s = USB_AUDIO(dev); int i; + if (!AUD_register_card(TYPE_USB_AUDIO, &s->card, errp)) { + return; + } + dev->usb_desc = s->multi ? &desc_audio_multi : &desc_audio; usb_desc_create_serial(dev); usb_desc_init(dev); s->dev.opaque = s; - AUD_register_card(TYPE_USB_AUDIO, &s->card); s->out.altset = ALTSET_OFF; s->out.vol.mute = false; diff --git a/softmmu/vl.c b/softmmu/vl.c index cafb1a98427..98e071e63bb 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -1962,9 +1962,7 @@ static void qemu_create_early_backends(void) * setting machine properties, so they can be referred to. */ configure_blockdev(&bdo_queue, machine_class, snapshot); - if (!audio_init_audiodevs()) { - exit(1); - } + audio_init_audiodevs(); } From patchwork Tue Oct 3 08:30:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1842517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FbHnJ9H2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S0B516kxkz1yph for ; Tue, 3 Oct 2023 19:36:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnaoy-0003xW-8c; Tue, 03 Oct 2023 04:32:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaor-0003lO-Lk for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.145.221.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnaop-0000Qo-G1 for qemu-devel@nongnu.org; Tue, 03 Oct 2023 04:31:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696321910; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TUsBw7Kt7G+GqYe51WoV2cEtrfFekkw/Aub/QiRVm0s=; b=FbHnJ9H21vqjoleq/3z3FaUv6mPIjzdL+IM6epM9X0eGb1e7uW0RoKDaTiA5sEuwGGA0p1 3hot951H0BxGvxV185H8QB8mWnqoSEaGs8h+ZP+N3dY7niHyIbLWrMJnPncYX1f7C/QUap 9Pd3WaYMdFjsxNvSgJPal5p4WRI1g4E= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-vRaCZVsfOH2kwQvhIe_Lug-1; Tue, 03 Oct 2023 04:31:34 -0400 X-MC-Unique: vRaCZVsfOH2kwQvhIe_Lug-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9aa20a75780so51867166b.2 for ; Tue, 03 Oct 2023 01:31:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696321892; x=1696926692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TUsBw7Kt7G+GqYe51WoV2cEtrfFekkw/Aub/QiRVm0s=; b=lg7JXmIAvDpyYEirCZENIJjFZJjdVJNehSqKvK7NrymDkZyPDPT6k+t6Ydl2fn2fgL 1ae73bpBHqwbxe3H3zMWX4uKV06+yETDeVLfSq4yKIezH6yCRBRsoPfXSXQVoFDvVlXk 000vg4oziSem9UJGkWzW4MXbjaEldxWLnHSCxpx7nnvkcs+YwIWH2HT+zVrbdcITUIPr Jt4bbfrVWK8931z4WS4WVZPqgRkU/ndseCOv2UjPbo3mBrFkZP3OcbuAe8N50ASEr025 wbNZzHBqzKnsaWNy2XSvp71d114B8H9FFBgjkm7AKiX8XfHRQgem/9TzmMPfFeh8FtO9 ljFw== X-Gm-Message-State: AOJu0Yx5Ab52EhOCYERiiJeQTK33d8EQdWQsbIDK1iXvX1knIQwCGcRS rFR0JH595rGaPEEOAP5Vy01K/z3gtz83G9klKLdFZFuCcTANR2ka941l0o6vOVgVJyKr0FWTOLK bxLkNY5aLjek4hcADvT0OfOSQEm5VCRhIKfQB6h2Qh11/wnTPAYtKhqZplthKk99i+r5bbAozcY w= X-Received: by 2002:a17:906:53ca:b0:9b2:8df4:f2cd with SMTP id p10-20020a17090653ca00b009b28df4f2cdmr13563578ejo.18.1696321892687; Tue, 03 Oct 2023 01:31:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEE5jtuibSwzADlm6WMDS0l2IshzEWRllefinMbGTkmaE7Ye/owA2izqeeV61Vqpco545AfMQ== X-Received: by 2002:a17:906:53ca:b0:9b2:8df4:f2cd with SMTP id p10-20020a17090653ca00b009b28df4f2cdmr13563567ejo.18.1696321892417; Tue, 03 Oct 2023 01:31:32 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.gmail.com with ESMTPSA id t18-20020a170906065200b0099bca8b9a31sm654596ejb.100.2023.10.03.01.31.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:31:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 24/24] audio: forbid default audiodev backend with -nodefaults Date: Tue, 3 Oct 2023 10:30:41 +0200 Message-ID: <20231003083042.110065-25-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231003083042.110065-1-pbonzini@redhat.com> References: <20231003083042.110065-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.145.221.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that all callers support setting an audiodev, forbid using the default audiodev if -nodefaults is provided on the command line. Signed-off-by: Paolo Bonzini --- audio/audio.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/audio/audio.c b/audio/audio.c index 4289b7bf028..730bf2498dc 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1692,6 +1692,10 @@ static void audio_create_default_audiodevs(void) { const char *drvname = getenv("QEMU_AUDIO_DRV"); + if (!defaults_enabled()) { + return; + } + /* QEMU_AUDIO_DRV=none is used by libqtest. */ if (drvname && !g_str_equal(drvname, "none")) { error_report("Please use -audiodev instead of QEMU_AUDIO_*"); @@ -1808,6 +1812,14 @@ bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp) { if (!card->state) { if (!QTAILQ_EMPTY(&audio_states)) { + /* + * FIXME: once it is possible to create an arbitrary + * default device via -audio DRIVER,OPT=VALUE (no "model"), + * replace this special case with the default AudioState*, + * storing it in a separate global. For now, keep the + * warning to encourage moving off magic use of the first + * -audiodev. + */ if (QSIMPLEQ_EMPTY(&default_audiodevs)) { dolog("Device %s: audiodev default parameter is deprecated, please " "specify audiodev=%s\n", name, @@ -1820,6 +1832,10 @@ bool AUD_register_card (const char *name, QEMUSoundCard *card, Error **errp) } card->state = audio_init(NULL, errp); if (!card->state) { + if (!QSIMPLEQ_EMPTY(&audiodevs)) { + error_append_hint(errp, "Perhaps you wanted to set audiodev=%s?", + QSIMPLEQ_FIRST(&audiodevs)->dev->id); + } return false; } }