From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538322; cv=none; d=zohomail.com; s=zohoarc; b=Y1yhWiO+tGSJXES3io1XpRXHR6MObnxI92aSxW85XYppJLaYSP35rvwPzvdCx56gFzhr7qlLq3iWXL3ZiD4PRFh9UogUPhqwPwS2rjoYa0sFERCXTmr2Z2OdyI5hRyswkAG3yzY/EooLLRRVLNCVeGQTPyhjfTCI+jsIlkyisFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538322; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yDkk/GA+2l4bxeW1AZ28WNsyZ9Bv1+mbcP+/6+DmWpc=; b=FTspvFWY8eOnyW20fpEeoL+Lr+FhHd224O8b7Iq3zAdcFP3/5hYykXOOj2Id7Qy4yNmu+V6UgaUBroykbS6UWBAxHW4C+xa0nw+bA0b6WItOnQndX/k9kBHVkXfOBreBNoaTaqS01gpUWW771ekWhP8xBdabd17vtg3KnArw4+s= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538322248216.6110207007713; Thu, 20 Mar 2025 23:25:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVo7-0007yT-48; Fri, 21 Mar 2025 02:24:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVo3-0007xt-OK; Fri, 21 Mar 2025 02:24:35 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVo1-0002yY-ML; Fri, 21 Mar 2025 02:24:35 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-223594b3c6dso35846865ad.2; Thu, 20 Mar 2025 23:24:32 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538271; x=1743143071; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yDkk/GA+2l4bxeW1AZ28WNsyZ9Bv1+mbcP+/6+DmWpc=; b=J1IggSHo4BpNJD1xi4pCdUVR0oyz8imIStUdImo9CkBkgMjb7bn7V0agwplwI14XtA NLV3PJVw6GXe+ffUFi6oLQnqF/kVx24xbBJGvLIRpmGbboMeWxqWm0oixvujZPczroLo MQKAwxlT6fPNYSuusrbvnDhV05GCnRmlfymxbPQd/RrLs2snLzmkMSh2lU1jpUAK5M3G LWn6hza2Ct2CY/PMwDbNlEsUfnzySNyOkhH1QNquw87XYuTuY6DChKaviCyuY4OQgBjt MWRKffMqUIv9W7SJywPSddqMwfLMXePhdXjOM55gwk0RuQXQBg11vFqWpH+fSdDAM/W9 TBrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538271; x=1743143071; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yDkk/GA+2l4bxeW1AZ28WNsyZ9Bv1+mbcP+/6+DmWpc=; b=EGI8hEbf1JVtrYYstK7ItozwaKexm53S7ahRb/x6zN+3PysARe73KaUXhjVU9aYx4p X/I6yqPNti58C3MM5qjBETu++MLkU23U7+FOQ58parN9tc57Iy9i/2K/JnKiKldesQoG tyKZDBs8HewoZJWy4wda65fVXd8T/e3G64Uvdu1MGXyE89aB584witFk9GrbWtupZYmy SBjZQ4eMlm7Yvte/9pgS0TPw6II3pHZQgErqtnQMZG2f1wlDu3UaWyFc/BBp307INOp6 BUWtHI+lWwfxl0CyRaTdZoBPi6nPmqsBVL3vaG10K8rQGz5r3YeFitPSYTdXaVwtXSID ftPw== X-Forwarded-Encrypted: i=1; AJvYcCWRH6tw2pwgm7lqEFPJF1kJmaUeatuVmUHp9121wbuVrM0iplcLi95bZPpkcbU5nRURwI06NqYP9A==@nongnu.org X-Gm-Message-State: AOJu0YyxxTvr7Q1tnAadQzPPgx9R2bzN3asVxgP4Y9yiP+dbzZ7wMV18 3Cx6T0gdjKadqO/GJg/vrvR9nZxtr6MXH6oGt6q5EnX0ftQtMRt1ur+9ag== X-Gm-Gg: ASbGncvK4P3xQ9jmPxOccEcLXscZxIhBLvO+2v2MxOSXNctMXVxRKZkJ37A+B8G0VCZ jAEgjEFozty0WY4kaePoke9Y8PLIrYggVE+6ai1NTJaGk2KUb2m2cStuPVAv9BXvtaj26A0xAo8 GWTOj88AKr4rEfCuQfI1hTMMmEsR8QnQAWIPvxayhjzYxoCzb/d906YcqP9qdkzAJZSOXSgyIBA AMDxlixOeFdjtlQFTEx/17HOPYCWy/VC0P7CT2ECyNRPeIBNlBKLxmn9hLpufxCZHIJPh0cX8IQ EIK/pNLcT8mB/PPcf7WRmDzNkGzD11/sRV+eABmZys5lXWrPZA== X-Google-Smtp-Source: AGHT+IHTZ2Awsvh1QlWTXhSEdpLjLcRA+D5sXGoL1SR0s7da7F6onwqqtq3T01w8O+sRyKPwSbaV8A== X-Received: by 2002:a05:6a20:6a26:b0:1f5:79c4:5da0 with SMTP id adf61e73a8af0-1fe4300d923mr4287413637.31.1742538271260; Thu, 20 Mar 2025 23:24:31 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Misbah Anjum N Subject: [PULL 01/12] ppc/spapr: Fix RTAS stopped state Date: Fri, 21 Mar 2025 16:24:05 +1000 Message-ID: <20250321062421.116129-2-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::633; envelope-from=npiggin@gmail.com; helo=mail-pl1-x633.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538323904019100 Content-Type: text/plain; charset="utf-8" This change takes the CPUPPCState 'quiesced' field added for powernv hardware CPU core controls (used to stop and start cores), and extends it to spapr to model the "RTAS stopped" state. This prevents the schedulers attempting to run stopped CPUs unexpectedly, which can cause hangs and possibly other unexpected behaviour. The detail of the problematic situation is this: A KVM spapr guest boots with all secondary CPUs defined to be in the "RTAS stopped" state. In this state, the CPU is only responsive to the start-cpu RTAS call. This behaviour is modeled in QEMU with the start_powered_off feature, which sets ->halted on secondary CPUs at boot. ->halted=3Dtrue looks like an idle / sleep / power-save state which typically is responsive to asynchronous interrupts, but spapr clears wake-on-interrupt bits in the LPCR SPR. This more-or-less works. Commit e8291ec16da8 ("target/ppc: fix timebase register reset state") recently caused the decrementer to expire sooner at boot, causing a decrementer exception on secondary CPUs in RTAS stopped state. This was not a problem on TCG, but KVM limits how a guest can modify LPCR, in particular it prevents the clearing of wake-on-interrupt bits, and so in the course of CPU register synchronisation, the LPCR as set by spapr to model the RTAS stopped state is overwritten with KVM's LPCR value, and that then causes QEMU's interrupt code to notice the expired decrementer exception, turn that into an interrupt, and set CPU_INTERRUPT_HARD. That causes the CPU to be kicked, and the KVM vCPU thread to loop calling kvm_cpu_exec(). kvm_cpu_exec() calls kvm_arch_process_async_events(), which on ppc just returns ->halted. This is still true, so it returns immediately with EXCP_HLT, and the vCPU never goes to sleep because qemu_wait_io_event() sees CPU_INTERRUPT_HARD is set. All this while the vCPU holds the bql. This causes the boot CPU to eventually lock up when it needs the bql. So make 'quiesced' represent the "RTAS stopped" state, and have it explicitly not respond to exceptions (interrupt conditions) rather than rely on machine register state to model that state. This matches the powernv quiesced state very well because it essentially turns off the CPU core via a side-band control unit. There are still issues with QEMU and KVM idea of LPCR diverging and that is quite ugly and fragile that should be fixed. spapr should synchronize its LPCR properly with KVM, and not try to use values that KVM does not support. Reported-by: Misbah Anjum N Tested-by: Misbah Anjum N Signed-off-by: Nicholas Piggin --- hw/ppc/pnv_core.c | 6 +++++- hw/ppc/spapr_cpu_core.c | 6 ++++++ hw/ppc/spapr_rtas.c | 5 ++++- target/ppc/cpu.h | 11 +++++++++++ target/ppc/excp_helper.c | 4 ++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/hw/ppc/pnv_core.c b/hw/ppc/pnv_core.c index 99d9644ee3..a33977da18 100644 --- a/hw/ppc/pnv_core.c +++ b/hw/ppc/pnv_core.c @@ -248,21 +248,25 @@ static void pnv_core_power10_xscom_write(void *opaque= , hwaddr addr, =20 if (val & PPC_BIT(7 + 8 * i)) { /* stop */ val &=3D ~PPC_BIT(7 + 8 * i); - cpu_pause(cs); env->quiesced =3D true; + ppc_maybe_interrupt(env); + cpu_pause(cs); } if (val & PPC_BIT(6 + 8 * i)) { /* start */ val &=3D ~PPC_BIT(6 + 8 * i); env->quiesced =3D false; + ppc_maybe_interrupt(env); cpu_resume(cs); } if (val & PPC_BIT(4 + 8 * i)) { /* sreset */ val &=3D ~PPC_BIT(4 + 8 * i); env->quiesced =3D false; + ppc_maybe_interrupt(env); pnv_cpu_do_nmi_resume(cs); } if (val & PPC_BIT(3 + 8 * i)) { /* clear maint */ env->quiesced =3D false; + ppc_maybe_interrupt(env); /* * Hardware has very particular cases for where clear maint * must be used and where start must be used to resume a diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 0671d9e44b..faf9170ba6 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -37,6 +37,9 @@ static void spapr_reset_vcpu(PowerPCCPU *cpu) =20 cpu_reset(cs); =20 + env->quiesced =3D true; /* set "RTAS stopped" state. */ + ppc_maybe_interrupt(env); + /* * "PowerPC Processor binding to IEEE 1275" defines the initial MSR st= ate * as 32bit (MSR_SF=3D0) with MSR_ME=3D1 and MSR_FP=3D1 in "8.2.1. Ini= tial @@ -98,6 +101,9 @@ void spapr_cpu_set_entry_state(PowerPCCPU *cpu, target_u= long nip, CPU(cpu)->halted =3D 0; /* Enable Power-saving mode Exit Cause exceptions */ ppc_store_lpcr(cpu, env->spr[SPR_LPCR] | pcc->lpcr_pm); + + env->quiesced =3D false; /* clear "RTAS stopped" state. */ + ppc_maybe_interrupt(env); } =20 /* diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 503d441b48..78309dbb09 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -110,7 +110,8 @@ static void rtas_query_cpu_stopped_state(PowerPCCPU *cp= u_, id =3D rtas_ld(args, 0); cpu =3D spapr_find_cpu(id); if (cpu !=3D NULL) { - if (CPU(cpu)->halted) { + CPUPPCState *env =3D &cpu->env; + if (env->quiesced) { rtas_st(rets, 1, 0); } else { rtas_st(rets, 1, 2); @@ -215,6 +216,8 @@ static void rtas_stop_self(PowerPCCPU *cpu, SpaprMachin= eState *spapr, * For the same reason, set PSSCR_EC. */ env->spr[SPR_PSSCR] |=3D PSSCR_EC; + env->quiesced =3D true; /* set "RTAS stopped" state. */ + ppc_maybe_interrupt(env); cs->halted =3D 1; ppc_store_lpcr(cpu, env->spr[SPR_LPCR] & ~pcc->lpcr_pm); kvmppc_set_reg_ppc_online(cpu, 0); diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index efab54a068..3ee83517dc 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -1356,6 +1356,17 @@ struct CPUArchState { * special way (such as routing some resume causes to 0x100, i.e. sres= et). */ bool resume_as_sreset; + + /* + * On powernv, quiesced means the CPU has been stopped using PC direct + * control xscom registers. + * + * On spapr, quiesced means it is in the "RTAS stopped" state. + * + * The core halted/stopped variables aren't sufficient for this, becau= se + * they can be changed with various side-band operations like qmp cont, + * powersave interrupts, etc. + */ bool quiesced; #endif =20 diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c index 44e19aacd8..c941c89806 100644 --- a/target/ppc/excp_helper.c +++ b/target/ppc/excp_helper.c @@ -1951,6 +1951,10 @@ static int ppc_next_unmasked_interrupt(CPUPPCState *= env) target_ulong lpcr =3D env->spr[SPR_LPCR]; bool async_deliver; =20 + if (unlikely(env->quiesced)) { + return 0; + } + #ifdef TARGET_PPC64 switch (env->excp_model) { case POWERPC_EXCP_POWER7: --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538390; cv=none; d=zohomail.com; s=zohoarc; b=iE45FcL0DupQwwSZHUpW7/PY6qdPUB21e/QuMjFMxwsng/4NfsCELNQsaF9pgew5poYomcF+Ddz+XIdIQnDZ4NwudvI1lC2/YRBHL72mGvps9rfaWpGZCnXBtd73M1DHhPCm8Qbtc4xItOWh+FNFDGDn8+Pjxc4pnIAMfty6y9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538390; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=we644wfM+ubmYaOXPQgkcVl1QFMKHObsCG66v2LC+OY=; b=FqWH59yE4rtxALpz7SHyEJVpJiRNb74HPhiV2DMvmdyX0+79PmaFcbTv577MnovK1+kP63N3UpigtAoo7PSmIyfGhPQn6SA06epReQ48uhRpJmLMEPOxLn9N/mQtz9qkLrB3W/L9rKr2a6f3oeg9aoxxHwGLarADdbZFv2s4vcQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174253839023416.250277913375612; Thu, 20 Mar 2025 23:26:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVpT-00008q-4c; Fri, 21 Mar 2025 02:26:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVo5-0007yS-M3; Fri, 21 Mar 2025 02:24:37 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVo4-0002zJ-6f; Fri, 21 Mar 2025 02:24:37 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-2241053582dso39366895ad.1; Thu, 20 Mar 2025 23:24:35 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538274; x=1743143074; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=we644wfM+ubmYaOXPQgkcVl1QFMKHObsCG66v2LC+OY=; b=bO3uX7D6BkAow82ZbaeGZzyO3yPBzvOmtn7RISu1/OtVlZgclzOtFckQK3bco2mFVn t5jgEH+ifpAXtgwiGJCD5HZkgn+58/rEJqPUFj6fJwKeFXeOz8fpAfy6gG26irNWfdqK VUKYjktHmUL/351ddcdxSO4Ml4O9jvNlZkGU+9WJOfnGSfTLGnm5jj4lyWEOqlPrPu+R v5PaOEmoOSJIgwfNRwJ4exSK7U7CVFiaOLlbkzcLGcmKzmFQTg9mRNna0aLuIMoO1l2v BO5rs0B9aaKJmM0X6SsP3mVr7ik45LW2KmoaHNcl9rTbyNmZO9xtuCRqtb4geseVSkcm ladg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538274; x=1743143074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=we644wfM+ubmYaOXPQgkcVl1QFMKHObsCG66v2LC+OY=; b=sDw9rFagRuTbQ558d6aNBtfZvkK4rBGylm/GR8EPgDGMZ3ipr607fqt1MthDTODvYv jZ26o+bnPlqXeEGA7TONoOrkPR+7HWsz+NncyD/IYSKtnKuLaXgxd8fLKJeJAgVL/9qb EevtwDSMMS34RD9cTovAD6t0I9xTB62ziOKfdQhbgXwEHt/AvmyJJ0jNZSAqbluxTun7 C/yj9TPzE9wpbNk+2sg2XOMAmyvV56EP/RonC7wrcnwDiObYvxNg85S8Hp3zu4ch4n74 kqekyAKcUkJM5LwPvYxK9zTlh2kQaMJKId3iiATMLZUSj7BLXV1n6YiQDLbCq/Q8B4rj IOUQ== X-Forwarded-Encrypted: i=1; AJvYcCWF9L1L+60rlBDROMP+OklDwSLrdPowIzE7WUUTiPmIXHlSOyV7BtwciNnV/tkzedsgKVvA0pJHuw==@nongnu.org X-Gm-Message-State: AOJu0Yz7QcDQ19K66bcSuLJnQtAIEYFd8uMG85U0UZvpYOQVwllxj6Fy hH44jnj2Y8wNvUCniFbvnhMCnJjd73d/0jdUb+OEXe7DTjMDgJPKPW4yOQ== X-Gm-Gg: ASbGncv3S5LPz/IcnfaVdt2LhazeIe0uJsMLyKaY5rwFlY/41mMabsXUhLCxfFyBz/r wH7EYCOLFaaZUmlWQbtowb396JaCxGQwWgFCEyupFBSD64tesaE0DTe9MNXjJ59PWlVGHk30+dC YHyvQStF2hQtqQ7Xq88uvSadYO9bziSjtgk2DB6pzkJsa8TFpdQhbD4aLJxEoE5vJ8E1J8lbwHC lD3ySPGAy2aJyqGU84LTRoPtxI+U8AvTW6is7Y7YZ8i0OBLIwEKpCeaUhtNbAAAMF4EJKuzvFqc 7GFauUMLr2FCZDhk+jkBKNPSvwRNpqTTxqtDm2oYu+IA7ftt5A== X-Google-Smtp-Source: AGHT+IGra9o/v0JuvnHMxWc/hMtROGCyFdm0hXo/easVMP1XHkFSGzOp6DHmX9NSi9n8K2LXJi/E/A== X-Received: by 2002:a05:6a20:a10c:b0:1f5:5614:18d3 with SMTP id adf61e73a8af0-1fe42f07bb6mr4112698637.8.1742538273802; Thu, 20 Mar 2025 23:24:33 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org Subject: [PULL 02/12] ppc/xive: Fix typo in crowd block level calculation Date: Fri, 21 Mar 2025 16:24:06 +1000 Message-ID: <20250321062421.116129-3-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::631; envelope-from=npiggin@gmail.com; helo=mail-pl1-x631.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538391773019100 Content-Type: text/plain; charset="utf-8" I introduced this bug when "tidying" the original patch, not Frederic. Paper bag for me. Fixes: 9cb7f6ebed60 ("ppc/xive2: Support group-matching when looking for ta= rget") Signed-off-by: Nicholas Piggin --- hw/intc/xive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/xive.c b/hw/intc/xive.c index c77df2c1f8..e86f274932 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -1686,7 +1686,7 @@ static uint8_t xive_get_group_level(bool crowd, bool = ignore, * Supported crowd sizes are 2^1, 2^2, and 2^4. 2^3 is not support= ed. * HW will encode level 4 as the value 3. See xive2_pgofnext(). */ - switch (level) { + switch (blk) { case 1: case 2: break; --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538488; cv=none; d=zohomail.com; s=zohoarc; b=PRLU/QEqSYohT7Linw0WB2+PhKHPGgaA0pEbbE4h1O9Dm+0gKmSRUV2QwRrE6Uo+Ax++mQXI2Ox+GFv2SKtv6NISySsTRtz1962MnN5nGiJVK8pmfsqJo/66Y8xd0DFMnOr3Kk9ZEoVBVHHke3Ir1z7OmW8qLp/+E9NrO8hHp7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538488; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kmhaDUCITVTolqS8yLhqK/IZH/DnuSfoIHP1VEj2LYg=; b=QGe7abmCUJglMaZqnHha7YEzBIvytXNWJh/qNZ3vLgniyy6Dib/8oolRYOggv3/QLYipDLlbuZNgIEoXFRBLhIqrWY4oYNkabB5l1hBFqwIbET2zfWQ8UjHaEmCwiqWg+7jzbNEtF1Hss+1vagm+i0LedGIFRaJ+kVPST3TUMxw= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538488790408.8508513645111; Thu, 20 Mar 2025 23:28:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVpz-0001HK-QS; Fri, 21 Mar 2025 02:26:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoH-00080q-GN; Fri, 21 Mar 2025 02:24:55 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoB-0002zw-Jx; Fri, 21 Mar 2025 02:24:49 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-225e3002dffso23036115ad.1; Thu, 20 Mar 2025 23:24:38 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538277; x=1743143077; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kmhaDUCITVTolqS8yLhqK/IZH/DnuSfoIHP1VEj2LYg=; b=GK2uFmOot5G0xk6SadwYeqCtdAaHV4vBPg65VFwldDAwuq/GU1PTRzSwDUP5CorJ7W OpvZrvIE1iBcPZmloh4aEacSJ1vZNJXZ8hhsuynVHSm7f6THxn5uzGk2SjGYx8HNUwSI WRkOpTuJALAkUuMbbz0/D0EjxKdQzOI3CvBWE/Ft5MwNyBBBUoVTzxbzWhoHDoopnHTK ox7751Fz04G7uHogm6mftArNVvcnM8zQCyLIKt0XkeD5pNTGf7vqxtG13ce3buFCqcGD 4U7ZDlSS6bAzm+OV/z0kG0OYPbVAVox3yUmgYni7XkOJTBqq0qAlts/Q1AbWif0NaklI 50bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538277; x=1743143077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kmhaDUCITVTolqS8yLhqK/IZH/DnuSfoIHP1VEj2LYg=; b=tHc8Ip7njaaomMmXQJF2UzaW5TYgBBSkySkZkQF2KV9wWQ564FzMfIiDNNFBK2JQKa JQ8d7PGXMgOWhkAUImQRY9wJb90+8tB3fomSiKGYmqqdjF28z+EQGJbAIAgxUG3BNnyP cNPO4Vlqg6Fd8OxiMdMNojEomBPPMsRsUuZEaAZnc0FO5adWrKoc1bkPWv2LNzSlhY9e S0r9UpeSLQi7chu5t/IXYK0pmWUWHGjGIczyGiXY3pGiZkTLRkWIlYYgl1V/nYaLm5H8 +ln1bcHkxRIcWsay73s9ZATiAj3zVo9nRwygO7GWWrpLaEhS4RIHZgTqkrOGVaM//3w9 bd0g== X-Forwarded-Encrypted: i=1; AJvYcCU9Q6ng9tg15af+5eNOgQ6jPsV/xmhfLK7rzgYVVgMdFk6c3WRyCKiBretbb2d8nsnJgTV+6VF+fA==@nongnu.org X-Gm-Message-State: AOJu0YxjMe+AaSZ9oD/SliKhxnJ80ujUjOT3/G65bv6YVaJ1iDOgVko/ PRh4UVBFc97jFOn5OuRs69z7dnDKWb4GBI4e+50ripL1tCKLfIBvKtCP2w== X-Gm-Gg: ASbGnctvGx/3d8SGp00hjxyPjFEvWeCVVKsh2x5liDZSZ7KAfgB+5gV26A2TrXtEQPT 5+u3nc4dmjyQ+5qATSW1Wm6J/BrI9oloVFEUlGiZO/qXKuiY4jR7DRHpA9vgUxgYYhiLlhzVLXb zvEO9tXAGJsWRPUb/4qZHnSGh2Spd7OTmP7juZe8cKhejD0qL2wK6fdQumuIvHZCXLO+trvDY0S up8uqo5e35ZhalF0dR//kQTctKKTi+Ewn3nSjo8H8kcbcDhhgrxEKTT+yjT9jmSa67lw22gI8k6 KcFeuWrla9vvPEnCYZlnH0k/GrodFEagiZRwddE/4CorI/xJ7g== X-Google-Smtp-Source: AGHT+IEOGvsxTiBD3KHtcOeVNMlnmFFi6gUvshWcXmiSLOJZ/rOF8QGFXWq8BVl/pOHX2VbOcGCIYw== X-Received: by 2002:a05:6a00:ac4:b0:736:4c93:1bdf with SMTP id d2e1a72fcca58-73905a275famr3039921b3a.18.1742538276697; Thu, 20 Mar 2025 23:24:36 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 03/12] pnv/xive: Fix possible undefined shift error in group size calculation Date: Fri, 21 Mar 2025 16:24:07 +1000 Message-ID: <20250321062421.116129-4-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::62c; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62c.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538490036019100 Coverity discovered a potential shift overflow in group size calculation in the case of a guest error. Add checks and logs to ensure a issues are caught. Make the group and crowd error checking code more similar to one another while here. Resolves: Coverity CID 1593724 Fixes: 9cb7f6ebed60 ("ppc/xive2: Support group-matching when looking for ta= rget") Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Nicholas Piggin --- hw/intc/xive.c | 27 ++++++++++++++++++++++++--- hw/intc/xive2.c | 19 ++++++++++++++----- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/hw/intc/xive.c b/hw/intc/xive.c index e86f274932..3eb28c2265 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -1662,12 +1662,20 @@ uint32_t xive_get_vpgroup_size(uint32_t nvp_index) * (starting with the least significant bits) in the NVP index * gives the size of the group. */ - return 1 << (ctz32(~nvp_index) + 1); + int first_zero =3D cto32(nvp_index); + if (first_zero >=3D 31) { + qemu_log_mask(LOG_GUEST_ERROR, "XIVE: Invalid group index 0x%08x", + nvp_index); + return 0; + } + + return 1U << (first_zero + 1); } =20 static uint8_t xive_get_group_level(bool crowd, bool ignore, uint32_t nvp_blk, uint32_t nvp_index) { + int first_zero; uint8_t level; =20 if (!ignore) { @@ -1675,12 +1683,25 @@ static uint8_t xive_get_group_level(bool crowd, boo= l ignore, return 0; } =20 - level =3D (ctz32(~nvp_index) + 1) & 0b1111; + first_zero =3D cto32(nvp_index); + if (first_zero >=3D 31) { + qemu_log_mask(LOG_GUEST_ERROR, "XIVE: Invalid group index 0x%08x", + nvp_index); + return 0; + } + + level =3D (first_zero + 1) & 0b1111; if (crowd) { uint32_t blk; =20 /* crowd level is bit position of first 0 from the right in nvp_bl= k */ - blk =3D ctz32(~nvp_blk) + 1; + first_zero =3D cto32(nvp_blk); + if (first_zero >=3D 31) { + qemu_log_mask(LOG_GUEST_ERROR, "XIVE: Invalid crowd block 0x%0= 8x", + nvp_blk); + return 0; + } + blk =3D first_zero + 1; =20 /* * Supported crowd sizes are 2^1, 2^2, and 2^4. 2^3 is not support= ed. diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c index f8ef615487..311b42e15d 100644 --- a/hw/intc/xive2.c +++ b/hw/intc/xive2.c @@ -1153,13 +1153,15 @@ static bool xive2_vp_match_mask(uint32_t cam1, uint= 32_t cam2, =20 static uint8_t xive2_get_vp_block_mask(uint32_t nvt_blk, bool crowd) { - uint8_t size, block_mask =3D 0b1111; + uint8_t block_mask =3D 0b1111; =20 /* 3 supported crowd sizes: 2, 4, 16 */ if (crowd) { - size =3D xive_get_vpgroup_size(nvt_blk); - if (size =3D=3D 8) { - qemu_log_mask(LOG_GUEST_ERROR, "XIVE: Invalid crowd size of 8n= "); + uint32_t size =3D xive_get_vpgroup_size(nvt_blk); + + if (size !=3D 2 && size !=3D 4 && size !=3D 16) { + qemu_log_mask(LOG_GUEST_ERROR, "XIVE: Invalid crowd size of %d= ", + size); return block_mask; } block_mask &=3D ~(size - 1); @@ -1172,7 +1174,14 @@ static uint32_t xive2_get_vp_index_mask(uint32_t nvt= _index, bool cam_ignore) uint32_t index_mask =3D 0xFFFFFF; /* 24 bits */ =20 if (cam_ignore) { - index_mask &=3D ~(xive_get_vpgroup_size(nvt_index) - 1); + uint32_t size =3D xive_get_vpgroup_size(nvt_index); + + if (size < 2) { + qemu_log_mask(LOG_GUEST_ERROR, "XIVE: Invalid group size of %d= ", + size); + return index_mask; + } + index_mask &=3D ~(size - 1); } return index_mask; } --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538428; cv=none; d=zohomail.com; s=zohoarc; b=IUqb1P2butEWeEgPc5S8u0kjkdX3RSRcAVTluzvfVzCg90wKZPjmtQ8kd06Mxe5FWocNoqYo2YfF/DoHynmGiABtftJUqgYEYy0L43B0Mx0NRv/mO6XyWd0wal7QuVr04ppPzQgzIicUaQ4y8XVxKq/ROZsAdLnAgnB/3B1N058= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538428; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SqViPbJrwkFdFnQi1kgDINENtOBtFE3qJ3dGXQXwpNg=; b=X6IlCf6U4i/x+qrxheRyC0E9a9blIMPfhVYdcZFI6FbC00IeOsW8yccrx26GE0VVrSDfM/39OhPy3qmTlwJvff7CsmFcFeDWLLd/XfbqRF9FRVu6R+hp2i30e31ibEzpBwB8vnFPjgScP9jKBVrOelcFm695C3zJ5gmxmvZzJOA= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538428199621.2204147440142; Thu, 20 Mar 2025 23:27:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVpq-0000he-FM; Fri, 21 Mar 2025 02:26:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoG-000808-OI; Fri, 21 Mar 2025 02:24:48 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoE-000309-He; Fri, 21 Mar 2025 02:24:48 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-223fd89d036so30893035ad.1; Thu, 20 Mar 2025 23:24:41 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538279; x=1743143079; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SqViPbJrwkFdFnQi1kgDINENtOBtFE3qJ3dGXQXwpNg=; b=X1yFSua1JjPqLE1uXq1Jl6WXqn2S/IqqYVfqb1KSdc+O44vt9DWNuLTX03hAVP7Maj 7w2ptpy9awpA4bdWD4GcaUqmHhT0Mia1i8vmJ8zdvvOv7Y2fd4KD4DcohIZ/3czMXn1U Myhe6Po4Mw8RwzsRESUDzApqxKNTHyq04+im6CD0k/q5A0F/Jdixr4kNSI39sXX76/2x BWprQuUeTqdm89IE0gm75WFIJrDqJHUKqmXMWu0TSv/L+8i6pz1TVoDpbBODwXBSn8sV CzwnQH0zY3nJ5B33B99hw9e59O8SmAq7cio1FpNzr2amcHLK6ewpSCdaAT/1FsXYqwoO ZrYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538279; x=1743143079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SqViPbJrwkFdFnQi1kgDINENtOBtFE3qJ3dGXQXwpNg=; b=W8f8Jyqy/M0ZhqP5zehEmsS0c/2VkbV7/oGP3rzSh1AQrCcaRLJfAW7bcojxa4qXUH z8S+Xn8EYWqrj6XsjnoxnDMyG+0iBK4xFvdphVLYFp8GNZI5P5nH4ntTTqVuEegIqihl RMVvR3w5S6OuOTSx37gdeQyJkzcoaUV7Lr36vbb1PMh6eWJDlIW5YcEKpBG+7fyTaMTh CUdkdCLQ5yEOHp5eosAeIYzu7zlg1EYAz3JxAHbdXnDX7CylVhJWAfxF+q9IC34LdSZn VRbpzESWOM25Bx6HawZeuRHHEgWTxknEvJlomLmgphDHafgeE1UyOrjsSUflAonW0U1k ec3g== X-Forwarded-Encrypted: i=1; AJvYcCW8CI2WRKCVGH55kzeht3i/Hu4dfYgMKTJDe/Z5DnYZ38q8SzdRXN0R3rFTWSeExm+cPIkJYYUGUg==@nongnu.org X-Gm-Message-State: AOJu0YxH7STPDtt2kdFFyJydTnK2bDZJt0gpD21lryaNK7+RRuPRk5Xo alXR8Wr3Sdo+Wzz589ycaR13+IK8NRtKIpwI6PIXHwyqiW975UzIu3pmew== X-Gm-Gg: ASbGncu2024o7iGj7i8GpjD/eZ8C/lAUsQgCywvZhOnni0XhDM1/30Rm7yIp8M18Xw/ C+iFsh2H2L+3O2OA/EWI7dMOYjKGBcz27QvKtVchZnDQjY6bG2xhM+4Dkc3R5ksI3kN4Rv5VTP9 RUmQQ8rvwWWWKPqouLVKVfNo+e1VdfT6imtEo9f/70K4pq//R2eAALIMP7WchPIUsJpqATBbCtW UvK6rteXuVspv9AHP11l9soV4UfxQmQqx8mnstJdxo934EzqJc+tddI/aH4mwRYHfVklgUKQa9O Xv0OcH9ODG7VMpRuFddXLTWBG66GAQAs5pvwnHfhfeJAGIV43g== X-Google-Smtp-Source: AGHT+IGhTE2seVPaGLaeE3sDq2xR7yTGaBdO/okZaNXp3hmqtCtqbwn9Hbd6fAfsIdSkkD/1Oxbznw== X-Received: by 2002:a05:6a00:3d0a:b0:736:4d05:2e2e with SMTP id d2e1a72fcca58-739059667damr4118480b3a.6.1742538279456; Thu, 20 Mar 2025 23:24:39 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 04/12] ppc/xive2: Fix logical / bitwise comparison typo Date: Fri, 21 Mar 2025 16:24:08 +1000 Message-ID: <20250321062421.116129-5-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::630; envelope-from=npiggin@gmail.com; helo=mail-pl1-x630.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538429247019000 The comparison as written is always false (perhaps confusingly, because the functions/macros are not really booleans but return 0 or the tested bit value). Change to use logical-and. Resolves: Coverity CID 1593721 Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Nicholas Piggin --- hw/intc/xive2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c index 311b42e15d..7d584dfafa 100644 --- a/hw/intc/xive2.c +++ b/hw/intc/xive2.c @@ -1344,7 +1344,7 @@ static void xive2_router_end_notify(Xive2Router *xrtr= , uint8_t end_blk, return; } =20 - if (xive2_end_is_crowd(&end) & !xive2_end_is_ignore(&end)) { + if (xive2_end_is_crowd(&end) && !xive2_end_is_ignore(&end)) { qemu_log_mask(LOG_GUEST_ERROR, "XIVE: invalid END, 'crowd' bit requires 'ignore' bi= t\n"); return; --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538389; cv=none; d=zohomail.com; s=zohoarc; b=IcrimiZeYnDaZkXNv2fcJ1qyf8crg8Hjit906qvM/BV60ZMgbOLss6m9+MuhfPBLn7czkIGSLH71Pfpnkwbnv2JRFjYGF3W1nZc7epe4QSDumyUxCQ83FhxsEu4nPPuc+c996W8t7k3RnohQIkBGxc0hvhG3kKJvoI0oL7m7ms8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538389; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fONuj6OGToGS6hsbceww1Dv4M/MhW6pQYlSp4fRXGvo=; b=abIqXK5kTjQNwJY1cT5M/h7LpoL/bcI830Ym8QASfDVDax+YgymMdSkcM6W7qJpRqQFcocEuVhI7eoWG+Sij1BzNfxSPWJ2vgH3YrX3iClZNk2OKlpWktwOB2Q0kT81AbF5cwAFZXo9BCbreRA/AC8f7TTSznpJNHOpeHQBJ/CE= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538389494954.1713980812119; Thu, 20 Mar 2025 23:26:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVpl-0000TR-4G; Fri, 21 Mar 2025 02:26:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoH-00080k-1J; Fri, 21 Mar 2025 02:24:49 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoE-00030N-IT; Fri, 21 Mar 2025 02:24:48 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-22438c356c8so30779395ad.1; Thu, 20 Mar 2025 23:24:43 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538282; x=1743143082; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fONuj6OGToGS6hsbceww1Dv4M/MhW6pQYlSp4fRXGvo=; b=TORJMf7Bv6qtlY1eRQKfew5uPcZC0qJ+T6ZPEf+l0SjSBtq5XMVkc7ehSQnRGd4/lE Yf4TchRBZAORiEnPTtVDgNLzIpU9HpGeSc/T5zlzwrc+L8jikMqCEqDmybFYaI/ZxLzG JE+FK6Ig6SX3Y+iTXNLmhbpw6etXGXhn6c4YHcIneUOQD/2x3XnWWyg2AIS3eHLXJ8Q/ 7oJJQr5V3iN2I8TZ2MNijCAgdTxquwMfCuidOGj11Z6xTv1XrXvqDMUrMeTQJLzoJgTq faCOrQa4jiuXxtO3nxQhBqVxxAAcvlaG8W6cuf8eS94elJNRR7E0YTw6A5wOVyTl4pSS hWBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538282; x=1743143082; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fONuj6OGToGS6hsbceww1Dv4M/MhW6pQYlSp4fRXGvo=; b=XDCgWZMUL83w2EujY+CaSMv3wp65NyhGTz1WW1INVtlD2Rff7mw8eMRkwawWaknhNX g0jULKt9gM4lOcDcdBNttAOk+LUXkDBgVn44pyMg4aKwNSPOz3pwh3E8noc6lB2uIsXu 82mIJdgrJgoHZcuSmVR9gnYCqiDXdBxahyJ/bbFI8mRzWRubIsgfaF+WZqI+tbhTd8ZR Y69iWR7eoDXyMW/N6MQDG7Gngj4R/vqsq1C7yFtxSbTDca7S0B/c5LeOkiiytSu9oauO Q8xEBfGwO7PxxM3iYIBX+dJCMudkgf/H9rIkOvHPM8DI6hPExmB5WOqpWvZsa/d21HDY xipw== X-Forwarded-Encrypted: i=1; AJvYcCUN1Vms6YXIUHL3m8uqDOph71kC1pI/UdO0frXbqIvtTTrF6/ALyVEjdGquWMs5B0alSQlpAHPj4Q==@nongnu.org X-Gm-Message-State: AOJu0Yxcv9BOUXYsyFkEEBmvT86+eJX6tvwzZp/gt35I8/jOZlFE7tsD 0dF7LPVpL4/MPIU3VhHtIOyEiM8BDnAvRPMLr4sTlbMi0eF75ZTsO6ASMQ== X-Gm-Gg: ASbGnctW24tzsBxIDefK3KHAaBH2aQs4QJI7w7czFIb+EXLycta5ndxmiYSfwZzESDI 8zFYrnTs9vgTzYq337T0iSTiHpMLRQH97VqMI7LxCN8T5KKx/r5Evwhtvr3w0KhKRtka0C1s2K9 bg5xZOeDXMfuYu86Z/LB/Ncqv0almKk1W2aV5zhFzwOEtLptba6KeaUCnZSZRrXHfCXEyyqPZ00 cDjidisQfCGa1gD4T/V+RQua9oCPl0U2tn+wc1r8HwSjV1Ciz91eKk64FAlaBIXk+ekKoCjkXl8 s/tiYmmX/sU9g2xbbmknZe6BXPMAxAYD1wgTCY75jtf3CXkIMA== X-Google-Smtp-Source: AGHT+IGJqmzLzF8cDK5wd50Kx26k9BjsuTZU+sQzltLa1wCV4wllfzX/N/bsclhojFd0kSyxLIm4RA== X-Received: by 2002:a05:6a21:4cc1:b0:1f5:6f61:a0ac with SMTP id adf61e73a8af0-1fe42f2a01bmr3851582637.5.1742538282562; Thu, 20 Mar 2025 23:24:42 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Shivaprasad G Bhat , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 05/12] ppc/spapr: Fix possible pa_features memory overflow Date: Fri, 21 Mar 2025 16:24:09 +1000 Message-ID: <20250321062421.116129-6-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::62c; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62c.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538391125019000 Coverity reports a possible memory overflow in spapr_dt_pa_features(). This should not be a true bug since DAWR1 cap is only be true for CPU_POWERPC_LOGICAL_3_10. Add an assertion to ensure any bug there is caught. Resolves: Coverity CID 1593722 Fixes: 5f361ea187ba ("ppc: spapr: Enable 2nd DAWR on Power10 pSeries machin= e") Reviewed-By: Shivaprasad G Bhat Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index a415e51d07..9865d7147f 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -296,6 +296,7 @@ static void spapr_dt_pa_features(SpaprMachineState *spa= pr, pa_features[40 + 2] &=3D ~0x80; /* Radix MMU */ } if (spapr_get_cap(spapr, SPAPR_CAP_DAWR1)) { + g_assert(pa_size > 66); pa_features[66] |=3D 0x80; } =20 --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538465; cv=none; d=zohomail.com; s=zohoarc; b=ma1TS5MkAig3EYp0o4FcOYi9Q5uNGfIe+EjMZWKzI+4L6DoS+GiWHZGMo/1FyxGyQtA7oOuGMIRdhhKQb7xLtdPVIqGwBOv/1OCTNCD+NN5sqKlOwBDwb6/0dlle2Xxa9BF7jdHFY0JvrXxfAE9WId0cy2TR3I4ydhPrObGzA64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538465; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sPlqrdvSPBhbQRkDKEesOvGQR55g+BN08vpUbW76CxI=; b=Hu6+F4blRfgOSruXwqdxQ/8ng4AVy++OHKVs9kiEJiPnWuwdTe9kZC8y5irKPbK7JPpR3FThoW/HKvXEtQDC8q/1O5M8S8Q7BZsy9O20VwDrf1PZYDiAxhjW2cg5Wi4KlTpuwoF1uEErjl1hLqeggr/R0ZvWPQi68rcgV3WMD9U= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174253846529676.44654253500119; Thu, 20 Mar 2025 23:27:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVpu-00010C-22; Fri, 21 Mar 2025 02:26:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoH-00080v-VL; Fri, 21 Mar 2025 02:24:59 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoG-00030o-0l; Fri, 21 Mar 2025 02:24:49 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-225df540edcso56742445ad.0; Thu, 20 Mar 2025 23:24:47 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538285; x=1743143085; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sPlqrdvSPBhbQRkDKEesOvGQR55g+BN08vpUbW76CxI=; b=lSGZl4pnwwrMssvlGWpwmrkIMTJNMs3lWW6ea3c3Cte70PuVDfEB2c1QG5FU4O1qHK 44c0nCtC+vuhlkR4sgxjtbM6FGH1U5b36z4nM7TP1vpQSy3Q7L2lMcZWI2VfQhH6tqiT H6hhY2KGvHh5j9YnQFiYrUvXqC6hGpBzW3r5Emh37iGDmjelgXHQdCOGcqIvj8cxs/JN 565qibsGwyi3WJBfJR3jE7myCyMetfZAYxcTly+6z4sN+hiEfV9jZpfRCOuAggG+JxwU qAQfpQk7hTGvwgdLaES7CeRpr6gXXjuzhZFBiuiy4WqTQBvDCIg6j/xJwt8J/A2HdBrh Ycsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538285; x=1743143085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sPlqrdvSPBhbQRkDKEesOvGQR55g+BN08vpUbW76CxI=; b=V+DWMWB/Yxp7U5gwtiAG8R7HI80MwhQi+t3g11q1veKAVimBjh0AWY8VQk+HqcNfe+ vnZaReePzN1MgqUkYtju9kYWCttpr2QmI+z001xzrMJDtTLOjQ34PwG8Gho1k3wRsv1e oPnSs31+07IfBAoVLtiNE2qsi8NXQM4FXrL3t1Ed6At5OlHF6Q3fKM2clNrjpLkKLCdx 74UmQk1xgR14NyVsetflVyDO7HpS+obIScDrtgLMjqocEyhbATDsDcZOLW7e/F9074F8 tBmvah1FHwQgu7tJJVfcGJjHiwpOIKzVNulRyqLPjXrtcAgbwZ6HkVISBIPO61u4I9/B vnzA== X-Forwarded-Encrypted: i=1; AJvYcCVIPRP5UHc/qfI0hk3QZLDPGvIlUT09gQd4k4JCUQeMDWPBlDcWfOOcMRBaiwKO4Twi2OMC0/Ddiw==@nongnu.org X-Gm-Message-State: AOJu0YwTDxm9Pc9bn0U/SjLgLA8D91lJnuxxIi9OZlFc1FIzZJZ5raue 75yYrinr+X9T9ojNFa+lGzmS01YY9+OZ76eV8PL9nkrHrTKE+0RpH44bwg== X-Gm-Gg: ASbGncuHFCKe0vEis0anqLT5wfg0c7fCpzBhelxEq793ab79189ixmtQBdErLDqiNSL qySUPv36UBPoYYO0VRV6Lah2muU2l/nymnG5RzDGLYKxFJQpN5Jg7R1my7jZxpStLUcbUbnHexc tc6XrG2MZ05YuQLYBWVXzik+fs/gWpE7humMYH//CKuDTt9vjYUPrISrb6XhJP95nVgLa2CaSEk LJXb3GZfaOa7V8jm6M9dWpKlEj4RFajS8WcNJ0ES96nNdR1mDPfh9HnpZ4ceSPuCo001JItIxqL jQNlPtagIupHZ48yEFw6SVLtnYQnKNTe39/hRzaFyBQICUk62A== X-Google-Smtp-Source: AGHT+IH/gZlhJTpKT1n2fkcvl7j9Vw5q6C95zNaaIuxkhMSPTSmvWNnzXHJlMtzZ7y/WzFr4rcTQ/A== X-Received: by 2002:a05:6a00:8718:b0:732:5875:eb95 with SMTP id d2e1a72fcca58-7377a0c768bmr8279841b3a.4.1742538285446; Thu, 20 Mar 2025 23:24:45 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 06/12] ppc/pnv: Move the PNOR LPC address into struct PnvPnor Date: Fri, 21 Mar 2025 16:24:10 +1000 Message-ID: <20250321062421.116129-7-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::62c; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62c.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538467969019100 Rather than use the hardcoded define throughout the tree for the PNOR LPC address, keep it within the PnvPnor object. This should solve a dead code issue in the BMC HIOMAP checks where Coverity (correctly) reported that the sanity checks are dead code. We would like to keep the sanity checks without turning them into a compile time assert in case we would like to make them configurable in future. Fixes: 4c84a0a4a6e5 ("ppc/pnv: Add a PNOR address and size sanity checks") Resolves: Coverity CID 1593723 Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: Nicholas Piggin --- hw/ppc/pnv.c | 2 +- hw/ppc/pnv_bmc.c | 4 ++-- hw/ppc/pnv_pnor.c | 2 ++ include/hw/ppc/pnv_pnor.h | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 59365370c3..63f2232f32 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1191,7 +1191,7 @@ static void pnv_init(MachineState *machine) * Since we can not reach the remote BMC machine with LPC memops, * map it always for now. */ - memory_region_add_subregion(pnv->chips[0]->fw_mr, PNOR_SPI_OFFSET, + memory_region_add_subregion(pnv->chips[0]->fw_mr, pnv->pnor->lpc_addre= ss, &pnv->pnor->mmio); =20 /* diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c index 811ba3d7a4..fb70a8c1f2 100644 --- a/hw/ppc/pnv_bmc.c +++ b/hw/ppc/pnv_bmc.c @@ -174,8 +174,8 @@ static void hiomap_cmd(IPMIBmcSim *ibs, uint8_t *cmd, u= nsigned int cmd_len, { PnvPnor *pnor =3D PNV_PNOR(object_property_get_link(OBJECT(ibs), "pnor= ", &error_abort)); + uint32_t pnor_addr =3D pnor->lpc_address; uint32_t pnor_size =3D pnor->size; - uint32_t pnor_addr =3D PNOR_SPI_OFFSET; bool readonly =3D false; =20 rsp_buffer_push(rsp, cmd[2]); @@ -251,8 +251,8 @@ static const IPMINetfn hiomap_netfn =3D { =20 void pnv_bmc_set_pnor(IPMIBmc *bmc, PnvPnor *pnor) { + uint32_t pnor_addr =3D pnor->lpc_address; uint32_t pnor_size =3D pnor->size; - uint32_t pnor_addr =3D PNOR_SPI_OFFSET; =20 if (!pnv_bmc_is_simulator(bmc)) { return; diff --git a/hw/ppc/pnv_pnor.c b/hw/ppc/pnv_pnor.c index 863e2e70ac..9db44ca21d 100644 --- a/hw/ppc/pnv_pnor.c +++ b/hw/ppc/pnv_pnor.c @@ -108,6 +108,8 @@ static void pnv_pnor_realize(DeviceState *dev, Error **= errp) memset(s->storage, 0xFF, s->size); } =20 + s->lpc_address =3D PNOR_SPI_OFFSET; + memory_region_init_io(&s->mmio, OBJECT(s), &pnv_pnor_ops, s, TYPE_PNV_PNOR, s->size); } diff --git a/include/hw/ppc/pnv_pnor.h b/include/hw/ppc/pnv_pnor.h index 19c2d642e8..b44cafe918 100644 --- a/include/hw/ppc/pnv_pnor.h +++ b/include/hw/ppc/pnv_pnor.h @@ -28,6 +28,7 @@ struct PnvPnor { BlockBackend *blk; =20 uint8_t *storage; + uint32_t lpc_address; /* Offset within LPC FW space */ int64_t size; MemoryRegion mmio; }; --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538417; cv=none; d=zohomail.com; s=zohoarc; b=i4u8PVX4E2rNSuwhMtejKhjVnDSTQVLxycpeElwDiryKV5tdpJQ850zdx2gFrsHwTi5LTSXYaCWTGq2Gmxy6netgD3sNxfbpWCYpBXxj2Im4qI31ec6/pKFMta8ZXIz2tLDkugOGt64d/ws/hJpPwa/qoe5MlJ/itX+rv190msY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538417; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=s9DMWwN++nDn/z8w6/tFVpHD3yh9Owg5T27xYWy3gZI=; b=hy0q25V4cQXp9/v/IKCr8Ngd377fHSxhfMhMVrdfTzj+6SHx34H7eWxmkHAyxG5NdLxp/xRGz8ulqkjgkoXv1ScOivfDvaPuDZFmkgd29X29C4/yPMmo14c5+g/fhaNHJ4b+/fIhNKMzVDSMIdKSiIdDYf1oFs6EztowD8k4DTU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538417155171.28701924639222; Thu, 20 Mar 2025 23:26:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVpr-0000m3-5p; Fri, 21 Mar 2025 02:26:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoN-00082H-L5; Fri, 21 Mar 2025 02:25:04 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoJ-00031e-02; Fri, 21 Mar 2025 02:24:53 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-225fbdfc17dso26000935ad.3; Thu, 20 Mar 2025 23:24:50 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538289; x=1743143089; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s9DMWwN++nDn/z8w6/tFVpHD3yh9Owg5T27xYWy3gZI=; b=RmrsANBzHFtxbncn2Q9awNREieq/ZGvIp+jY+DxJY5vIz1UKcQtmA0o5wI+dcwm40I 0UK4uGXu4CKYteEj26KX9Zo8ryC6J0mwRHHevKqEo0VFrCJ2MnkfW2G08y8R3wTHXQvz BA5yPAmJbkKEXxEXFEUZUIaaCOw4dKmXdq5pv7euo4lhD06KXW0AeMuZtdX0Fm6Ksf3N D1uUsC9hKdTLXolwaqN5YyRnRyjeU3f4L+dMUZzz3dnUZNghUD8+kI4ZWoVLpEaRWSKi JMJb5atm74w1f4u0s9B/Kjg5tKa0I7r5RhctBjrzSjx+lE9Y/Nj2BioUcHNCbSTLGjpE cc8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538289; x=1743143089; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s9DMWwN++nDn/z8w6/tFVpHD3yh9Owg5T27xYWy3gZI=; b=Pem8wL455BDzVRx482n2ugseSrTTC5jVhSspH8nMUWglPGjJ0KJ0enVm1CZdbivMFe I1Q7IkzjhPk4a34jLtBFMmZs7YbSx+E88D+1vWYAp6bxJJXcQHff1jAuxaVPty+rmZVR X7UvP97W8BTmajL7f05T7jx0LRh7sLqjsdCqgDMIlQezdOYfACz/UjxW0ir1sGxKH0GZ 4l6onHU1D5I5UYoImK7vGZvchpxQI+y1liUSKl2wAn9HzRI2+xN/8PTsopNjtgzaqnyH CEyJ5gttC5pfViGmNnzHyV15Y0/VtJdK2ps7v6+Clq/mMqzLHo21cC0E9x+JhpOf62VA GJMg== X-Forwarded-Encrypted: i=1; AJvYcCW6jr1tFyq7QfQukM44RphliZa5Ewqjvw6Zy7L6sLVHls74BT6eeSMNOojf4S7GwIZlemU4NJNnew==@nongnu.org X-Gm-Message-State: AOJu0YxAumF00GOqEoZg8PS7rBzs0E8EkLoT0VLImkMeKmQ9gHofeJQ5 +SFLFA3UOxaBf+ldGJcLTTTWbBbP4VoLuanyL7PFfuOCUkKPZ/Ejezj2Dg== X-Gm-Gg: ASbGncsQPVc4xNyJUHeAPpiA+DFVPkwRpba11LDQNt0ED99loDeT91cP+EIniPtFZ0J j3npCzAK7XSi8axUU/64V1rKct/5VM+ciAKrFkDX0r09VK2bCe0NjVhf0kBG6gH2Ow/zdQDdpEX ceHXIuJ77du/LjseacTZSniyrhYTgf5UEUJ0qjTkXtrmBhC8hTuiktSrO+3JSaVDCVVvaPpm8HJ +2e3/NEd5L7l9j/JJNTdviMP8TGgYCrzj7swfV7+UQ42Fxs0zn1nPwRGTpgu6jkZ+5LIF/zm+Ud TTPmQl+0o0TB7mhz7U8UySQ7O+PJe/FYEsEsNtH+RJOjskImYg== X-Google-Smtp-Source: AGHT+IGJ8nABmj58AOFOOSgxZHDCEiNecGwSBxT7AKzK+VA1UUy+uMmYYY8jRECL0l76s2/IBT8w7w== X-Received: by 2002:a05:6a20:7347:b0:1ee:e2ac:5159 with SMTP id adf61e73a8af0-1fe42f53152mr3551858637.19.1742538289011; Thu, 20 Mar 2025 23:24:49 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Stefan Hajnoczi" , Thomas Huth Subject: [PULL 07/12] ppc/pnv: Fix system symbols in HOMER structure definitions Date: Fri, 21 Mar 2025 16:24:11 +1000 Message-ID: <20250321062421.116129-8-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::62c; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62c.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538419941019100 These definitions were taken from skiboot firmware. I naively thought it would be nicer to keep the code similar by using the preprocessor, but it was pointed out that system headers might still use those symbols and cause something unexpected. Also just nicer to keep the QEMU tree clean. Cc: "Philippe Mathieu-Daud=C3=A9" Cc: "Stefan Hajnoczi" Reviewed-by: Thomas Huth Fixes: 70bc5c2498f46 ("ppc/pnv: Make HOMER memory a RAM region") Signed-off-by: Nicholas Piggin --- hw/ppc/pnv_occ.c | 201 ++++++++++++++++++++++------------------------- 1 file changed, 96 insertions(+), 105 deletions(-) diff --git a/hw/ppc/pnv_occ.c b/hw/ppc/pnv_occ.c index bda6b23ad3..177c5e514b 100644 --- a/hw/ppc/pnv_occ.c +++ b/hw/ppc/pnv_occ.c @@ -364,7 +364,12 @@ static void pnv_occ_register_types(void) =20 type_init(pnv_occ_register_types); =20 -/* From skiboot/hw/occ.c with tab to space conversion */ +/* + * From skiboot/hw/occ.c with following changes: + * - tab to space conversion + * - Type conversions u8->uint8_t s8->int8_t __be16->uint16_t etc + * - __packed -> QEMU_PACKED + */ /* OCC Communication Area for PStates */ =20 #define OPAL_DYNAMIC_DATA_OFFSET 0x0B80 @@ -384,20 +389,6 @@ type_init(pnv_occ_register_types); #define FREQ_MAX_IN_DOMAIN 0 #define FREQ_MOST_RECENTLY_SET 1 =20 -#define u8 uint8_t -#define s8 int8_t -#define u16 uint16_t -#define s16 int16_t -#define u32 uint32_t -#define s32 int32_t -#define u64 uint64_t -#define s64 int64_t -#define __be16 uint16_t -#define __be32 uint32_t -#ifndef __packed -#define __packed QEMU_PACKED -#endif /* !__packed */ - /** * OCC-OPAL Shared Memory Region * @@ -434,69 +425,69 @@ type_init(pnv_occ_register_types); * @spare/reserved/pad: Unused data */ struct occ_pstate_table { - u8 valid; - u8 version; - union __packed { - struct __packed { /* Version 0x01 and 0x02 */ - u8 throttle; - s8 pstate_min; - s8 pstate_nom; - s8 pstate_turbo; - s8 pstate_ultra_turbo; - u8 spare; - u64 reserved; - struct __packed { - s8 id; - u8 flags; - u8 vdd; - u8 vcs; - __be32 freq_khz; + uint8_t valid; + uint8_t version; + union QEMU_PACKED { + struct QEMU_PACKED { /* Version 0x01 and 0x02 */ + uint8_t throttle; + int8_t pstate_min; + int8_t pstate_nom; + int8_t pstate_turbo; + int8_t pstate_ultra_turbo; + uint8_t spare; + uint64_t reserved; + struct QEMU_PACKED { + int8_t id; + uint8_t flags; + uint8_t vdd; + uint8_t vcs; + uint32_t freq_khz; } pstates[MAX_PSTATES]; - s8 core_max[MAX_P8_CORES]; - u8 pad[100]; + int8_t core_max[MAX_P8_CORES]; + uint8_t pad[100]; } v2; - struct __packed { /* Version 0x90 */ - u8 occ_role; - u8 pstate_min; - u8 pstate_nom; - u8 pstate_turbo; - u8 pstate_ultra_turbo; - u8 spare; - u64 reserved1; - u64 reserved2; - struct __packed { - u8 id; - u8 flags; - u16 reserved; - __be32 freq_khz; + struct QEMU_PACKED { /* Version 0x90 */ + uint8_t occ_role; + uint8_t pstate_min; + uint8_t pstate_nom; + uint8_t pstate_turbo; + uint8_t pstate_ultra_turbo; + uint8_t spare; + uint64_t reserved1; + uint64_t reserved2; + struct QEMU_PACKED { + uint8_t id; + uint8_t flags; + uint16_t reserved; + uint32_t freq_khz; } pstates[MAX_PSTATES]; - u8 core_max[MAX_P9_CORES]; - u8 pad[56]; + uint8_t core_max[MAX_P9_CORES]; + uint8_t pad[56]; } v9; - struct __packed { /* Version 0xA0 */ - u8 occ_role; - u8 pstate_min; - u8 pstate_fixed_freq; - u8 pstate_base; - u8 pstate_ultra_turbo; - u8 pstate_fmax; - u8 minor; - u8 pstate_bottom_throttle; - u8 spare; - u8 spare1; - u32 reserved_32; - u64 reserved_64; - struct __packed { - u8 id; - u8 valid; - u16 reserved; - __be32 freq_khz; + struct QEMU_PACKED { /* Version 0xA0 */ + uint8_t occ_role; + uint8_t pstate_min; + uint8_t pstate_fixed_freq; + uint8_t pstate_base; + uint8_t pstate_ultra_turbo; + uint8_t pstate_fmax; + uint8_t minor; + uint8_t pstate_bottom_throttle; + uint8_t spare; + uint8_t spare1; + uint32_t reserved_32; + uint64_t reserved_64; + struct QEMU_PACKED { + uint8_t id; + uint8_t valid; + uint16_t reserved; + uint32_t freq_khz; } pstates[MAX_PSTATES]; - u8 core_max[MAX_P10_CORES]; - u8 pad[48]; + uint8_t core_max[MAX_P10_CORES]; + uint8_t pad[48]; } v10; }; -} __packed; +} QEMU_PACKED; =20 /** * OPAL-OCC Command Response Interface @@ -531,13 +522,13 @@ struct occ_pstate_table { * @spare: Unused byte */ struct opal_command_buffer { - u8 flag; - u8 request_id; - u8 cmd; - u8 spare; - __be16 data_size; - u8 data[MAX_OPAL_CMD_DATA_LENGTH]; -} __packed; + uint8_t flag; + uint8_t request_id; + uint8_t cmd; + uint8_t spare; + uint16_t data_size; + uint8_t data[MAX_OPAL_CMD_DATA_LENGTH]; +} QEMU_PACKED; =20 /** * OPAL-OCC Response Buffer @@ -571,13 +562,13 @@ struct opal_command_buffer { * @data: Response specific data */ struct occ_response_buffer { - u8 flag; - u8 request_id; - u8 cmd; - u8 status; - __be16 data_size; - u8 data[MAX_OCC_RSP_DATA_LENGTH]; -} __packed; + uint8_t flag; + uint8_t request_id; + uint8_t cmd; + uint8_t status; + uint16_t data_size; + uint8_t data[MAX_OCC_RSP_DATA_LENGTH]; +} QEMU_PACKED; =20 /** * OCC-OPAL Shared Memory Interface Dynamic Data Vx90 @@ -608,31 +599,31 @@ struct occ_response_buffer { * @rsp: OCC Response Buffer */ struct occ_dynamic_data { - u8 occ_state; - u8 major_version; - u8 minor_version; - u8 gpus_present; - union __packed { - struct __packed { /* Version 0x90 */ - u8 spare1; + uint8_t occ_state; + uint8_t major_version; + uint8_t minor_version; + uint8_t gpus_present; + union QEMU_PACKED { + struct QEMU_PACKED { /* Version 0x90 */ + uint8_t spare1; } v9; - struct __packed { /* Version 0xA0 */ - u8 wof_enabled; + struct QEMU_PACKED { /* Version 0xA0 */ + uint8_t wof_enabled; } v10; }; - u8 cpu_throttle; - u8 mem_throttle; - u8 quick_pwr_drop; - u8 pwr_shifting_ratio; - u8 pwr_cap_type; - __be16 hard_min_pwr_cap; - __be16 max_pwr_cap; - __be16 cur_pwr_cap; - __be16 soft_min_pwr_cap; - u8 pad[110]; + uint8_t cpu_throttle; + uint8_t mem_throttle; + uint8_t quick_pwr_drop; + uint8_t pwr_shifting_ratio; + uint8_t pwr_cap_type; + uint16_t hard_min_pwr_cap; + uint16_t max_pwr_cap; + uint16_t cur_pwr_cap; + uint16_t soft_min_pwr_cap; + uint8_t pad[110]; struct opal_command_buffer cmd; struct occ_response_buffer rsp; -} __packed; +} QEMU_PACKED; =20 enum occ_response_status { OCC_RSP_SUCCESS =3D 0x00, --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538538; cv=none; d=zohomail.com; s=zohoarc; b=XxO3BqQqsvNrBLkgArmQueovNemU/aeTrlv4Q49lXo5/Hv3cqXlB4TtchsnoZznRACWC4GM4hdzgebJkzn5ACqp3ClIu48FPd2Lbsb1rSUTFxWhtupnkdwiKgMZ7tw6XN7eGGB5INMoZDNytJjUcaLS5x6SUY4702ycS8NTK4fo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538538; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tEL/F7R455u00adVFhFI6UsyhKk0acwI0gMRQ2k9pMY=; b=IkR39GUEDVjfLd9Xhwv07HWE+X+oS9ic2N4ayyKZlT0lLI21owgRFkhSKY8VTB+jjqpqFF6jt4NuGuYg40k94yboxwKGBT6kTOI7WSmaRNtnjrxhtcqKKhCYU5/TUQUrhOfzDTazR3q6sDuHK84ZDh1uVs/07sH57VlS7a5tDuQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538538375265.7087821361166; Thu, 20 Mar 2025 23:28:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVr8-0003II-4v; Fri, 21 Mar 2025 02:27:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoU-0008D5-Ui; Fri, 21 Mar 2025 02:25:06 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoN-000325-OE; Fri, 21 Mar 2025 02:24:57 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-224100e9a5cso30596635ad.2; Thu, 20 Mar 2025 23:24:53 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538292; x=1743143092; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tEL/F7R455u00adVFhFI6UsyhKk0acwI0gMRQ2k9pMY=; b=KTiNX0xVbRU7YxzOjb+UP5C4Q4g+c2F/QFzW9sUmIlmO5f7R3BHlbjIBX1ywLOKkk/ bHhuqNbc9WbqKFzFFFrv41gvVpL94eeKX7glJhc/wdEyOoPIm1r5RFR00yKmcJNlXlnQ J1Bv5W36xm/48SVspjDfly03hwWoaLZ6iNbchyyrGq1X8duCAWQ6D6GX7Qt3GeoYVDFk 2USai7ls4/XfMyqHORcneSHOkS6v/HdKqpM6fmGjnzVcGdqsf3i2CWXwt/QQaHSoEKUV K2WApeh/lPj4fyimLj1Msk7UTWgqhcl1VpY8g4uGIsTqX3sU8vpsUCJ5ZKp3IrFRbv89 peXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538292; x=1743143092; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tEL/F7R455u00adVFhFI6UsyhKk0acwI0gMRQ2k9pMY=; b=d+rgI2qBtNwMbwSekGPDcw7V+7FFJA7wiQcG7eDse1zfRqSzKFUvj3v1RMxJcJvxRm enyEjo7XkvAMnQPEyLbA9oNZb9MYkC546+abCYHpT7B9H/V0QEYi4HCG24d4MrVvlxzd xH8aJcCRcW72RCam0nfWfnajhEtqhmXOdf+OHPjVZApmCgWlMPHLPfL5DKE0hyCu40PC YLDuUQUiL4yTXhLz76v6gi97KhamKzOYhrYIF2uLej8b7SlzSIgQ1qqmwylRwTLt94ef rXAM7cFwxA2esC1qntA1MwHOKLaBUs5QADWX8tBrZsxyJYqDta9NIBidDNAcRYVzd3Xl YmLw== X-Forwarded-Encrypted: i=1; AJvYcCVhXUDDEJLCtxwUM83VZcwFmVOAAx0Z2NxpNVjiIhSpCY7um7pVNKzB7RSO3Uv1ALnbdKcO1APdlw==@nongnu.org X-Gm-Message-State: AOJu0YwmBJrmTvPodkMB3WHVpYes9LTo3h8xvgbLHt1xkFKGr4FfsEl5 0V06I7Unofk/O77MMWIm82a6KlLxWl3cHOoITWh/BOJ1H27KrAVqikIHpw== X-Gm-Gg: ASbGnctaBPxOZxEzX8A/P3JzRR66TjdwWUMi6BjF5UJjzfDUFQiPFvfE6Z7WFsRR8+N 3a1YUVud02mHjPgYnhvSyznLMB+6uJ6pKMceD93cjXXX4hMaZe25lylEoAwZsZ2HCDknbj20uwh T2McOY7mzi7/jcGqkDuLReTi/bGlb6CpZRHQeFi5TJbGYoIg15pL9w5HyzCO+ojSyfAq6Z4CKbK stIHRNp6rMyGlppSUBThaWQccrIgBcT9d6OfsRvWnPY8/zNtGkoPCDftas+q5EWhCmXzrFsgDAc zS3ji4zKKvCGqX/WMJ/Itm5evKGe4I0DU0rbMN+ecxb+i08K/g== X-Google-Smtp-Source: AGHT+IHHS5uWJZUEiUIitUEsV9d7FN+nW+c8WQ9i0lPXIKIA1w77HQqHU30Qw209Y0xUCZtwKVL/rQ== X-Received: by 2002:a05:6a20:431c:b0:1f5:81bc:c72e with SMTP id adf61e73a8af0-1fe4300ff4fmr3546559637.33.1742538291680; Thu, 20 Mar 2025 23:24:51 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, BALATON Zoltan Subject: [PULL 08/12] ppc/amigaone: Check blk_pwrite return value Date: Fri, 21 Mar 2025 16:24:12 +1000 Message-ID: <20250321062421.116129-9-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::634; envelope-from=npiggin@gmail.com; helo=mail-pl1-x634.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538540336019100 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Coverity reported that return value of blk_pwrite() maybe should not be ignored. We can't do much if this happens other than report an error but let's do that to silence this report. Resolves: Coverity CID 1593725 Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin Message-ID: <20250314200140.2DBE74E6069@zero.eik.bme.hu> Signed-off-by: Nicholas Piggin --- hw/ppc/amigaone.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c index 483512125f..5d787c3059 100644 --- a/hw/ppc/amigaone.c +++ b/hw/ppc/amigaone.c @@ -108,8 +108,8 @@ static void nvram_write(void *opaque, hwaddr addr, uint= 64_t val, uint8_t *p =3D memory_region_get_ram_ptr(&s->mr); =20 p[addr] =3D val; - if (s->blk) { - blk_pwrite(s->blk, addr, 1, &val, 0); + if (s->blk && blk_pwrite(s->blk, addr, 1, &val, 0) < 0) { + error_report("%s: could not write %s", __func__, blk_name(s->blk)); } } =20 @@ -151,15 +151,17 @@ static void nvram_realize(DeviceState *dev, Error **e= rrp) *c =3D cpu_to_be32(CRC32_DEFAULT_ENV); /* Also copies terminating \0 as env is terminated by \0\0 */ memcpy(p + 4, default_env, sizeof(default_env)); - if (s->blk) { - blk_pwrite(s->blk, 0, sizeof(crc) + sizeof(default_env), p, 0); + if (s->blk && + blk_pwrite(s->blk, 0, sizeof(crc) + sizeof(default_env), p, 0)= < 0 + ) { + error_report("%s: could not write %s", __func__, blk_name(s->b= lk)); } return; } if (*c =3D=3D 0) { *c =3D cpu_to_be32(crc32(0, p + 4, NVRAM_SIZE - 4)); - if (s->blk) { - blk_pwrite(s->blk, 0, 4, p, 0); + if (s->blk && blk_pwrite(s->blk, 0, 4, p, 0) < 0) { + error_report("%s: could not write %s", __func__, blk_name(s->b= lk)); } } if (be32_to_cpu(*c) !=3D crc) { --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538461; cv=none; d=zohomail.com; s=zohoarc; b=OgnMWZ5oyBIl5+3nNQalgjKYo6+zogCvPCgYsTFWWKN6PBQtwR3s7shqwKk8xQLJCQJW6tmQ9FW2R+3V23notyARR5EZzFqB2tYhgDSmFpyca6cYvMpV6Sw/CyeifEELDE5L6RWTWd7e6dzuLJTZo62go/T6M/6jiXVsywbRcbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538461; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UI94a7Hw91whhjlIDY7N1S0ogpBosIVfhZhQbQGDvvE=; b=Oa9XcVbGox1Pxjrg3OT5AuRa1ZIOm6rYwDM9fGP9W7NtumKNnQ2qicDNkQwpm39fpwsWuMon0G/sbNnWl56Uv/oQmPZAV2v7l0OPaMJm3BFjLkmpiENwTpHdFR4Ps8Qyz6bwpPWfOmjaPo5p5hI/8qjeKu9dWUEuNioDJTOwWmk= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538461885496.27890531516107; Thu, 20 Mar 2025 23:27:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVpz-0001HR-A3; Fri, 21 Mar 2025 02:26:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoY-0008Dr-Ha; Fri, 21 Mar 2025 02:25:11 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoS-00032e-Pn; Fri, 21 Mar 2025 02:25:05 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-2240b4de12bso43014725ad.2; Thu, 20 Mar 2025 23:24:56 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538295; x=1743143095; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UI94a7Hw91whhjlIDY7N1S0ogpBosIVfhZhQbQGDvvE=; b=fQs0qkF0grf9EMVDffYpEU4cDMaie6lue/15Tqh8TugLVTI+gkB3e+4uIe7Zslf4L3 OkpNQgJYnZCM8fLLfc3u2x6AyvLO3YMqAKcC6vN4mR4XN152dw2keRGIeqCtz1bYofwr EUUMrJ5+tnbPBt6h1qd3sv9VB1tG7gknaPF4JbvjzNhETmVtKcUTwKRTHlqpT+KI1l9q Yxs540FZF6bYRsQC/MWNyJR6T5CUvL2oX10LfmQW8FgmOannjirW9DvHME+UUHTG81R4 1dBmGF35kZGRN+c0OD58U5Pxc7OCrvWHKS+lz9j/hAkb4TFu0ERRPiODCMvF5O6t9eXG SC0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538295; x=1743143095; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UI94a7Hw91whhjlIDY7N1S0ogpBosIVfhZhQbQGDvvE=; b=SpOzqVjtyOPFm/IFDkhn7PVQfLk8bD9NsUkOMlZQHXAyF5O+lDIpOghidMCL0EbJG0 WBY9w9Xj0hxjXosRYHZ0aFt6fkpyZfv4KNAKE49yNVSw6OdMRLhNgZHfPwmvdwGN11aS llUCqj/SCA8WvuVB0Gk6xnREJQTLrl3gdvFXDmiKmM64scgQW0WOYAigM3+AJ3ZmMhFt ZH/coo4JEZX9WRnMoMVw5q37nsX3IOL4IciZxT5B5lrpWR/GpO1b5pLgA+cvXvrMiAOD p/coa78OGXGAd7/RQdHQv1Eh72pDd6ln/3KQg7qlj/wtAKjfCMmAKYxTPhUrmsMfi3lw jJzw== X-Forwarded-Encrypted: i=1; AJvYcCX/SCC7zvGoTlqPnCOz2n6dtNW3FvtZmC7C/Nk5+wTjeujtECfuZu6RCqS9VBPUMJeY5E/Ttq9F+w==@nongnu.org X-Gm-Message-State: AOJu0Yw20Oa37b/N47YoBAQKHjeAY7zSb/dXGe9im3w+8QTONytQ/ZuL w3sVOeJ1s4Kduk7M56NKPmnAJPmXpHaUHpeZ9Sw/UWjEQjFgI3LCuFC1zQ== X-Gm-Gg: ASbGncshaeG+6hjRpxifNi0I24sCrXeopwPtWGldxKTdnuUmrhTU2P2p9RBDJMv/w92 Za2nxPQKtHEUnm0SakBaxl3eOQLlALytCaJzo3SYZyZLLiMJ6yxnCkaX50j4nacKUL9dN68BNAb O+E5f3k1vXhEo3vg2EFOALDoXAknVyfSt8RqDxV8jFDLwvH+0r2IoSPsw3RrUXI+jJp6DvdJoJg gsoABjx3/V1LBAD45C7mp9HXiCAULjQ687rfEqKspOkkxCe3cac3H7ynOGx4BUcIn4RIALUhUE5 0T+DDzi5i/D72BVb4vSAJfr7XSlizr962F3C4InxG5aXZOE0hw== X-Google-Smtp-Source: AGHT+IHchM7hVeW3NoHawa4F8N20+QV0J2N/cppA+T+l0672m/ck1m4M4Y8Yfta1LyitDdJBF1PNaQ== X-Received: by 2002:a05:6a00:240a:b0:735:d89c:4b8e with SMTP id d2e1a72fcca58-7390593b951mr3120789b3a.5.1742538295049; Thu, 20 Mar 2025 23:24:55 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 09/12] ppc/amigaone: Constify default_env Date: Fri, 21 Mar 2025 16:24:13 +1000 Message-ID: <20250321062421.116129-10-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::62b; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62b.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538464063019100 From: BALATON Zoltan The variable holding default env is not supposed to be written. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20250314200145.08E0F4E6067@zero.eik.bme.hu> Signed-off-by: Nicholas Piggin --- hw/ppc/amigaone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c index 5d787c3059..e9407a51b5 100644 --- a/hw/ppc/amigaone.c +++ b/hw/ppc/amigaone.c @@ -63,7 +63,7 @@ static const char dummy_fw[] =3D { #define NVRAM_ADDR 0xfd0e0000 #define NVRAM_SIZE (4 * KiB) =20 -static char default_env[] =3D +static const char default_env[] =3D "baudrate=3D115200\0" "stdout=3Dvga\0" "stdin=3Dps2kbd\0" --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538630; cv=none; d=zohomail.com; s=zohoarc; b=di+AunOM/opEZPgGH3XqSxBsiVdRUWtbJ8HbSASAJO5gXqXcfaHBcs75kIC5gFGnG1nncHtCJMjKvLg8ios+dunx4vsVV3bW9KaovYo0hJ7BBmzZn7yrLznPNM+d7MKpEfHN1NPtSyFPYLVozGGiEQ4va+xuRq0diCJuCs+E+yk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538630; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IQz0IzfTSBf1SfVI6stCuKzL/l4PXUG7VWLq5owfvNU=; b=lSCTULFo2SYWow5ZDBqFvjiDjvK3fDTF7FP2ahNlPiyS9CWszJg9DrY9KOUNrZUz716A6Y4KCo08qpEs8a0nnD5fISkvz7ngCFIzPF/HMDw/BzaiJJwp7HxntEVDoOZU/+xbbY6Jf5pA8jU/eEi68DZCMff+1cIkl52SMfOLEnU= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538630738983.3703517688858; Thu, 20 Mar 2025 23:30:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVr2-0002d2-FB; Fri, 21 Mar 2025 02:27:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoq-0008Uu-Rl; Fri, 21 Mar 2025 02:25:28 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoZ-00033Q-5y; Fri, 21 Mar 2025 02:25:10 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-225d66a4839so43025535ad.1; Thu, 20 Mar 2025 23:25:00 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:24:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538299; x=1743143099; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IQz0IzfTSBf1SfVI6stCuKzL/l4PXUG7VWLq5owfvNU=; b=BxghPGQSeskOj1I8Ua/arAYSKgR4cGF66kfmE9QhA0sr0w7PKYBV6yMbt+BqFgof56 ZdZfabVqZvPisDwwTnS0useZJBSV2zgS8pKmCaw5ZqqH0zBuv/XBxr2Krs5xSFbZ0bhr gBmdP+GMrgUHZQwBwCLsorDKWSBfZ0/ordcSx67Twpm5xSKnD67S2TnOdIJb9rTDmN/+ +Blj/1v/x6gsd5xBkakuIj6mIULA0l1nELlCRuXVhYcaUMWo4+AdytSEd5MZwjxEgqMU xq40g7SQJjK+Tp1eM8HrvsSB1/5ddVLsniTOQlAGR+7H56+oQGMP0v3XeYBbOwjICEE/ PVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538299; x=1743143099; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IQz0IzfTSBf1SfVI6stCuKzL/l4PXUG7VWLq5owfvNU=; b=lUPWl4OaeqE0XQ0gr8tOet+8lw9xEzdzaGFpqYVwCig8Gs2tZbanbSRA2Sbmx7rTAP htivIUdaaWB9KqreKNkmEeiO5C3Eg7o1BbyOp25Ajiep1nbwjoG5DQGNT2h3TXIauv/3 nqXl/azEu7qPVtRvhzh5/+VTRIGOCjjtrwAVCDb8gJCGxznKOtbMUHEwJfHCaHnt9Zvq JVIqD4TYXiyQtnN/tYmkr8r6BWRL7sdiyb32IChQrRQH60s0+GJTgl0tM2kVWdan2Y7A 7GHMvNKrRr81ZWTcmJ8HWu4bLscQLGxeiUOM7AgCs1hL0vIWSpzThPojTUgmik5ewru7 ZXBg== X-Forwarded-Encrypted: i=1; AJvYcCWF+GUMqiSBVxES6w9dg/mDYaFMJywzJ7Cmr5xB29cgZz+vIK/67RhEjdVUeZY8tTJ7BiTAvdhWw43EmhM=@nongnu.org, AJvYcCWvwPmCQy47mQXz+JFPLuhsCQaqC4w8gFCpSK2KDstfmWwZAXdfxXjqpOC6W8X4cGE0ZZbasIbgxw==@nongnu.org X-Gm-Message-State: AOJu0YzlpkHO6Df/bXoE5tUxQ99mGckO78awOVFKcAJuZ0AzbJMqK8tB /0yat+gpKyP7uoFNaRN6tC2x1Mw2ACWK8Nny2NEI4f3Zvv3YPMEt8MAIEQ== X-Gm-Gg: ASbGncsGBActnLqnTKRN//AFlz1y9WCXQ56We7vZjU6MbXo0TjXgTSLH6ClrDw5LlFh UVZOkNBiBS2hNpCgnzkHrWU87drwzSFoMW/vjAd+NnE2g5auSCs3ePNrL45hFOqeDrTnT6PTd2X VDKZ/dQ9K9lcUq1RrfowLRYvLrJTK7Hf7r1OIro1b9ZxKsZ5H5J1C+fP3OOPDvEBLdC0kVKayLF egHkZN29rE7eXVjsCZ2gYrDBO0OidW3payf0IGGjPtb0SwIALzDhlL1fmujgrv5FqgsX/sWs7rV OpxVoBa9laR1UkFgRHPt9dMyRwUoyVsAcMKoae1AuSBzdCXdyg== X-Google-Smtp-Source: AGHT+IFBKszsiRLcCSTKnAe2L0Ejmbm9N2O2N/APTy53HBC3EIuf0PeIFteHj7DFu1OHKJM7tNEpBQ== X-Received: by 2002:a05:6a20:c886:b0:1db:822f:36d8 with SMTP id adf61e73a8af0-1fe42770d03mr4292260637.3.1742538298915; Thu, 20 Mar 2025 23:24:58 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Harsh Prateek Bora , qemu-stable@nongnu.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/12] ppc/spapr: fix default cpu for pre-9.0 machines. Date: Fri, 21 Mar 2025 16:24:14 +1000 Message-ID: <20250321062421.116129-11-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::630; envelope-from=npiggin@gmail.com; helo=mail-pl1-x630.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538631116019000 From: Harsh Prateek Bora When POWER10 CPU was made as default, we missed keeping POWER9 as default for older pseries releases (pre-9.0) at that time. This caused breakge in default cpu evaluation for older pseries machines and hence this fix. Fixes: 51113013f3 ("ppc/spapr: change pseries machine default to POWER10 CP= U") Cc: qemu-stable@nongnu.org Signed-off-by: Harsh Prateek Bora Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20250313094705.2361997-1-harshpb@linux.ibm.com> Signed-off-by: Nicholas Piggin --- hw/ppc/spapr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9865d7147f..b0a0f8c689 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4816,6 +4816,7 @@ static void spapr_machine_8_2_class_options(MachineCl= ass *mc) { spapr_machine_9_0_class_options(mc); compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len); + mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("power9_v2.2"); } =20 DEFINE_SPAPR_MACHINE(8, 2); --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538584; cv=none; d=zohomail.com; s=zohoarc; b=DKs3JHg7fbhuQTg/0yRLcJZwyeEmBprhYFpMG1vD8FZIL8sTqisniVdBbMjkh8g3ljSM4ydWbp+f7N9T3tjKzQIN9NVxwV5R5Q2g2n9G+2ygnypuYiSGbQD0xLVDuyliUsOkrnUuYhxPmr59KCe3dzmeUV2QuuJz2JeABWtfo/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538584; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e7DqV4tV/voUsRe6QWgdTDXfFT62jTytrnlFn7HzaIs=; b=KxyPcer+GJFGbLjW/T9Z1hRJu0hOK9VdhL6dJ8xH8bFoPzUeSvJE2TX3pU/2fzS7JCXKec3z2f7xBcnntZrfc6g0Yt6sBykLHSXF1N+urCFnLpdo4QeqBtRFj/1Nnvrc50yBbK3ZGTGTOOtzUN4vf2v0Zr5TrgIU2s5+syuJMSY= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538584113981.931134721918; Thu, 20 Mar 2025 23:29:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVrH-0003R6-Ch; Fri, 21 Mar 2025 02:27:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVoq-0008Us-QM; Fri, 21 Mar 2025 02:25:28 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVoZ-000345-38; Fri, 21 Mar 2025 02:25:11 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-22580c9ee0aso32598455ad.2; Thu, 20 Mar 2025 23:25:03 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538302; x=1743143102; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e7DqV4tV/voUsRe6QWgdTDXfFT62jTytrnlFn7HzaIs=; b=C8y2CpyjqBCc1vvuKFXBsFD/PJ5ycJXIQ+Jvd2ED9VVM2h9KFphuQnplj+/ref+NyH Q2jTOc8f6PxeAswIsnhE8kFn0wUONOH+vvl23n41EZk8SCKhwMNYNRYvoxz+oWIVIdF3 qGSgHW6N4DZ3I7BZS1IQoxQqQshVfUOMZriQkSkcq7lxtX8lGLpsrqapufZuPj79w+xD vcRYozV2/fZ7vCtEi4Z4+2bY1CEk4hCTyPDk6/91CN/MdLxxZGt9xBm8Udoh7s35wonr 3wXQ1zhR0UW8rU5F8hpOvZ73C5KrDBIDjQJNs90ObBSA14juPuEgzfPYJvbUq0Cyi9je Z6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538302; x=1743143102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e7DqV4tV/voUsRe6QWgdTDXfFT62jTytrnlFn7HzaIs=; b=wVWId6bao/ESWGD7R/flz0qTOnZvi8qvfsi7r5UGWCqJQbi/g9w69wDtGSetoT70Zp zqXp+5FGDZWlSi1bN/TMHQtJ4hI1MdVIRRa/CshFp2Io9y1VbUgGWckGV09msmvtgj43 mQh+MMMxUdDn8MtFdlY9upWnz4Bd8ZjI7gLbnkwBUrQIgLg4KztSK4nfxsEe9Db+4Y4+ sHiM/3/8qCwe700dM52p9hIQXVrR3ETO3StbVRuJB0Cr/Ur/rjS+Kvtw08ycmZH5cvt6 XxKTe3ay6z1pokHZVFI+7X7yaUKXB2qlpLpbtZqXDGuFxMcTsypYnYBx3gkMgIGMcjZU /1SQ== X-Forwarded-Encrypted: i=1; AJvYcCVwHpwyclcV9Gy72PBu5ZM+51uewVFjsylY/aUISRUvuLIjkdEM+PMRk1bA4iDg6ZW8UnbyRqtiD/OB7Xg=@nongnu.org, AJvYcCWWnogKuNA3ZGmzmz+pfNbNGUIQcJ96s4H8IS6qKWFx1HcAuIh+np73/7fGdyu7wdI3i8nJY5z2YQ==@nongnu.org X-Gm-Message-State: AOJu0YxzZaU61zNFaL2rTI7dovVU+ET/HSWmCy8l8bZu+O8XmduMi3u5 /tpSioNpEBQPZgSd7nliAHEUc0asR4Fp2VMpzd2wY5n24+x3S07xJF1euQ== X-Gm-Gg: ASbGncuylApWYLE8VegbRsLy+mHUDFp2v5+KMfBiK4j26ZTu00cezIFMPfqg0jDBjqF V08bHcgBEoHjgqSb5CDJYcizCifIJ4ycNw9MjPqH6WXd4jyC+CL/NZrbdXIt07t15i7HVLK8Xiq l3FZ/Wr11SPPVBt9Mnz0xOAQ+L2LSIey4ywsUKT1lkBNUqiHISjQISpE+P8VfRwND7hdtEDPgc1 3/Y8GoAqW9btrLSFM9qLTCLi4p0njee60hE2MsEa9CRPGF7Dtq8HWuKnyDIomZEyDX6fP9U0gs3 H8682VK3c6WbWhvJpOUSsab5nQdoWNiBWzk/fcAsdC7wIlJC5g== X-Google-Smtp-Source: AGHT+IGdLwwP+v4bVMmXG7zn9pCGOTBGiaziUN/j24uCJ5F1LwW29b5eEDovMAIy5qpW/j/J4JJiWQ== X-Received: by 2002:a05:6a21:9214:b0:1f5:8e04:f186 with SMTP id adf61e73a8af0-1fe4347d987mr4155579637.35.1742538302414; Thu, 20 Mar 2025 23:25:02 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Chinmay Rath , qemu-stable@nongnu.org, Richard Henderson Subject: [PULL 11/12] target/ppc: Fix facility interrupt checks for VSX Date: Fri, 21 Mar 2025 16:24:15 +1000 Message-ID: <20250321062421.116129-12-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::62c; envelope-from=npiggin@gmail.com; helo=mail-pl1-x62c.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538585792019000 Content-Type: text/plain; charset="utf-8" Facility interrupt checks in general should come after the ISA version check, because the facility interrupt and facility type themselves are ISA dependent and should not appear on CPUs where the instruction does not exist at all. This resolves a QEMU crash booting NetBSD/macppc due to qemu: fatal: Raised an exception without defined vector 94 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2741 Cc: Chinmay Rath Cc: qemu-stable@nongnu.org Debugged-by: Richard Henderson Reviewed-by: Richard Henderson Fixes: aa0f34ec3fc7 ("target/ppc: implement vrlq") Fixes: 7419dc5b2b5b ("target/ppc: Move VSX vector storage access insns to d= ecodetree.") Signed-off-by: Nicholas Piggin --- target/ppc/translate/vmx-impl.c.inc | 2 +- target/ppc/translate/vsx-impl.c.inc | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/target/ppc/translate/vmx-impl.c.inc b/target/ppc/translate/vmx= -impl.c.inc index 70d0ad2e71..92d6e8c603 100644 --- a/target/ppc/translate/vmx-impl.c.inc +++ b/target/ppc/translate/vmx-impl.c.inc @@ -994,8 +994,8 @@ static bool do_vector_rotl_quad(DisasContext *ctx, arg_= VX *a, bool mask, { TCGv_i64 ah, al, vrb, n, t0, t1, zero =3D tcg_constant_i64(0); =20 - REQUIRE_VECTOR(ctx); REQUIRE_INSNS_FLAGS2(ctx, ISA310); + REQUIRE_VECTOR(ctx); =20 ah =3D tcg_temp_new_i64(); al =3D tcg_temp_new_i64(); diff --git a/target/ppc/translate/vsx-impl.c.inc b/target/ppc/translate/vsx= -impl.c.inc index a869f30e86..00ad57c628 100644 --- a/target/ppc/translate/vsx-impl.c.inc +++ b/target/ppc/translate/vsx-impl.c.inc @@ -61,8 +61,8 @@ static bool trans_LXVD2X(DisasContext *ctx, arg_LXVD2X *a) TCGv EA; TCGv_i64 t0; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, VSX); + REQUIRE_VSX(ctx); =20 t0 =3D tcg_temp_new_i64(); gen_set_access_type(ctx, ACCESS_INT); @@ -80,8 +80,8 @@ static bool trans_LXVW4X(DisasContext *ctx, arg_LXVW4X *a) TCGv EA; TCGv_i64 xth, xtl; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, VSX); + REQUIRE_VSX(ctx); =20 xth =3D tcg_temp_new_i64(); xtl =3D tcg_temp_new_i64(); @@ -113,12 +113,12 @@ static bool trans_LXVWSX(DisasContext *ctx, arg_LXVWS= X *a) TCGv EA; TCGv_i32 data; =20 + REQUIRE_INSNS_FLAGS2(ctx, ISA300); if (a->rt < 32) { REQUIRE_VSX(ctx); } else { REQUIRE_VECTOR(ctx); } - REQUIRE_INSNS_FLAGS2(ctx, ISA300); =20 gen_set_access_type(ctx, ACCESS_INT); EA =3D do_ea_calc(ctx, a->ra, cpu_gpr[a->rb]); @@ -133,8 +133,8 @@ static bool trans_LXVDSX(DisasContext *ctx, arg_LXVDSX = *a) TCGv EA; TCGv_i64 data; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, VSX); + REQUIRE_VSX(ctx); =20 gen_set_access_type(ctx, ACCESS_INT); EA =3D do_ea_calc(ctx, a->ra, cpu_gpr[a->rb]); @@ -185,8 +185,8 @@ static bool trans_LXVH8X(DisasContext *ctx, arg_LXVH8X = *a) TCGv EA; TCGv_i64 xth, xtl; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, ISA300); + REQUIRE_VSX(ctx); =20 xth =3D tcg_temp_new_i64(); xtl =3D tcg_temp_new_i64(); @@ -208,8 +208,8 @@ static bool trans_LXVB16X(DisasContext *ctx, arg_LXVB16= X *a) TCGv EA; TCGv_i128 data; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, ISA300); + REQUIRE_VSX(ctx); =20 data =3D tcg_temp_new_i128(); gen_set_access_type(ctx, ACCESS_INT); @@ -312,8 +312,8 @@ static bool trans_STXVD2X(DisasContext *ctx, arg_STXVD2= X *a) TCGv EA; TCGv_i64 t0; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, VSX); + REQUIRE_VSX(ctx); =20 t0 =3D tcg_temp_new_i64(); gen_set_access_type(ctx, ACCESS_INT); @@ -331,8 +331,8 @@ static bool trans_STXVW4X(DisasContext *ctx, arg_STXVW4= X *a) TCGv EA; TCGv_i64 xsh, xsl; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, VSX); + REQUIRE_VSX(ctx); =20 xsh =3D tcg_temp_new_i64(); xsl =3D tcg_temp_new_i64(); @@ -364,8 +364,8 @@ static bool trans_STXVH8X(DisasContext *ctx, arg_STXVH8= X *a) TCGv EA; TCGv_i64 xsh, xsl; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, ISA300); + REQUIRE_VSX(ctx); =20 xsh =3D tcg_temp_new_i64(); xsl =3D tcg_temp_new_i64(); @@ -394,8 +394,8 @@ static bool trans_STXVB16X(DisasContext *ctx, arg_STXVB= 16X *a) TCGv EA; TCGv_i128 data; =20 - REQUIRE_VSX(ctx); REQUIRE_INSNS_FLAGS2(ctx, ISA300); + REQUIRE_VSX(ctx); =20 data =3D tcg_temp_new_i128(); gen_set_access_type(ctx, ACCESS_INT); --=20 2.47.1 From nobody Tue Apr 1 07:39:06 2025 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1742538497; cv=none; d=zohomail.com; s=zohoarc; b=XyheNwvfo3VQmE3FZij8GXSkhAamOfbYm7bPD+5b+K2Y/7cqwjyQxf29EMklGh1ORJKPWFpKiVOaGnb8YTokMO4cSFLnS4UoRiNtby0vwd/UCicmWaNusNiish1qZntyOEqi0uQKDVQzyd3V3/ZlUKMIx5tqt3Fus+557BPEoIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742538497; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=24gnmUrT5i08RUn4/4zRaCLV4SSfI5SdNAnq4FqL/eQ=; b=FySPV+PzE7bVEfklLyPDxiFpXENVXvI4uYx4flFwCFeQ65rApmt0Nar3jRCXKqgCjYcQiafPdi9FRihxouGkJpDyaKO3kTp6D0MIkccoWTV9VBbnvesYgDgz3KvjMNy2NHqFrW7cdGFlQRhZZac8l8o6Dfa7eeBOfdjFZoVTuwI= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1742538497142421.4455748687026; Thu, 20 Mar 2025 23:28:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tvVrS-0003pG-Gd; Fri, 21 Mar 2025 02:28:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tvVos-0008W1-Kf; Fri, 21 Mar 2025 02:25:29 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvVob-0003GD-OP; Fri, 21 Mar 2025 02:25:25 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2243803b776so2747625ad.0; Thu, 20 Mar 2025 23:25:07 -0700 (PDT) Received: from wheely.local0.net ([118.208.135.36]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af8a2a4761fsm941381a12.65.2025.03.20.23.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 23:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742538306; x=1743143106; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=24gnmUrT5i08RUn4/4zRaCLV4SSfI5SdNAnq4FqL/eQ=; b=moTed/O+oE3pqiNy3tMzT36JQAamRraMgtQm+fDx11yzXfgrDZwRCnXoRQjcaRVaul rkCMFMvbva9uPJ2Uhg9YsKBZmSYLYemyGU3vbPh2SEjwsxkzM4gHE1JAGAxrlIQMmECK srGtOqr2+PIpG8b7MWyEml+sTXKEK2kDBtptP+X4mnbiXmqA2dCFeorKJxxi22+/3WO6 BmHD92IxluASZQdlrfspQzO7ziJO3pgu4AkSH8xtZ97JCrtYQWk4BWsuUqVfazAQ3ogu t4RBNHsc6QObDbw0QGFKfvgo7z+iqZLaO4D7KunVaiTIJTw9QdJkIx2L6UvgHA5uVI7b sqqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742538306; x=1743143106; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=24gnmUrT5i08RUn4/4zRaCLV4SSfI5SdNAnq4FqL/eQ=; b=vvC8dzQoJLnzE/Z9av4zF8A7YkCJo6KLv42N40nYseWYU6yp1Jx+iXYNldF3w2EEX9 qkbappzgEpps695Eqok4qMkPAdf5pF1o+3pEw4XFadR6IvIdfoFLCuL6nb97ejVcXKAa phbrwcDFN4HM3CjzbUn7+1gTjtiaBbRH82dksYewJSt+uSIacybev7OCgbZRxwiXtwOI QU9/WbP04t1982NoxCh/T4lpZBPAFwu7D1oBP71rqDqZ+LPQYWsU5Bai0aPPO9dEef2+ 9O6PLNJe6MS2vHMQErQhCA/SCncwZA5L3qxUed8Jf8+hBMScEllunuScbW8nTAqZTASs 8CXw== X-Forwarded-Encrypted: i=1; AJvYcCUM+CU7yV5KiK5gEdR93Mi4ThQAIuODknNuTwSM9vPmba3tdrykrJwU0yjZ9VVOHIXY1G3hahWVnKSpsVo=@nongnu.org, AJvYcCVO/P9YOGykxmkCCFXGNJIWwBlTRKpJDqgD1eUsySgRD1OGglvEmEPzBG+5Xm8RX8DZbVFCL5POTg==@nongnu.org X-Gm-Message-State: AOJu0YzLGeq+tO56QFPNCl0vaQWS2iZNN5o5kJ75F/AQXM0RW8I4fqV3 LJrPuXZBo5aATD1zcjn/8/VZkXj2evL/u3HvIGq5srsfYcnkwKR9aCGb+Q== X-Gm-Gg: ASbGncumqnP+7Ws/VNQ5ADwSzWWTczxfA7GO0z5k/ZPceI6A7q57wcOd8P1MY5b3vvH 6r3dPYB7yn9SW3cciMjFPG+VNDhPmQ9tEwTRLTNv1G44IZIObwYTyW3+Uyvfwg4+oFdiAnkcb8R MTEy5dRzHXAFQZ31+TMxSY+zUFxMLbhyAZQmaFu3cg4xLQyHo0oDHxB51jKZydmGclLf814vGCw w6WdeGsezWT8iK4mRxxzODpvT7ObWcarMpQLqIKhHv2W9h8+HDPeG2F49ly/1li/d2t9ty5QE3i AH5dOAVURDrmaullYfSXo6WVJriFDeouU/GPpdYGNlgsphHAbw== X-Google-Smtp-Source: AGHT+IFvphionuusYD9iRNTfrF/Xp32lZfLaPckWOPBQ/idE4kcPqk59rep4PJ4Gu/NB5/z7BO00EA== X-Received: by 2002:a05:6a21:b90:b0:1ee:dded:e5b with SMTP id adf61e73a8af0-1fe42f9bb33mr4381619637.24.1742538305821; Thu, 20 Mar 2025 23:25:05 -0700 (PDT) From: Nicholas Piggin To: qemu-devel@nongnu.org Cc: Nicholas Piggin , qemu-ppc@nongnu.org, Roman Kapl , qemu-stable@nongnu.org Subject: [PULL 12/12] target/ppc: Fix e200 duplicate SPRs Date: Fri, 21 Mar 2025 16:24:16 +1000 Message-ID: <20250321062421.116129-13-npiggin@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321062421.116129-1-npiggin@gmail.com> References: <20250321062421.116129-1-npiggin@gmail.com> 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=2607:f8b0:4864:20::632; envelope-from=npiggin@gmail.com; helo=mail-pl1-x632.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1742538498567019000 Content-Type: text/plain; charset="utf-8" DSRR0/1 registers are in the BookE ISA not e200 specific, so remove the duplicate e200 register definitions. Cc: Roman Kapl Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2768 Fixes: 0e3bf4890906 ("ppc: add DBCR based debugging") Signed-off-by: Nicholas Piggin --- target/ppc/cpu_init.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 8b590e7f17..7decc09aec 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -2744,14 +2744,6 @@ static void init_proc_e200(CPUPPCState *env) SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* TOFIX */ - spr_register(env, SPR_BOOKE_DSRR0, "DSRR0", - SPR_NOACCESS, SPR_NOACCESS, - &spr_read_generic, &spr_write_generic, - 0x00000000); - spr_register(env, SPR_BOOKE_DSRR1, "DSRR1", - SPR_NOACCESS, SPR_NOACCESS, - &spr_read_generic, &spr_write_generic, - 0x00000000); =20 init_tlbs_emb(env); init_excp_e200(env, 0xFFFF0000UL); --=20 2.47.1