From patchwork Fri Jan 17 05:55:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 858165 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp555058wrb; Thu, 16 Jan 2025 22:10:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVRPGeMiWRWe71uHlWU+r0MG7c7Ek3YgjSyDXevKNo4b+cZu+oULwLfF0i+Z8CK4jZIgdRA0Q==@linaro.org X-Google-Smtp-Source: AGHT+IH4PiZATmXhtAZvsDXL4MdDsOEnTdXEIHaEtIaHZ7GfO05zswoa9oy3/A9beeGxZdF3UCD9 X-Received: by 2002:a05:620a:29d1:b0:7b6:7863:cbc4 with SMTP id af79cd13be357-7be632162dbmr255578785a.18.1737094226603; Thu, 16 Jan 2025 22:10:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737094226; cv=none; d=google.com; s=arc-20240605; b=a0z9wEf1wv0zZDDZLC7MHXAlsXHthlE39MAATi/1iCgaSeVqblyJ5u/b0zWFRU3BFr RZcEQVaYmS4wC+Q5UlSHIAkrUDTm4rUHEdYKjr5QR4dc9vKNeAjSyUjSxjvoekMoNpty tH1SETb4JYrmvMK9SgOg6YW/k+1d76uj5rQNWw/20H2IWG3xKLIqST79849pzMQd89ts 4DsHfzuOB1G+AinDRPO0cHoUVYl/rFo+O0nAaBA8SEM7aBebqKNsQO1CDyOCKZiGbWTe jbK9m4AQqf8OykqWARBFmCIWrRY8k/8oNo/N/l6rhhL22OqZPb1WhNXrBetew89qfXoF 5dfg== 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=SvKTZTfwHo09+/+9jpS1HMWs+F6dxpkz87v0o67vzNg=; fh=cj4qnHVrWz/y42l/9CpyjaFc8mYHB7wOV/1A5ab0cio=; b=YNUQHDUT2pHXXBoB6Cn/MZiAIHjviijTJgbXhBzAxb+xI9q4b81ceHIYMQvR+4Ma9B GNDrIySuEDOgKbi1U9zE48VRwLJzwdgGTRBYNvVzZZgcPOmNoLhiu8DRofa2BPVIDSIX nLeaEBGnEV6vVD+/vmAiW32ZTH8Dh3h1moQv1/j1yhjBBb03HUFcTjV66hAsowkTjxd3 tzUdZh4wJ+mdKDQAH7wtOiXhVophbSCdrR/uCnN58WxDQycxZq6XblB3EBCZDMHMmy9n 2SBJyM7AOP+8HNbMF3UsPqm5RQGDqIvrFZ9UogHTC6LHjcJfkOWjxfRbXWdg5R2xcA21 DJ2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hP9lsflQ; 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 af79cd13be357-7be614ed357si202507285a.516.2025.01.16.22.10.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Jan 2025 22:10:26 -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=hP9lsflQ; 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 1tYfMr-0007uz-Ii; Fri, 17 Jan 2025 00:58:06 -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 1tYfML-0007KY-3D for qemu-devel@nongnu.org; Fri, 17 Jan 2025 00:57:33 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tYfMJ-00063j-IN for qemu-devel@nongnu.org; Fri, 17 Jan 2025 00:57:32 -0500 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-21628b3fe7dso31153655ad.3 for ; Thu, 16 Jan 2025 21:57:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737093450; x=1737698250; 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=SvKTZTfwHo09+/+9jpS1HMWs+F6dxpkz87v0o67vzNg=; b=hP9lsflQGoTxsogiEfo7eHu5PBdpVTkGhcVKmyHVKt+VFtMUp02oiw8rTtpqQWWyMZ ZV8dLVyeGlcCOK/JSSi7Faf0peI9w99WSt3BH4p2ji2Ch4NRg/1Xv7YGZF2iM2+WcXQP wOMKVd5uuBpudoVPhbhK1qh3vPpsYhYzWHaEpJJs0RdOrgRf0W3oXwMZWb9DJpBntO/T 9iyPhzlugF+uz7pBmHDiQhHGwx0SGqNzYmQeePQXPKeuXPQJIEL/BSvhRdf+D1Zzp5X9 iKM9jFJRusK9upVIZ78qHG5NzZE05zuXMTnTZuSIpF3WKplrKNFCJETqgo6caoe9BB3f OFtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737093450; x=1737698250; 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=SvKTZTfwHo09+/+9jpS1HMWs+F6dxpkz87v0o67vzNg=; b=JbABR0AFrmE0Av1nOoJpRFj7KPNjMu0pAFwNJOnpANZ8WTa3FKJSaptF0l64NKsFQI jdWYifCJPZTPqG80FRY41BpXhr2aKPFaV3t2vMWmPL+xxOcbJu/1/iLH7jx14ULds1vl xJ8e9nBL1AYx7iUffNa0DmmLo0oi94D4xa9buvL94SKHcaBbbBlDaZDOjJJGnNxEWzuU /SnKsumK1anN4Isn/HB0WUCH0XriE0c0n1Z4PkTEMqqVB9iNL+u4xLHhtlSydyK/xkuq F8TMNuNv0Acp+xjZJg2phv3oEnOjCgW8v3cByUQ3Bft9xsRkdILYYAnkCTVkjvIf0lmJ 5TWQ== X-Gm-Message-State: AOJu0Yy3x6LoB9MJ/BjE6IjC+qiykc1sd+ZngQd9ms+3/qYCn5bTcAfW YmsSJlqeTHxBljizcxKNuU0xcpOLT4R3/DDL8XuZAgHADDkeRGWYBjqktw== X-Gm-Gg: ASbGnctkrC5474aITCdb7CmowIWvWBG3eQcfV1KHhJefOB+iS0b2uMMJPiIvef9hBio ElufB2qakF2801GBXZTIBCEpzot5wrX+eKjm4D9MRVErHQPsh5pEBXXZN66zDqMmJwzaqGYnJ9u m/Xs1cqoI/MbVOW86jjSzyZefe7vIXbGcyzd1Imk7iaypOMUhEjGnSSNcBUgJEdeoeqKqYh9NWY /80wjNkHtE/B3YtxW25zswvWAEwCvrXfjbSKdc/L8Q6Z7PoXl5K+nhBiWLFCLmDvz6q+niLCk4W qeQPPC+mp/V+uPaqFHmHJZQhF8TRNKchk9+N6iIyPuyI3w2Vpqb9uKEHiFnv X-Received: by 2002:a17:903:2342:b0:215:cbbf:8926 with SMTP id d9443c01a7336-21c355b053fmr20983145ad.35.1737093450042; Thu, 16 Jan 2025 21:57:30 -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 d9443c01a7336-21c2d3d6fbbsm8563595ad.168.2025.01.16.21.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 21:57:29 -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 26/50] target/riscv: Have kvm_riscv_get_timebase_frequency() take RISCVCPU cpu Date: Fri, 17 Jan 2025 15:55:28 +1000 Message-ID: <20250117055552.108376-27-alistair.francis@wdc.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117055552.108376-1-alistair.francis@wdc.com> References: <20250117055552.108376-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=alistair23@gmail.com; helo=mail-pl1-x62e.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 Fri Jan 17 05:55:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 858164 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp554858wrb; Thu, 16 Jan 2025 22:09:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXl3RoIa5T00QBtpBytwAmXPmQ0YGyFM2ynSQ9vMqH3rbsY44h2oEzAXqD1donb+0HloS9rEg==@linaro.org X-Google-Smtp-Source: AGHT+IG4xeal7NN+bHV7mXFE5taKM54eX+FbGtmDJrp24R4H5GN8BeKVRUw/9NlV0MJhtWxt52PR X-Received: by 2002:ac8:5a92:0:b0:46d:d23c:99f5 with SMTP id d75a77b69052e-46e12b56503mr26461001cf.33.1737094182390; Thu, 16 Jan 2025 22:09:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737094182; cv=none; d=google.com; s=arc-20240605; b=Cjgra8DGWTf5iefDZToZWtRT9LaSLB1edMxHlYwSjuctU7rA6TxZkQWP0NBt8cgHG2 UcOJ6/iJOixY77MPNfwMAxCaz5i0upi315SjmR2ByC1nAWRlUaiqxhntYGMwf9QSoCWh 4TD0DjxKmQjO6LLsVlczV3tqKfMldFeBJjEojkYlHbbALCXKRML1X6RUdKR2vfTMgNrL 2ejCzv0FEaa+mCqnIKAUcQ4PUyPSKp7/sj834PFZSblHYtu7v1BruRSt92NAudF6/J32 5d64GM8ubmOT7icU6Pu8dOMx47yeJ/iPM4QhUtKMZlnAYyx7PzMcQN/AtZtJu/EWaZyu KL2Q== 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=xUehjOG3PrlgTPgdJIY8hZ6AHJgb7hHIonBDupfXjbM=; fh=cj4qnHVrWz/y42l/9CpyjaFc8mYHB7wOV/1A5ab0cio=; b=AeMwqQLjxMnHH5e9RTOl/zVPEohYowdPF9GZZMBwWH7GQskNSc1zcDX57r1+4FJVW+ egWBAjRs+mCRUFmh3kqAxQZ3k0CHF/XGgkSHSpCT3+DoF29wOR7mdyPiKSx+C2wXKrtW 4KBcfOpweLa0nrT3+wn6hd2nqfQZ5PrWd9UtpH5RFQr76CtLcz8tWlLMNFKYHb2aG15Z OPWdvidT+rRNMDDHgHPQJl7c9FlvYsUF233zjxLoazi4CfU52hTLI6p48yC+6cmev6h0 DYZVcDDy4JzVjPrf4qKn71UdsphacYfFPR84e/bhOXfri16Yfc7vPy41gszcCtAmXK++ m3cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=NSQ1vYDa; 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 d75a77b69052e-46e10488206si16113241cf.490.2025.01.16.22.09.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Jan 2025 22:09:42 -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=NSQ1vYDa; 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 1tYfMr-0007nS-3p; Fri, 17 Jan 2025 00:58:05 -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 1tYfMP-0007T6-1I for qemu-devel@nongnu.org; Fri, 17 Jan 2025 00:57:37 -0500 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 1tYfMM-00064I-LM for qemu-devel@nongnu.org; Fri, 17 Jan 2025 00:57:36 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-21bc1512a63so34464525ad.1 for ; Thu, 16 Jan 2025 21:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737093453; x=1737698253; 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=xUehjOG3PrlgTPgdJIY8hZ6AHJgb7hHIonBDupfXjbM=; b=NSQ1vYDaCuBBQhqBMxx6d5ACF1zCv2r822zczznNhOfb4cCSWZQ/EoS7BsXElNvwK2 vCZdL8qeifFCTSMxL/NpuKnniVuoAyWUAAGMj4Q53JAE4SpetIpiPc99IXPkuDkm3njD w/CBaHonq77l7vJvQFCrCkB9OPJrMmGa+xNAHgDmMOr7DWbKEoz/tLN5C/DK5Rv2v5oE 8NY9CqUgPg5dcuki3n+hhqETsWuaAka0wMApYR5Jd4bkpzCOn772jn7USqc2YZZ7KbKh bmhhU+wws32jSbR/2235eVYtFDDrugzGkENbwRL52Qau/1WdA1vhGAPhU0CE1USFaeaX JpFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737093453; x=1737698253; 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=xUehjOG3PrlgTPgdJIY8hZ6AHJgb7hHIonBDupfXjbM=; b=FqxRNcYjGJjdnOACkJ9Bnou+OPVu+r/Br64+0o5KK2JFuLZ0thsQMeGwnGU1jp0OOG AYE+/UIjcvzwifxghVz1VTfMmu/z0kX9iBUHvPlKLZEkEKJ/5irM0A8uOPJx7v7wdnOQ UVgDOt3GmKejWtKtA/v3VJuLBEfeDL5bxFU8HWffveZRSnm+hY8porhurkbfrdLgaFc2 3IG0A9Y7kQQtJz3PrgdbTAGnopsZMZdDlqk1bXQh9M16SyL+wqh5Pjkpc4Z3umgKwnj7 fp2GUm8p02eOflX6Qsex91uQp91kldDoMuBBIfeHysFv2P23UFBSBdAjDB5KPBGtBdGk 27Pw== X-Gm-Message-State: AOJu0YxGSHZv87g8FY8N5jp6V0cb8QgNMxwTx2e3AbTwMzRo6mRt1yqK /V2Db4HeXmbP/yo+V4s1J2mQpY2fjOwszwBypuFcCWH3d0Zi11lF6/qBRg== X-Gm-Gg: ASbGncs78jEIBV6bFDXsJI7d+wzTDK90cW2fBa8AQ+M6ky7amBmntBIMbTNgqifPfA3 7KUNB1n1B29vAAEE4h3oGclU0GgMSO7+DLtZQ0W3ddKK5+QJc86C2RPrLC4NS+HwtDK4EziET6N OmGOAkjI1TWY2yP2WKhJe496fQ9xEEBL7ya6+btOwR3dkRAWBdHpL5JfumkgBqe+6dgLMLFYlp7 PCXkM1qzIsmD4m+V192jJcpFv16jevQrkT/CFq67CC0Q9uI0NEqttZ4tubrYFWXMxwqjEvMFN5Y W8Poj9BZOujq8GQeWGlU47x57EerQ+nvKFqJkHBOE1oKJWwqlXD8UARpWHeB X-Received: by 2002:a17:902:cf01:b0:215:5ea2:654b with SMTP id d9443c01a7336-21c3553b6efmr27408765ad.1.1737093452998; Thu, 16 Jan 2025 21:57:32 -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 d9443c01a7336-21c2d3d6fbbsm8563595ad.168.2025.01.16.21.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 21:57: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 27/50] hw/riscv/virt: Remove unnecessary use of &first_cpu Date: Fri, 17 Jan 2025 15:55:29 +1000 Message-ID: <20250117055552.108376-28-alistair.francis@wdc.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117055552.108376-1-alistair.francis@wdc.com> References: <20250117055552.108376-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=alistair23@gmail.com; helo=mail-pl1-x631.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 Fri Jan 17 05:55:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 858163 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:cc8:b0:385:e875:8a9e with SMTP id dq8csp553132wrb; Thu, 16 Jan 2025 22:03:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWk85D2kra32PEI8213bcDsVnIJKvNtZdjqDhl86vOmkTnrIwJPluL+qjKsSFDUgLEdH0WW0g==@linaro.org X-Google-Smtp-Source: AGHT+IG0KVWuyZouDqSedydPuSqnByEd0j1nges233Cbm/YTqkNuh523u5uWfDop4pwrxvL2Trmd X-Received: by 2002:a05:6214:20a1:b0:6d8:8742:137c with SMTP id 6a1803df08f44-6e1b21d8e2dmr23843016d6.24.1737093822471; Thu, 16 Jan 2025 22:03:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737093822; cv=none; d=google.com; s=arc-20240605; b=ept8DK7P9L+oPydnnY/BuDsOepbMEYwXMDzGd3DnZfXffoI/csofWFdFl9lAvy1e2n WxMCxsRA/zF7273rvc95BQCJWxvFkbflElgM4XfEG//I3Qdq8PE+QZM+JhSLwZOqHQTE xL7acmVCNuQNSSLJAtIo5qteLWHg2z6pRkecZD727PlEtmZyWOnRK0egn2oiFs8B5x2n Apy8IaND/kzUAVLFOPHuc9UVvhrscviK6Lmp6k8e2onAtTU61LNIqJbanR/fd3+26gHW nz0ltDEy1tQPG/2QCLfVf64XpXPnxbWYuAejQ0cwW04BJG3thYZ7zONI2y9rtA9cxd6E MN+g== 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=x6PYrAaud1A8fkgX2672cOm89fY4AZSHQAdDHt+jLww=; fh=cj4qnHVrWz/y42l/9CpyjaFc8mYHB7wOV/1A5ab0cio=; b=D2ZgaYgY1GwR3DmxcL8es5IALLJvE8nALo9oGha39lExdcDoAAKAq/YxyLwuXsRrBB JmcfTiKONmxxJruSIX0LGSQUqfIZSOXWgTIQIOPBG8J9A45Rt3Gl8y8DPcHe9ZHG8g2e gc1OZGZ63iQy0aoPGJJfa5/kRVx5XhXzEQ4VYKlZWxR5411zDktgnZ8MRkDuP5posv5S W2bAPcwxlGtS46owMKkfbXXZ3Ly3GQ237xUKvwOeYt+Wd1dztg33C5c4Oh0Zb8Ml2ZK0 NaFCpf8PGNueRhsF3n1mL0R302p825e+UeI6fswm59v9h9aiJfQkbKwMQD/NDb9e7qxm 0nDQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QxNpZzNc; 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 6a1803df08f44-6e1afc1b375si20030706d6.128.2025.01.16.22.03.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Jan 2025 22:03:42 -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=QxNpZzNc; 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 1tYfOK-0003Xp-Ur; Fri, 17 Jan 2025 00:59:37 -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 1tYfNd-0001Pw-2P for qemu-devel@nongnu.org; Fri, 17 Jan 2025 00:58:53 -0500 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 1tYfNb-0006Df-AR for qemu-devel@nongnu.org; Fri, 17 Jan 2025 00:58:52 -0500 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-2161eb94cceso20820495ad.2 for ; Thu, 16 Jan 2025 21:58:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737093530; x=1737698330; 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=x6PYrAaud1A8fkgX2672cOm89fY4AZSHQAdDHt+jLww=; b=QxNpZzNctjZR/kPwzi8uovtnGR7FuW+gZds1pm3ippzazf8kIYcBqo0aCbg5YGlgTf 3RUyR0SlGQT4+tRK4OM6buKpPm0c6wcNibjGrccB6pdpJLlb5GaxBN/4rRlp4Gsy6csQ yNPnWiTYGzjnp7YcScCRHqRaFwSXVKvLkMahcgbY8Pj9MfXDdleqzThYI2eJkxoI0S1N NA/FECgmz4pvvXXRMtmh/9192+N14jzdCLDbXMm8MGydTosYcObqmFInBqHFwRWCrz07 Jf4S48tA8Vm7sU5fxNYBNuEL5WjDXJA7ajE/6igpjhWB6EEivRd4M6/GVG5TO6jxY487 e1hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737093530; x=1737698330; 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=x6PYrAaud1A8fkgX2672cOm89fY4AZSHQAdDHt+jLww=; b=gfVQau1zO47OVNDAkNSqk7ec8M1FtTmLGavToOj+q06/yvzKH17NFeDyZtxHrCxaUH Xj61UlUcfK/buzkHjkM3H1EuE1FEkpwa4IT8+AosJN0BmF1jkGAJ5DA1eXf3cEwwFApr IicGbXj5XBBW6vrlMOyKbz18J9k/BpvdXxfHVuJXnwWEk4A2uMbkQ2dDhCSfvYCmoYBk JFy/Go2lE6Y95CF2F28Mbs/a6znUpJ+ZB0jMgk0iwSgTD86woTX0MBcGJUd77+AJ9GFn UQH6QtfR6Madk+fjqeD/GePIwVpZ4LhbRja65eM+5hE/icpSIeCLmlz651GRvU1la53R VKGA== X-Gm-Message-State: AOJu0YwLEnuE7XIWdG91FbqwJDS/neY1JzenG0VXh/wVx0hsHjjLFA1C DTgCszzgN4IVlcv6PAIkXSZjtVHdbazfU0qkm6iBsq25AynMdp3iyX8U5A== X-Gm-Gg: ASbGncuwfBS8yNC7mh5kCSR0PnbOEoW/mn0XA9C1p5EtN6ucBEPOk2Cmp5j5JsFKHGZ blZdv8TA+mluPU6aIOChNHaj00xPC9tEVWx7TnSwsTDcxumgXpS0VNG4a18+BizZJWbIkFSBIk+ FaDL3/76tyuoVVPA9IKjTTKZpwH6tF7p6SIufnv7T1/TOctYebvYDlCwWr7JP0HJJAFe/vrzOEn cXpsgT0gTeVR/m930d0LnPBSavVUh4BGCuiRnW1KpFTnHL2kA1db2dT55XHmO3iR6jJO/UJ8HRZ 0qTdhdR4Ul2dX6oXYvc8H5dGw23hk3hbonnE9nvPIC/pCSNJblxXUhu4gZLD X-Received: by 2002:a17:903:230b:b0:216:554a:212c with SMTP id d9443c01a7336-21c355f703amr19157055ad.46.1737093529698; Thu, 16 Jan 2025 21:58:49 -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 d9443c01a7336-21c2d3d6fbbsm8563595ad.168.2025.01.16.21.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 21:58:49 -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 50/50] hw/char/riscv_htif: Convert HTIF_DEBUG() to trace events Date: Fri, 17 Jan 2025 15:55:52 +1000 Message-ID: <20250117055552.108376-51-alistair.francis@wdc.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250117055552.108376-1-alistair.francis@wdc.com> References: <20250117055552.108376-1-alistair.francis@wdc.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=alistair23@gmail.com; helo=mail-pl1-x630.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