From patchwork Sun Jan 19 01:12:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 858666 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp1347385wrb; Sat, 18 Jan 2025 17:14:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWXuaVgB4jWtUoJ688k1+dANlmXL90RGgxxqxw0LGLMOI0sZ4CocDzIHKgmFN4plDj/Fx5vgw==@linaro.org X-Google-Smtp-Source: AGHT+IEK4MTQANLxSqOLEQbDA24SvKkf/KF9zqG+LdQQg1XmRz638yvQyWfVPqeuSDarhh9UNT+r X-Received: by 2002:a05:6000:2a7:b0:38a:615c:8225 with SMTP id ffacd0b85a97d-38bf577ff42mr8317521f8f.15.1737249279452; Sat, 18 Jan 2025 17:14:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737249279; cv=none; d=google.com; s=arc-20240605; b=aq3LFx/ifSrG0oOGDbB3R1hz+bGp4f0DJMaYmujmi3hEoGdWLKul3eRLXdBxPG0eJk /G++oCB5fSAoZlJ0OvbRYtG2fXfPtbYKgPQ7X1cLUIe8Ko/ttu/Lf4c+OZzdWiTdg5Bg bnPGAot5DehPtCa6p6R9nLRqTtWLk6glw1LISWEKN9J/jkvOJcuqlrmb3+6YEvt1FCH4 KOv5zoOpXlZq8NEv4Sw0pr8RakZT11uuu7t166BVxm7cMaeDME1KuO6CJsmpB64tXcHH e89r0GV4v55GgjKx8N5Zij+OOl0N+6bPe+hDkqsgG0BdDznq9NWnDJ2a6gzSiOfabjif WItA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KIx7yMpbHg8i0EoIEIkPLKxcpay9Dhimmk1POO5dii4=; fh=cj4qnHVrWz/y42l/9CpyjaFc8mYHB7wOV/1A5ab0cio=; b=Fzpet+yqvPZ2mWOpvgO7lYRp0yd217UDGnWwaSC0nYyAfmnKhacponFHbIe37r/+jW FD7/FX9AUdTOTVXNFgaU8FFxFY357omz1AagQE61IkrQ44LdmNNcIkJt5dud98XMeHS9 HidvxarBdLd/WN03X3iDgfDng5/R1o6r9jmVEap3xjeAyvpCVv6oQsjX1IUGy9lj8WFi aeCy/61KW6q9ZheJ4udFS5F5t33j6kjHcQ7Ug1CKdEyLQ+KR1w1oJsJRA2ebDf82TuSm 83qj/UxoO5s6M+0sSzFlUN3a2HRMQBNpg3MwN6501UtnGEoDZFydNv3xiUsnqx+WVcD1 TwEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="PIWAAn/s"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ffacd0b85a97d-38bf32843dcsi4024771f8f.557.2025.01.18.17.14.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Jan 2025 17:14:39 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="PIWAAn/s"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZJtG-0005Jp-Dj; Sat, 18 Jan 2025 20:14:14 -0500 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 1tZJtE-0005Am-4A for qemu-devel@nongnu.org; Sat, 18 Jan 2025 20:14:12 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tZJtC-0003Jo-FL for qemu-devel@nongnu.org; Sat, 18 Jan 2025 20:14:11 -0500 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2ee86a1a92dso4714302a91.1 for ; Sat, 18 Jan 2025 17:14:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737249249; x=1737854049; 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=KIx7yMpbHg8i0EoIEIkPLKxcpay9Dhimmk1POO5dii4=; b=PIWAAn/s9XH+TlQv35nKCn5qEnvu0s/V231VAZHrHekboaWGjaKMW1VtoN7Q6RDRVM pzNT8tsgf87dJx+yQpMbUNfr9IaF7M8e+i6vuUpZ0HX40Z7mWg8Am0GXIY54o7/lXcrO KgnJJnmHhj3BULElmA0YhXcjjQNVjfqQ0M8+B6GS/x48ba/6EAMTC/0YoByfPdaXN3HU 65QeUbHflLH+YvpLlAxKuZ7cVJ4DHNNooIeMJv3nE5W0YaIgRQ3SF79Vtrg82mxnA/oH E1tKttM7l9L8Lu0CB7HWW/ETXYk5iLHCsjhmUcliEofby0I9AHc6IktVfxQiu756xlvc 7vjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737249249; x=1737854049; 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=KIx7yMpbHg8i0EoIEIkPLKxcpay9Dhimmk1POO5dii4=; b=uF9NRvEIIcDo64UzV/YkWAV1tCVlk77/9fgFLsfCXyaR0keoL7zEL7SA6SKaYUuuSt 7dUkkMleqBljX+ItW1hps/3xcNgYJodqfM6eX2o5pGcvkdeP4onsfedt5KePJGTFnkHW 95FeZpGRYwuSIIpPk4J/otdobH1qfC2wLWtQXry/zjAvvnvtp31UbG6r9BQRe/LvFdjU zYHIGdVcQfSeLjJ76S6MBBhGAEx1wpTS/D2zoMc43UCaqDdPFgkblNLMqo3GJpUr5wNX 9HVpC98vTjdTxYaDVUu3f9KN0rHsk6HYzJ2RYESMCag2SJvYYmPrOgRAnrL+whXAS9gk gw/g== X-Gm-Message-State: AOJu0YxuDsbC20mHe8a0C4lByE4JRAQq3d4SyBGk3qCkX745oSPGkm/j NwS0JPE4/SVY5Edn4BfD5NlRg4aHG9IE2miLL45bNZMJCgHl+U1OsnLjXaE2 X-Gm-Gg: ASbGncuH9p5H7cEG+sAk5rGc4qNLkk/S5BkphdBU4Yt8GWMp6U7vmIVMH+l6dSDuukC 1KL1vqlfAtDZtEedwpDh86UVIQt5Q6tFAXX7tyZr7yPcGpx4OeoD3KeXoKD+cYUA6N5p6GMKP0U wPwmlUtdal6jmU/qXqqhLG1/mYZodlPS3GqVolANSZqlKrw5W3AZoSH8HFPJTl9E87Yyjk+V7c2 8YQPP6LQkDSAe3Vergq/oaVolBsIdJyMKgLFFU//RKNh3mbYdK5amQRgdM2mxqL/tRHbjia6+qd +kDO61KpfjgHBxup5hUFQSN4umcAdtTE1cWcR4dOx5swmy5ygz1VoCyNxtCrKonG2sAaRdTzng= = X-Received: by 2002:a17:90b:4c43:b0:2ee:c5ea:bd91 with SMTP id 98e67ed59e1d1-2f782d65adbmr11178532a91.29.1737249248734; Sat, 18 Jan 2025 17:14:08 -0800 (PST) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f776185b02sm4760314a91.21.2025.01.18.17.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2025 17:14:08 -0800 (PST) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis Subject: [PULL v2 26/50] target/riscv: Have kvm_riscv_get_timebase_frequency() take RISCVCPU cpu Date: Sun, 19 Jan 2025 11:12:01 +1000 Message-ID: <20250119011225.11452-27-alistair.francis@wdc.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119011225.11452-1-alistair.francis@wdc.com> References: <20250119011225.11452-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=alistair23@gmail.com; helo=mail-pj1-x1033.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Keep kvm_riscv_get_timebase_frequency() prototype aligned with the other ones declared in "kvm_riscv.h", have it take a RISCVCPU cpu as argument. Include "target/riscv/cpu-qom.h" which declares the RISCVCPU typedef. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-ID: <20250112231344.34632-2-philmd@linaro.org> Signed-off-by: Alistair Francis --- target/riscv/kvm/kvm_riscv.h | 4 +++- hw/riscv/virt.c | 2 +- target/riscv/kvm/kvm-cpu.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/target/riscv/kvm/kvm_riscv.h b/target/riscv/kvm/kvm_riscv.h index 5851898868..b2bcd1041f 100644 --- a/target/riscv/kvm/kvm_riscv.h +++ b/target/riscv/kvm/kvm_riscv.h @@ -19,6 +19,8 @@ #ifndef QEMU_KVM_RISCV_H #define QEMU_KVM_RISCV_H +#include "target/riscv/cpu-qom.h" + void kvm_riscv_reset_vcpu(RISCVCPU *cpu); void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level); void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift, @@ -28,6 +30,6 @@ void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift, void riscv_kvm_aplic_request(void *opaque, int irq, int level); int kvm_riscv_sync_mpstate_to_kvm(RISCVCPU *cpu, int state); void riscv_kvm_cpu_finalize_features(RISCVCPU *cpu, Error **errp); -uint64_t kvm_riscv_get_timebase_frequency(CPUState *cs); +uint64_t kvm_riscv_get_timebase_frequency(RISCVCPU *cpu); #endif diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 2bc5a9dd98..9e8876be29 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -750,7 +750,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap, qemu_fdt_add_subnode(ms->fdt, "/cpus"); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "timebase-frequency", kvm_enabled() ? - kvm_riscv_get_timebase_frequency(first_cpu) : + kvm_riscv_get_timebase_frequency(RISCV_CPU(first_cpu)) : RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#size-cells", 0x0); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#address-cells", 0x1); diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 11278ea778..23ce779359 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -758,11 +758,11 @@ static void kvm_riscv_put_regs_timer(CPUState *cs) env->kvm_timer_dirty = false; } -uint64_t kvm_riscv_get_timebase_frequency(CPUState *cs) +uint64_t kvm_riscv_get_timebase_frequency(RISCVCPU *cpu) { uint64_t reg; - KVM_RISCV_GET_TIMER(cs, frequency, reg); + KVM_RISCV_GET_TIMER(CPU(cpu), frequency, reg); return reg; } From patchwork Sun Jan 19 01:12:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 858667 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp1347611wrb; Sat, 18 Jan 2025 17:15:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVCa+41FlUxIqvYIhLGpHd+cJjPiZ4SKAWB1zt7gusnDnOv5PL3oNNE3LwkfWi9oFUqbmx6pg==@linaro.org X-Google-Smtp-Source: AGHT+IHYhAvyjUj6HU90uKDu/Mo9wj4GnTQEiw+7PwiNNelUBGbSle0j6xp3AoB4WpeT/XKXf9r+ X-Received: by 2002:a05:600c:1c84:b0:436:1b08:4c78 with SMTP id 5b1f17b1804b1-4389144fd70mr85206215e9.31.1737249329232; Sat, 18 Jan 2025 17:15:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737249329; cv=none; d=google.com; s=arc-20240605; b=c2jZ+OO1vy7XyFY278FBABnGquOPrdE+gTbbQytZFMsIe1NfAcMEwK7qNNRpYYbZbW FUp3LZB54BpOpZ3r6jyfgFoW2ox/gp6rR+7wKUf38UAikmHK0lJfduIEgnwubY7GFrMn rAxHh27zsMltJqh4PvFmBzBE+r8kPtGKiV6y/8t5PSwFQwFaD4WT/bp6ggjkOmCNYXa+ CtwxuS6kRdJMvlYE5erKw+5RY8J1Ysq2b5Rmp1xOptPe44C7b2wOdjf17C1JbzsLXlLE 12ZDJJQLJMVIfy+DF8u97rFO03KSeZ8fM1nX6j+denBFgAEFmTBhXoC6BYZ5/CToUSjI c8UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NdLEaQfdnKEQEDdTsYjN/zThxqSlLF48asIv/trDC5U=; fh=cj4qnHVrWz/y42l/9CpyjaFc8mYHB7wOV/1A5ab0cio=; b=E6kkZwrRpqmZROYQNOu/yzMM6ewBnkffIoF3EcVM7AqOIXtyF399EMKcjAtANEiKFn CnRTMCVVIsVLrNzEyVTwtVMpYPdjCJTixgWvoCbhRAn0zYXOVb2Pz2j2beyWRPHxzkIe OcQaCPQid56/y/A5L7xR/X0/CLYbjC6JtOxh9gQOmDTf0IF+jLUBjnnr9W0wcEuEpwFE ri04IuN0ZnWouAnjyfMol507Orh1VDgEgd9LYCsfK1lIpF9re4otjV1u2duzODm3skAp Ovt31OkImh3hUcDXmZ/QmwFQxJMe1hTfTG8tGmlJXWBubn/CPNQPkvTP5n2sE+wQpmmE 7MaQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fy2Id470; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 5b1f17b1804b1-437c74a7f70si67626105e9.51.2025.01.18.17.15.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Jan 2025 17:15:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fy2Id470; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZJtM-0005hz-5k; Sat, 18 Jan 2025 20:14:20 -0500 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 1tZJtJ-0005XX-2G for qemu-devel@nongnu.org; Sat, 18 Jan 2025 20:14:17 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tZJtF-0003KR-DN for qemu-devel@nongnu.org; Sat, 18 Jan 2025 20:14:16 -0500 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-2ee9a780de4so4366030a91.3 for ; Sat, 18 Jan 2025 17:14:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737249252; x=1737854052; 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=NdLEaQfdnKEQEDdTsYjN/zThxqSlLF48asIv/trDC5U=; b=fy2Id470hVPQ19pNDsM9IWI4J1eKWLimkX3jPLNuLHbNPcqI4AqD3QjGG980t9ib2d TRkDV2eqIcu6yzlKfiSQ8mDyd9rMZkzsDty7UMosm/HL27pMIblgVJunyNeda1U/kepW rf0FjHyzbgtLM2bULCHfX7Cjp723bovRzlMOKJmKdumOKSG4j6HePrSAZtEwFEyTyqNt F9ryAz+IDIUZ+R0QtBSDEeKlnQVn2dbPja5UHt5jRtduCDsuCWGX1aZpUP4otwvI1eHZ SznN6dpxn7wrP0ajlMEbWzSR5ep6XjuGbjxM6VfMciVpTqphG0KsKOqLJtwcGyRpc8A7 2pSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737249252; x=1737854052; 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=NdLEaQfdnKEQEDdTsYjN/zThxqSlLF48asIv/trDC5U=; b=j9SQWy7TKVX3nnW0lH9+xVJbVL/1XjtjdBMkV8YJ03wB2u2zRw0OpLWeNnFx0EMkHe CyXN38LKeQ7/0f8W+EXc/7O/iWBiF7h9ko3IDKn0BHpCV0htCXk2tuYoHluJKJaLgwAi MxHVla4fOPZvky7yiZ3XInxHCGAG/7RTOqJLOlpJjxrSH/3VEGkpLnm1Gq2203UAMMqb Rmwlmp82Cc09bMS1U1CrRTvH5cnTAwjzmmQamNDnASHVdHvK3/o5tTgtzHOxH7NXstAQ S2E5tfcy0RgJ5D5vSEJpBNHOqqhSNc1q6gbXN8NaxRgAZ7GTvszdr9XyZkI+cVL9KzwJ XrRA== X-Gm-Message-State: AOJu0YzMobIm0iXGEf1/dLl8AoStsK+puLfdRc/dHuMGe7wQBYJ0GmqT buCrAs1NB/7n73HLNmgwq4oFuoPmfWIcWP1kAiYKX4yUZ/hZNtMtvBdRq+mB X-Gm-Gg: ASbGncsXbEFeEXQ0lbQBD9bL8bQ9zQ8b4RlcmQbMzXsOMjDscXqFmIvbX+B781z3F+l dw1E7HlwkU+apmoujZ2rhT0HesK2izg11uOARmWfp/vmFtLy2wbtFAZNjGsxf3br6ZCBVlurgN0 CXOvz+zKoaw+tFokbjS/pdYa7JyIu14ki1prtO/VI4BJlzcI/ET1iGx6rj1WP/K5Vht3dovfdaN RLp3HJhrngqi14dmn/LoqJk6wIaV2e1JnF+Tv7JhlKEWmAi5bScR0b4YCl3mcG20syKqnkRAaLu pX9MPayjxKu5NHLvN2EuEY6V8W4HKQsN3pvCzskF860edkaqG7AVLMy3m/e4FN4zkfl2If+Jow= = X-Received: by 2002:a17:90a:c883:b0:2ee:b2be:f390 with SMTP id 98e67ed59e1d1-2f782d37d55mr11524979a91.28.1737249251797; Sat, 18 Jan 2025 17:14:11 -0800 (PST) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f776185b02sm4760314a91.21.2025.01.18.17.14.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2025 17:14:11 -0800 (PST) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis Subject: [PULL v2 27/50] hw/riscv/virt: Remove unnecessary use of &first_cpu Date: Sun, 19 Jan 2025 11:12:02 +1000 Message-ID: <20250119011225.11452-28-alistair.francis@wdc.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119011225.11452-1-alistair.francis@wdc.com> References: <20250119011225.11452-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=alistair23@gmail.com; helo=mail-pj1-x102a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé virt_machine_init() creates the HARTs vCPUs, then later virt_machine_done() calls create_fdt_sockets(), so the latter has access to the first vCPU via: RISCVVirtState { RISCVHartArrayState { RISCVCPU *harts; ... } soc[VIRT_SOCKETS_MAX]; ... } s; Directly use that instead of the &first_cpu global. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-ID: <20250112231344.34632-3-philmd@linaro.org> Signed-off-by: Alistair Francis --- hw/riscv/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 9e8876be29..241389d72f 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -750,7 +750,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap, qemu_fdt_add_subnode(ms->fdt, "/cpus"); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "timebase-frequency", kvm_enabled() ? - kvm_riscv_get_timebase_frequency(RISCV_CPU(first_cpu)) : + kvm_riscv_get_timebase_frequency(&s->soc->harts[0]) : RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#size-cells", 0x0); qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#address-cells", 0x1); From patchwork Sun Jan 19 01:12:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 858668 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp1348165wrb; Sat, 18 Jan 2025 17:18:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXb6KV7wgVRTWYSE6kG6bAS8nSpmiNXEJVa/UknP8RFnAMlZvuRPEduXIXaKcBK0+vYIZqbiw==@linaro.org X-Google-Smtp-Source: AGHT+IGhBjgsoUTJ7kWhHk0TAw9JIUKP6cvxxQJsgB5orSK9jw9l/h6Iiax7Ernl5o2VKZXsUNdj X-Received: by 2002:a5d:5a09:0:b0:385:e30a:e0f7 with SMTP id ffacd0b85a97d-38bf5674715mr6364134f8f.22.1737249482442; Sat, 18 Jan 2025 17:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737249482; cv=none; d=google.com; s=arc-20240605; b=EZasEywRYkRDnJ1ekq+k9/SnTjFDYqvucdNTqVh1zfBhQ2DXAR0MhJtHam/I9FDyZm NSEqIzOdC6uVuP3oSQoK6powagQcOHGxhkROhJnb5uxhQo2VtpReuNiMyemX0B2Cb5Q3 BfH8HDN3jy2QPg05XT9AI8MR/k9VBM46houARC9cqLFA5534HzS35kqGYOaG8BP4yB5o cGvfVTR+YYt+PJXxtMGPBVRynkfy021RlaVsLII4AGutaStJ/Vcs4OqHQ4rTCI69BN23 2SXXNagZ9VhlX7z8JtqxBmySjqN+DmtsES2hZalgfQ0yeuUiryTRiO2aDbVEerY0aW/Y ltqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hepX22FTlqXSa6p5bX3QV0CVCwBYpn5hMPqWA0qdSSQ=; fh=cj4qnHVrWz/y42l/9CpyjaFc8mYHB7wOV/1A5ab0cio=; b=PctaZvv9I9hP3Q4Xzy9I5Q1yTsqPDSKwPTUM6+sRsSA6KNsjk1vDD7UbFqwoCU8xRw 5cDCfC5qddwMrqbwfiIQEtJc4YFlt9TMtphha+SGvlAVRLOxmaLLnsceJ7mMKgvaIvGR Qt7nEIy41QBAmWpujPbrYxs+7ydRtsJBAFezh3J4T7wLPfhMg/vIwtvOjzvZGXlSE2k+ M6iQMVPCFBdMatgAUYjzbm/Yu0N9J5SDOuCheqRlKHB32o6JYw5tckrI367IZATdHw2D /YAShpqGxjuU0aTI0URtNC9At0npSr5DSJJG6b9oS7RI7dNFd3WU4dWb0dzz9iizcRJW pSmw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DzVFNibv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ffacd0b85a97d-38bf3215f2csi3881991f8f.6.2025.01.18.17.18.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Jan 2025 17:18:02 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DzVFNibv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZJv1-00048f-Sf; Sat, 18 Jan 2025 20:16:03 -0500 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 1tZJua-0003HV-Uu for qemu-devel@nongnu.org; Sat, 18 Jan 2025 20:15:37 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tZJuZ-0003ke-BE for qemu-devel@nongnu.org; Sat, 18 Jan 2025 20:15:36 -0500 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2ee46851b5eso4518900a91.1 for ; Sat, 18 Jan 2025 17:15:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737249333; x=1737854133; 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=hepX22FTlqXSa6p5bX3QV0CVCwBYpn5hMPqWA0qdSSQ=; b=DzVFNibvcFVY5obGXd1o6sHdb0Wgyqvit1AvHRi80+LOJvhfrEK01B6qrkAYe76TqP d914E3lmIUC37LvDueUZt5dcyHPmO7UnXH2Uk073NrURk6oq/P1Udl+ryhmZt0nSwkYn uhlQpy0GeL+bSYLdIuXYVkwxw+/kkRuj4Ag6vZhyHbM4NDwgsqNa47n87vxmLZUCF+DW 9rD6iyQMfuC2lH1IPnAlFVmi3OcfbiuqWRVRZp36pBLV+hkQh9f/DsG28UYdTSQTCFxF JZl4i9Yj3/OYpa+1XMYUqo7KMp6m743ngheehOMRzNjyefOR3LHPlfqGh+GE1jXNqHj0 D+qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737249333; x=1737854133; 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=hepX22FTlqXSa6p5bX3QV0CVCwBYpn5hMPqWA0qdSSQ=; b=hOP9HqRkuG2wKMXhekl3PsLe7N7MzkLu8EpeWIPKR/lgRqMmIpyFZbudxttNjkvIs7 yrEzi2lqogrjEB/RAx/d9tkbcahFvXQpCGtkWej2qNKeuOKQqiAVub3vl7cD8lKKdy6P qrQ2ogRrgij1JWKF4lmFpmCraJ4/AZIw9qZt0a3oXh4DK39afgUR/iPwWamUVimrJQTT 8MIOO1jq4CFONz20U77AqFHNdxjyQwMWZhaOASVJEt3qAXpeCA6gRuzTKfW9MXqN9lHM uN02PUUUMlvq2y18cQv9N2XDjQMz0TRxnBABcf/mgn7m/vnL3TAHdzE4FxTbYFBGRiwf aflg== X-Gm-Message-State: AOJu0YxTu5VmxJYLJ66t9vVNA2oi1+++83XKi2YcNy47Vg4MlD1fw7LU 7YpQPdWcNIB512//v8MMqapDXRoUhuTRiDVDXJ+mQniBT/hbY/F9WOYe5ak7 X-Gm-Gg: ASbGncs3wftvIhfY/mmycRbPlRAI7mxvVmpFnOduWhCKRrKfMUXLvx6xHl3aWE8AXW1 j8SLCGiUGaYCQNrM3TBySEXB3sRR3RyS86bzexYmQD24+G1vywKGsKXRVdSo7KbVLx2wu9EfHcl uLlxEomNHaJLBH4dKNkuxotATSI3jhPJV968hQXu3E1ojcDoDma+nkRI1DP4RwqfhNWYc5UE6ti 1ofpA1pQ53T4LKDkcAVe0MEhflbTamVAEGlNLCh9m5G7IOTfn7g9PMsCgOLliBmjzNX2c80C2gS jp99LbHi96pmquujEjjYuPVuZ/I31dhZ45V73FZ3mlalvEdgGKAHugaD7+PLFmB+fIFDSkLATQ= = X-Received: by 2002:a17:90a:c2c5:b0:2ee:8008:b583 with SMTP id 98e67ed59e1d1-2f782c9c88fmr12762086a91.16.1737249333565; Sat, 18 Jan 2025 17:15:33 -0800 (PST) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f776185b02sm4760314a91.21.2025.01.18.17.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2025 17:15:32 -0800 (PST) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis Subject: [PULL v2 50/50] hw/char/riscv_htif: Convert HTIF_DEBUG() to trace events Date: Sun, 19 Jan 2025 11:12:25 +1000 Message-ID: <20250119011225.11452-51-alistair.francis@wdc.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119011225.11452-1-alistair.francis@wdc.com> References: <20250119011225.11452-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=alistair23@gmail.com; helo=mail-pj1-x102d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Message-ID: <20250116223609.81594-1-philmd@linaro.org> Signed-off-by: Alistair Francis --- hw/char/riscv_htif.c | 15 +++------------ hw/char/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c index 11a0e1a7b7..ec5db5a597 100644 --- a/hw/char/riscv_htif.c +++ b/hw/char/riscv_htif.c @@ -32,14 +32,7 @@ #include "exec/tswap.h" #include "system/dma.h" #include "system/runstate.h" - -#define RISCV_DEBUG_HTIF 0 -#define HTIF_DEBUG(fmt, ...) \ - do { \ - if (RISCV_DEBUG_HTIF) { \ - qemu_log_mask(LOG_TRACE, "%s: " fmt "\n", __func__, ##__VA_ARGS__);\ - } \ - } while (0) +#include "trace.h" #define HTIF_DEV_SHIFT 56 #define HTIF_CMD_SHIFT 48 @@ -159,8 +152,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written) uint64_t payload = val_written & 0xFFFFFFFFFFFFULL; int resp = 0; - HTIF_DEBUG("mtohost write: device: %d cmd: %d what: %02" PRIx64 - " -payload: %016" PRIx64 "\n", device, cmd, payload & 0xFF, payload); + trace_htif_uart_write_to_host(device, cmd, payload); /* * Currently, there is a fixed mapping of devices: @@ -251,8 +243,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written) } } else { qemu_log("HTIF unknown device or command\n"); - HTIF_DEBUG("device: %d cmd: %d what: %02" PRIx64 - " payload: %016" PRIx64, device, cmd, payload & 0xFF, payload); + trace_htif_uart_unknown_device_command(device, cmd, payload); } /* * Latest bbl does not set fromhost to 0 if there is a value in tohost. diff --git a/hw/char/trace-events b/hw/char/trace-events index 3ee7cfcdff..b2e3d25ae3 100644 --- a/hw/char/trace-events +++ b/hw/char/trace-events @@ -136,3 +136,7 @@ stm32f2xx_usart_read(char *id, unsigned size, uint64_t ofs, uint64_t val) " %s s stm32f2xx_usart_write(char *id, unsigned size, uint64_t ofs, uint64_t val) "%s size %d ofs 0x%02" PRIx64 " <- 0x%02" PRIx64 stm32f2xx_usart_drop(char *id) " %s dropping the chars" stm32f2xx_usart_receive(char *id, uint8_t chr) " %s receiving '%c'" + +# riscv_htif.c +htif_uart_write_to_host(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64 +htif_uart_unknown_device_command(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64