From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120313; cv=none; d=zohomail.com; s=zohoarc; b=MPcev4PD3iuOT5YcDEkfd63s/Ey+NcxKgNgMPKtNUaFwmSq6WN8FpeKQ1wZs57qaxj7tjL6aYRZPbBSJbtUsqzXTAJVzj321pbc/ewpNVv1C5wl94nfuc0UAcZ0Fu9dBNdSasLl1GVKbIYhjYJlbXe/jV9UTAoNPrnrfm2uP+zM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120313; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9+vWx3FqtrO6G+H4ty7no9j/6Y8/B4v8DIST+CCoA8U=; b=VdNUk2MKx4hhF+JLOv2OW8fLF60X5Fs2Dbo9PnrJIVMr1mjvaQfJ1kX2tOHWEcVvqpGd/IOSOAmJFjtU7FMzv4nt3HGK5KMT19nEW1O+8qzG2BPoRUW1LmmnLgSzt4AJXibtt2IGW0NOunVjeXX6udwmPbylKSrEijkzEeEmijU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120313231497.2092168663613; Fri, 8 Jan 2021 07:38:33 -0800 (PST) Received: from localhost ([::1]:56328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtqR-000647-SE for importer@patchew.org; Fri, 08 Jan 2021 10:38:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtoS-0004Nu-EK for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:28 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:35885) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoQ-0002pZ-Rv for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:28 -0500 Received: by mail-wr1-x42c.google.com with SMTP id t16so9438236wra.3 for ; Fri, 08 Jan 2021 07:36:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9+vWx3FqtrO6G+H4ty7no9j/6Y8/B4v8DIST+CCoA8U=; b=wTppJBwLhe3wao62eCltjTkNFIwMZfJgdoAkxZL08MB8Uwxr2QJLQM+Ehxx4oDs2dI 7rgkqEMAJBBKj+POVXHEDpjWoy0AaUYbTzMeeWjLfYOP54vS+/W2ioYnLh53GjZUu+z3 fO3+5LbEUrA9MwH5GQV+ItBsthWeR0JP44ufQp+bSRXiHWsvoS3dOEroHQnS6Adu+Kwh TtuhYCb1K88xKL31KC3q1cqeWBpT/po740jxs4XJTiGLutEOx4wbqqe2OLtFM7UTv8O0 Yl5Nimv1/IqWRIKOrjI5eKTLsu31XivPmLin7dM/NU8rxyH/+C4sMn5AWzWSEKhvYU0v 1ybw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9+vWx3FqtrO6G+H4ty7no9j/6Y8/B4v8DIST+CCoA8U=; b=C1a4k9+O5pHwi5MThEiAimsO5bcILTZ+e5ut0d35cAF9OhidY8OAxwZM5ejZA4rUcC WJ16BmENE9F++rLDVA4O9FpFK78EXj1gVh1MCTxRq7qHezaxPopK2SIrg1C7Y+boQ0qC zllJRwjZtv4VjjYzhDQwADwX8q5YESWBFUXReSAyFNqE7PJggH2Ap3sq6RjZZQzuxnBg 1l+xyZONGbJRKXpxCr1POCuNTh3GTfR8ekBLkOysUndq7Hj5iX5up6dWDHzGOUvNySd7 QZJ1+X5v3OHq5n6qUM64WBJXo2+9CT+OzXbkcT0hQJdzK35nvOCmzySK2kU/tjAcTLmp K7/w== X-Gm-Message-State: AOAM530qCz+m8rEkDu6tvPq7YjJhmNN2SACYhoQBjwj/R04G9+/gi2EP sHgBuwANw1GPz60nYppck6yYHa/mcboEVA== X-Google-Smtp-Source: ABdhPJzGyCgAvHx4/ekXEVcHlRi19S/uAKumSxuVy5uJgnpaHnWjTx2MkWy6yhBSUo/pbxNEBNMy/Q== X-Received: by 2002:adf:ee4a:: with SMTP id w10mr4098184wro.81.1610120185000; Fri, 08 Jan 2021 07:36:25 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/23] intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs Date: Fri, 8 Jan 2021 15:35:59 +0000 Message-Id: <20210108153621.3868-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: "Edgar E. Iglesias" Correct the indexing into s->cpu_ctlr for vCPUs. Signed-off-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Luc Michel Message-id: 20201214222154.3480243-2-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell --- hw/intc/arm_gic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index c60dc6b5e6e..af41e2fb448 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -141,6 +141,8 @@ static inline void gic_get_best_virq(GICState *s, int c= pu, static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool vi= rt, int group_mask) { + int cpu_iface =3D virt ? (cpu + GIC_NCPU) : cpu; + if (!virt && !(s->ctlr & group_mask)) { return false; } @@ -149,7 +151,7 @@ static inline bool gic_irq_signaling_enabled(GICState *= s, int cpu, bool virt, return false; } =20 - if (!(s->cpu_ctlr[cpu] & group_mask)) { + if (!(s->cpu_ctlr[cpu_iface] & group_mask)) { return false; } =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120315; cv=none; d=zohomail.com; s=zohoarc; b=QIgTSfUsl0WVwUqXPMo7XMCuzg4+yAfwrKLjOVgcJ6uDNDn3lnDEsq0UK6JPbDkYSIo3Jr6RARNK6kgmn8ZIMeXqVKHOxwkPJ5DtXA45hU1xplH5LKny64HP9W9AYkFKuL5DMVxnGQLs6WfoF5hYGtInasGXelPy/7ONGzoRtAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120315; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jdOk99DwEgR6uV3BnG6e53Xn4wFxnSp+zoQof5hSqoQ=; b=R8LXr3DdVciRY47ePxjeMA4QTUP7hzDLpgjO1Gd1FQCT1sOOZv8rvutw642/b47Ab5uphDCn/gxl2mXn5Zxv+kbe8ROXmeSgf59VYgZSCO1PaELJKjTE2SJlr73OxyD3Db3kybpxwV4jjrLYntgohowIJ/gWsY7686++nnB9uBw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120315951130.78680841941662; Fri, 8 Jan 2021 07:38:35 -0800 (PST) Received: from localhost ([::1]:56626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtqU-0006BB-Hp for importer@patchew.org; Fri, 08 Jan 2021 10:38:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtoV-0004Q8-Ge for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:31 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:46986) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoR-0002pi-Qd for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:31 -0500 Received: by mail-wr1-x436.google.com with SMTP id d13so9366388wrc.13 for ; Fri, 08 Jan 2021 07:36:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jdOk99DwEgR6uV3BnG6e53Xn4wFxnSp+zoQof5hSqoQ=; b=xWFmZslBu2UvkBRQ785jonj6vVxvYTM5Z3gvCvHihW9wQI22ZmylAop47SmGAFmKFw PEBG8OhoYxRDSkAdPOcX6iuWxDegPIJ2XR9UaHlE4Hs/EQDuv9eO3VKMWSkZGw7hHdUo 1IjkJYQiPs9BYZMKQEAX+zsQPORwfxNZy63xE9u53pA/FhjtFKf9mq2H1D7o7KjyoYIU KQ3gALJfWrE4EVxGe71nzKT+dz0X5T8oJgsF4XA/8+nxP0WOldHsfh2EeRye8ciRiUqB qX+bqNhZEUeVhH3HNKwuC14VpN0EJT5kmJ46P7/8VpzB38u//93kWX1tvwF4RZdUd59p z0FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jdOk99DwEgR6uV3BnG6e53Xn4wFxnSp+zoQof5hSqoQ=; b=SYbs+yQPHQIdtD2QFBvBwi6+okqE2OvI+2RTG9S+fVVcUIV2/eQ5tf6a3GIqY4Ub4x XRg/2KLbGjFG+bikdJlKj3AJQwfbM0QxcTpCg5N+wGCIa71MxKqcsjh1uOmBzg66J93w K6A73CC/t48NXJ5KEbOFAQ+djCuo3ooltHS+Wt1lW2MWRSqrTlLnbOM9gBq+R2u52wcJ qG0Wjz9Ge5MTgllOLmfYmorhMJIMz98HY5+AUsmdsrM/RVIVdkndkDFjy9HIpcCHTR12 f1JiGIN3Kr9KiGrWxZt/rrPAGNy/q/ceDOB6WMuDlX5ixUTt4+KnXOHmtrbPwjTxW265 6VmA== X-Gm-Message-State: AOAM5335UCLzd3AOTCSYMHSLtGrJxRw1ixp0d5U51YxIklUqy7fxEvBZ r2DqiuzbOddn6lmNM76jJ9YagePbsJMoFw== X-Google-Smtp-Source: ABdhPJzO/GAL+HwStZ1sy7DY9YDTV7EMorhfEZWK+PQ3bNdGuCSxHL/59FBEZB+PaFr5KVhPl1DDOA== X-Received: by 2002:a5d:5112:: with SMTP id s18mr4175051wrt.267.1610120186185; Fri, 08 Jan 2021 07:36:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/23] hw/arm/virt: Remove virt machine state 'smp_cpus' Date: Fri, 8 Jan 2021 15:36:00 +0000 Message-Id: <20210108153621.3868-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Andrew Jones virt machine's 'smp_cpus' and machine->smp.cpus must always have the same value. And, anywhere we have virt machine state we have machine state. So let's remove the redundancy. Also, to make it easier to see that machine->smp is the true source for "smp_cpus" and "max_cpus", avoid passing them in function parameters, preferring instead to get them from the state. No functional change intended. Signed-off-by: Andrew Jones Reviewed-by: David Edmondson Reviewed-by: Ying Fang Message-id: 20201215174815.51520-1-drjones@redhat.com [PMM: minor formatting tweak to smp_cpus variable declaration] Signed-off-by: Peter Maydell --- include/hw/arm/virt.h | 3 +-- hw/arm/virt-acpi-build.c | 9 +++++---- hw/arm/virt.c | 21 ++++++++++----------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index abf54fab498..e4a2d216420 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -151,7 +151,6 @@ struct VirtMachineState { MemMapEntry *memmap; char *pciehb_nodename; const int *irqmap; - int smp_cpus; void *fdt; int fdt_size; uint32_t clock_phandle; @@ -182,7 +181,7 @@ static inline int virt_gicv3_redist_region_count(VirtMa= chineState *vms) =20 assert(vms->gic_version =3D=3D VIRT_GIC_VERSION_3); =20 - return vms->smp_cpus > redist0_capacity ? 2 : 1; + return MACHINE(vms)->smp.cpus > redist0_capacity ? 2 : 1; } =20 #endif /* QEMU_ARM_VIRT_H */ diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 711cf2069fe..9d9ee240534 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -59,11 +59,12 @@ =20 #define ACPI_BUILD_TABLE_SIZE 0x20000 =20 -static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) +static void acpi_dsdt_add_cpus(Aml *scope, VirtMachineState *vms) { + MachineState *ms =3D MACHINE(vms); uint16_t i; =20 - for (i =3D 0; i < smp_cpus; i++) { + for (i =3D 0; i < ms->smp.cpus; i++) { Aml *dev =3D aml_device("C%.03X", i); aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007"))); aml_append(dev, aml_name_decl("_UID", aml_int(i))); @@ -484,7 +485,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) gicd->base_address =3D cpu_to_le64(memmap[VIRT_GIC_DIST].base); gicd->version =3D vms->gic_version; =20 - for (i =3D 0; i < vms->smp_cpus; i++) { + for (i =3D 0; i < MACHINE(vms)->smp.cpus; i++) { AcpiMadtGenericCpuInterface *gicc =3D acpi_data_push(table_data, sizeof(*gicc)); ARMCPU *armcpu =3D ARM_CPU(qemu_get_cpu(i)); @@ -603,7 +604,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) * the RTC ACPI device at all when using UEFI. */ scope =3D aml_scope("\\_SB"); - acpi_dsdt_add_cpus(scope, vms->smp_cpus); + acpi_dsdt_add_cpus(scope, vms); acpi_dsdt_add_uart(scope, &memmap[VIRT_UART], (irqmap[VIRT_UART] + ARM_SPI_BASE)); if (vmc->acpi_expose_flash) { diff --git a/hw/arm/virt.c b/hw/arm/virt.c index bf3a7171118..86070dfd98b 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -323,7 +323,7 @@ static void fdt_add_timer_nodes(const VirtMachineState = *vms) if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { irqflags =3D deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START, GIC_FDT_IRQ_PPI_CPU_WIDTH, - (1 << vms->smp_cpus) - 1); + (1 << MACHINE(vms)->smp.cpus) - 1); } =20 qemu_fdt_add_subnode(vms->fdt, "/timer"); @@ -350,6 +350,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *v= ms) int cpu; int addr_cells =3D 1; const MachineState *ms =3D MACHINE(vms); + int smp_cpus =3D ms->smp.cpus; =20 /* * From Documentation/devicetree/bindings/arm/cpus.txt @@ -364,7 +365,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *v= ms) * The simplest way to go is to examine affinity IDs of all our CPUs.= If * at least one of them has Aff3 populated, we set #address-cells to = 2. */ - for (cpu =3D 0; cpu < vms->smp_cpus; cpu++) { + for (cpu =3D 0; cpu < smp_cpus; cpu++) { ARMCPU *armcpu =3D ARM_CPU(qemu_get_cpu(cpu)); =20 if (armcpu->mp_affinity & ARM_AFF3_MASK) { @@ -377,7 +378,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *v= ms) qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#address-cells", addr_cells); qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#size-cells", 0x0); =20 - for (cpu =3D vms->smp_cpus - 1; cpu >=3D 0; cpu--) { + for (cpu =3D smp_cpus - 1; cpu >=3D 0; cpu--) { char *nodename =3D g_strdup_printf("/cpus/cpu@%d", cpu); ARMCPU *armcpu =3D ARM_CPU(qemu_get_cpu(cpu)); CPUState *cs =3D CPU(armcpu); @@ -387,8 +388,7 @@ static void fdt_add_cpu_nodes(const VirtMachineState *v= ms) qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", armcpu->dtb_compatible); =20 - if (vms->psci_conduit !=3D QEMU_PSCI_CONDUIT_DISABLED - && vms->smp_cpus > 1) { + if (vms->psci_conduit !=3D QEMU_PSCI_CONDUIT_DISABLED && smp_cpus = > 1) { qemu_fdt_setprop_string(vms->fdt, nodename, "enable-method", "psci"); } @@ -534,7 +534,7 @@ static void fdt_add_pmu_nodes(const VirtMachineState *v= ms) if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { irqflags =3D deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START, GIC_FDT_IRQ_PPI_CPU_WIDTH, - (1 << vms->smp_cpus) - 1); + (1 << MACHINE(vms)->smp.cpus) - 1); } =20 qemu_fdt_add_subnode(vms->fdt, "/pmu"); @@ -1674,9 +1674,9 @@ static void finalize_gic_version(VirtMachineState *vm= s) * virt_cpu_post_init() must be called after the CPUs have * been realized and the GIC has been created. */ -static void virt_cpu_post_init(VirtMachineState *vms, int max_cpus, - MemoryRegion *sysmem) +static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem) { + int max_cpus =3D MACHINE(vms)->smp.max_cpus; bool aarch64, pmu, steal_time; CPUState *cpu; =20 @@ -1829,8 +1829,6 @@ static void machvirt_init(MachineState *machine) exit(1); } =20 - vms->smp_cpus =3D smp_cpus; - if (vms->virt && kvm_enabled()) { error_report("mach-virt: KVM does not support providing " "Virtualization extensions to the guest CPU"); @@ -1846,6 +1844,7 @@ static void machvirt_init(MachineState *machine) create_fdt(vms); =20 possible_cpus =3D mc->possible_cpu_arch_ids(machine); + assert(possible_cpus->len =3D=3D max_cpus); for (n =3D 0; n < possible_cpus->len; n++) { Object *cpuobj; CPUState *cs; @@ -1966,7 +1965,7 @@ static void machvirt_init(MachineState *machine) =20 create_gic(vms); =20 - virt_cpu_post_init(vms, possible_cpus->len, sysmem); + virt_cpu_post_init(vms, sysmem); =20 fdt_add_pmu_nodes(vms); =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120473; cv=none; d=zohomail.com; s=zohoarc; b=jLrsbetrjlt3ye6Udg6FWhRJXVGiCOlEUKIVMur56rksIivYpBLnSqTwP3+SX2bgPBSaS79WYcKIsFuk7W2rIDHUznd4yAng0Wv1nRaibUYX3az3cC6A7521beIp3ROR2YAmy3BqmE+3/thBCU+5KQxWRwZgFH6yHFls4F9yUQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120473; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mE99S3UkDiamuGx6t5YBtNr2w1FyoGDj+zB0sQ6CfpM=; b=W2vQZ9tBrs//NL7mMmdUpvbao1kjkNa8GspIhwmAbl/nJDTwvzfU5oEIoy8BAExa4T6IGcowbgV+cIA+EancdJXWZZDT+8yiofysAvZTn5dqLiDic7sCt9RZFOj6Xlc0H64BG78RNgukKszXBoTahhY8Q5V+Fa2z17ONfzunt3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161012047392851.61508948476978; Fri, 8 Jan 2021 07:41:13 -0800 (PST) Received: from localhost ([::1]:36634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtt1-00013q-Aw for importer@patchew.org; Fri, 08 Jan 2021 10:41:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtoU-0004OJ-HG for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:30 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:42859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoS-0002qb-RS for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:30 -0500 Received: by mail-wr1-x42c.google.com with SMTP id m5so9401336wrx.9 for ; Fri, 08 Jan 2021 07:36:28 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=mE99S3UkDiamuGx6t5YBtNr2w1FyoGDj+zB0sQ6CfpM=; b=rwIcor+ZUwRDpi+aLwOMAmM6yN1iU99lCtYqgG+vVEfHAN0FjekXEQyPr3PGGq0i7U EZo3ysH8G9C3VDYeqI/YKohR9rps41gW9mV+hzeZwrL03DVyd1PyVU/sH9aTjmqRWRO7 /QntmtkuzCcjk2mtqvNWRK70l/RIit8LFld6IrsJXRhflQF7FdNTjYUrc9YNOV5z2D+v WDG3arIExToHEMnkMWA2CyLBgEM7+qYt7WSkInLHrAAfF+0oN/i5keAhdhcvk80MMH4q DhgBc8WOLFPozREHFjsN0IGEVXxnqSnOMNlNjgXyx19T6GXVmzdBOokSpAxQFhW2IkxF ekOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mE99S3UkDiamuGx6t5YBtNr2w1FyoGDj+zB0sQ6CfpM=; b=WkTuothWgJiD8Rdv88c/M00qVBwFY6rg2Z4PmEwJbzAnFlGU6TJiQq86RV+Bkidb/M 8FnsQtxbRVrQtGw9THCo1OlRH8fLB1ul1kmCRNjXZ7w0bxYmQricIwJH18CMBWO0ZkoO 6pbvZ2TTruDXxX3/9QQQQVnfU3bhxPNyIKNK1i03oeYjRb5zr8KMdFCikN0UdjdF/0un YuICx01YgYzyVUHWHa+nf7EXJx/6g/FxQ+LAWT1dq7Z+w1paYdoYpsTuTQ4k32YxVdcC g1XC89zfRUxwtj5lJJv/x7/dE6n89QTv7RDPJSfAC5qL0KdK8bQjYfMRon5ldARj/A+P t8Eg== X-Gm-Message-State: AOAM533gyFtfpBsqOMJeqXD/ZhmOJsB8X2WZGGcOQrDSNEjka+FqG2zS VYcQxBrKP+4FsS8xwJAfPb7M2UZNFISHgA== X-Google-Smtp-Source: ABdhPJzh0V8VNB89DkAIB1BX3JfxjfZ52JCt7BUMwSQ0mN2mjdSr+44TGy8OWUkooyojCMWL3mJzOQ== X-Received: by 2002:adf:b194:: with SMTP id q20mr4250243wra.199.1610120187425; Fri, 08 Jan 2021 07:36:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/23] target/arm: Fix MTE0_ACTIVE Date: Fri, 8 Jan 2021 15:36:01 +0000 Message-Id: <20210108153621.3868-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson In 50244cc76abc we updated mte_check_fail to match the ARM pseudocode, using the correct EL to select the TCF field. But we failed to update MTE0_ACTIVE the same way, which led to g_assert_not_reached(). Cc: qemu-stable@nongnu.org Buglink: https://bugs.launchpad.net/bugs/1907137 Signed-off-by: Richard Henderson Message-id: 20201221204426.88514-1-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 2d0d4cd1e10..d077dd9ef51 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12928,7 +12928,7 @@ static uint32_t rebuild_hflags_a64(CPUARMState *env= , int el, int fp_el, if (FIELD_EX32(flags, TBFLAG_A64, UNPRIV) && tbid && !(env->pstate & PSTATE_TCO) - && (sctlr & SCTLR_TCF0) + && (sctlr & SCTLR_TCF) && allocation_tag_access_enabled(env, 0, sctlr)) { flags =3D FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1); } --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120478; cv=none; d=zohomail.com; s=zohoarc; b=aRwxbDyTA6SKpPCGhy+ZnjJ5/cLR5CpJnc2ORaAc4v1s4c9NwN2WIMnq2pSK0MNQNGSAJ6ytX4eK9QtUVh0oMBNkEZv6vqflo8/kkjaR4RJ32Ln+Orn/PPEKFB36oLPbAUJrENe8VL9vk+0Amp//Pyq/3tY8fTIfEacZWGvVwM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120478; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ggk6XwbVgArtMF3BwIoGtJEK0P5cWAROytXFXCULmto=; b=Lq3HfTlvLtng9WNVoEiSKZVBmqxvd6lYiFzC2/nuAmyEGZtvnaTwd1jpjfoMqhyuJWxIpzY66u0fDaJBLikUwemrH/9OBrPxxbuwbtBjcA/TQvsDh0EiJ6EcT5JOTPncF9Be84OkEYT8+TZ+vLn8eGSewDrH+lScmjTGubmHlts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120478105338.50962069673403; Fri, 8 Jan 2021 07:41:18 -0800 (PST) Received: from localhost ([::1]:36936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtt7-0001Gs-0X for importer@patchew.org; Fri, 08 Jan 2021 10:41:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtoX-0004Up-QX for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:33 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:43398) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoV-0002rm-IT for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:33 -0500 Received: by mail-wr1-x430.google.com with SMTP id y17so9399927wrr.10 for ; Fri, 08 Jan 2021 07:36:31 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Ggk6XwbVgArtMF3BwIoGtJEK0P5cWAROytXFXCULmto=; b=EcpP0KliWpMITXEFV+oH2EW/1VQUi2bKwT+lbJrrEQgA6oiLtHsGDkYcuxwiJfSO0k WVMbEswM5401E8p8EhUWbUML9A7WGgaP0qRXQw0PX15RUxfuBh1wlMvwxnkK/oaFF09m QLTHrf7OPl52aY5Ie/dUx9eUwNwjX7rspUa9dM7jCrsEEbI03aNeVxNgD2skIS91d8ZG C0t/wV2e61SlKNkLpTkdgoJgsWzdldy0uN3lwgGZnBu89z25SH7jCS8mHA3IRtxvmNC+ IF1q4YwOAxwZFoctbxTlgzakdGSa1Kij6oOoWIfqmJVJ0/NIPSaj0HI7ir29VeQYIQlI hA5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ggk6XwbVgArtMF3BwIoGtJEK0P5cWAROytXFXCULmto=; b=lHl8A0cIp7i3cevNDJq0XkK0t5KiEj/GYqdf1EQVTZhfI5t5CUoB8O8HVCCTRVeEgz vlpccA+AYiS3YX34py/DjYk2ne62w65TyRLL3efTvT/2Ktu8cwXYntFf4S4TosZWTKdb K51SCuUl9R6BdQ6fHOxj74hfxy2qUbGV5zJLEJBEJnffF3MEIE2fTHeMEmttmDzK48uo kQZY+ww7YHokTUtdjjw4zKYUGo5NFD0aPnfKTcYUpb+hztb4QV2R1cusRLCiG1ryJfBS u3t4jRTrezjBtOrf6iu71Dd7xxKCEsJmr0aN6qigMFwIAMy0DOhRINZ14ngulYgK1KAr SIsQ== X-Gm-Message-State: AOAM532r6OJ0xQm22SB6dat23vM1v+QF0mEM4awENM9CWo/bVHoRAQrp ISezPQBcgkMF2zqsMmSTaAM6pqX9kKSSTA== X-Google-Smtp-Source: ABdhPJy3GXDzmY0M8jHzBLjq0U+OeCASN/7qdK7RApfj6/yxB3Xoys7ZFi46mokOtzf6jPEDPRNGow== X-Received: by 2002:a5d:4a10:: with SMTP id m16mr4358769wrq.18.1610120190019; Fri, 08 Jan 2021 07:36:30 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/23] hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN Date: Fri, 8 Jan 2021 15:36:02 +0000 Message-Id: <20210108153621.3868-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The CCR is a register most of whose bits are banked between security states but where BFHFNMIGN is not, and we keep it in the non-secure entry of the v7m.ccr[] array. The logic which tries to handle this bit fails to implement the "RAZ/WI from Nonsecure if AIRCR.BFHFNMINS is zero" requirement; correct the omission. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20201210201433.26262-2-peter.maydell@linaro.org --- hw/intc/armv7m_nvic.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index f63aa2d8713..0d8426dafc9 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -1106,6 +1106,12 @@ static uint32_t nvic_readl(NVICState *s, uint32_t of= fset, MemTxAttrs attrs) */ val =3D cpu->env.v7m.ccr[attrs.secure]; val |=3D cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK; + /* BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0 */ + if (!attrs.secure) { + if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { + val &=3D ~R_V7M_CCR_BFHFNMIGN_MASK; + } + } return val; case 0xd24: /* System Handler Control and State (SHCSR) */ if (!arm_feature(&cpu->env, ARM_FEATURE_V7)) { @@ -1683,6 +1689,15 @@ static void nvic_writel(NVICState *s, uint32_t offse= t, uint32_t value, (cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK) | (value & R_V7M_CCR_BFHFNMIGN_MASK); value &=3D ~R_V7M_CCR_BFHFNMIGN_MASK; + } else { + /* + * BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0, so + * preserve the state currently in the NS element of the array + */ + if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { + value &=3D ~R_V7M_CCR_BFHFNMIGN_MASK; + value |=3D cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIG= N_MASK; + } } =20 cpu->env.v7m.ccr[attrs.secure] =3D value; --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120318; cv=none; d=zohomail.com; s=zohoarc; b=YNJpOPYFJRUmS/YvN9P9jYQKzL8hIR/RRpMYcHOt5fKw6d1hBadhhoCUOCREFf2A2xDH1kvnNH/QE8E2vrntHh7wvJYZuYN0eoU/k4RF0K8f/vCi4jgeW2RbtcSUew0AZUMrDczfqvc7sIvA7niZ63mXOH60NJJxu8gBfl9+pvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120318; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PHnQifPYkpxyN3yopYiKijmjA/1sTdlzBbc4NIn5EpQ=; b=g442yEbVtAHoZZwtakxPYEK+b8sa6ADGcYfxu7Yb5Qmy2HAiLQ+7hYOWQn1BOvKxJ/Q/s3552jii6G2jUF6dqcocS7869+9Deg4JMTcH4q3CZeAgqwAgAzzeHFLtOuq71k1iKrP70iGjN0vgJVtuioPFGN1j2JkFPbFdqJDciY4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120318428862.9681347464352; Fri, 8 Jan 2021 07:38:38 -0800 (PST) Received: from localhost ([::1]:57014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtqX-0006KR-BE for importer@patchew.org; Fri, 08 Jan 2021 10:38:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtoY-0004X8-SZ for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:34 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:35316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoX-0002ry-A8 for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:34 -0500 Received: by mail-wm1-x334.google.com with SMTP id e25so8799953wme.0 for ; Fri, 08 Jan 2021 07:36:32 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=PHnQifPYkpxyN3yopYiKijmjA/1sTdlzBbc4NIn5EpQ=; b=HULWYQOAMxLCA0UUz3+2moD29KWcF98X71uUYyllv+KlRii4uiHBG+Q6U1+Br9mpHs u1J75J8mPrMrpEat/6Ye++tYYDAYp4zreD8ZENC1FPOCMHqvTXClNOIsFMbkDQQ5/HYJ WKDREr3hb/gKhk6PtPBNUq0vvDTkyFlJ0rvGnk1+7s/TnW9xUqYddmmLTx+LfqO4kAm1 L6EXHTfx5+0bjFFneZIjNb++tZkw5eO206FRocAlJim9qmSWVuYdOp9Iv/Eq8lxaHGCo yCWzmxJh9N5zxHTr/G0txoExucn6Rq08gpoNvJECwe8uLy2uCrT9e6p5RJoJCA+Mll/u G5Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PHnQifPYkpxyN3yopYiKijmjA/1sTdlzBbc4NIn5EpQ=; b=X9uO6IwKY2zBJsUP639x/9eV+VYeB/y3AAfsCbgOd6dTD9anxbt5PlXp293rODXS0X uIWfoipRsFrPrn+tPXcvlpb6KB/V2urhUfTmlf5C3B/dxJftM2ohsCpR8YL+TJcUB/pv fscbbzU+c/0hkU1NPXTtZFSKejA5Dv2qKAjVgbsppgHugYi8UCd3OYIdgTgJwoFIJiO4 LNooDuoPHsKGSemYrAGuFC8/ExTpzP6PSgdnq8pwgu0kEIftMdrML7SO3u0qpfqIDF65 lFabY4DRUT5cJQzqLmybUgND3rqOHIKnpddIV+xeXpkZkr0as25TW3kqaIpnkkmMtFAX 8Z/w== X-Gm-Message-State: AOAM5324bUVSA7AmHK4aZtJR+ukp2bD6UiWiwlUKigueNFJkO3VcRGjC +9PhADFVlIXZfhJUuYBCa30sN4NwVV9DGQ== X-Google-Smtp-Source: ABdhPJwcD5BbnB+69NBBKw9zo5yCwG+1A14kdSsKZSxVDGYf3DKtDMDfYgx6TUy83KPAFwkpFTP4Hw== X-Received: by 2002:a1c:2e88:: with SMTP id u130mr3541898wmu.83.1610120191734; Fri, 08 Jan 2021 07:36:31 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/23] target/arm: Correct store of FPSCR value via FPCXT_S Date: Fri, 8 Jan 2021 15:36:03 +0000 Message-Id: <20210108153621.3868-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" In commit 64f863baeedc8659 we implemented the v8.1M FPCXT_S register, but we got the write behaviour wrong. On read, this register reads bits [27:0] of FPSCR plus the CONTROL.SFPA bit. On write, it doesn't just write back those bits -- it writes a value to the whole FPSCR, whose upper 4 bits are zeroes. We also incorrectly implemented the write-to-FPSCR as a simple store to vfp.xregs; this skips the "update the softfloat flags" part of the vfp_set_fpscr helper so the value would read back correctly but not actually take effect. Fix both of these things by doing a complete write to the FPSCR using the helper function. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20201210201433.26262-3-peter.maydell@linaro.org --- target/arm/translate-vfp.c.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc index 0db936084bd..8b4cfd68cad 100644 --- a/target/arm/translate-vfp.c.inc +++ b/target/arm/translate-vfp.c.inc @@ -723,8 +723,11 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int= regno, } case ARM_VFP_FPCXT_S: { - TCGv_i32 sfpa, control, fpscr; - /* Set FPSCR[27:0] and CONTROL.SFPA from value */ + TCGv_i32 sfpa, control; + /* + * Set FPSCR and CONTROL.SFPA from value; the new FPSCR takes + * bits [27:0] from value and zeroes bits [31:28]. + */ tmp =3D loadfn(s, opaque); sfpa =3D tcg_temp_new_i32(); tcg_gen_shri_i32(sfpa, tmp, 31); @@ -732,11 +735,8 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int= regno, tcg_gen_deposit_i32(control, control, sfpa, R_V7M_CONTROL_SFPA_SHIFT, 1); store_cpu_field(control, v7m.control[M_REG_S]); - fpscr =3D load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]); - tcg_gen_andi_i32(fpscr, fpscr, FPCR_NZCV_MASK); tcg_gen_andi_i32(tmp, tmp, ~FPCR_NZCV_MASK); - tcg_gen_or_i32(fpscr, fpscr, tmp); - store_cpu_field(fpscr, vfp.xregs[ARM_VFP_FPSCR]); + gen_helper_vfp_set_fpscr(cpu_env, tmp); tcg_temp_free_i32(tmp); tcg_temp_free_i32(sfpa); break; --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120598; cv=none; d=zohomail.com; s=zohoarc; b=Z1sm4AcZHWhgHIpw3FK6z3ZjoMRcoP91ZutB7FRmFFB2FiBRDqwVu8MHhB2eQB6RnfP5FfnUcgk3OHSwSocSwMmNsi2ovRkJf2CrUmCU8NfpheoKpBI7xG4kXzkyPsKeCaGyp6Jhfn/K1WBDLAntbccPtRYKOmIcPSIPKYDgDLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120598; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=magHpsOy0Dv5+dKtnYn3AaMCDQw5EoHZAD4Bcu40G28=; b=kD82RO7Zha8m9DWnGpJ5yjsTeTZYcM4kLInUHdKoWKBYUGWhpsqWw9Yai+GTyrP1hnFnvXKQo1UbHFht3jLMK+j/mgb/f5YeZJnoj0NLnV+CfVFP83DMWfAxnoh8oGygYXMvHqD8gS+EsvJ+lWYI7CDI7NwAUetZUKLP8LAD7es= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120598706974.3349556990096; Fri, 8 Jan 2021 07:43:18 -0800 (PST) Received: from localhost ([::1]:44528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtv3-0004OX-Ie for importer@patchew.org; Fri, 08 Jan 2021 10:43:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtob-0004fS-Rf for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:37 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:38891) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoZ-0002t1-TW for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:37 -0500 Received: by mail-wr1-x42d.google.com with SMTP id r7so9410086wrc.5 for ; Fri, 08 Jan 2021 07:36:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=magHpsOy0Dv5+dKtnYn3AaMCDQw5EoHZAD4Bcu40G28=; b=yz7PSyoHLxPtGKahcXb2xwhgzC8JKduvPMQ7OY1AJuRvzqJzOPLyaWprDtQthfInYE /ySfWruwAT5ozQ/SybmhuHOfxhqBgGBMd9zRFqE2L5TIhjAAJW5rTb9/F5eZFmVksdMF XMMNopKizRSnZn3wu67IeY30vzUq5evjF8tY+fiZDgFXwYfrwTQl/hNIS3UiOLGuCs8q H3hUKppTA8rhR4RlFLD7NxnvVVmO2DkS+NYuzBo2MY0TcLMd5+uVMiYbB+4e0Rbm25Yy FI9oifF8YYdt4jX6uXqzq6M1QKv8S1CEcRO9IhdCOfIISFj5iTK9VqvepHa/JplrIVKs 4GMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=magHpsOy0Dv5+dKtnYn3AaMCDQw5EoHZAD4Bcu40G28=; b=WOOEc7X5WORPBZX2uV3L8tFaZu6mp2KKHqsSWyx9ame5JIJI0JD3fvGeNgsEmTVuXJ QDNg4hcGI1J1HxKDBqxE12yNiy4eGeihMQCogSQpx9665vBQKQxdJRW1kzvRbSmwmo24 x8uIBLuiU7uZZZCcAVJOpeHLPAIiVHZiZWB0zwFQYRlZ0cTRRe8a2tRImCRymspGRprA F1JRFxhciJLMDpBMcAZ75eIBhTm+Foo3E3duTXzjVMJxPVqiNHwEN2tt1TpkKfzTOvOs SNUyHaygSfLx4Bzq16jszOTYEI0dmYWK6GEC7b3FVuC6VdNdw166F8AHtwLzvZx0Qupx FkrQ== X-Gm-Message-State: AOAM530XFQLntBrG7aT6Zoe/NNu5UymaN4UodGVSFa+YZscZXGk44QOu JQ3KXOWpXdju7AtuOJdFgFVDrdwuA7OfxQ== X-Google-Smtp-Source: ABdhPJwbf4zVbD1LSEEDmsRYdY/IQwigkjFYTw+ssfdSfnFv/lDUSQOyMHbPKx0L4xR4OgsD9v8lgg== X-Received: by 2002:adf:94e1:: with SMTP id 88mr4185126wrr.341.1610120194291; Fri, 08 Jan 2021 07:36:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/23] target/arm: Implement FPCXT_NS fp system register Date: Fri, 8 Jan 2021 15:36:04 +0000 Message-Id: <20210108153621.3868-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Implement the v8.1M FPCXT_NS floating-point system register. This is a little more complicated than FPCXT_S, because it has specific handling for "current FP state is inactive", and it only wants to do PreserveFPState(), not the full set of actions done by ExecuteFPCheck() which vfp_access_check() implements. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20201210201433.26262-4-peter.maydell@linaro.org --- target/arm/translate-vfp.c.inc | 102 ++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 3 deletions(-) diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc index 8b4cfd68cad..10766f210c1 100644 --- a/target/arm/translate-vfp.c.inc +++ b/target/arm/translate-vfp.c.inc @@ -663,6 +663,7 @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContex= t *s, int regno) } break; case ARM_VFP_FPCXT_S: + case ARM_VFP_FPCXT_NS: if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { return false; } @@ -674,13 +675,48 @@ static FPSysRegCheckResult fp_sysreg_checks(DisasCont= ext *s, int regno) return FPSysRegCheckFailed; } =20 - if (!vfp_access_check(s)) { + /* + * FPCXT_NS is a special case: it has specific handling for + * "current FP state is inactive", and must do the PreserveFPState() + * but not the usual full set of actions done by ExecuteFPCheck(). + * So we don't call vfp_access_check() and the callers must handle thi= s. + */ + if (regno !=3D ARM_VFP_FPCXT_NS && !vfp_access_check(s)) { return FPSysRegCheckDone; } - return FPSysRegCheckContinue; } =20 +static void gen_branch_fpInactive(DisasContext *s, TCGCond cond, + TCGLabel *label) +{ + /* + * FPCXT_NS is a special case: it has specific handling for + * "current FP state is inactive", and must do the PreserveFPState() + * but not the usual full set of actions done by ExecuteFPCheck(). + * We don't have a TB flag that matches the fpInactive check, so we + * do it at runtime as we don't expect FPCXT_NS accesses to be frequen= t. + * + * Emit code that checks fpInactive and does a conditional + * branch to label based on it: + * if cond is TCG_COND_NE then branch if fpInactive !=3D 0 (ie if ina= ctive) + * if cond is TCG_COND_EQ then branch if fpInactive =3D=3D 0 (ie if a= ctive) + */ + assert(cond =3D=3D TCG_COND_EQ || cond =3D=3D TCG_COND_NE); + + /* fpInactive =3D FPCCR_NS.ASPEN =3D=3D 1 && CONTROL.FPCA =3D=3D 0 */ + TCGv_i32 aspen, fpca; + aspen =3D load_cpu_field(v7m.fpccr[M_REG_NS]); + fpca =3D load_cpu_field(v7m.control[M_REG_S]); + tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); + tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); + tcg_gen_andi_i32(fpca, fpca, R_V7M_CONTROL_FPCA_MASK); + tcg_gen_or_i32(fpca, fpca, aspen); + tcg_gen_brcondi_i32(tcg_invert_cond(cond), fpca, 0, label); + tcg_temp_free_i32(aspen); + tcg_temp_free_i32(fpca); +} + static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, =20 fp_sysreg_loadfn *loadfn, @@ -688,6 +724,7 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int = regno, { /* Do a write to an M-profile floating point system register */ TCGv_i32 tmp; + TCGLabel *lab_end =3D NULL; =20 switch (fp_sysreg_checks(s, regno)) { case FPSysRegCheckFailed: @@ -721,6 +758,13 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int= regno, tcg_temp_free_i32(tmp); break; } + case ARM_VFP_FPCXT_NS: + lab_end =3D gen_new_label(); + /* fpInactive case: write is a NOP, so branch to end */ + gen_branch_fpInactive(s, TCG_COND_NE, lab_end); + /* !fpInactive: PreserveFPState(), and reads same as FPCXT_S */ + gen_preserve_fp_state(s); + /* fall through */ case ARM_VFP_FPCXT_S: { TCGv_i32 sfpa, control; @@ -744,6 +788,9 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int = regno, default: g_assert_not_reached(); } + if (lab_end) { + gen_set_label(lab_end); + } return true; } =20 @@ -753,6 +800,8 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int r= egno, { /* Do a read from an M-profile floating point system register */ TCGv_i32 tmp; + TCGLabel *lab_end =3D NULL; + bool lookup_tb =3D false; =20 switch (fp_sysreg_checks(s, regno)) { case FPSysRegCheckFailed: @@ -811,12 +860,59 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int= regno, fpscr =3D load_cpu_field(v7m.fpdscr[M_REG_NS]); gen_helper_vfp_set_fpscr(cpu_env, fpscr); tcg_temp_free_i32(fpscr); - gen_lookup_tb(s); + lookup_tb =3D true; + break; + } + case ARM_VFP_FPCXT_NS: + { + TCGv_i32 control, sfpa, fpscr, fpdscr, zero; + TCGLabel *lab_active =3D gen_new_label(); + + lookup_tb =3D true; + + gen_branch_fpInactive(s, TCG_COND_EQ, lab_active); + /* fpInactive case: reads as FPDSCR_NS */ + TCGv_i32 tmp =3D load_cpu_field(v7m.fpdscr[M_REG_NS]); + storefn(s, opaque, tmp); + lab_end =3D gen_new_label(); + tcg_gen_br(lab_end); + + gen_set_label(lab_active); + /* !fpInactive: Reads the same as FPCXT_S, but side effects differ= */ + gen_preserve_fp_state(s); + tmp =3D tcg_temp_new_i32(); + sfpa =3D tcg_temp_new_i32(); + fpscr =3D tcg_temp_new_i32(); + gen_helper_vfp_get_fpscr(fpscr, cpu_env); + tcg_gen_andi_i32(tmp, fpscr, ~FPCR_NZCV_MASK); + control =3D load_cpu_field(v7m.control[M_REG_S]); + tcg_gen_andi_i32(sfpa, control, R_V7M_CONTROL_SFPA_MASK); + tcg_gen_shli_i32(sfpa, sfpa, 31 - R_V7M_CONTROL_SFPA_SHIFT); + tcg_gen_or_i32(tmp, tmp, sfpa); + tcg_temp_free_i32(control); + /* Store result before updating FPSCR, in case it faults */ + storefn(s, opaque, tmp); + /* If SFPA is zero then set FPSCR from FPDSCR_NS */ + fpdscr =3D load_cpu_field(v7m.fpdscr[M_REG_NS]); + zero =3D tcg_const_i32(0); + tcg_gen_movcond_i32(TCG_COND_EQ, fpscr, sfpa, zero, fpdscr, fpscr); + gen_helper_vfp_set_fpscr(cpu_env, fpscr); + tcg_temp_free_i32(zero); + tcg_temp_free_i32(sfpa); + tcg_temp_free_i32(fpdscr); + tcg_temp_free_i32(fpscr); break; } default: g_assert_not_reached(); } + + if (lab_end) { + gen_set_label(lab_end); + } + if (lookup_tb) { + gen_lookup_tb(s); + } return true; } =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120730; cv=none; d=zohomail.com; s=zohoarc; b=SfyCtWZefPyptLhMEfOh4xEUXQFbEmOHdQIEvUen/lowtS3opPet/YbDhnkyn+TqB9XF6KeXUYfVnCuBiq9mUhJiKQ21J2r1gwnKOzY+I/VxU5O5BU7bOM95Q3Pr+v773zIk3FyCN5LAxpZJeJiI2P+y2r6LGaKZwo7XfAZMTHU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120730; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2D1No+kzyFL1cUkFc4BKpRp9iyQy/AXg4LApV51ftSM=; b=lprC6JoKmMAxyiK7HDnxu3zqma3rqz/Ua35DedB/AqiMXOGT9I17hiB0vziBsI/FiRSTtsLvrEl6hqQQoqQ0GLCwrAvXm4Rboi+R3liUzZvkw4DWuoo/a6yIfuHz/fPg9FWHQXNM7Ra/TrtLTV6IG/Crho2+2qBztqe8pCRtAwo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161012073002547.32046509770487; Fri, 8 Jan 2021 07:45:30 -0800 (PST) Received: from localhost ([::1]:50630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtx9-0006sR-OV for importer@patchew.org; Fri, 08 Jan 2021 10:45:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtod-0004j6-9S for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:39 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:37916) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoa-0002t7-TQ for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:39 -0500 Received: by mail-wm1-x32a.google.com with SMTP id g185so8774897wmf.3 for ; Fri, 08 Jan 2021 07:36:36 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2D1No+kzyFL1cUkFc4BKpRp9iyQy/AXg4LApV51ftSM=; b=ZQjov/ZMnhvv6STpkzAUQ6Dp6V8g0H2Fg1xYKILDKUU1NNMEr02Z3aWfb0rAHjbI6H gEd6g2QjNpNdzv5/019IfMLzJmSFrxhnm7PaljKhdrwCMbLCU6I9X+R3aEneCG5vhUsT h5BqCWg44WfR7d54jgavxduGt5hiMJunnB1sSjTHEl1cD0+h3AOVxWb9OzGH7WiPjJrm pYUAiFvtjgJeXCVuSZGaN35t/nrbY6jILwm56O3giwNDe/Ga/634HOSPmF6+eyFxJ/DQ GDR21I5V2pCl/u3E8aoXhZ7t8adO3HPy25zo5LfATU0L+mYXz32qpahO5jQyo5Drk9UQ 2fSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2D1No+kzyFL1cUkFc4BKpRp9iyQy/AXg4LApV51ftSM=; b=j5IOjPDyK5vk8HMNGwgvYjwuHsBQ71DCzRfcpNocMZTdNrcfbLnie5hfTboKJpEtkV VktmiyNpatXfZUCi6Z0NeA/ndUwKPX6VzbhAgaQDElZ1E2BCohuRMGXc1bLkpcj58pl1 y/uyzGSZQ07NjCc50uA7t82X9tRPvOGfp7pWpEvEv21Umh4f5r4RkhKGVZ6I7UzoZU89 Bn3xXKX8azVnHj4Q5Y0484hOrM7C3lhI+ebEXkoTbuOumV7L7DV3136PoI0DkIi0wJbr QoQkLlDV2MYX+0LIhi7oMzPGYwMKw/gGEWaqvpokgIxD4MdADufry3Lpk+fwbZN3Bz9c FEqw== X-Gm-Message-State: AOAM533tbmL1nJ/KVPMKSDzARP9EYOSJboWEZCuKL2rA+6edj5Jpojwq /SxijTLLYflIt9jjFyeVLMJjoNnPtgs7Fw== X-Google-Smtp-Source: ABdhPJzq92OQZBlABpJd8SbfJ6BGWwG/Pgvi+xSSd/af2rg6YzVDlLDn4SR+J5mg11f1FsUpLPNcsA== X-Received: by 2002:a1c:2c4:: with SMTP id 187mr3615500wmc.187.1610120195314; Fri, 08 Jan 2021 07:36:35 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/23] target/arm: Implement Cortex-M55 model Date: Fri, 8 Jan 2021 15:36:05 +0000 Message-Id: <20210108153621.3868-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Now that we have implemented all the features needed by the v8.1M architecture, we can add the model of the Cortex-M55. This is the configuration without MVE support; we'll add MVE later. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20201210201433.26262-5-peter.maydell@linaro.org --- target/arm/cpu_tcg.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index 0013e25412f..98544db2df3 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -401,6 +401,46 @@ static void cortex_m33_initfn(Object *obj) cpu->ctr =3D 0x8000c000; } =20 +static void cortex_m55_initfn(Object *obj) +{ + ARMCPU *cpu =3D ARM_CPU(obj); + + set_feature(&cpu->env, ARM_FEATURE_V8); + set_feature(&cpu->env, ARM_FEATURE_V8_1M); + set_feature(&cpu->env, ARM_FEATURE_M); + set_feature(&cpu->env, ARM_FEATURE_M_MAIN); + set_feature(&cpu->env, ARM_FEATURE_M_SECURITY); + set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); + cpu->midr =3D 0x410fd221; /* r0p1 */ + cpu->revidr =3D 0; + cpu->pmsav7_dregion =3D 16; + cpu->sau_sregion =3D 8; + /* + * These are the MVFR* values for the FPU, no MVE configuration; + * we will update them later when we implement MVE + */ + cpu->isar.mvfr0 =3D 0x10110221; + cpu->isar.mvfr1 =3D 0x12100011; + cpu->isar.mvfr2 =3D 0x00000040; + cpu->isar.id_pfr0 =3D 0x20000030; + cpu->isar.id_pfr1 =3D 0x00000230; + cpu->isar.id_dfr0 =3D 0x10200000; + cpu->id_afr0 =3D 0x00000000; + cpu->isar.id_mmfr0 =3D 0x00111040; + cpu->isar.id_mmfr1 =3D 0x00000000; + cpu->isar.id_mmfr2 =3D 0x01000000; + cpu->isar.id_mmfr3 =3D 0x00000011; + cpu->isar.id_isar0 =3D 0x01103110; + cpu->isar.id_isar1 =3D 0x02212000; + cpu->isar.id_isar2 =3D 0x20232232; + cpu->isar.id_isar3 =3D 0x01111131; + cpu->isar.id_isar4 =3D 0x01310132; + cpu->isar.id_isar5 =3D 0x00000000; + cpu->isar.id_isar6 =3D 0x00000000; + cpu->clidr =3D 0x00000000; /* caches not implemented */ + cpu->ctr =3D 0x8303c003; +} + static const ARMCPRegInfo cortexr5_cp_reginfo[] =3D { /* Dummy the TCM region regs for the moment */ { .name =3D "ATCM", .cp =3D 15, .opc1 =3D 0, .crn =3D 9, .crm =3D 1, .= opc2 =3D 0, @@ -655,6 +695,8 @@ static const ARMCPUInfo arm_tcg_cpus[] =3D { .class_init =3D arm_v7m_class_init }, { .name =3D "cortex-m33", .initfn =3D cortex_m33_initfn, .class_init =3D arm_v7m_class_init }, + { .name =3D "cortex-m55", .initfn =3D cortex_m55_initfn, + .class_init =3D arm_v7m_class_init }, { .name =3D "cortex-r5", .initfn =3D cortex_r5_initfn }, { .name =3D "cortex-r5f", .initfn =3D cortex_r5f_initfn }, { .name =3D "ti925t", .initfn =3D ti925t_initfn }, --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120474; cv=none; d=zohomail.com; s=zohoarc; b=SfAK8DK5TC7hrSMBnq1YMRhzroBcEmZQOndHsGI7dw1SesfYpXCvtgpsMyhLCmo4Y6duve49LBhqqFWIXgKS4oQqaqy9WBTzOm05mrf2+Mu4snWTlgY5697rbww8szAv12j9ZNeiXS1S/ADKn9VajnyOS16+jB5P2g6ljBBUt+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120474; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yZOeSSXeiw2HQ+tvPkDoDlq1tyApzywP9jbeOOtyMI0=; b=RKiX3EGyekRe5p+TE/i+Zx7GYD9vn9Je233h1r2MsXJZ5G3jIeIF5wZkXIeW7pF0yV/VUo1L7FqYbkybtuBiMcsCSFW4n8dVps+rDb3zVgzdpeihTcDAFe2uZNycJBdFQqG+CXF8FSwwOARgsHbY+7ZMQwSrgz1xxDjF+M45jZs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120474231955.558864342355; Fri, 8 Jan 2021 07:41:14 -0800 (PST) Received: from localhost ([::1]:36672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtt2-00014t-UL for importer@patchew.org; Fri, 08 Jan 2021 10:41:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtod-0004kJ-QE for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:39 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:44228) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoc-0002u1-1R for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:39 -0500 Received: by mail-wr1-x42c.google.com with SMTP id w5so9381535wrm.11 for ; Fri, 08 Jan 2021 07:36:37 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yZOeSSXeiw2HQ+tvPkDoDlq1tyApzywP9jbeOOtyMI0=; b=WKIDaCNnP7V/SHcJyVnvTZn4dgMwMMlxZc+FFgYDG/TS3bk/0crVmWj03xQCWQZPD2 QHTTGneyigrBU94hXwQSzXsBrfGvPis2WPBtsDQLyqamFfYJ2rFu7HYsSj4U7KegHB// MehRPHZHtXRGThCZbelzWkbLySidLJsrlkNJLE9rzq/V+dSCA07p3z+N7AhjMxX2xyYy KXIRUIt3QK+ZxyQNXta8KeX2fyW6l2xxVGWGOGFW2QAzdna97+S9/VbMW5a3/37bMtbo ZJBiitJoWs1bm1Xk4M+KYCKGG19Wp10ce6A5Ijr4uwqT3Rka7M5JyvWXXXgwsz+bsgQY kZCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yZOeSSXeiw2HQ+tvPkDoDlq1tyApzywP9jbeOOtyMI0=; b=KdawVwxhKV7GBvR15lzJ89uEDmw4qsI6gq4dG9vp/zz0iQhSAYZ3MY1WbKY4c/KOHd /HM8gfmHc9DsFzJ1QR0KiRSAwMnPq+B2T+phNdAxLScbbzeQGBFJTzFXvDypDO4+U2ZJ YFSvObAdpVouJGx7vBBOBsIoNClz6f9h0XK3Kq6c795+3QxITlbiBWskevlm542HH7bx Ka7rXBzvovIskbE8SfDKL5jSaUzXIHTG17LJYJhI9aplJaLxmicchCoCmXy/Ec1tRImL kJU+KTnLphzEpjanT/sMaujW3dfsG+xx9/ad51uK8ZhIf6YOGCs2lU2l63D5LTjQLjqL Vvzg== X-Gm-Message-State: AOAM531VfAkiwY0Wnf6ZiCQOiUvJxIL4S8r4n+KEpG7d2JemkBQOobis hGarIbhNmkX/lKvCIhfhfO1MaA1Gd4iwEg== X-Google-Smtp-Source: ABdhPJw2MxbuHFOEN9pWVIKQZjkCEuqCxNN7x6GoMxno9fTrPIcaPE2beqsloQaR+qVCE00deUvlug== X-Received: by 2002:a5d:5112:: with SMTP id s18mr4175743wrt.267.1610120196521; Fri, 08 Jan 2021 07:36:36 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/23] hw/arm/highbank: Drop dead KVM support code Date: Fri, 8 Jan 2021 15:36:06 +0000 Message-Id: <20210108153621.3868-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Support for running KVM on 32-bit Arm hosts was removed in commit 82bf7ae84ce739e. You can still run a 32-bit guest on a 64-bit Arm host CPU, but because Arm KVM requires the host and guest CPU types to match, it is not possible to run a guest that requires a Cortex-A9 or Cortex-A15 CPU there. That means that the code in the highbank/midway board models to support KVM is no longer used, and we can delete it. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20201215144215.28482-1-peter.maydell@linaro.org --- hw/arm/highbank.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index bf7b8f4c648..bf886268c57 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -26,7 +26,6 @@ #include "hw/arm/boot.h" #include "hw/loader.h" #include "net/net.h" -#include "sysemu/kvm.h" #include "sysemu/runstate.h" #include "sysemu/sysemu.h" #include "hw/boards.h" @@ -38,6 +37,7 @@ #include "hw/cpu/a15mpcore.h" #include "qemu/log.h" #include "qom/object.h" +#include "cpu.h" =20 #define SMP_BOOT_ADDR 0x100 #define SMP_BOOT_REG 0x40 @@ -396,15 +396,9 @@ static void calxeda_init(MachineState *machine, enum c= xmachines machine_id) highbank_binfo.loader_start =3D 0; highbank_binfo.write_secondary_boot =3D hb_write_secondary; highbank_binfo.secondary_cpu_reset_hook =3D hb_reset_secondary; - if (!kvm_enabled()) { - highbank_binfo.board_setup_addr =3D BOARD_SETUP_ADDR; - highbank_binfo.write_board_setup =3D hb_write_board_setup; - highbank_binfo.secure_board_setup =3D true; - } else { - warn_report("cannot load built-in Monitor support " - "if KVM is enabled. Some guests (such as Linux) " - "may not boot."); - } + highbank_binfo.board_setup_addr =3D BOARD_SETUP_ADDR; + highbank_binfo.write_board_setup =3D hb_write_board_setup; + highbank_binfo.secure_board_setup =3D true; =20 arm_load_kernel(ARM_CPU(first_cpu), machine, &highbank_binfo); } --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120598; cv=none; d=zohomail.com; s=zohoarc; b=hbCgvWQb1tsZHyqlf6F7ELxq2GJ5J7E2Vw/QQfn5QvaBB0rxEfyYcGXjYpwCD+mwKBTdFmJtikrIsV0B7me46HvELa4jJYNm/tDySzpwTMsL6mv16AvG0aMQTrskBBMS6bWZCwznwjxI78pjgedc3nQFGbjqxPz/WoDxGeKkZHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120598; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=k/yTTW3gJMy8kmNQdvCvlmrK8ZnSXl30930dPL2g97c=; b=Ef++vi4XJEYSHICRjIwrLdvQUuWBLkv9VraFJ7PeyLGMH0l7WtlYHCJ4XXfd+jeyc8h5LuC971CAz6QjgZn2AaofVlmrSZIQZqmkBsq+kkbpLfsDlfnh+KHMoXMIzDpf4QygLB0A6ORwDxVlkz1Z0tYq4+rp2o1BdhXoGT9Qfew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120598088924.9442306783646; Fri, 8 Jan 2021 07:43:18 -0800 (PST) Received: from localhost ([::1]:44514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtv3-0004OF-0Q for importer@patchew.org; Fri, 08 Jan 2021 10:43:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtof-0004qF-Iv for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:41 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:44234) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtod-0002uC-0q for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:41 -0500 Received: by mail-wr1-x432.google.com with SMTP id w5so9381589wrm.11 for ; Fri, 08 Jan 2021 07:36:38 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=k/yTTW3gJMy8kmNQdvCvlmrK8ZnSXl30930dPL2g97c=; b=fTBlzZ6AUXKbhJhYj6DM8p2sA0eXcpFyq7LRt3YbWzivJ75miO1PPGWUpO9eiRSkM7 LrPe5SnvRzd5rKpHSfEBhOmkbaqyoJE8+oUr0XGHxkzoDk1r3oRqa9sFrXXZ56cSgS5S YEIs03MMmKr7rZs2q0xVu8bOXnKV8SXh27YKznMIXeUk7JjHFffH4INVA9jpF0U3f7cu +8wfoxEuRQPt4B42bOedUDyhm7kZsRpUkT2dujAswitlGxa9S0kUkn+AroKL0M57Cmr1 WU2gE6A7ON1U3ff4IBX7uGO4FKGdeRJxlbq3wbUmtiTylA11Uo4GUSd86NU18HKqhuYG i6xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k/yTTW3gJMy8kmNQdvCvlmrK8ZnSXl30930dPL2g97c=; b=oz5J/1+Iqhjo3MX9c+X8hSWdqeYpKXoJVwbPeRanepF8Y479pkJ3FhhARfOEpX0j01 YBVyaJl7E1HVq6rtSsL1iRzcx7U+qwbm1utcNTwqQ7RHtoK35BcDk5qGRbef7Zt1xwFX VJdc2DBTXBxqP+4bux5+1aFPD2MM5jfgKxfHpfOew1Wyb8i4Ftpao2Fg23a0AxetVjtB 5/ns+01yAfwOuTeIanGh7ONdob15R9EMKx8r+tXggWRFtR+XsMMrqjEmJZ9COHbKBmRk p7VGrniEeF1yyrIiGw0Fla+EYd4K4wvx/idWsGlvmDxvA0LYTgyx0szKrl6PcdgLS4SV K8kg== X-Gm-Message-State: AOAM531DsVIkTOHkCMxs9oqrPXs+m0zHcXivOF0h9ahyp1GclLo62qrF bJjTM8cXCSRft94oWwqrqCVYz5k1FWBcaQ== X-Google-Smtp-Source: ABdhPJxRZiH/7oP+Utj40UC9SxxxJPihaX6yPXVGRmjnwPiY2nTJa5+on57vRaUM19Gnl59GAn1z1g== X-Received: by 2002:adf:a1d5:: with SMTP id v21mr4225623wrv.24.1610120197470; Fri, 08 Jan 2021 07:36:37 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/23] util/qemu-timer: Make timer_free() imply timer_del() Date: Fri, 8 Jan 2021 15:36:07 +0000 Message-Id: <20210108153621.3868-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Currently timer_free() is a simple wrapper for g_free(). This means that the timer being freed must not be currently active, as otherwise QEMU might crash later when the active list is processed and still has a pointer to freed memory on it. As a result almost all calls to timer_free() are preceded by a timer_del() call, as can be seen in the output of git grep -B1 '\' This is unfortunate API design as it makes it easy to accidentally misuse (by forgetting the timer_del()), and the correct use is annoyingly verbose. Make timer_free() imply a timer_del(). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20201215154107.3255-2-peter.maydell@linaro.org --- include/qemu/timer.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index bdecc5b41fe..61296ea980c 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -609,17 +609,6 @@ static inline QEMUTimer *timer_new_ms(QEMUClockType ty= pe, QEMUTimerCB *cb, */ void timer_deinit(QEMUTimer *ts); =20 -/** - * timer_free: - * @ts: the timer - * - * Free a timer (it must not be on the active list) - */ -static inline void timer_free(QEMUTimer *ts) -{ - g_free(ts); -} - /** * timer_del: * @ts: the timer @@ -631,6 +620,19 @@ static inline void timer_free(QEMUTimer *ts) */ void timer_del(QEMUTimer *ts); =20 +/** + * timer_free: + * @ts: the timer + * + * Free a timer. This will call timer_del() for you to remove + * the timer from the active list if it was still active. + */ +static inline void timer_free(QEMUTimer *ts) +{ + timer_del(ts); + g_free(ts); +} + /** * timer_mod_ns: * @ts: the timer --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120601; cv=none; d=zohomail.com; s=zohoarc; b=jaiF59DYwOqxSZBuHNm07cNByqCuFUojqLAkACR64AhzT6tl6aw2v1x8o/ysZOx8pe8aKSPa1IPODp3I/vZlTZFM8ld7PZTEItFXZ4w9HhVP3bj9BRKCNGCaRoRhFCM7lbaAqC0sIQHsChBsakRd8RwRuOa6LNmd+PSZ5c2ctkQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120601; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/bYzZPH4tKpsMQvtJRcHRyaf4REHsMCcIzPJUmKEZHg=; b=FkCwWa7nMDNccgoAB5kmUB2AWUu2mBBn1LsPqWwzBObV2T5nywor/yFT9UmDpCATs0330/8V107l7uFqR9OdiBMPibWznmvaghKwUwD/7AeAu9bdqc26bRBDVVywRxd9ZTYq/BBOGMsxnGgupSTdrx9tFxb7+CfFGOUsu6murYQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120601261827.2314156948945; Fri, 8 Jan 2021 07:43:21 -0800 (PST) Received: from localhost ([::1]:44702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtv5-0004Sn-K7 for importer@patchew.org; Fri, 08 Jan 2021 10:43:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtof-0004qb-MA for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:41 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:35449) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoe-0002vT-2j for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:41 -0500 Received: by mail-wr1-x434.google.com with SMTP id r3so9441653wrt.2 for ; Fri, 08 Jan 2021 07:36:39 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/bYzZPH4tKpsMQvtJRcHRyaf4REHsMCcIzPJUmKEZHg=; b=Ncn5h/od/Lwq0s3apIH+SckOpN0F+Tlqdh9iSK3uEjzrCgdV5Z81IXUB+tIrkgQBLS sinFL5lAWR6PSvii/QMMwNOa+GNcnsKzIAsTHyN9asL07utOvIEEupAGflJTih3MAp1f 5NfSFNCiSQNFAwv5DrvjpprzTR9OzU3ZilVsSK47EiIrEoneYEbFFDblUsmEmmtWQets aPuHnxCheHKf5pNWbD/ITuLJ1yOq1MN2Yaaz3mKoYEJPh+pEYj2QxwNzOgxnoG95NJPK +hHldmy2ac/sHR0Dz3gAc9CKCEkGo2KFiBr2RbgPb9oZLPz3B4GSpd7c3LDnqY4kP2Nn z9Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/bYzZPH4tKpsMQvtJRcHRyaf4REHsMCcIzPJUmKEZHg=; b=PlXvtNEUvweL+OYDzGcB8v+GHYwAlstnxLC4NesG4N1+DM9rUh1x9VKq6F9nZu4mS3 7ACDxKh3tZ83cuxnUtpBNkiDeS9FNUOSJgFc9qMCxjR70aV3JbQX9f3ziBUl+iwAHmNf 4sdaqRatTXdmN8yjA9Bj1blhdaldEG11YBijNoBol2sDA9F1oJm1ZkstSvLcGDbrIzzV VDvBc4gbP9y1u9tUuwMI49LSn66dhWGxYrm9ObL+90m50KNIcXIVjUCRPP9nVeL5tt0X bwKHXi5f3EM/6uPYLDl3sGk6JIi5lnXqi+u0RZ+xdI5PdQ5sr/OCf9XgH5ASEPY7g5Ez ZEMw== X-Gm-Message-State: AOAM533ar1xbzQ5bis0r3DJ4bFdE3IW4ZVTb30tIr7PZEH9fjLOYxh73 E0/vgaK8VWD7ccvcIX5NWznQLGprWBvefQ== X-Google-Smtp-Source: ABdhPJy2PM7JEy6qRKzIRnYPQ3jVy09y2MeCN5KHm9uNwKXwXd+ok8wh2I1Ta5q9m9tP9lXj+UHfYQ== X-Received: by 2002:adf:dd92:: with SMTP id x18mr4239280wrl.311.1610120198523; Fri, 08 Jan 2021 07:36:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/23] scripts/coccinelle: New script to remove unnecessary timer_del() calls Date: Fri, 8 Jan 2021 15:36:08 +0000 Message-Id: <20210108153621.3868-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Now that timer_free() implicitly calls timer_del(), sequences timer_del(mytimer); timer_free(mytimer); can be simplified to just timer_free(mytimer); Add a Coccinelle script to do this transformation. Signed-off-by: Peter Maydell Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20201215154107.3255-3-peter.maydell@linaro.org --- scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci diff --git a/scripts/coccinelle/timer-del-timer-free.cocci b/scripts/coccin= elle/timer-del-timer-free.cocci new file mode 100644 index 00000000000..c3cfd428039 --- /dev/null +++ b/scripts/coccinelle/timer-del-timer-free.cocci @@ -0,0 +1,18 @@ +// Remove superfluous timer_del() calls +// +// Copyright Linaro Limited 2020 +// This work is licensed under the terms of the GNU GPLv2 or later. +// +// spatch --macro-file scripts/cocci-macro-file.h \ +// --sp-file scripts/coccinelle/timer-del-timer-free.cocci \ +// --in-place --dir . +// +// The timer_free() function now implicitly calls timer_del() +// for you, so calls to timer_del() immediately before the +// timer_free() of the same timer can be deleted. + +@@ +expression T; +@@ +-timer_del(T); + timer_free(T); --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120741; cv=none; d=zohomail.com; s=zohoarc; b=S3UY9GRSp32tL+JNFk92BKWZ+7RAUHGmzS49g70XVzDdDrYMNC3lJYZxJT3tZZMjNDfnUEwiJxgjslzFcxATCe6PjGVtwDRRF0VjjYAajbKe+IeAHEAqvkSgM3OQ4Ww2/f1g/ojn/wfWoLNoM0mUFr1UwR/ACNS9eVjoSk2SwPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120741; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SE3TDvMvjW9VPzi1pPqrgCcEVGayPXue5AQHo5rTSF4=; b=DqeLqgytExNeg1k6AQcbI1bq6BrsU/tPY5uIbHOSPEmG4jwqjgPZOk5OwTZZwzyfowpiORExK6vKE3XJEHnqvZ/TuYkIYeS+z+ej48W+CShR6N+TBGCJvQoI/x8+q8ciiv6Lcf0wXzzOCylAHl1BM8L61YDTyMqeZeF9FJDGxDY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120740632120.85277789676047; Fri, 8 Jan 2021 07:45:40 -0800 (PST) Received: from localhost ([::1]:50720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxtxE-0006uY-HE for importer@patchew.org; Fri, 08 Jan 2021 10:45:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtoj-0004x7-RO for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:45 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:46988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtof-0002wD-Sv for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:45 -0500 Received: by mail-wr1-x436.google.com with SMTP id d13so9367097wrc.13 for ; Fri, 08 Jan 2021 07:36:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SE3TDvMvjW9VPzi1pPqrgCcEVGayPXue5AQHo5rTSF4=; b=vYfvHtlIP6hbwd0BJuUuUioHgqZ6z+smqpzIvFaXnH9vlqg5sGFUHab58rRcKp4/bu BlWy2+dfiHxSjTTi1pJLLjewPZ+chKSthK2YmphuJsDZBrJLRA3HGziF7sYG0zXypYhJ bHiefnCWI5pKELe4RsxqaEMZIQf6dspjx7D0J3mm2uRews85VK2A4FHSI0MaeqrQwKkv SXgTpKcTnO25zOIQ6N/ttHxS102JKdnxhSIdGOQr0YyuEg82Sdu3MDhF/ZpxlGScdE+N 3uSI61pP3Xhmv1f8di1Zlg4gGZVcOjN9ZrTDTeJw121aPsZcDMPblnj1uRKv7wXkoZyd L4hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SE3TDvMvjW9VPzi1pPqrgCcEVGayPXue5AQHo5rTSF4=; b=Y/fQmS3KXHuz63LpKn/Du0V4aqxmmCmOhNHncDgvo/sG1Nc5JfjbNaptdhHhXgzYbP ldGCXc4CTgI77ukyE2pRu6gqDjwczoBoXk5Fm6xypxelUntu1y4phOQkmDe3+dI4uWhd xIe9tmb6MbLP+6voVkJCzBwUlfuQNYXQnbdV0YxX9ar74mYhZeLawP6+XhEJwXdkY8W9 CfApDeT3wRjGa2BU513GHB/48715h1xxj6HQsuO1xywnFMaGX/rG2jlV/mAio8kkKJeJ xeVStFqMmkcX+3FABqexqcuZmHyddTZL09A9SXa4iNrN+weo19KBPqjXbJiDRt7y0lLr Ngmw== X-Gm-Message-State: AOAM532ETb8erOER/3aLK7bGGxpMSl5fqCA9Ab+r3OsQqVD/tfLFvEVo m2wyShSDSMBkqssivgigpJeI6orPZNG4Mw== X-Google-Smtp-Source: ABdhPJxp2dfkBkk3tQ/HqrVszIgVBKEzd7PpExaYrJQszjZjuPAUrGQUAZuYu5A+xrpObU//LtbWlw== X-Received: by 2002:a5d:62c7:: with SMTP id o7mr4150529wrv.257.1610120199994; Fri, 08 Jan 2021 07:36:39 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/23] Remove superfluous timer_del() calls Date: Fri, 8 Jan 2021 15:36:09 +0000 Message-Id: <20210108153621.3868-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) This commit is the result of running the timer-del-timer-free.cocci script on the whole source tree. Signed-off-by: Peter Maydell Acked-by: Corey Minyard Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20201215154107.3255-4-peter.maydell@linaro.org --- block/iscsi.c | 2 -- block/nbd.c | 1 - block/qcow2.c | 1 - hw/block/nvme.c | 2 -- hw/char/serial.c | 2 -- hw/char/virtio-serial-bus.c | 2 -- hw/ide/core.c | 1 - hw/input/hid.c | 1 - hw/intc/apic.c | 1 - hw/intc/ioapic.c | 1 - hw/ipmi/ipmi_bmc_extern.c | 1 - hw/net/e1000.c | 3 --- hw/net/e1000e_core.c | 8 -------- hw/net/pcnet-pci.c | 1 - hw/net/rtl8139.c | 1 - hw/net/spapr_llan.c | 1 - hw/net/virtio-net.c | 2 -- hw/s390x/s390-pci-inst.c | 1 - hw/sd/sd.c | 1 - hw/sd/sdhci.c | 2 -- hw/usb/dev-hub.c | 1 - hw/usb/hcd-ehci.c | 1 - hw/usb/hcd-ohci-pci.c | 1 - hw/usb/hcd-uhci.c | 1 - hw/usb/hcd-xhci.c | 1 - hw/usb/redirect.c | 1 - hw/vfio/display.c | 1 - hw/virtio/vhost-vsock-common.c | 1 - hw/virtio/virtio-balloon.c | 1 - hw/virtio/virtio-rng.c | 1 - hw/watchdog/wdt_diag288.c | 1 - hw/watchdog/wdt_i6300esb.c | 1 - migration/colo.c | 1 - monitor/hmp-cmds.c | 1 - net/announce.c | 1 - net/colo-compare.c | 1 - net/slirp.c | 1 - replay/replay-debugging.c | 1 - target/s390x/cpu.c | 2 -- ui/console.c | 1 - ui/spice-core.c | 1 - util/throttle.c | 1 - 42 files changed, 58 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 7d4b3b56d5c..4d2a416ce77 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1524,12 +1524,10 @@ static void iscsi_detach_aio_context(BlockDriverSta= te *bs) iscsilun->events =3D 0; =20 if (iscsilun->nop_timer) { - timer_del(iscsilun->nop_timer); timer_free(iscsilun->nop_timer); iscsilun->nop_timer =3D NULL; } if (iscsilun->event_timer) { - timer_del(iscsilun->event_timer); timer_free(iscsilun->event_timer); iscsilun->event_timer =3D NULL; } diff --git a/block/nbd.c b/block/nbd.c index 42536702b6f..242a258f3a5 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -194,7 +194,6 @@ static void nbd_recv_coroutines_wake_all(BDRVNBDState *= s) static void reconnect_delay_timer_del(BDRVNBDState *s) { if (s->reconnect_delay_timer) { - timer_del(s->reconnect_delay_timer); timer_free(s->reconnect_delay_timer); s->reconnect_delay_timer =3D NULL; } diff --git a/block/qcow2.c b/block/qcow2.c index 3a90ef27868..5d94f45be95 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -852,7 +852,6 @@ static void cache_clean_timer_del(BlockDriverState *bs) { BDRVQcow2State *s =3D bs->opaque; if (s->cache_clean_timer) { - timer_del(s->cache_clean_timer); timer_free(s->cache_clean_timer); s->cache_clean_timer =3D NULL; } diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 01b657b1c5e..27d2c72716e 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1052,7 +1052,6 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest = *req) static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n) { n->sq[sq->sqid] =3D NULL; - timer_del(sq->timer); timer_free(sq->timer); g_free(sq->io_req); if (sq->sqid) { @@ -1334,7 +1333,6 @@ static uint16_t nvme_get_log(NvmeCtrl *n, NvmeRequest= *req) static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n) { n->cq[cq->cqid] =3D NULL; - timer_del(cq->timer); timer_free(cq->timer); msix_vector_unuse(&n->parent_obj, cq->vector); if (cq->cqid) { diff --git a/hw/char/serial.c b/hw/char/serial.c index 6e52539648d..bc2e3229704 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -941,10 +941,8 @@ static void serial_unrealize(DeviceState *dev) =20 qemu_chr_fe_deinit(&s->chr, false); =20 - timer_del(s->modem_status_poll); timer_free(s->modem_status_poll); =20 - timer_del(s->fifo_timeout_timer); timer_free(s->fifo_timeout_timer); =20 fifo8_destroy(&s->recv_fifo); diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index cf08ef97281..b20038991a6 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -741,7 +741,6 @@ static void virtio_serial_post_load_timer_cb(void *opaq= ue) } } g_free(s->post_load->connected); - timer_del(s->post_load->timer); timer_free(s->post_load->timer); g_free(s->post_load); s->post_load =3D NULL; @@ -1138,7 +1137,6 @@ static void virtio_serial_device_unrealize(DeviceStat= e *dev) g_free(vser->ports_map); if (vser->post_load) { g_free(vser->post_load->connected); - timer_del(vser->post_load->timer); timer_free(vser->post_load->timer); g_free(vser->post_load); } diff --git a/hw/ide/core.c b/hw/ide/core.c index e85821637c9..b49e4cfbc6c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2716,7 +2716,6 @@ void ide_init2(IDEBus *bus, qemu_irq irq) =20 void ide_exit(IDEState *s) { - timer_del(s->sector_write_timer); timer_free(s->sector_write_timer); qemu_vfree(s->smart_selftest_data); qemu_vfree(s->io_buffer); diff --git a/hw/input/hid.c b/hw/input/hid.c index 89239b5634d..e1d2e460837 100644 --- a/hw/input/hid.c +++ b/hw/input/hid.c @@ -88,7 +88,6 @@ static void hid_idle_timer(void *opaque) static void hid_del_idle_timer(HIDState *hs) { if (hs->idle_timer) { - timer_del(hs->idle_timer); timer_free(hs->idle_timer); hs->idle_timer =3D NULL; } diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 1c8be40d8b4..3ada22f4270 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -888,7 +888,6 @@ static void apic_unrealize(DeviceState *dev) { APICCommonState *s =3D APIC(dev); =20 - timer_del(s->timer); timer_free(s->timer); local_apics[s->id] =3D NULL; } diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index a3021a4de16..264262959d5 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -474,7 +474,6 @@ static void ioapic_unrealize(DeviceState *dev) { IOAPICCommonState *s =3D IOAPIC_COMMON(dev); =20 - timer_del(s->delayed_ioapic_service_timer); timer_free(s->delayed_ioapic_service_timer); } =20 diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c index e141a5cd45e..acf2bab35fa 100644 --- a/hw/ipmi/ipmi_bmc_extern.c +++ b/hw/ipmi/ipmi_bmc_extern.c @@ -511,7 +511,6 @@ static void ipmi_bmc_extern_finalize(Object *obj) { IPMIBmcExtern *ibe =3D IPMI_BMC_EXTERN(obj); =20 - timer_del(ibe->extern_timer); timer_free(ibe->extern_timer); } =20 diff --git a/hw/net/e1000.c b/hw/net/e1000.c index d7d05ae30af..d8da2f6528b 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -1647,11 +1647,8 @@ pci_e1000_uninit(PCIDevice *dev) { E1000State *d =3D E1000(dev); =20 - timer_del(d->autoneg_timer); timer_free(d->autoneg_timer); - timer_del(d->mit_timer); timer_free(d->mit_timer); - timer_del(d->flush_queue_timer); timer_free(d->flush_queue_timer); qemu_del_nic(d->nic); } diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c index 095c01ebc60..4dcb92d966b 100644 --- a/hw/net/e1000e_core.c +++ b/hw/net/e1000e_core.c @@ -434,23 +434,16 @@ e1000e_intrmgr_pci_unint(E1000ECore *core) { int i; =20 - timer_del(core->radv.timer); timer_free(core->radv.timer); - timer_del(core->rdtr.timer); timer_free(core->rdtr.timer); - timer_del(core->raid.timer); timer_free(core->raid.timer); =20 - timer_del(core->tadv.timer); timer_free(core->tadv.timer); - timer_del(core->tidv.timer); timer_free(core->tidv.timer); =20 - timer_del(core->itr.timer); timer_free(core->itr.timer); =20 for (i =3D 0; i < E1000E_MSIX_VEC_NUM; i++) { - timer_del(core->eitr[i].timer); timer_free(core->eitr[i].timer); } } @@ -3355,7 +3348,6 @@ e1000e_core_pci_uninit(E1000ECore *core) { int i; =20 - timer_del(core->autoneg_timer); timer_free(core->autoneg_timer); =20 e1000e_intrmgr_pci_unint(core); diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c index ccc3fce2a00..95d27102aa4 100644 --- a/hw/net/pcnet-pci.c +++ b/hw/net/pcnet-pci.c @@ -183,7 +183,6 @@ static void pci_pcnet_uninit(PCIDevice *dev) PCIPCNetState *d =3D PCI_PCNET(dev); =20 qemu_free_irq(d->state.irq); - timer_del(d->state.poll_timer); timer_free(d->state.poll_timer); qemu_del_nic(d->state.nic); } diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index ba5ace1ab75..4675ac878e9 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -3338,7 +3338,6 @@ static void pci_rtl8139_uninit(PCIDevice *dev) =20 g_free(s->cplus_txbuffer); s->cplus_txbuffer =3D NULL; - timer_del(s->timer); timer_free(s->timer); qemu_del_nic(s->nic); } diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index 581320a0e7d..10e85a45560 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -363,7 +363,6 @@ static void spapr_vlan_instance_finalize(Object *obj) } =20 if (dev->rxp_timer) { - timer_del(dev->rxp_timer); timer_free(dev->rxp_timer); } } diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 8356eeec131..09ceb02c9d9 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1862,7 +1862,6 @@ static void virtio_net_rsc_cleanup(VirtIONet *n) g_free(seg); } =20 - timer_del(chain->drain_timer); timer_free(chain->drain_timer); QTAILQ_REMOVE(&n->rsc_chains, chain, next); g_free(chain); @@ -2645,7 +2644,6 @@ static void virtio_net_del_queue(VirtIONet *n, int in= dex) =20 virtio_del_queue(vdev, index * 2); if (q->tx_timer) { - timer_del(q->tx_timer); timer_free(q->tx_timer); q->tx_timer =3D NULL; } else { diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c index 76b08a39a73..654fac6c0a5 100644 --- a/hw/s390x/s390-pci-inst.c +++ b/hw/s390x/s390-pci-inst.c @@ -955,7 +955,6 @@ void pci_dereg_ioat(S390PCIIOMMU *iommu) void fmb_timer_free(S390PCIBusDevice *pbdev) { if (pbdev->fmb_timer) { - timer_del(pbdev->fmb_timer); timer_free(pbdev->fmb_timer); pbdev->fmb_timer =3D NULL; } diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 2aeab39c3fe..4375ed5b8b2 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -2133,7 +2133,6 @@ static void sd_instance_finalize(Object *obj) { SDState *sd =3D SD_CARD(obj); =20 - timer_del(sd->ocr_power_timer); timer_free(sd->ocr_power_timer); } =20 diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 2f8b74a84f7..8ffa53999d8 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1330,9 +1330,7 @@ void sdhci_initfn(SDHCIState *s) =20 void sdhci_uninitfn(SDHCIState *s) { - timer_del(s->insert_timer); timer_free(s->insert_timer); - timer_del(s->transfer_timer); timer_free(s->transfer_timer); =20 g_free(s->fifo_buffer); diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 40c1f906942..e35813d7722 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -576,7 +576,6 @@ static void usb_hub_unrealize(USBDevice *dev) &s->ports[i].port); } =20 - timer_del(s->port_timer); timer_free(s->port_timer); } =20 diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index ae7f20c502a..aca018d8b5f 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2534,7 +2534,6 @@ void usb_ehci_unrealize(EHCIState *s, DeviceState *de= v) trace_usb_ehci_unrealize(); =20 if (s->frame_timer) { - timer_del(s->frame_timer); timer_free(s->frame_timer); s->frame_timer =3D NULL; } diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c index f95199e0bbc..8e1146b8627 100644 --- a/hw/usb/hcd-ohci-pci.c +++ b/hw/usb/hcd-ohci-pci.c @@ -97,7 +97,6 @@ static void usb_ohci_exit(PCIDevice *dev) usb_bus_release(&s->bus); } =20 - timer_del(s->eof_timer); timer_free(s->eof_timer); } =20 diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 27ca237d71f..5969eb86b31 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -1283,7 +1283,6 @@ static void usb_uhci_exit(PCIDevice *dev) trace_usb_uhci_exit(); =20 if (s->frame_timer) { - timer_del(s->frame_timer); timer_free(s->frame_timer); s->frame_timer =3D NULL; } diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 9ce7ca706e3..46212b1e695 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3395,7 +3395,6 @@ static void usb_xhci_unrealize(DeviceState *dev) } =20 if (xhci->mfwrap_timer) { - timer_del(xhci->mfwrap_timer); timer_free(xhci->mfwrap_timer); xhci->mfwrap_timer =3D NULL; } diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 03b6f61f75b..7e9e3fecbfe 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1481,7 +1481,6 @@ static void usbredir_unrealize(USBDevice *udev) qemu_bh_delete(dev->chardev_close_bh); qemu_bh_delete(dev->device_reject_bh); =20 - timer_del(dev->attach_timer); timer_free(dev->attach_timer); =20 usbredir_cleanup_device_queues(dev); diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 342054193b3..42d67e870b7 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -186,7 +186,6 @@ static void vfio_display_edid_exit(VFIODisplay *dpy) =20 g_free(dpy->edid_regs); g_free(dpy->edid_blob); - timer_del(dpy->edid_link_timer); timer_free(dpy->edid_link_timer); } =20 diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c index 5b2ebf34961..4ad6e234adf 100644 --- a/hw/virtio/vhost-vsock-common.c +++ b/hw/virtio/vhost-vsock-common.c @@ -151,7 +151,6 @@ static void vhost_vsock_common_post_load_timer_cleanup(= VHostVSockCommon *vvc) return; } =20 - timer_del(vvc->post_load_timer); timer_free(vvc->post_load_timer); vvc->post_load_timer =3D NULL; } diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index e83017c02df..e7709551767 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -204,7 +204,6 @@ static bool balloon_stats_enabled(const VirtIOBalloon *= s) static void balloon_stats_destroy_timer(VirtIOBalloon *s) { if (balloon_stats_enabled(s)) { - timer_del(s->stats_timer); timer_free(s->stats_timer); s->stats_timer =3D NULL; s->stats_poll_interval =3D 0; diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 2886c0ce2a6..76ce9376931 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -233,7 +233,6 @@ static void virtio_rng_device_unrealize(DeviceState *de= v) VirtIORNG *vrng =3D VIRTIO_RNG(dev); =20 qemu_del_vm_change_state_handler(vrng->vmstate); - timer_del(vrng->rate_limit_timer); timer_free(vrng->rate_limit_timer); virtio_del_queue(vdev, 0); virtio_cleanup(vdev); diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c index 4c4b6a6ab70..e135a4de8b2 100644 --- a/hw/watchdog/wdt_diag288.c +++ b/hw/watchdog/wdt_diag288.c @@ -110,7 +110,6 @@ static void wdt_diag288_unrealize(DeviceState *dev) { DIAG288State *diag288 =3D DIAG288(dev); =20 - timer_del(diag288->timer); timer_free(diag288->timer); } =20 diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 502f45a9399..4c52e3bb9e1 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -454,7 +454,6 @@ static void i6300esb_exit(PCIDevice *dev) { I6300State *d =3D WATCHDOG_I6300ESB_DEVICE(dev); =20 - timer_del(d->timer); timer_free(d->timer); } =20 diff --git a/migration/colo.c b/migration/colo.c index 3f1d3dfd956..de27662cab5 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -636,7 +636,6 @@ out: * error. */ colo_compare_unregister_notifier(&packets_compare_notifier); - timer_del(s->colo_delay_timer); timer_free(s->colo_delay_timer); qemu_event_destroy(&s->colo_checkpoint_event); =20 diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 0dd594f92bd..fd4d77e2461 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1586,7 +1586,6 @@ static void hmp_migrate_status_cb(void *opaque) error_report("%s", info->error_desc); } monitor_resume(status->mon); - timer_del(status->timer); timer_free(status->timer); g_free(status); } diff --git a/net/announce.c b/net/announce.c index db90d3bd4b9..26f057f5ee4 100644 --- a/net/announce.c +++ b/net/announce.c @@ -41,7 +41,6 @@ void qemu_announce_timer_del(AnnounceTimer *timer, bool f= ree_named) { bool free_timer =3D false; if (timer->tm) { - timer_del(timer->tm); timer_free(timer->tm); timer->tm =3D NULL; } diff --git a/net/colo-compare.c b/net/colo-compare.c index 337025b44f8..84db4978ac3 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -951,7 +951,6 @@ static void colo_compare_timer_init(CompareState *s) static void colo_compare_timer_del(CompareState *s) { if (s->packet_check_timer) { - timer_del(s->packet_check_timer); timer_free(s->packet_check_timer); s->packet_check_timer =3D NULL; } diff --git a/net/slirp.c b/net/slirp.c index 77042e6df74..8350c6d45f7 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -184,7 +184,6 @@ static void *net_slirp_timer_new(SlirpTimerCb cb, =20 static void net_slirp_timer_free(void *timer, void *opaque) { - timer_del(timer); timer_free(timer); } =20 diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c index 1d6a9684060..5ec574724a2 100644 --- a/replay/replay-debugging.c +++ b/replay/replay-debugging.c @@ -78,7 +78,6 @@ static void replay_delete_break(void) assert(replay_mutex_locked()); =20 if (replay_break_timer) { - timer_del(replay_break_timer); timer_free(replay_break_timer); replay_break_timer =3D NULL; } diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 8a734c2f8c0..7da70afbf22 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -313,9 +313,7 @@ static void s390_cpu_finalize(Object *obj) #if !defined(CONFIG_USER_ONLY) S390CPU *cpu =3D S390_CPU(obj); =20 - timer_del(cpu->env.tod_timer); timer_free(cpu->env.tod_timer); - timer_del(cpu->env.cpu_timer); timer_free(cpu->env.cpu_timer); =20 qemu_unregister_reset(s390_cpu_machine_reset_cb, cpu); diff --git a/ui/console.c b/ui/console.c index 4db5b04cc2e..d80ce7037c3 100644 --- a/ui/console.c +++ b/ui/console.c @@ -253,7 +253,6 @@ static void gui_setup_refresh(DisplayState *ds) timer_mod(ds->gui_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME)); } if (!need_timer && ds->gui_timer !=3D NULL) { - timer_del(ds->gui_timer); timer_free(ds->gui_timer); ds->gui_timer =3D NULL; } diff --git a/ui/spice-core.c b/ui/spice-core.c index eea52f53899..5746d0aae7c 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -76,7 +76,6 @@ static void timer_cancel(SpiceTimer *timer) =20 static void timer_remove(SpiceTimer *timer) { - timer_del(timer->timer); timer_free(timer->timer); g_free(timer); } diff --git a/util/throttle.c b/util/throttle.c index b38e742da53..81f247a8d18 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -247,7 +247,6 @@ static void throttle_timer_destroy(QEMUTimer **timer) { assert(*timer !=3D NULL); =20 - timer_del(*timer); timer_free(*timer); *timer =3D NULL; } --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120948; cv=none; d=zohomail.com; s=zohoarc; b=ES8yH7CoWFVntm2U+B1VrrU4eYIyXtHk59cgsT1MlumxGTLG1SWC4CxzMzUBn5hFa/120bO+aPM/ZTE80RE9dh1HL+hqnl3hPUTqbnJs+kWo4pi1q34pVnEWav9D0er86S3xMGdX02vwXkK4sapEmDgIm4pLTk24ArU68DpbrQw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120948; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J6A1hV47s+jT9+q8dDBSWtFjk7A03IrGyk65mbUm7jM=; b=BiuEwpxOqHJi9BuauD7GbLcOr59D5j53pJCgtNk93S4AZmiW5hAHe1mdz9SJDUP8SmiXLnnpy7jcfvoLSYkFnIdZjx8y/8uEKuPN1d4Sy+mi71hAabATmMCO1WUy74Hj5ykURZI4IwGCKS2XHstywJmytczQQBufOvfPfNZ4ioM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120948270323.50928659244914; Fri, 8 Jan 2021 07:49:08 -0800 (PST) Received: from localhost ([::1]:58298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu0g-0001vO-Uz for importer@patchew.org; Fri, 08 Jan 2021 10:49:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtoh-0004vz-Ta for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:43 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:51007) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtog-0002wX-9P for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:43 -0500 Received: by mail-wm1-x330.google.com with SMTP id 190so8163288wmz.0 for ; Fri, 08 Jan 2021 07:36:41 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=J6A1hV47s+jT9+q8dDBSWtFjk7A03IrGyk65mbUm7jM=; b=kRrV6FgmB6xukC9rBSMu5vQ+rAW2lVT4Zv6Is8yNaOqM5bFOe7Rt4TphvJLOruptHw 3rBJSt1pLBhEcbEizUhLMbJk9b3AqEhDmDz9Q4IwRCBJZvoFRE1W7cUCLCGWjsC4tV0r JCqkjaETQUBwqsCQGoqbwnapNsHxNdKe1Gy66ryncpxj1+rxFFek/mXk/MWeAdYBBTDq 6giI4Fv1srCKLcM4z808S5WnxGyjN7RZm7jzFYkvwLjaFsG2dEA0q/NRPP0ElJJIjQnv CG409gc5/1S+Vteok0DxG8IiV1/wP+tYgbh+mUFG2v13pW825NS2cIvT/s7P40LAmuxv 4GYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J6A1hV47s+jT9+q8dDBSWtFjk7A03IrGyk65mbUm7jM=; b=sBOAp7pcQvVpe4WEVbkWltfA24AT3X2xRK9GkeOwJierCgDVMnZ0EAkcJ1liEtsaB4 9QjhNwMYqm6+Or6LQc/UFtvPSR8sebaJBPvJTqfwuYd+56k+6FQkD8MgEP9MxDDHH2k/ xnGV8WnfNps+GTpABX7EzJXfZu0ku9Ja+7nh+fW2tYL9LyFXnjD/hqUdIYxUoLXQZiOT fMuI7DOIW3dYVwH1sre9xbF6LhLglF5OYeOCmkcLo0Z6V2fESuMf+4M9hZP1BD3IQcFi HgBUCUdAD5dwq+B5QBDRvHu2MobgDAK+UTiDIZRQq89F0b1aQbFjA3pHAtckCE84wU8X ArLQ== X-Gm-Message-State: AOAM533sJyOzLh3mtCouOprbPEEWNmOqPNcaQMm3b9bpewv15owX2erI JtUbBgWkNMNxKWyvmGoCFNML1VA6AhoN8Q== X-Google-Smtp-Source: ABdhPJxfowpOC+Sx3kaii6lAz1m9AF2/VEDG6QlTvFGkmz04ARyZFUW1hwwZYpxN22owqMC6f4Lhxg== X-Received: by 2002:a7b:c198:: with SMTP id y24mr3579665wmi.151.1610120200770; Fri, 08 Jan 2021 07:36:40 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/23] target/arm: Remove timer_del()/timer_deinit() before timer_free() Date: Fri, 8 Jan 2021 15:36:10 +0000 Message-Id: <20210108153621.3868-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) The Arm CPU finalize function uses a sequence of timer_del(), timer_deinit(= ), timer_free() to free the timer. The timer_deinit() step in this was always unnecessary, and now the timer_del() is implied by timer_free(), so we can collapse this down to simply calling timer_free(). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-id: 20201215154107.3255-5-peter.maydell@linaro.org --- target/arm/cpu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 62e319eb6ad..8387e94b944 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1305,8 +1305,6 @@ static void arm_cpu_finalizefn(Object *obj) } #ifndef CONFIG_USER_ONLY if (cpu->pmu_timer) { - timer_del(cpu->pmu_timer); - timer_deinit(cpu->pmu_timer); timer_free(cpu->pmu_timer); } #endif --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121122; cv=none; d=zohomail.com; s=zohoarc; b=MVBVOfzKDkZhz5+4NhVF0Z44QyY524i+ICBPacb1cZ3x+lVqe68W47DwfmMuoDFTYsdL2PRIxRyvjl+wKbOwFKDhxyxje82+L7Lquk/cly/bonIJMB3F2+BmLI1ONQ/bO+bhSUnqbOtHzeno4xnEFyN3Jsu86T8xH7qIQDcFB04= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121122; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M1QetWJUJoDE77s/fKEVmCNBI+2lQSp4v7iXPPK7Vd0=; b=XmGG06Jrsow8r/FN+t3HdIlpFGOZbssNFFj2i2oZ5ZKJdfeqp75BAitquc8zTNp4poW3dmz0eDLbFh3wZnXg+0ep15nYGWnpsea4v4gvKLvpiq1FFdU/iXISSL7OQ21p9AtHrH9Zsx1AVUSey7N73FXJNyRqCny/A/VMddCw6jQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161012112294299.98801202104471; Fri, 8 Jan 2021 07:52:02 -0800 (PST) Received: from localhost ([::1]:35220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu3V-00049v-Sl for importer@patchew.org; Fri, 08 Jan 2021 10:52:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtol-0004yX-O0 for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:47 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:34708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoh-0002wo-8W for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:47 -0500 Received: by mail-wr1-x42a.google.com with SMTP id q18so9457593wrn.1 for ; Fri, 08 Jan 2021 07:36:42 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=M1QetWJUJoDE77s/fKEVmCNBI+2lQSp4v7iXPPK7Vd0=; b=bCktKPQyMO24w7TiMjvjG01rvArqeE2dMHhNRZvkK34+iDrLfaXYc/kqjzdGk/X77/ qRMlfJeezV7Wm5DkdG2eA15kqI63XE6ECPobv4eVkBlVHIFHrVUNsfWE6mHNb9vPV0uv jgUt49uDm+4pgp/FBCnMopCKAlt6OpRzlQKFJKGHPb97I5FxkVdQnxr7ASgT8GAIFOg9 AOqo23R5P+pPfCtaQgU+NrhYWrZgGsmDL/AaQZ4l17CToVtMtkIozszC79azga3RmNII n3mhTzvrLhahvhNJmoDMIl4VkwB7f6pXzswfUKp9M/aZUbxn+M1oMfti0ml3DKp7dXfj jB+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M1QetWJUJoDE77s/fKEVmCNBI+2lQSp4v7iXPPK7Vd0=; b=HkLOd86Zoa8xbgB+izrlUNIhZSPQFjYGZ3pIA/Cm4XrQVCo4AuRPOFaeNBjwtdWsBX R5ZWiYLPaXxowrfqeL9Dr5mflV3WBMWfY/7eYCq3K/31WufD8IWqV9scUnf4fzk+kC13 G5oKiCdkqHTsXSRGhtzZJr0V91RV0Rorm8gETjOnSsgz4RmKjfJi989ekl5v9j1G14JS eNRv6xDc4wqt5+pSt+cIuClvPhU3yitBFdj1LXPeJate3o5N/q4hEzzfV2t5xU5k7ejT cnUtp/eWtlDu+cZhUgELkfui7e2BQY6ZQjAzBXbw/E4JF00ZinHTPT7yY10H+KQiEc+A 3uIg== X-Gm-Message-State: AOAM530aTDEeQ641AIWHHdV2/48lTi5+NRTwijqoebopetGNvlqZHALj 3ywPGUks4xGxQvJjNYCHc/lxnSkJmQ7vuA== X-Google-Smtp-Source: ABdhPJxXi988NmY5XT9D4NMaaMxkCfG28kqybbA6H3wd+Lq3/SL+qSwtaIsWVFnF1NoNpFFaiMg47g== X-Received: by 2002:a5d:5227:: with SMTP id i7mr4389944wra.68.1610120201773; Fri, 08 Jan 2021 07:36:41 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/23] digic-timer: Use ptimer_free() in the finalize function to avoid memleaks Date: Fri, 8 Jan 2021 15:36:11 +0000 Message-Id: <20210108153621.3868-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Gan Qixin When running device-introspect-test, a memory leak occurred in the digic_timer_init function, so use ptimer_free() in the finalize function to avoid it. ASAN shows memory leak stack: Indirect leak of 288 byte(s) in 3 object(s) allocated from: #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) #2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432 #3 0xaaabf5b04084 in digic_timer_init /qemu/hw/timer/digic-timer.c:142 #4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #5 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/obje= ct.c:564 #6 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/objec= t.c:547 #7 0xaaabf5b40e84 in digic_init /qemu/hw/arm/digic.c:46 #8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 #10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds= .c:153 #11 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qap= i-commands-qdev.c:59 #12 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 Reported-by: Euler Robot Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/digic-timer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c index 32612228daf..e3aae4a45a4 100644 --- a/hw/timer/digic-timer.c +++ b/hw/timer/digic-timer.c @@ -154,6 +154,13 @@ static void digic_timer_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); } =20 +static void digic_timer_finalize(Object *obj) +{ + DigicTimerState *s =3D DIGIC_TIMER(obj); + + ptimer_free(s->ptimer); +} + static void digic_timer_class_init(ObjectClass *klass, void *class_data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -167,6 +174,7 @@ static const TypeInfo digic_timer_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(DigicTimerState), .instance_init =3D digic_timer_init, + .instance_finalize =3D digic_timer_finalize, .class_init =3D digic_timer_class_init, }; =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120910; cv=none; d=zohomail.com; s=zohoarc; b=C9TMMIkUhsqqlZFzde5kSGqviD6LITsKVRQV/3KdJGEQDBvqNsTBAof/YaHHBikkRk/SS3gPSE97MhG3mFxFYjiXsX0yAcpo+CbYn3AdsgEdTwtoju+mxWIWqpH2FgcKu3Y0k4IebTsCIBalvEDb7Speaqf/U6TMDvRN8Ci4kiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120910; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YNbbCXLYwFs5e3ZlATxT/qWoHe4YgqAQ3sZTdG+49vY=; b=SPt5d23cU0sxHVCcZO2JMwFoD/oQa7a3arOZa7tFJGM2MQQxkDg/CNJNQMWh/V0ssY6ZhAAiEaStU6jfeONqAOk+U5hvPntnidd7m0efRzczlP7SvTTJuM6gorZCHzzL5ay4eaLMFkNQvqP6YNzo9FRq/Pc/SSzMBgwWlrREAIY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120910111449.40946953023297; Fri, 8 Jan 2021 07:48:30 -0800 (PST) Received: from localhost ([::1]:56020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu01-0000um-Vd for importer@patchew.org; Fri, 08 Jan 2021 10:48:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtom-000505-TE for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:49 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46978) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoj-0002wt-HP for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:48 -0500 Received: by mail-wr1-x42b.google.com with SMTP id d13so9367207wrc.13 for ; Fri, 08 Jan 2021 07:36:44 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=YNbbCXLYwFs5e3ZlATxT/qWoHe4YgqAQ3sZTdG+49vY=; b=lslQ/oaA6zoMf5f2m0k/kyIMQTwVgDrwqSBCamqqTGeMF9hu5hTu35fdV5t/rxGya+ HiqbLm8+RN2qcBJUD0PiVlZH0ScxO+YMNQTz/g/FjsSZXz3aIz4uufYRlMBQgNPyZeip w0VL9ySUwg//Bgo9LIkJol8HSA17A2+vz+g6muVUurBokd41X/DszRbp6fiwUY7UJH6t xmGD+FF6By62r7FmxCuHlOkk+ZQa06e2yryOvjsvpL0aYz3yKi3KlsmquE6U+SBzuG6Q Y6GtjObbdbCzmTZBSEBPDILevhu3MTOOjdfJC2rvBE1ri+ahItqtNfK70tevKAZZzhwY KAVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YNbbCXLYwFs5e3ZlATxT/qWoHe4YgqAQ3sZTdG+49vY=; b=pje9tfWvl6SGqOZ7tGYq+8fLyXTG5Xk5ozCv0ANLv5WXZHJSX9Fp1IedYex73nQaRO Ak6feVyFg9Fw3akHcU0NvfN5QFNlpN6NMS36xi5OEvbKlWxZJfJLPpwv18pLdE7fVr10 8Ov1NSWlJgXH8TITOFlkh59psITbkQYSdpTtVFsfGqUlU4c61orX0GLGA895/BGCy2Gd wUbNuMu51rOkMl8JKEiaMjKPgsGE8ojpvuR+3r3jD/NWm1O1I3fzu7JuiQRu1dSgEKGu prn56GR6vc6vmT/3UaIEeYP0bUUzReKnmk/q/AdbHyiYtUg0Ke6gUdXc5YhSG6Vm17on QFDA== X-Gm-Message-State: AOAM531SDUFn/aaFGMNu6mz1DXsb+NH0kLTNakxxL2TV0P6k5bUiEIHV M8OILbf/loAHI3031sF1jsvIxkF0R+7/AQ== X-Google-Smtp-Source: ABdhPJxOKlklF6yBOYpvzXxPG/rbtVlPSD0wSlSB8hbYGJucpxL/fX4z+q62pH7zScZfvbAlqamauA== X-Received: by 2002:adf:e452:: with SMTP id t18mr4047725wrm.177.1610120202880; Fri, 08 Jan 2021 07:36:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/23] allwinner-a10-pit: Use ptimer_free() in the finalize function to avoid memleaks Date: Fri, 8 Jan 2021 15:36:12 +0000 Message-Id: <20210108153621.3868-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42b.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Gan Qixin When running device-introspect-test, a memory leak occurred in the a10_pit_= init function, so use ptimer_free() in the finalize function to avoid it. ASAN shows memory leak stack: Indirect leak of 288 byte(s) in 6 object(s) allocated from: #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) #2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523 #3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544 #4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562 #5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433 #6 0xaaabf57415e8 in a10_pit_init /qemu/hw/timer/allwinner-a10-pit.c:278 #7 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #8 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/obje= ct.c:564 #9 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/objec= t.c:547 #10 0xaaabf5b94680 in aw_a10_init /qemu/hw/arm/allwinner-a10.c:49 #11 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #12 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 Reported-by: Euler Robot Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/allwinner-a10-pit.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c index f84fc0ea25a..c3fc2a4daaf 100644 --- a/hw/timer/allwinner-a10-pit.c +++ b/hw/timer/allwinner-a10-pit.c @@ -279,6 +279,16 @@ static void a10_pit_init(Object *obj) } } =20 +static void a10_pit_finalize(Object *obj) +{ + AwA10PITState *s =3D AW_A10_PIT(obj); + int i; + + for (i =3D 0; i < AW_A10_PIT_TIMER_NR; i++) { + ptimer_free(s->timer[i]); + } +} + static void a10_pit_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -294,6 +304,7 @@ static const TypeInfo a10_pit_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(AwA10PITState), .instance_init =3D a10_pit_init, + .instance_finalize =3D a10_pit_finalize, .class_init =3D a10_pit_class_init, }; =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121252; cv=none; d=zohomail.com; s=zohoarc; b=D9zEG6I2vPXqlJS6yCGrekFft87YC+TWobU9qJHrLOWfXGusenf29biY7c7O7lcXhJXxfcRpJLleogG5QDeuN/LPWOIuflOTFKK3KB9mNaaE8y1l3JNad4Cz947kcsUdI7vQxbM0CjzNHWGBCPio5x5zXb5deMD2nEARbDzA8DY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121252; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7IobhQX/+A6TtX0qjdoX990irSdLhMNlwbzyQmtsQK4=; b=n8GRAQQFp8vzcLdBH0rjODA/V0L0mYn/rSSBFYnSXjpKBsc4BAGItD4kcxn+qSF8veDFyQsv4/Ys8ep9TBqzX+MkPmNVrC7XLkAKoxV2Vf6Zhv+XGp45rKN4c+8yyLAtQmj/7sDhR7vFDSTG+GONjy9jGOCLcuxnUYQD9Zi5qAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610121252314311.90475608870474; Fri, 8 Jan 2021 07:54:12 -0800 (PST) Received: from localhost ([::1]:39938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu5b-0006Qo-7C for importer@patchew.org; Fri, 08 Jan 2021 10:54:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtop-00052B-Fv for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:52 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:37736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtol-0002x5-53 for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:51 -0500 Received: by mail-wm1-x331.google.com with SMTP id q75so8786560wme.2 for ; Fri, 08 Jan 2021 07:36:45 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7IobhQX/+A6TtX0qjdoX990irSdLhMNlwbzyQmtsQK4=; b=nV1Qjr7ZEWE/8+auGX64xRbYO7GPkSyw3leoi+2nVtd5wSaN6nXUejUai/51PPX0Gq aZ7oOyaJY7mLmtW6ZdboHkbAroSMTQgXxc4U8QyV8aoDvVXZb7zja0C4TKFYqaHmS0Yg kzVUzQiT3AXUiN6jyV3Fv4OLgjdZymYS/jZjnWLkKlj+7lpx7zFpzvNnG4TuhfyKCvyA ka3trWKiqUohDCfQvqr2G8YReiGk8xkZT78K3CfxxpQulWN/iOTt5ZG2TqYY3mB5P92n 5V4oQiDUPRax3kpd3Zm4DXab7t0jLgLoXORwcQ2NMMR/Wt/rJFq90pjxAf4ZsUe24+Wz 82fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7IobhQX/+A6TtX0qjdoX990irSdLhMNlwbzyQmtsQK4=; b=Hneo2+8FGS73alvoJcABXarQFthBn2e1YVoNveA+KukFMB3beOofXnrmFcxL5qCEoA DoqbZiW08ebgOhcRxhYhf1hNjJgiZwGo6YFLUlgRusx5nkb/LwXHhGwQwYOvpJKMfbdM fZLNI7axTS2VceetFJdxTd45FbO4xQGM6tfbNeddSIOnvi6iwQYVYsCnAE5WLRVX5r8E BEUj63xO2y7AG8KkrQu/4iYLJnx1D9NgJEue/goRTEAsarhrSTij7ZJ0DFH/x2BNafWv GU83jyGymOTebnt0rpFknuz7nEfUmHjLf4jPAw6p9UqtwlvOfvxlwYzeFKcFAFpJkDm+ 55tw== X-Gm-Message-State: AOAM532J8iJxyryTSKRG7a8nC9moYnYwVZa6XL/GN2TtXWXLqGbQoyHt YxYh9Sn0dLZ3EMnifoq0DXoRWYqRr2XsnA== X-Google-Smtp-Source: ABdhPJyB4dqb9QE2DhqlVEg+1yo3DlDoptQXf1kFirkFEafLJ1Wm3o+Cm8kJir8tduex9xjI665a+w== X-Received: by 2002:a1c:b742:: with SMTP id h63mr3517550wmf.122.1610120204044; Fri, 08 Jan 2021 07:36:44 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/23] exynos4210_rtc: Use ptimer_free() in the finalize function to avoid memleaks Date: Fri, 8 Jan 2021 15:36:13 +0000 Message-Id: <20210108153621.3868-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Gan Qixin When running device-introspect-test, a memory leak occurred in the exynos4210_rtc_init function, so use ptimer_free() in the finalize function= to avoid it. ASAN shows memory leak stack: Indirect leak of 96 byte(s) in 1 object(s) allocated from: #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) #2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432 #3 0xaaabf57b3934 in exynos4210_rtc_init /qemu/hw/rtc/exynos4210_rtc.c:= 567 #4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #5 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 #6 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.= c:153 #7 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi= -commands-qdev.c:59 #8 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 #9 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136 #10 0xaaabf6552708 in aio_bh_poll /qemu/util/async.c:164 #11 0xaaabf655f19c in aio_dispatch /qemu/util/aio-posix.c:381 #12 0xaaabf65523f4 in aio_ctx_dispatch /qemu/util/async.c:306 Reported-by: Euler Robot Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/rtc/exynos4210_rtc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c index 4c976244786..45c0a951c44 100644 --- a/hw/rtc/exynos4210_rtc.c +++ b/hw/rtc/exynos4210_rtc.c @@ -584,6 +584,14 @@ static void exynos4210_rtc_init(Object *obj) sysbus_init_mmio(dev, &s->iomem); } =20 +static void exynos4210_rtc_finalize(Object *obj) +{ + Exynos4210RTCState *s =3D EXYNOS4210_RTC(obj); + + ptimer_free(s->ptimer); + ptimer_free(s->ptimer_1Hz); +} + static void exynos4210_rtc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -597,6 +605,7 @@ static const TypeInfo exynos4210_rtc_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(Exynos4210RTCState), .instance_init =3D exynos4210_rtc_init, + .instance_finalize =3D exynos4210_rtc_finalize, .class_init =3D exynos4210_rtc_class_init, }; =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610120481; cv=none; d=zohomail.com; s=zohoarc; b=GvIAC2COcnhqYBCv/mO+VnEEMTsiHcNQQ3bjEY0r8vR7UIxqMiVYtqgf3uVGmRu+0l6CGZaDCF3rYziGItc+pQt1hcq8EoJojYjSinUak0++SOoR/p8v8GHT4bLThjb+7KmaaE9jgqGI8qn4VoUV2m78Gds9Su8A1DbFEbjqT5Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610120481; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HmFO2WrrsiJDYKi0WtVF2XWZwmueRlAIM1cBOWRgQrQ=; b=F+silZl+T3Oxky8ddIHE2NZDzPjPbU1PnU0hWKbc21OCH1Mf9YJ9+7yOWe4TDx7VjBuFN3VBhVp09WjasDDFlfx626p8jiAUH1jaEfBC1ZzpaCZZX3YfVCRb8jwEk7hPLSNsx1ktPBB3pJ3assP6YgfPAkzDVerFr2khdmqMPnY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610120481251684.2388228486973; Fri, 8 Jan 2021 07:41:21 -0800 (PST) Received: from localhost ([::1]:37270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxttA-0001Ou-59 for importer@patchew.org; Fri, 08 Jan 2021 10:41:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxton-00050t-J4 for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:49 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:51001) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtol-0002xB-6P for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:49 -0500 Received: by mail-wm1-x329.google.com with SMTP id 190so8163463wmz.0 for ; Fri, 08 Jan 2021 07:36:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=HmFO2WrrsiJDYKi0WtVF2XWZwmueRlAIM1cBOWRgQrQ=; b=nXqMUgrCk6eCrtfsPVS0jHCJDZ5lJHxUh6XY42fCiapuRUOFw2UVv4aTdhcZb//oyn yMGnXjgL/YPICsYI3WkbGexk99LEegt4kRpCIHoxfCReY1vVsfWb53uW2CRLvcnqNs54 8q3SaHO9UqMXNtWpY7D9rR++BZcyWJ+fJ8IbxYkUuVggdlImDEETb03/QHyynbIAiVpK OEm9NLkaw+hn6mp4EXrtkiG41OFcQpixXoeWRI1aEyCBGWdgIimrihit0DmELJFxLD3u 1jbRrDubLVlyDAO/7oVFUvnb9zq3ITdrIGRiml1HOl3QN7wS+wZQn1J96gXgiWQUQN4j Pa2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HmFO2WrrsiJDYKi0WtVF2XWZwmueRlAIM1cBOWRgQrQ=; b=qLDNh8LHqs/NfGaWQ+Dp6RRNK521dHzqFF0bgGlluK1sjUQgigGBHyhLllfLLNY/ql zIlW1CuYYZKmG5ZJMGZXYhpp6XPp73KFbZBa8hCZB45N5z9VbyFKLawzpfXpnMcuAyjP 8C5c5+BrmpFRZlhenheL4E1brY1GWbq83T86cNxOspo9UDfN5omga449+h5CO/BGEiYF qiE2TEoNv3KYUZHn+ZRNNbGv/00/XgXnIU6S33wiZ+E+wK9to4t2a6YA+ZxXYXZiB5H7 6TdKQG2cl24O5WEXulVP0B8a00b6yg4IUbyuZCAgUcaZvIhLKZllg0LYDUDQLNBuhs4L mMBw== X-Gm-Message-State: AOAM533C5agvvnEPofWfhTWit2HKxMpK0x1YlQwEHllkQutZMv5mrsUw S9dkaZetOWXvWIWKb/1JOep9H/fnBcQ2Ww== X-Google-Smtp-Source: ABdhPJzZRyQ9Uit4S1fJOtTFUeM9o0BgUDqmunUBJy5HFAM+szb+JIENcw0QpbzkZtIEAgnJcvLiIQ== X-Received: by 2002:a1c:7217:: with SMTP id n23mr3413609wmc.167.1610120205002; Fri, 08 Jan 2021 07:36:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/23] exynos4210_pwm: Use ptimer_free() in the finalize function to avoid memleaks Date: Fri, 8 Jan 2021 15:36:14 +0000 Message-Id: <20210108153621.3868-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Gan Qixin When running device-introspect-test, a memory leak occurred in the exynos4210_pwm_init function, so use ptimer_free() in the finalize function= to avoid it. ASAN shows memory leak stack: Indirect leak of 240 byte(s) in 5 object(s) allocated from: #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) #2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523 #3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544 #4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562 #5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433 #6 0xaaabf56a36cc in exynos4210_pwm_init /qemu/hw/timer/exynos4210_pwm.= c:401 #7 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #8 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 #9 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.= c:153 #10 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qap= i-commands-qdev.c:59 #11 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 #12 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136 Reported-by: Euler Robot Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/exynos4210_pwm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c index de181428b47..220088120ee 100644 --- a/hw/timer/exynos4210_pwm.c +++ b/hw/timer/exynos4210_pwm.c @@ -410,6 +410,16 @@ static void exynos4210_pwm_init(Object *obj) sysbus_init_mmio(dev, &s->iomem); } =20 +static void exynos4210_pwm_finalize(Object *obj) +{ + Exynos4210PWMState *s =3D EXYNOS4210_PWM(obj); + int i; + + for (i =3D 0; i < EXYNOS4210_PWM_TIMERS_NUM; i++) { + ptimer_free(s->timer[i].ptimer); + } +} + static void exynos4210_pwm_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -423,6 +433,7 @@ static const TypeInfo exynos4210_pwm_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(Exynos4210PWMState), .instance_init =3D exynos4210_pwm_init, + .instance_finalize =3D exynos4210_pwm_finalize, .class_init =3D exynos4210_pwm_class_init, }; =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121078; cv=none; d=zohomail.com; s=zohoarc; b=DqHzTx/L5Nq90q94TFwcp+xb2ZPxJzHBZqo0Dcsgw8BU3MXCVC0WrTykTHBs4FcM/CzwrVhP/7yaGL+RMaceIDVqaMxae31+k9njeeI67mNNtXf12bs3sXEMpRYQY8RSjLgSBOqBOc2RtNIR6DIbxM0Q7EgsvoibPZFR6z79pjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121078; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zAAuZ1tCL604rEihyQT4jKiq0+zkWMxy7qtoZl3QY24=; b=IIwR3Gchr3EINXEa7YeKJ/TkFHhdW+jewwuZpX7EbW/HexNujAmdNhwpZHrhxdrzd3kiQPnITHkXwqhF1qmDUT1w6YIYo6CTEb6hCwH0wkLrg795sVxkZpFPT7fuzXxXZAG6YYg5UAlOnTLwKgAVmBSrsDfDLRTpCdPYMrxJy0E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610121078964916.9641374749546; Fri, 8 Jan 2021 07:51:18 -0800 (PST) Received: from localhost ([::1]:33908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu2n-0003Vp-Pp for importer@patchew.org; Fri, 08 Jan 2021 10:51:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtoo-000521-9E for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:51 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:37729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtol-0002xL-JF for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:49 -0500 Received: by mail-wm1-x329.google.com with SMTP id q75so8786673wme.2 for ; Fri, 08 Jan 2021 07:36:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=zAAuZ1tCL604rEihyQT4jKiq0+zkWMxy7qtoZl3QY24=; b=W+PddmnBmKGtUChnoxr5PbLa3eLiMEpmG2YtvwniNrabzcuPi3qhK8h0NDuxBA3RgM ALpfmLQLefVzvCOn0JH1VSTodUAfxkGqpPNjfQELS3hFvbw5PzEECMYm9CJ7IjG6pRwO g6wjI6PdNaWV8jvE2HaRYXmiql0Ei3RnPxTBPCd8X1LPrsuKjrVQ+Jx8TMXSBUQLw3+v vpNEvVafg4qeVob5DG15X2O1BM2WrRqUHNYbrf5bPSQMGPM1YSgjwE+vThmIhhrUhD9W cyaGVJK5q/cOQH/LIs2vxt9Bj5rF3e+/4YQckd4Gt/srfn+Axu9+Tu/f+b/HTApcce/5 sC5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zAAuZ1tCL604rEihyQT4jKiq0+zkWMxy7qtoZl3QY24=; b=mMkuiMv/W2ii0lV5biUQmgDqwNyd3Y15c3ZRnyKRWKopqzeQgoLta64iqnnLqqdvBD VKWnZZqCooDJIiT9CBt8VQk1QGgJOkZ2gCdaYr0jxUSPWW3098JZBywWwEu83hvbICfO gM/+0vocP1w4c00h2US2cL1c7K0EuwEYnmD9CYtyt7SfKeS0dSyE+qj7LwmC03sMtnkV B7NBjZ84ZFxL3m/SHY+hHafHXNOpm44eiaipxNI49r/VlTSWh/TdaPuCkfT9DaYwDEmn rEiBepzJPXj4nVXJEN7YLzGKMU21sdGnubehJAd8gGBUWABgqXo9PlsHIF4BxlCEMfe7 gNkw== X-Gm-Message-State: AOAM5321mtau3eAn7YXlTK6s6/JGps88dWrGkO81wlSsr0RqN9xGSUZM PPRPb4B0I0EEgpfk9tkKprQp7LEsp5ALXg== X-Google-Smtp-Source: ABdhPJwkBPxx5xqdv5I5QdRQvkHPaQN8tsxcIQ1QAuIjDajUTHCc3KYtXfx9wpB6hca5QFPWs46oSQ== X-Received: by 2002:a1c:1d1:: with SMTP id 200mr3626917wmb.98.1610120206132; Fri, 08 Jan 2021 07:36:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/23] mss-timer: Use ptimer_free() in the finalize function to avoid memleaks Date: Fri, 8 Jan 2021 15:36:15 +0000 Message-Id: <20210108153621.3868-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Gan Qixin When running device-introspect-test, a memory leak occurred in the mss_timer_init function, so use ptimer_free() in the finalize function to a= void it. ASAN shows memory leak stack: Indirect leak of 192 byte(s) in 2 object(s) allocated from: #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) #2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432 #3 0xaaabf58a0010 in mss_timer_init /qemu/hw/timer/mss-timer.c:235 #4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #5 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/obje= ct.c:564 #6 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/objec= t.c:547 #7 0xaaabf5b8316c in m2sxxx_soc_initfn /qemu/hw/arm/msf2-soc.c:70 #8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 #10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds= .c:153 #11 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qap= i-commands-qdev.c:59 #12 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 Reported-by: Euler Robot Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/mss-timer.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/timer/mss-timer.c b/hw/timer/mss-timer.c index 29943fd7446..fe0ca905f3c 100644 --- a/hw/timer/mss-timer.c +++ b/hw/timer/mss-timer.c @@ -244,6 +244,18 @@ static void mss_timer_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &t->mmio); } =20 +static void mss_timer_finalize(Object *obj) +{ + MSSTimerState *t =3D MSS_TIMER(obj); + int i; + + for (i =3D 0; i < NUM_TIMERS; i++) { + struct Msf2Timer *st =3D &t->timers[i]; + + ptimer_free(st->ptimer); + } +} + static const VMStateDescription vmstate_timers =3D { .name =3D "mss-timer-block", .version_id =3D 1, @@ -287,6 +299,7 @@ static const TypeInfo mss_timer_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(MSSTimerState), .instance_init =3D mss_timer_init, + .instance_finalize =3D mss_timer_finalize, .class_init =3D mss_timer_class_init, }; =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121216; cv=none; d=zohomail.com; s=zohoarc; b=UYJBVOJBQEMsCgVObn2yqEbuqE0HyOsbTxN+Ea/6hbKaatjBaCUqkl8Xl++7uq0jfMuID3uag51avZCXC03G4AOtXP46MBxwcLkXQ2Ro/OJb8EWUqF6D2olLrnN5k4vgVT5WS12ouEei7tVg2En/1NUj8Z9Zpy4GsiB0OfxK+tk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121216; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RIEXcwEpP45gL5u8u6zJ6MrAGVSM1NG0JUiUEWfKY+Y=; b=L8u1kDjr05tbE2NMBKjcReb8mzr/pw4RzDqb2zjjqkeQC9Qb1Autu3CXzqOPy6Zb8FyO2SaiPFVdzjU8IHUZM1IKk/BvPefoAqgQXqd3MMwhqA4GKIKMQyzpe9NkX34NuLq0a2KjLUtgvVHfggjdbs1P1XWmz+CvXyMdKKTw0vA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610121216403242.3955717938495; Fri, 8 Jan 2021 07:53:36 -0800 (PST) Received: from localhost ([::1]:38396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu51-0005mL-Ba for importer@patchew.org; Fri, 08 Jan 2021 10:53:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtop-00052H-U9 for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:53 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:35446) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxton-0002xz-9C for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:51 -0500 Received: by mail-wr1-x42f.google.com with SMTP id r3so9442112wrt.2 for ; Fri, 08 Jan 2021 07:36:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RIEXcwEpP45gL5u8u6zJ6MrAGVSM1NG0JUiUEWfKY+Y=; b=RIURHrBIziZX04Y0FApYfTu1/klV8QuKPR6IVgJ04d440r+vSdQetPOPl6dMyFIlzm dvUtcjpFjHobSgziG28N5XpvyCUKtxv/WDnYkBTrvF5/DyyZLogAwPq6zCM8NYkiioHp ffrpbnomfZpeZ6Z5IdU7hwB6IkSLggJ0fRQnrKsKm3iy29PiG8ytZ+RBUaHZCDFhgUBv UAAvqP6KNY32ojuFkv5lK9yhJJME+8AS3hfCrk+z3nmMzVnmfsGJSYlYcGszFWJfW2lT v74s8mw95MQBaivuu18LB+P2KryfPw1PxHlg6tEoMjuX8a24kEkG5GAhfmo2CZlmycMx 5LUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RIEXcwEpP45gL5u8u6zJ6MrAGVSM1NG0JUiUEWfKY+Y=; b=F+z3g6haUKByuHX6ZNAN2xXssph9xA1WEeZq9wHV6iTUYokXRbdiyfIhraYkWQzK7n AkD0ggSD3koT0pt68nAvlKOs4jO2Q5hG9dM/RYmcwF7v8pN0naTSxyRYPiIKbnu008Pu ekuXDw3HiC0Ek2fo8oevLci9/JssyJcKjLcbPzRXOOC6YzOPmhEsLJBO1qzXXhQ3wdrw QmRtggBYAex1+hbR4poCCCh419M+j2JG+WtnShcc/Dz5d/VMsYZZKHdd+HeXc8ZeIHjB M7w5T0UP8lLX72r4MQN2J5PFfRmzc12RY5qSVet+M1MHNRIO2ThwHf2Gz1HbaO7m9cUG CNtg== X-Gm-Message-State: AOAM530l9c7xrXRPjRibS82JsKlQ5K09ZO/9nq9axDlBym5gcFmX9EcU A3LePPGNAK21c7x8WcDsPzVPoOUxFv/jZQ== X-Google-Smtp-Source: ABdhPJwXkX4oeRdmBryl4bcXbgC/D6P1N6CX9EfXiCeu1Q2SYsTPltYgeimXa5KH8PFr2a04L8TYcw== X-Received: by 2002:a5d:4882:: with SMTP id g2mr4143008wrq.273.1610120207270; Fri, 08 Jan 2021 07:36:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/23] musicpal: Use ptimer_free() in the finalize function to avoid memleaks Date: Fri, 8 Jan 2021 15:36:16 +0000 Message-Id: <20210108153621.3868-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Gan Qixin When running device-introspect-test, a memory leak occurred in the mv88w8618_pit_init function, so use ptimer_free() in the finalize function = to avoid it. ASAN shows memory leak stack: Indirect leak of 192 byte(s) in 4 object(s) allocated from: #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) #2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523 #3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544 #4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562 #5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433 #6 0xaaabf5bb2290 in mv88w8618_timer_init /qemu/hw/arm/musicpal.c:862 #7 0xaaabf5bb2290 in mv88w8618_pit_init /qemu/hw/arm/musicpal.c:954 #8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 #10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds= .c:153 #11 0xaaabf5a95540 in qdev_device_help /qemu/softmmu/qdev-monitor.c:283 #12 0xaaabf5a96940 in qmp_device_add /qemu/softmmu/qdev-monitor.c:801 Reported-by: Euler Robot Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/musicpal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 458b1cbeb76..6aec84aeed8 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -959,6 +959,17 @@ static void mv88w8618_pit_init(Object *obj) sysbus_init_mmio(dev, &s->iomem); } =20 +static void mv88w8618_pit_finalize(Object *obj) +{ + SysBusDevice *dev =3D SYS_BUS_DEVICE(obj); + mv88w8618_pit_state *s =3D MV88W8618_PIT(dev); + int i; + + for (i =3D 0; i < 4; i++) { + ptimer_free(s->timer[i].ptimer); + } +} + static const VMStateDescription mv88w8618_timer_vmsd =3D { .name =3D "timer", .version_id =3D 1, @@ -994,6 +1005,7 @@ static const TypeInfo mv88w8618_pit_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(mv88w8618_pit_state), .instance_init =3D mv88w8618_pit_init, + .instance_finalize =3D mv88w8618_pit_finalize, .class_init =3D mv88w8618_pit_class_init, }; =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121353; cv=none; d=zohomail.com; s=zohoarc; b=N0yiT4UW+DgbYHNWnb3m0e0vp0XiEgv7wGpwi6AOuk0Y0Fgk9E4FQNFJWHFunM2C07Ni96CGIOEF0Pvt5S4FC9qFe7oBUcRDZIGWYkYKbR1lpxBwVPqljyf35tYExzp+Z8J3txkVe+GNCkWHS8vaC/BX/Fq17iqdXCuoaHp2kUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121353; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3psp3ieItsXSg+BAwR517+P8wNoT4jZliP7RqS9B40A=; b=b0WbcIIPLn14UPQChvL/VnSRG0EFG8E3LGwijyRhu44q6Bi8YEcCr4DsNHCxYyLDKJTkREw8iOfgC7D3tMLkhw8yCth2lQ46TPnbfYjkZNXTHnOxf8vmylbpl+tQKknj85+tPY/z1HVSOwS/PMcbLBSl1GY2L4ZTfJgHWGcTGXA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610121353616683.8558397464128; Fri, 8 Jan 2021 07:55:53 -0800 (PST) Received: from localhost ([::1]:44084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu7E-0008AV-7m for importer@patchew.org; Fri, 08 Jan 2021 10:55:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtor-00052Q-8b for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:53 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:34716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoo-0002yT-KU for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:53 -0500 Received: by mail-wr1-x431.google.com with SMTP id q18so9457891wrn.1 for ; Fri, 08 Jan 2021 07:36:49 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=3psp3ieItsXSg+BAwR517+P8wNoT4jZliP7RqS9B40A=; b=EhtsMVltRcc4ZwpAc7rVPMhrDszTP2tHtbqHLguqOGHPPBb4E5XkAPb0bXBHnAU2MS RSELFu0nUZoTDncYMPliuFBGJIs/BBSL2yzX7BWfBhtNY2mPinqYxiWgIgCFGw1J9dBc EtJk3EvHGkmJZjQkeWdd3BcbGwV3momIhTjklwsySLMYvjaQz2OJVzmlaRYQNzbAic1A FSLYvtYd9CRIr9aKWpnQfmbZ21So89l3NRDce5/hwLxY7GF5gRATGiFBx9/fjdB9KbhM Mcj6UAfJxVUC8AFiJ2XPZyY29A5mvB4ulYZzo7s7IMCGWhROoX4lHEbeHWvKEYTrzzKJ oMIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3psp3ieItsXSg+BAwR517+P8wNoT4jZliP7RqS9B40A=; b=YkKPx20PHef06QnvZ4uBKjoggOHxfcqIobGwHiqORjOnigNC/7hZBImYj+bfTY9tyi Vqp/bEeASZ45PvTS/p0m3SlxVRV76AN2mwZYxjnaEbAzg+rD0bpAOAJmO2g8yFtvmOpe 2+wXrclojgQH3x//RHjsF5DbjLXtdPOrIdAZceSEznBIe+/J5B+r2hcsU6NfCTFv6W7i Nz+cp4bid0NkwcLxO2xeRRW/GRMkoZxcw/M5AetPn9obHVGY/cCLZHy8rR0lvWqwS0pm NvOQuoB2opHOD3KIKHEVDREXCCZoCCSuHgdqy5Cc1ftVzMcLNPO8jlbH1NNngcwYX/h1 0QXg== X-Gm-Message-State: AOAM531cRMOIDt9y7G7hdsPnxrT3F2uUSbv0MbB+2wDEjkEP5aF8wOkw jD+WIik6d/xuPF4/d280kljeHDl3ougvyQ== X-Google-Smtp-Source: ABdhPJzWpDyAHZ71V/jA0H0xrbdfSccIc3MOCCdZtIwnsSK4+e0SzqjvZYna8ShPU5mzaLpPOP2JqQ== X-Received: by 2002:adf:e54a:: with SMTP id z10mr4300850wrm.1.1610120208548; Fri, 08 Jan 2021 07:36:48 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/23] exynos4210_mct: Use ptimer_free() in the finalize function to avoid memleaks Date: Fri, 8 Jan 2021 15:36:17 +0000 Message-Id: <20210108153621.3868-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Gan Qixin When running device-introspect-test, a memory leak occurred in the exynos4210_mct_init function, so use ptimer_free() in the finalize function= to avoid it. ASAN shows memory leak stack: Indirect leak of 96 byte(s) in 1 object(s) allocated from: #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) #2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432 #3 0xaaabf56b01a0 in exynos4210_mct_init /qemu/hw/timer/exynos4210_mct.= c:1505 #4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515 #5 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729 #6 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.= c:153 #7 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi= -commands-qdev.c:59 #8 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110 #9 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136 #10 0xaaabf6552708 in aio_bh_poll /qemu/util/async.c:164 #11 0xaaabf655f19c in aio_dispatch /qemu/util/aio-posix.c:381 #12 0xaaabf65523f4 in aio_ctx_dispatch /qemu/util/async.c:306 Reported-by: Euler Robot Signed-off-by: Gan Qixin Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/exynos4210_mct.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 439053acd2a..d0e53439968 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -1530,6 +1530,19 @@ static void exynos4210_mct_init(Object *obj) sysbus_init_mmio(dev, &s->iomem); } =20 +static void exynos4210_mct_finalize(Object *obj) +{ + int i; + Exynos4210MCTState *s =3D EXYNOS4210_MCT(obj); + + ptimer_free(s->g_timer.ptimer_frc); + + for (i =3D 0; i < 2; i++) { + ptimer_free(s->l_timer[i].tick_timer.ptimer_tick); + ptimer_free(s->l_timer[i].ptimer_frc); + } +} + static void exynos4210_mct_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -1543,6 +1556,7 @@ static const TypeInfo exynos4210_mct_info =3D { .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(Exynos4210MCTState), .instance_init =3D exynos4210_mct_init, + .instance_finalize =3D exynos4210_mct_finalize, .class_init =3D exynos4210_mct_class_init, }; =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121452; cv=none; d=zohomail.com; s=zohoarc; b=aRSWxNVDI91QrXfDpIhVFuFWwVyydvu1fBGmkzBsXThGjZL2kyvZc7STExhGSiu1/E471sy2gGilXqpRzsEvP7RnO13CgAHpl/cNgLs7w5WsdruFm8kjjEG4XaGvMbpBaISfCMhekvYkO7qsLw4ILAC8sTLePsHG5zGiicSnkcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121452; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=914fnl0pJhWjr3RTpGLKQ1skila3tieL+3miZYLqW2k=; b=JCtv8PpF+RyXdqiwj8IwWzGk9OJ0i02wQgdOH1gdEU9z+nWhIT8HGkg/TqhoDB+aJs6ykTqbC8sNtpz6r+yGzoWpcadlmkuHQnfjR4bJPx/0BzHz/tlmrvtMi7n2b6kWvgh+fQp+Av45dfF6XwoaRTS4G5yHcwszlQ39K3uSAik= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610121452386139.47884859904286; Fri, 8 Jan 2021 07:57:32 -0800 (PST) Received: from localhost ([::1]:48218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu8p-0001Yc-1M for importer@patchew.org; Fri, 08 Jan 2021 10:57:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtot-00053W-BA for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:55 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:44239) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtop-0002ye-AM for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:55 -0500 Received: by mail-wr1-x435.google.com with SMTP id w5so9382173wrm.11 for ; Fri, 08 Jan 2021 07:36:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=914fnl0pJhWjr3RTpGLKQ1skila3tieL+3miZYLqW2k=; b=j31kWkXiRRZM9er6yKN8ZJGXe2ymrCBMaLepbDycINGK1SqsUxXClkCYKbBe9W9deM 9fISOP9oUsAiDt4t1UZm084+BxFRBbBI0BZNQX/dTuG3hW7iE3dTTPcpVE1qKkDYpEFl oJJJsB+V1ZkMTM/zm7hZsU1k73oI1HTh3POwxFF0xF7D8p3mUvzSCQ5BezUNyRQgIWC2 mpa++2Kvu103NDAysslDiOJUXhOM0roUB9Dnnma9Jr7MgPDWXArhTVCGQ5ipaEHUrPOF ZoPQhHIHAxy5TGsg3HP/Ieu1sJNqmV6fvi/7fQ86DnJXhhjbG6hrGPzEwFnF2VVsqbal Qh1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=914fnl0pJhWjr3RTpGLKQ1skila3tieL+3miZYLqW2k=; b=anOTuiIQw7B+8W30LMLAZqB8PE+MxiMGWsfjKijWltSrpFkQohMkX/xjjHpBltTay/ l/FMKoRY8u/QxxWMBsI9V7CSHY2Gq3NeNoEPAgtigOWKh8WBQA7DfUfVOhT3t6iO/oyv OxNReQFa9xJNKTA7+CQlYoVxfxi0g2i6zzy2IZCbcLFNGYUv8CFFDQnir+xhkkOvWo/T GZnJvhdziTrvgLd7I5mfvpO5HNyDIqe3FNAqyxhfqgHqxdwTJmUa1HwonsD8a/oHo2vX 4ACmFWGVKxyrk0uhtVIrl8cN8OfYWZuoAS39pPvLzEZhJkRaoZmPO/A5u36k+T7WIiEd OiYg== X-Gm-Message-State: AOAM531xKK0SWWT0Y+sPNw+DlaVs518Cip16Y0rSGpKnDjTRyFJ+njhE pFTsZwIwhHbbc8t2XKUlDk/4mnkwaRc07Q== X-Google-Smtp-Source: ABdhPJzsjvd4snxXwFAKsYhyaczhmavrUt98knWVDdrxeepEVUFkLUMR5JVTtXGUMaYip5QhlUfsEw== X-Received: by 2002:adf:e60f:: with SMTP id p15mr4190393wrm.60.1610120209659; Fri, 08 Jan 2021 07:36:49 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/23] hw/misc: imx6_ccm: Update PMU_MISC0 reset value Date: Fri, 8 Jan 2021 15:36:18 +0000 Message-Id: <20210108153621.3868-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Bin Meng U-Boot expects PMU_MISC0 register bit 7 is set (see init_bandgap() in arch/arm/mach-imx/mx6/soc.c) during boot. This bit indicates the bandgap has stabilized. With this change, the latest upstream U-Boot (v2021.01-rc3) for imx6 sabrelite board (mx6qsabrelite_defconfig), with a slight change made by switching CONFIG_OF_SEPARATE to CONFIG_OF_EMBED, boots to U-Boot shell on QEMU with the following command: $ qemu-system-arm -M sabrelite -smp 4 -m 1G -kernel u-boot \ -display none -serial null -serial stdio Boot log below: U-Boot 2021.01-rc3 (Dec 12 2020 - 17:40:02 +0800) CPU: Freescale i.MX?? rev1.0 at 792 MHz Reset cause: POR Model: Freescale i.MX6 Quad SABRE Lite Board Board: SABRE Lite I2C: ready DRAM: 1 GiB force_idle_bus: sda=3D0 scl=3D0 sda.gp=3D0x5c scl.gp=3D0x55 force_idle_bus: failed to clear bus, sda=3D0 scl=3D0 force_idle_bus: sda=3D0 scl=3D0 sda.gp=3D0x6d scl.gp=3D0x6c force_idle_bus: failed to clear bus, sda=3D0 scl=3D0 force_idle_bus: sda=3D0 scl=3D0 sda.gp=3D0xcb scl.gp=3D0x5 force_idle_bus: failed to clear bus, sda=3D0 scl=3D0 MMC: FSL_SDHC: 0, FSL_SDHC: 1 Loading Environment from MMC... *** Warning - No block device, using defa= ult environment In: serial Out: serial Err: serial Net: Board Net Initialization Failed No ethernet found. starting USB... Bus usb@2184000: usb dr_mode not found USB EHCI 1.00 Bus usb@2184200: USB EHCI 1.00 scanning bus usb@2184000 for devices... 1 USB Device(s) found scanning bus usb@2184200 for devices... 1 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found scanning usb for ethernet devices... 0 Ethernet Device(s) found Hit any key to stop autoboot: 0 =3D> Signed-off-by: Bin Meng Reviewed-by: Alex Benn=C3=A9e Message-id: 20210106063504.10841-2-bmeng.cn@gmail.com Signed-off-by: Peter Maydell --- hw/misc/imx6_ccm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c index cb740427eca..7e031b67757 100644 --- a/hw/misc/imx6_ccm.c +++ b/hw/misc/imx6_ccm.c @@ -450,7 +450,7 @@ static void imx6_ccm_reset(DeviceState *dev) s->analog[PMU_REG_3P0] =3D 0x00000F74; s->analog[PMU_REG_2P5] =3D 0x00005071; s->analog[PMU_REG_CORE] =3D 0x00402010; - s->analog[PMU_MISC0] =3D 0x04000000; + s->analog[PMU_MISC0] =3D 0x04000080; s->analog[PMU_MISC1] =3D 0x00000000; s->analog[PMU_MISC2] =3D 0x00272727; =20 --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121331; cv=none; d=zohomail.com; s=zohoarc; b=mBmM2OUfIgLRb3MiVZk1/7Ji6QPgIcp1SFPJbzIKA4dOlO/2PLpaCS11N7LGBXy6DGBg7DAGdxp8JMGfIopwZJVrgRZhIWhB6VqUUV45BAk2ShTr9XNplrCZdw+Pj0J4fNxigbshJZsjk68hvP2/qwrqj+uYyu1Mh1b/YZw2To4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121331; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Q+9hde3K1MBMpA3NU0diSpudMf3Bp4YMA1COVKFBOoc=; b=HJ+7irPkstJQETeAZBQ0OWtZWZr9GHx1TTpfEjPCaZ0NW8ao//SwCI9YKIm61v2trkRjwCN2am1LWooPZ+zEuy9wFnXf50HYt44bHUILENGu5p2s7wR9ZpO16VxmLRY9rXLF1AvVYdryvm+wEnCBJXe/W+8w1v0XroPyXwaKP/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610121331895270.6115687027442; Fri, 8 Jan 2021 07:55:31 -0800 (PST) Received: from localhost ([::1]:42836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxu6s-0007eB-Ng for importer@patchew.org; Fri, 08 Jan 2021 10:55:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtor-00053S-Rs for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:55 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:40423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtoq-0002zD-9m for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:53 -0500 Received: by mail-wr1-x433.google.com with SMTP id 91so9427029wrj.7 for ; Fri, 08 Jan 2021 07:36:51 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Q+9hde3K1MBMpA3NU0diSpudMf3Bp4YMA1COVKFBOoc=; b=VWBwQWrmGUtzXWYXm/70ZhZ++M1nrYD26GpkCfKa7SgmijRudr8fjjECH+1GpY/iQC 0W+J0/kQlemcsqryUQ4K24YauDCgCl7w3QVh6JD/XvYT0Uc75McLGeFGy8892qsl5hhK LkXKnSC8yfTAFDPogE0xoOpWLVXYqiMDSb92nhPsL9y1C1FndiWll+VIxvt6PqI1+Nw/ 40gXF2XAKRAyYXb5q/JJVjU5T6s/KHwgXb0j9DjbYyNL5O7n7UKf9czRcCLCo6TIbDD0 4eEZqv7krrswewqnNqVJCFTQV/AsknhnzOtL1Is71iohV+XZ0C8546069hRj6aFWIEvC HutQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q+9hde3K1MBMpA3NU0diSpudMf3Bp4YMA1COVKFBOoc=; b=eh9GooZaylLvNLpDXlsjDyo7KFwQdYmIdwUvkxIXq0wiZnooLNrTkIn0n5HkVjPWyU hPhvilkjbu6yUNXlc7kMSMRGnGs+go2Gj34Z2+onNi5gH/fkjeOhxIsNDt2y+RTQY2jC a8pe6cLMi5R4JVUohO7KsGaCurC4Wer3tZ8XBwYHtehggRDUchhKlc0WsMzccgzlo+WD 8Irqmu5hFKCoKp5Ee6/LXsznsm6iqBsb5DNsXIUsdqWjbTCWavU4L22f8/rdVI+l94yk ZzWgYYCAAFnNxQ5MmFHNR/BMJaZ6f8ox5qFxu9ONtx6pN9v+wMMoatiaIGe9UW+TTGNy x+Nw== X-Gm-Message-State: AOAM532Tof3FRRHRJYN4VUYrJ8Qg1odqNWf0YTZHS2dfTDda1HsC2Y+N I8JcO/NuGOQshSLGhQRQ9UH6QRs2m/vM1Q== X-Google-Smtp-Source: ABdhPJygxDyZRzRM2Kk7Sqljsuwmj5NlfLSi2c7/hi49frMqWzha5zIGhXAePiiVld3TrTNOfqFBgA== X-Received: by 2002:adf:e443:: with SMTP id t3mr4193108wrm.366.1610120210789; Fri, 08 Jan 2021 07:36:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/23] hw/msic: imx6_ccm: Correct register value for silicon type Date: Fri, 8 Jan 2021 15:36:19 +0000 Message-Id: <20210108153621.3868-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Bin Meng Currently when U-Boot boots, it prints "??" for i.MX processor: CPU: Freescale i.MX?? rev1.0 at 792 MHz The register that was used to determine the silicon type is undocumented in the latest IMX6DQRM (Rev. 6, 05/2020), but we can refer to get_cpu_rev() in arch/arm/mach-imx/mx6/soc.c in the U-Boot source codes that USB_ANALOG_DIGPROG is used. Update its reset value to indicate i.MX6Q. Signed-off-by: Bin Meng Reviewed-by: Alex Benn=C3=A9e Message-id: 20210106063504.10841-3-bmeng.cn@gmail.com Signed-off-by: Peter Maydell --- hw/misc/imx6_ccm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c index 7e031b67757..4c830fd89ae 100644 --- a/hw/misc/imx6_ccm.c +++ b/hw/misc/imx6_ccm.c @@ -462,7 +462,7 @@ static void imx6_ccm_reset(DeviceState *dev) s->analog[USB_ANALOG_USB2_VBUS_DETECT] =3D 0x00000004; s->analog[USB_ANALOG_USB2_CHRG_DETECT] =3D 0x00000000; s->analog[USB_ANALOG_USB2_MISC] =3D 0x00000002; - s->analog[USB_ANALOG_DIGPROG] =3D 0x00000000; + s->analog[USB_ANALOG_DIGPROG] =3D 0x00630000; =20 /* all PLLs need to be locked */ s->analog[CCM_ANALOG_PLL_ARM] |=3D CCM_ANALOG_PLL_LOCK; --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121562; cv=none; d=zohomail.com; s=zohoarc; b=cKT8gDZ88PsfeqPtjOSUfH1OymZqgXAjcbd+Kj7vGbsS5hNYOtXK/TYn+t63PPTGGbsK6erca4AbP6xab2ZkknmtKfhv7+hvSoOJCAFJUxU+XnE/PaxYZxJhqOV9dzz1IrE+Xl50D/soCXhGuyTpch84K4xXN+PYIumhW3j2/nc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121562; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y3Fa3uOgGDt+2ElYGobv8hDNglxxVduImG7QdAhjbfc=; b=No9IExPXxVZnYVEJZI3nz9auX/f+ndnvSF+oieD0QT5pk06h3pBlO9/Cfw8SpbZPzYks6X/w5EuB5jhgTql6eQdSW7vmdXFpH0Mtwm2liEZyLDnSiD2HqqCo7A9MM0nBICx4TFDOFXCYuRrQ0OCYpxgTDcHIgZvImDMDj1p6BvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610121562530679.7213970974021; Fri, 8 Jan 2021 07:59:22 -0800 (PST) Received: from localhost ([::1]:52470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxuAb-0003LF-4a for importer@patchew.org; Fri, 08 Jan 2021 10:59:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtov-000551-C9 for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:57 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:46985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtor-0002zf-GV for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:57 -0500 Received: by mail-wr1-x431.google.com with SMTP id d13so9367646wrc.13 for ; Fri, 08 Jan 2021 07:36:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=y3Fa3uOgGDt+2ElYGobv8hDNglxxVduImG7QdAhjbfc=; b=qR/BAvuXxLiVBSlhOUao0OIIDmZn4jDZWLRxmKDUyfLi9eZupm0nJ2cMT+70g41G9J wGGLif+AI1K3C5yzNtSBcff54MaLEtebodADJ7FvsS2CS260RzxoDYrJxl4lPUoHRVjL 5kiHrz4+1+5QpL+tFircMOrB+GdDdIPhR2hGvBhvdii4Va2mGohnGJMlCs/rBPksV1q5 kESnEOcIM3BiNJjDZgMB4TPk73is5ImUuAyyoUUVX6UQPag8Bwz+V5/4XyTtOE7ssslw +fFJL1W89MhWrlV2SsxdfIPjxdTOHw6dz3WZopQQpcbOyRl3G88eInHW1mqDA5lDSvnP ZMWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y3Fa3uOgGDt+2ElYGobv8hDNglxxVduImG7QdAhjbfc=; b=bALV0U4DZ6IXPVNdQh0fnEIkfAGG5ldd1YdDy7HHA4v3tIqhj/Co49MsP1VKLketsB 7F2lbqgXsb7pe65BDtNr4X86ujDuMKhW4fPXxYN8R/pH1vWhkrr8uBL0P9yYmxVtwXyP oKBYu2KnJUFL9b5PwXVZpMXciEyWPmd3U8b5keXrpeBYXPsS5Rv9rN2Otwoxg3HuUaZv nwE0nKW+3u0B6aHHUF8KEUWasrc4luNCB4NIygTNH3GElFbxeIqVg2gzE5dWcoqsiHqu SN1/BZLgI+oeEbLEUc/WJaRT48ihlR7vdhBHmwVKnnB0Lm6OaEF9zgyZyMh58SN9WSQD /Nhg== X-Gm-Message-State: AOAM531zsd4LWnN6Je5RXO4UbBqsRal1FPb9JtS4cK8YQBsMPMDggcSr I/PiuGgL2y+MF7kw5qFA2TLrXRPDB4QHiA== X-Google-Smtp-Source: ABdhPJzahqGzQmuEKnFz0jGAMjdnGzV/JvlD8pXSWgTPccyE4j40L17V54Lq201D6Jug0uIumOwCWQ== X-Received: by 2002:adf:e452:: with SMTP id t18mr4048299wrm.177.1610120211988; Fri, 08 Jan 2021 07:36:51 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/23] hw/arm: sabrelite: Connect the Ethernet PHY at address 6 Date: Fri, 8 Jan 2021 15:36:20 +0000 Message-Id: <20210108153621.3868-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Bin Meng At present, when booting U-Boot on QEMU sabrelite, we see: Net: Board Net Initialization Failed No ethernet found. U-Boot scans PHY at address 4/5/6/7 (see board_eth_init() in the U-Boot source: board/boundary/nitrogen6x/nitrogen6x.c). On the real board, the Ethernet PHY is at address 6. Adjust this by updating the "fec-phy-num" property of the fsl_imx6 SoC object. With this change, U-Boot sees the PHY but complains MAC address: Net: using phy at 6 FEC [PRIME] Error: FEC address not set. This is due to U-Boot tries to read the MAC address from the fuse, which QEMU does not have any valid content filled in. However this does not prevent the Ethernet from working in QEMU. We just need to set up the MAC address later in the U-Boot command shell, by: =3D> setenv ethaddr 00:11:22:33:44:55 Signed-off-by: Bin Meng Reviewed-by: Alex Benn=C3=A9e Message-id: 20210106063504.10841-4-bmeng.cn@gmail.com Signed-off-by: Peter Maydell --- hw/arm/sabrelite.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c index 91d8c43a7eb..a3dbf85e0ed 100644 --- a/hw/arm/sabrelite.c +++ b/hw/arm/sabrelite.c @@ -51,6 +51,10 @@ static void sabrelite_init(MachineState *machine) =20 s =3D FSL_IMX6(object_new(TYPE_FSL_IMX6)); object_property_add_child(OBJECT(machine), "soc", OBJECT(s)); + + /* Ethernet PHY address is 6 */ + object_property_set_int(OBJECT(s), "fec-phy-num", 6, &error_fatal); + qdev_realize(DEVICE(s), NULL, &error_fatal); =20 memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR, --=20 2.20.1 From nobody Mon Feb 9 09:22:21 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1610121739; cv=none; d=zohomail.com; s=zohoarc; b=iBaNN/yhNSYDS5qDXQGNYBg5k1rQ/lH5l8FPtvXnbl8LmoSbLVGwunRoH2bU9H+u01glJHIVx+itbP1qP6xpiNREIKkmWDr8eieQjoUfAgVAtzvU6o/RRpNXOGcvs4hkFIcozgam/5aFsL6VUzf6XuZATBBy63jqLbZ0jxL5Vik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610121739; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AMnhlZyrvWZ5ic2poiBccv6AydLf+e+4fw82RlCGQo4=; b=Rv3uLjl/S/0LLKVbfv9zCSkVxCQQeNbxpILKgp2A+MABhJ6lQpzlt9KCjcZnPFe4g4W3e2C6jSoSL05ZzBlXxDnQyz8g8D49RrlLYS5r6VkD6qAi2XTuoljpT6HRQxA3B7OvoCd8j5r7olMSL1DaKv0heFceUdQz/zsayFbDG8s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1610121739326626.1314556285282; Fri, 8 Jan 2021 08:02:19 -0800 (PST) Received: from localhost ([::1]:56376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxuDR-0005Gs-VX for importer@patchew.org; Fri, 08 Jan 2021 11:02:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxtov-00055j-Lu for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:57 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:45689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxtot-0002zo-31 for qemu-devel@nongnu.org; Fri, 08 Jan 2021 10:36:57 -0500 Received: by mail-wr1-x42e.google.com with SMTP id d26so9382672wrb.12 for ; Fri, 08 Jan 2021 07:36:54 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f9sm15887572wrw.81.2021.01.08.07.36.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 07:36:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=AMnhlZyrvWZ5ic2poiBccv6AydLf+e+4fw82RlCGQo4=; b=wfEmKfrpDcPlngQpnoUCcn17F5dpYiMsxNxmSa8l5QhwlImRSCLAn8WN7b3aUVRMj0 7kR0jGpiuqKlPDAx/PGP9UOPYKeK/pMr8ue/ZkWzqrfL9q0biUK/Jkz7mNxEBn/2iA+3 gsY7YTRx8KsZLly+aJF8/k9ZSkEq0BxrZ/gVUwTE6YUbl7ML3aziXSpA8JcTD+wcDeHY ZE7WeyEWSu/3l7HfI2j8OEBW/ZLkOGN5IK0Vfhz6xdSe+G0FGN7ZKxZcesOQy1cp1vQC ZzD/1TSF0JMc9xpsTbUEkjCtqxdAIR0EwCnFhTHlXZLg6sJY5Rj/mClqXfYXl5EcvZNd NlAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AMnhlZyrvWZ5ic2poiBccv6AydLf+e+4fw82RlCGQo4=; b=hjnUUkXemSwt31lzQDC7GtGq9IU1FyJBSvn7jWNEqxbSFW+zvOXtNSa44cKLrnaS8n N8/hiqsKN0xfJNAjbPrPlnO9g4u1P7u/U5V5lbr5JI7JyYdUmccWpzKjPOJe/oawEmwB HudrgN7VhLO70DkwbHKrjBjfLsQQ3QM4JdtOCK9BLHZHFk1P9KG53bss968KUu5CZyLh GrVdk+AqbOV6/bXg1lff4B953UO2pkWxqcc0Uc6/xHOipESS4aZGiE+t/5cElsAcWQyY qiP6SqsRDOCkGWQuj/7Vw++uvioRXEPPqkKUeYRGWUU6UZ1lPjYejMi63NRdFF9mVfGw cYCQ== X-Gm-Message-State: AOAM530PpjSba19jcqTucOjsR9rimNsP665NvyAifWxXXNyJhCB+yVoD 13ccYvBVyy0p4Xk7heeazbg6eMcUBI6DmA== X-Google-Smtp-Source: ABdhPJx0JDy+EP5nwUNy08X3YVXhWC1/Bo1209u1Hq4ukk+WRNRlqjpQg3hSpQwBajs9lZh6VLWVAQ== X-Received: by 2002:a5d:5049:: with SMTP id h9mr4378355wrt.404.1610120212903; Fri, 08 Jan 2021 07:36:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/23] docs/system: arm: Add sabrelite board description Date: Fri, 8 Jan 2021 15:36:21 +0000 Message-Id: <20210108153621.3868-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108153621.3868-1-peter.maydell@linaro.org> References: <20210108153621.3868-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.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, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Bin Meng This adds the target guide for SABRE Lite board, and documents how to boot a Linux kernel and U-Boot bootloader. Signed-off-by: Bin Meng Reviewed-by: Alex Benn=C3=A9e Message-id: 20210106063504.10841-5-bmeng.cn@gmail.com Signed-off-by: Peter Maydell --- docs/system/arm/sabrelite.rst | 119 ++++++++++++++++++++++++++++++++++ docs/system/target-arm.rst | 1 + 2 files changed, 120 insertions(+) create mode 100644 docs/system/arm/sabrelite.rst diff --git a/docs/system/arm/sabrelite.rst b/docs/system/arm/sabrelite.rst new file mode 100644 index 00000000000..71713310e3a --- /dev/null +++ b/docs/system/arm/sabrelite.rst @@ -0,0 +1,119 @@ +Boundary Devices SABRE Lite (``sabrelite``) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Boundary Devices SABRE Lite i.MX6 Development Board is a low-cost developm= ent +platform featuring the powerful Freescale / NXP Semiconductor's i.MX 6 Quad +Applications Processor. + +Supported devices +----------------- + +The SABRE Lite machine supports the following devices: + + * Up to 4 Cortex A9 cores + * Generic Interrupt Controller + * 1 Clock Controller Module + * 1 System Reset Controller + * 5 UARTs + * 2 EPIC timers + * 1 GPT timer + * 2 Watchdog timers + * 1 FEC Ethernet controller + * 3 I2C controllers + * 7 GPIO controllers + * 4 SDHC storage controllers + * 4 USB 2.0 host controllers + * 5 ECSPI controllers + * 1 SST 25VF016B flash + +Please note above list is a complete superset the QEMU SABRE Lite machine = can +support. For a normal use case, a device tree blob that represents a real = world +SABRE Lite board, only exposes a subset of devices to the guest software. + +Boot options +------------ + +The SABRE Lite machine can start using the standard -kernel functionality +for loading a Linux kernel, U-Boot bootloader or ELF executable. + +Running Linux kernel +-------------------- + +Linux mainline v5.10 release is tested at the time of writing. To build a = Linux +mainline kernel that can be booted by the SABRE Lite machine, simply confi= gure +the kernel using the imx_v6_v7_defconfig configuration: + +.. code-block:: bash + + $ export ARCH=3Darm + $ export CROSS_COMPILE=3Darm-linux-gnueabihf- + $ make imx_v6_v7_defconfig + $ make + +To boot the newly built Linux kernel in QEMU with the SABRE Lite machine, = use: + +.. code-block:: bash + + $ qemu-system-arm -M sabrelite -smp 4 -m 1G \ + -display none -serial null -serial stdio \ + -kernel arch/arm/boot/zImage \ + -dtb arch/arm/boot/dts/imx6q-sabrelite.dtb \ + -initrd /path/to/rootfs.ext4 \ + -append "root=3D/dev/ram" + +Running U-Boot +-------------- + +U-Boot mainline v2020.10 release is tested at the time of writing. To buil= d a +U-Boot mainline bootloader that can be booted by the SABRE Lite machine, u= se +the mx6qsabrelite_defconfig with similar commands as described above for L= inux: + +.. code-block:: bash + + $ export CROSS_COMPILE=3Darm-linux-gnueabihf- + $ make mx6qsabrelite_defconfig + +Note we need to adjust settings by: + +.. code-block:: bash + + $ make menuconfig + +then manually select the following configuration in U-Boot: + + Device Tree Control > Provider of DTB for DT Control > Embedded DTB + +To start U-Boot using the SABRE Lite machine, provide the u-boot binary to +the -kernel argument, along with an SD card image with rootfs: + +.. code-block:: bash + + $ qemu-system-arm -M sabrelite -smp 4 -m 1G \ + -display none -serial null -serial stdio \ + -kernel u-boot + +The following example shows booting Linux kernel from dhcp, and uses the +rootfs on an SD card. This requires some additional command line parameters +for QEMU: + +.. code-block:: none + + -nic user,tftp=3D/path/to/kernel/zImage \ + -drive file=3Dsdcard.img,id=3Drootfs -device sd-card,drive=3Drootfs + +The directory for the built-in TFTP server should also contain the device = tree +blob of the SABRE Lite board. The sample SD card image was populated with = the +root file system with one single partition. You may adjust the kernel "roo= t=3D" +boot parameter accordingly. + +After U-Boot boots, type the following commands in the U-Boot command shel= l to +boot the Linux kernel: + +.. code-block:: none + + =3D> setenv ethaddr 00:11:22:33:44:55 + =3D> setenv bootfile zImage + =3D> dhcp + =3D> tftpboot 14000000 imx6q-sabrelite.dtb + =3D> setenv bootargs root=3D/dev/mmcblk3p1 + =3D> bootz 12000000 - 14000000 diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst index bde4b8e044e..edd013c7bbd 100644 --- a/docs/system/target-arm.rst +++ b/docs/system/target-arm.rst @@ -83,6 +83,7 @@ undocumented; you can get a complete list by running arm/versatile arm/vexpress arm/aspeed + arm/sabrelite arm/digic arm/musicpal arm/gumstix --=20 2.20.1